Griffon in Action
eBook - ePub

Griffon in Action

Andres Almiray, Danno Ferrin

Compartir libro
  1. 384 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Griffon in Action

Andres Almiray, Danno Ferrin

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Summary Griffon in Action is a comprehensive tutorial written for Java developers who want a more productive approach to UI development. After a quick Groovy tutorial, you'll immediately dive into Griffon and start building examples that explore its high productivity approach to Swing development.
About the Technology
You can think of Griffon as Grails for the desktop. It is a Groovy-driven UI framework for the JVM that wraps and radically simplifies Swing. Its declarative style and approachable abstractions are instantly familiar to developers using Grails or JavaFX.
About the Book
Griffon in Action gets you going quickly. Griffon's convention-over-configuration approach requires minimal code to get an app off the ground, so you can start seeing results immediately. You'll learn how SwingBuilder and other Griffon "builders" provide a coherent DSL-driven development experience. Along the way, you'll explore best practices for structure, architecture, and lifecycle of a Java desktop application.Written for Java developers—no experience with Groovy, Grails, or Swing is required. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.
What's Inside

  • Griffon from the ground up
  • Full compatibility with Griffon 1.0
  • Using SwingBuilder and the other "builders"
  • Practical, real-world examples
  • Just enough Groovy


=======================================

Table of Contents

PART 1 GETTING STARTED

  • Welcome to the Griffon revolution
  • A closer look at Griffon
  • PART 2 ESSENTIAL GRIFFON
  • Models and binding
  • Creating a view
  • Understanding controllers and services
  • Understanding MVC groups
  • Multithreaded applications
  • Listening to notifications
  • Testing your application
  • Ship it!
  • Working with plugins
  • Enhanced looks
  • Griffon in front, Grails in the back
  • Productivity tools

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Griffon in Action un PDF/ePUB en línea?
Sí, puedes acceder a Griffon in Action de Andres Almiray, Danno Ferrin en formato PDF o ePUB, así como a otros libros populares de Informatik y Programmierung in Java. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Editorial
Manning
Año
2012
ISBN
9781638353805

Part 1. Getting started

Our goal in part 1 is to get you up to speed on what Griffon offers to the desktop application development experience by diving directly into code. Part 1 is all about hitting the ground running.
We’ll introduce you to Griffon by guiding you through building your first Griffon application: a simple multitabbed file viewer. You’ll experience most of the tasks required to design, build, package, and deploy an application; and we’ll take a quick look at the building blocks of the framework, its conventions, and the application’s life cycle.
Taking inspiration from mythology, a Griffon (or Griffin) is a mystical beast that’s half eagle, half lion. In antiquity, the lion was considered the king of beasts, while the eagle held the same title for birds. Thus an amalgam of both creatures results in the king of all creatures. The Griffon framework is an amalgam between the web world (thanks to its Grails heritage) and the desktop world. Griffons were thought to guard treasures and riches; in our case, Griffon is the key to a productive experience when writing desktop applications.
Let’s begin our journey by looking the Griffon directly in the eye.

Chapter 1. Welcome to the Griffon revolution

This chapter covers
  • What Griffon is all about
  • Installing Griffon
  • Building your first Griffon application
  • Understanding how Griffon simplifies desktop development
