Griffon in Action
eBook - ePub

Griffon in Action

Andres Almiray, Danno Ferrin

Buch teilen
  1. 384 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfĂŒgbar
eBook - ePub

Griffon in Action

Andres Almiray, Danno Ferrin

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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

HĂ€ufig gestellte Fragen

Wie kann ich mein Abo kĂŒndigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kĂŒndigen“ – ganz einfach. Nachdem du gekĂŒndigt hast, bleibt deine Mitgliedschaft fĂŒr den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich BĂŒcher herunterladen?
Derzeit stehen all unsere auf MobilgerĂ€te reagierenden ePub-BĂŒcher zum Download ĂŒber die App zur VerfĂŒgung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die ĂŒbrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den AboplÀnen?
Mit beiden AboplÀnen erhÀltst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst fĂŒr LehrbĂŒcher, bei dem du fĂŒr weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhĂ€ltst. Mit ĂŒber 1 Million BĂŒchern zu ĂŒber 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
UnterstĂŒtzt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nÀchsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Griffon in Action als Online-PDF/ePub verfĂŒgbar?
Ja, du hast Zugang zu Griffon in Action von Andres Almiray, Danno Ferrin im PDF- und/oder ePub-Format sowie zu anderen beliebten BĂŒchern aus Informatik & Programmierung in Java. Aus unserem Katalog stehen dir ĂŒber 1 Million BĂŒcher zur VerfĂŒgung.

Information

Verlag
Manning
Jahr
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 ...

Inhaltsverzeichnis