Griffon in Action
eBook - ePub

Griffon in Action

Andres Almiray, Danno Ferrin

Condividi libro
  1. 384 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Griffon in Action

Andres Almiray, Danno Ferrin

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul 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

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Griffon in Action è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Griffon in Action di Andres Almiray, Danno Ferrin in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatik e Programmierung in Java. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Editore
Manning
Anno
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 ...

Indice dei contenuti