Welcome to a revolution in how desktop applications are designed, developed, and maintained. You may be wondering, a revolution against what exactly? Let’s begin with how you pick the application’s source layout, or how you organize build time versus runtime dependencies. What about keeping the code clean? How do you deal with multithreading concerns? Can you extend an application’s capabilities with plugins? These are but a few of the most common obstacles that must be sorted out in order to get an application out the door. Many hurdles and obstacles lurk in your path, waiting their turn to make you slip that important deadline or drive you to frustration.
Griffon is a revolutionary solution that can make your job easier while bringing back the fun of being programmer. Griffon is a Model-View-Controller (MVC) based, convention-over-configuration, Groovy-powered desktop application development framework. Using Griffon to build your desktop applications will result in organized code and less of it. But why would you build a desktop application in the first place? There are times when being close to the metal pays off really well: for example, how would you access a local device like a scanner or a printer from a web page? Via some other domain-specific device, perhaps? This is a valid use case scenario in both financial and health industries. We believe that once you use Griffon, you’ll enjoy it as much as we do.
This chapter will get you started building Griffon applications. It lays out the core concepts and underlying designs behind the framework. You’ll start by getting your development environment set up and building your first Griffon application. You’ll build on your first application and create a simple tab-based editor with a menu and actions to open and save files. We’ll review some of the challenges with Java-based desktop development and see how Griffon approaches it. Along the way, we’ll discuss some of the core Griffon constructs, components, and philosophy.
Are you ready to become truly productive building applications for the desktop? Let’s begin!

1.1. Introducing Griffon

Griffon’s goal is to bring the simplicity and productivity of modern web application frameworks like Grails and Rails to desktop development. Griffon leverages years of experience and lessons learned by Grails, Groovy, Rails, Ruby, Java Desktop, and Java developers and their communities. Griffon has adopted many of those languages’ and frameworks’ best practices, including Model-View-Controller, convention-over-configuration, a modern dynamic language (Groovy), domain-specific languages (DSLs), and the builder pattern.
Web application development as we knew it suddenly changed in 2004, when a framework named Ruby on Rails (RoR; http://rubyonrails.org) was released in the wild. It showed that a dynamic language like Ruby could make you highly productive when teamed with a well-thought-out set of conventions. Add the convention-over-configuration paradigm and the viral reception from disheartened Java developers longing for something better than JEE, and RoR suddenly stepped into the spotlight.
A year later, another web framework appeared: its name was Grails, and Groovy was its game. It followed RoR’s ideals, but its founders decided to base the framework on well-known Java technologies such as the Spring framework, Hibernate, SiteMesh, and Quartz. Grails included a default database and a full stack to develop JEE applications without the hassle that comes with a regular JEE application.
Grails grew in popularity and a community was created around it, to the point that it’s now the most successful and biggest project at the Codehaus (www.codehaus.org), an organization that hosts open source projects; that’s where Grails was born and Griffon is hosted.
Grails is a convention-over-configuration, MVC-based, Groovy-powered web application development framework. Does that definition sound familiar? Just exchange desktop for web, and you get Griffon.
Both frameworks share a lot of traits, and it’s no surprise that Griffon’s MVC design and plugin facility were based on those provided by Grails, or that the command-line tools and scripts found in one framework can also be found in the other. The decision to use Grails as the foundation of Griffon empowers developers to switch between web and desktop development: the knowledge gathered in one environment can easily be translated to the other.
Note
If you’re in a hurry to understand how to use plugins, take a quick peek at chapter 11.
Let’s get started by setting up the development environment and building your first simple Griffon application.

1.1.1. Setting up your development environment

In order to get started with Griffon, you’ll need the following three items in your toolbox: a working JDK installation, a binary distribution of the Griffon framework, and your favorite text editor or IDE.
First, make sure you have the JDK installed. The version should be 1.6 or later: to check, type javac -version from your command prompt.
Next, download the latest IzPack-based Griffon distribution from http://griffon.codehaus.org/download. The file link looks like this one:
griffon-0.9.5-installer.jar
Note that the version number may differ. The important thing is that you pick the IzPack link. IzPack provides a cross-platform installer that should take care of installing the software and configuring the environment variables for you. It will even unpack the source distribution of the framework, where you can find sample applications that are useful for learning cool tricks. You can run the installer by locating the file and double-clicking it. Alternatively, you can run the following command in a console prompt:
java –jar griffon-0.9.5-installer.jar
If for some reason the installer doesn’t work for you, or if you’d rather configure everything by yourself, download the latest Griffon binary distribution from the same page in either zip or tar.gz format. Uncompress the downloaded file into a folder of your choosing (preferably one whose name doesn’t contain whitespace characters). A standard Griffon distribution contains all the files and tools you need ...

Índice