Griffon Presentation

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

1 comments

Comments 1 - 1 of 1 previous next Post a comment

Post a comment
Embed Video
Edit your comment Cancel

Notes on slide 1

developers on Griffon are contributors to Groovy and have provided handy AST transformations

What makes it “hard” to program Swing? VERBOSITY, boilerplate

What things does Groovy do to help? Builder pattern is great at building tree structures Helpful abstractions one line initialization, no need to call get/set

What does Griffon add to the mix to make it even easier? no need to remember which builder you are calling; conflicts can be resolved using namespaces standardization/delegation of methods: size(), getAt(), putAt(), iterator()

After this slide, demo CSSBuilder and some of the Swingpad samples Swingpad can be used to prototype UI elements in isolation, Mockfor and Stubfor can be used to mock dependencies

After this slide, show the files in IDE and explain they’re nothing more than properties files consumed by ConfigSlurper

show L&F change? build a new app from scratch, change from label to button, run, change L&F and rerun

Getting your application built and published is important - you do want people to use these things after all Point out that demos are all .app files

No framework would be complete without testing support Show FEST test after this slide

Polyglot programming made easy

Wrappers for SwingUtilities methods Demo Binding example

SwingWorker DSL Demo EDT example and Animation example

Here’s how you work with it at the lowest level. Demo loading up the application in a console

Just out of interest, the demo application created to go along with this talk comes in pretty lean. Lifecycle and Integration Tests are defaults And all of these LOC measures include comments, to be fixed in a release soon

2 Favorites

Griffon Presentation - Presentation Transcript

  1. Griffon
    • “Griffon is a Grails like application framework for developing desktop applications in Groovy.”
  2. What is Griffon?
    • framework for developing Swing apps
    • Groovy based, Grails inspired
    • extensible by plugins
    • MVC
    • convention over configuration
    • aims to make build Swing apps easy!
  3. State of Swing
    • very verbose to get it right
    public void actionPerformed(ActionEvent e) {      (new Thread(new Runnable() {          public void run() {              final String result = longRunningOperation();              SwingUtilities.invokeLater(new Runnable() {                  public void run() {                      label.setText(result);                  }              });          }      }).start(); } final JLabel label = ... ; class MeaningOfLifeFinder extends SwingWorker<String, Object> { @Override public String doInBackground() { return findTheMeaningOfLife(); } @Override protected void done() { try { label.setText(get()); } catch (Exception ignore) { } } } (new MeaningOfLifeFinder()).execute();
    • SwingWorker helps with the pattern
  4. Groovy helps a lot
    • SwingBuilder DSL for fluent syntax
    • shortened forms and simplified configuration
      • Java: JPanel panel = new JPanel(); new BoxLayout(panel, BoxLayout.X_AXIS)
      • Groovy: panel { boxLayout() }
    • map coercion VS constructors
    • huge reduction in boilerplate
    • simple Binding
  5. Griffon helps even more
    • CompositeBuilder: combines numerous builders into one common dsl
    • IGriffonApplication: provides a common infrastructure
    • meta-enhancement: additional methods added to Swing components at run-time
    • makes publishing and launching easy
  6. Builders
    • SwingXBuilder - Swing component extensions
    • FxBuilder - JavaFX script support
    • JideBuilder - Swing component extensions
    • SwingXtrasBuilder - aggregate of 3 smaller Swing component extensions(I2fprod, BalloonTip, xswingx)
    • CSSBuilder - Swing Clarity: adds cssClass property to all Swing nodes
    • TridentBuilder - animation library
    • GfxBuilder - Java 2D(without pulling your hair out)
  7. App Configuration
    • Your A, B, C’s
      • Application.groovy- title, root MVC group to initialize on startup, all MVC groups registered in the app
      • Builder.groovy - CompositeBuilder configuration
      • Config.groovy - logging, dev/test/prod environments, additional build script or lifecycle event configuration
  8. App Lifecycle
    • Initialize - before any Swing code is realized; used for L&F and setup
    • Startup - after startup MVC groups are initialized
    • Ready - all events sent to EDT queue have been processed
    • Shutdown - opportunity to free resources before exit
    • Stop - Applet specific
  9. Distribution and Installation
    • stand-alone, webstart and applet support
    • create launchers for Windows(.exe), Linux(shell script), Mac(.app) and as executable jar
    • create installers using IzPack, RPM and DMG
    • ‘big jar’ support for those lucky people in the US who can use the Java Store
    • can create all installers and launchers in one step
  10. Testing and Analysis
    • FEST - framework for Swing integration testing; equivalent of Selenium for Web testing
    • EasyB - scenario based testing
    • Cobertura - code coverage metrics
    • JDepend - static analysis
  11. Language support
    • Scala - plugin available
    • Clojure - plugin available
    • Java - if you REALLY want :)
  12. The EDT in Groovy
    • doOutside{
    • //long running operations in a new thread
    • edt {
      • //jump back to the EDT if needed
    • }
    • doLater{
      • //update the UI when we’re done
    • }
    • }
  13. EDT With SwingWorker in Griffon in Griffon
    • jxwithWorker {onInit {
    • //setup } work {
      • //do long running work and publish intermediate results
    • publish(...) }
      • onUpdate {
      • //respond to intermediate results } onDone {
    • //update UI with final results }}
    • //update UI with final results }}
      • //update UI with final results }}
    • //update UI with final results }}
      • //update UI with final results }}
    • //update UI with final results }}
  14. How to get Griffon?
    • download the izpack installer
    • macports
    • install from source - set $GRIFFON_HOME and put $GRIFFON_HOME/bin in your path, there’s an ant target to install
    • tonite’s demo was 0.2-SNAPSHOT built from source
  15. How to use Griffon?
    • On the command line
      • create/run/test Applications
      • create MVC groups or their individual components
      • create tests
      • install/uninstall plugins
      • create your own plugins
    • run a shell/console with your Application on the classpath
    • ...
  16. Tool support
    • Netbeans - Geertjan Wielenga crafted an alpha version plugin for Java One this year
    • Intellij - Maia (version 9, in EAP now) parallels existing Grails support
    • Eclipse - Groovy plugin, no specific support for Griffon; yet
    • Griffon in Action has instructions for each of these IDE’s without plugins, based on ant
  17. IntelliJ Maia Closeup Project view showing libraries/plugins Griffon MVC plugin view
  18. What’s to come?
    • Spring plugin
    • Maven
    • Gradle
    • Grails plugin ports
    • Griffon In Action from Manning Books
  19. How much code does it take? +----------------------+-------+-------+ | Name | Files | LOC | +----------------------+-------+-------+ | Controllers | 4 | 112 | | Models | 4 | 26 | | Views | 4 | 122 | | Lifecycle | 5 | 76 | | Integration Tests | 1 | 4 | +----------------------+-------+-------+ | Totals | 18 | 340 | +----------------------+-------+-------+
  20. Questions
    • ???
SlideShare Zeitgeist 2009

+ The KaptainThe Kaptain Nominate

custom

356 views, 2 favs, 1 embeds more stats

A presentation for the Vancouver Island Java User's more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 356
    • 303 on SlideShare
    • 53 from embeds
  • Comments 1
  • Favorites 2
  • Downloads 0
Most viewed embeds
  • 53 views on http://www.kellyrob99.com

more

All embeds
  • 53 views on http://www.kellyrob99.com

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories