Your SlideShare is downloading. ×
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Griffon: Re-imaging Desktop Java Technology

8,663

Published on

Griffon is a desktop framework for Java Swing leveraging the dynamic language Groovy and values convention over configuration. …

Griffon is a desktop framework for Java Swing leveraging the dynamic language Groovy and values convention over configuration.

Presented at Devoxx 2008

Published in: Technology, Art & Photos
0 Comments
10 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
8,663
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
116
Comments
0
Likes
10
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Transcript

    • 1. www.devoxx.com
    • 2. Griffon: Re-imaging Desktop Java Technology
      • James Williams
      • Griffon Co-creator
    • 3. Overall Presentation Goal
      • Learn how to create Java apps with ease
    • 4. Speaker’s qualifications
      • James is the creator of SwingXBuilder
      • James is a co-creator of the Griffon framework
      • James speaks frequently on Groovy technology
    • 5.
      • What's been said about Griffon:
      • Grails for the Desktop.
      • Griffon is agility for Swing application development.
      • The case for Groovy has been made a whole lot stronger via Griffon.
    • 6.
      • A Brief History of Desktop Java
      • What is Griffon ?
      • Griffon Lifecycle
      • Builders / @Bindable
      • Griffon MVC
      • SwingWorker
      • Plugins
      • App Deployment
      • Tool Support
      Agenda
    • 7.
      • Java 1.0
      • Java 1.1
      • Java 1.2
      • Java 1.4
      • Java 5
      • Java 6
      • JavaFX ???
      History of Desktop Java
    • 8.
      • Closures(no more waiting for JDK7)
      • Concise syntax
      • Less ceremonial code
      • Lots of useful closures already added to core classes
      What Groovy adds to Java
    • 9.
      • Meta Object Protocol (MOP)
          • Allows methods to be intercepted
          • Allows methods to be added to objects at run-time
          • Allows missing methods to be handled
          • Magic
      What Groovy adds to Java
    • 10.
      • Instead of this:
      • public class HelloWorld extends JFrame {
      • JLabel label = new JLabel(“Your name:”);
      • JTextField field = new JTextField(20);
      • JButton button = new Button(“Click”);
      • button.addActionListener(new ActionListener() {
      • public void actionPerformed(ActionEvent evt) {
      • JOptionPane.showMessageDialog(....)
      • }
      • }
      • setLayout(new FlowLayout())
      • add(label)
      • add(field)
      • add(button)
      • }
      • You can type this:
      • frame (size:[200,200], title:'Hello World', layout:new FlowLayout()) {
      • label('Your name:')
      • textField(id:'nameField', cols:20)
      • button(text:'Click', actionPerformed:{JOptionPane.showMessageDialog(....) }
      • }
      Groovy Magic
    • 11.
      • Is a desktop framework for Swing leveraging Groovy
      • Heavily influenced by Grails
      • Apache Licensed (ASL 2)
      • Values convention over configuration
      • Strongly adheres to a MVC directory structure
      Griffon ...
    • 12. Griffon and Grails
      • Griffon
      • Uses MVC
      • Uses scripts for lifecycle events
      • No persistence story (gotta wire your own)
      • Under 10 plugins
      • Grails
      • Uses MVC
      • Uses scripts for lifecycle events
      • Persistence via Hibernate
      • Over 100 plugins
    • 13.
      • %PROJECT_HOME%
      • + griffon-app
      • + conf ---> location of configuration artifacts
      • + keys ---> keys for code signing
      • + webstart ---> webstart and applet config
      • + controllers ---> location of controller classes
      • + i18n ---> location of message bundles for i18n
      • + lifecycle ---> location of lifecycle scripts
      • + models ---> location of model classes
      • + resources ---> location of non code resources (images, etc)
      • + views ---> location of view classes
      • + lib
      • + scripts ---> scripts
      • + src
      • + main ---> optional; location for Groovy and Java source files
      • (of types other than those in griffon-app/*)
      Structure of a Griffon app
    • 14.
      • Initialize
      • Startup
      • Ready
      • Stop
      • Shutdown
      Griffon Lifecycle
    • 15.
      • Navigate to http://griffon.codehaus.org
      • Download zip (deb, izpack, and dmg will be available soon) and unzip it somewhere
      • If not set by the installer, add GRIFFON_HOME to your path.
      • You're all set.
      Griffon Quickstart
    • 16. DEMO
      • Creating a Griffon app
    • 17.
      • Are DSLs to compose complex structures
      • Exist for UI components and structured documents
      • Additional builders can be provided via plugins
      • Allow components to be intermingled
      • Much more readable than conventional code
      • Can be declared in namespaces to avoid clashes
      Builders
    • 18.
      • The granddad of all the Swing-based builders
      • Wraps all J2SE components
      • Sample SwingBuilder code: frame (size:[200,200], title:'Hello World', layout:new FlowLayout()) {
      • label('Your name:')
      • textField(id:'nameField', columnss:20)
      • button(text:'Click', actionPerformed:{JOptionPane.showMessageDialog(....) }
      • }
      SwingBuilder
    • 19.
      • Wraps most SwingLabs components
      • The first UI builder to be implemented in Groovy
      • Provides aliases for long properties names
      • Provides support for painters and effects
      SwingXBuilder
    • 20.
      • Wraps JIDE Common Layer components
      • List of components available at http://groovy.codehaus.org/JideBuilder
      JIDEBuilder
    • 21.
      • Added in Groovy 1.5 (with Groovy's annotation support)
      • Provides one-way binding between a variable and a component
      • Automagically wraps the target in a PropertyChangeListener
      @Bindable Annotation
    • 22.
      • General form: bind(< map >)
        • source
        • sourceProperty
        • sourceValue
        • target
        • targetProperty
        • validator
        • converter
      @Bindable Annotation
    • 23.
      • swing.frame() {
      • panel {
      • textField('Change Me!', id:'tf')
      • button(text: bind(source:tf, sourceProperty:'text'))
      • }
      • }
      • swing.frame() {
      • panel
      • {
      • textField('Change Me!', id:'tf')
      • button(text: bind(source:tf, sourceProperty:'text',
      • validator: { tf.text.length() >= 1}, converter: { it.toLowerCase() } ))
      • }
      • }
      @Bindable Annotation
    • 24. DEMO
      • SwingBuilder Sample
      • FontPicker
    • 25.
      • Store variables referenced by the controller and views
      • Can use the @Bindable annotation to automagically notify via PropertyChangeListeners
      • Injected into the controller and view at run-time
      Models
    • 26.
      • Represent specific components in your app
      • Can be written in Groovy or Java
      • Referenced in code with build(NameOfView)*
      • Can mix and match code from all the builders
      Views
    • 27.
      • application(title:'HelloWorld', size: [300, 500], defaultCloseOperation:WC.EXIT_ON_CLOSE ) {
      • label(model.greeting)
      • }
      • class HelloWorldModel {
                  • @Bindable greeting
      • }
      HelloWorldModel.groovy HelloWorldView.groovy Sample View/Model
    • 28.
      • Contain most UI-based application logic
      • Injected with the model and view at run-time
      Griffon Controllers
    • 29.
      • Wrapper for J2SE SwingWorker to run long tasks
      • Unlike in Java, a Groovy SwingWorker can be reused
      • Uses the appropriate version if using < Java1.6
      • SwingWorker closures
      • onInit – the initialization work
      • work – the work to be done
      • onUpdate – for incremental updates (optional)
      • onDone – what to do when finished
      Groovy SwingWorker
    • 30.
      • def doImageLoad = {evt = null ->
      • withWorker(start:true) {
                      • onInit { /* Init stuff here */ }
                      • work { /* load images here */}
                      • onUpdate { /* draw loaded image */ }
                      • onDone { /* finish and do cleanup */ }
                      • }
      • }
      Sample SwingWorker
    • 31.
      • Provide fine grained separation of concerns
      • Can be used to inject complex objects at runtime
      • Encourages code reuse
      • Not covered in this BOF
      Multiple MVC Groups
    • 32.
      • Provide extensibility for Griffon
      • Can be project-specific or global
      • Current plugins:
          • easyb
          • fest
          • Installer (izpack, dmg, rpm)
          • JideBuilder
          • SwingXBuilder
      Plugins
    • 33.
      • Experimental Netbeans plugin for 6.5
      • Generates Ant and Eclipse files automatically
      • Close relationship to Grails should make it easy to adapt existing Grails plugins (for IDEs)
      Tool Support
    • 34.
      • Scripts for desktop, applet, and webstart deployment
      • Automates JNLP generation and jar signing
      • Can generate applet host page
      Deploying your App
    • 35. DEMO
      • Griffon Flubber
      • Various deploy targets
    • 36. Griffon Roadmap
      • 0.1-BETA ( Releasing Soon ) Plugin support Built-in testing support Support for pack200 Ability to opt out of code signing and packaging
      • 0.2 Planned Features (No release date set) Addon support (runtime plugins) GORM from Grails 1.1
      • Wish List/Items not tied to a version Flamingo/Substance, GraphicsBuilder, JavaFX Scene Graph, JavaFX Interop, IDE interop, NB Matisse
    • 37.
      • Introducing SwingPad
    • 38. Summary
      • Griffon separates Model, View and Controller
      • Griffon apps share the same structure
      • Builders make UI code more readable
      • Deploy to desktop, webstart, and applets with no changes
      • Plugins provide extensibility
    • 39. Concluding statement
      • Griffon is simplified, sensibly structured Swing.
    • 40. Q&A
    • 41. Thanks for your attention!
      • Web links :
      • http://griffon.codehaus.org
      • [email_address]
      • Creators' blogs :
      • Danno Ferrin http://shemnon.com/speling
      • Andres Almiray http://jroller.com/aalmiray
      • James Williams http://jameswilliams.be/blog

    ×