Griffon - Making Swing Fun Again

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.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    6 Favorites & 2 Groups

    Griffon - Making Swing Fun Again - Presentation Transcript

    1. Making Swing Fun Again
    2. Agenda
      • A Brief History of Desktop Java
      • Groovy’s Improvements for Swing
      • Grails + Swing -> Griffon
      • Griffon’s Unique Values
      • Q&A / Live Demo
    3. History of Desktop Java
      • Java 1.0 January 1996
        • AWT
          • Native Peers
          • Subclass to Add Behavior
    4. History of Desktop Java
      • Java 1.1 February 1997
        • Inner and Anonymous Classes
        • JavaBeans
          • Events
            • Listener Interfaces and Event Objects
          • Properties
            • getters/setters and BeanInfos
        • AWT reworked with JavaBeans
        • Lightweight Peers
        • Swing as an External Library
    5. History of Desktop Java
    6. History of Desktop Java
      • Java 1.3 May 2000
        • HotSpot JIT
        • JavaSound
        • Java WebStart as External Download
    7. History of Desktop Java
      • Java 1.4 February 2002
        • Java WebStart
        • Reworked Focus and Drag and Drop
        • JSpinner and JFormattedTextField
      • Java 1.4.2 September 2003
        • Windows XP Look and Feel
        • GTK+ Look and Feel
    8. History of Desktop Java
      • Java 5.0 September 2004
        • Synth Look and Feel
        • Ocean Theme for Metal
        • Pack 200
        • Generics
        • AutoBoxing
        • Annotations
        • Enumerations
        • Varargs
    9. History of Desktop Java
      • Java 6.0 December 2006
        • SwingWorker API
        • Scripting Language support (JSR-223)
        • Improved Java2D Rendering Pipeline
          • No More Grey Rectangles
        • System Tray and Notifications Support
    10. History of Desktop Java
      • Java 6u10 October 2008
        • Kernel Installer
        • Nimbus Look and Feel
        • Improved Java Plug-In
          • JNLP Integration
          • New Process Model
        • Patch in Place Updating
    11. History of Desktop Java
      • JavaFX Desktop 1.0 December 2008
        • New Node Based Graphics Engine
          • Interop APIs for Swing
        • New Programming Language
          • Java Interop on par with JRuby / Jython / Rhino
      • Should You Forget Most of the Last 8 Slides?
    12. Groovy’s Improvements
      • Groovy Addresses Developer Pain Points
        • JavaBeans Events
        • JavaBeans Properties
        • Declarative Structure
      • Groovy Language Features
        • Closures
        • Concise Syntax
        • Meta Object Protocol
    13. Groovy’s Improvements
      • Java Beans Event Listener
        • Java JButton myButton = new JButton("Hello World"); myButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { System.out.println("Hello World"); } });
        • Groovy JButton myButton = new JButton("Hello World") myButton.actionPerformed = { println "Hello World" }
    14. Groovy’s Improvements
      • Properties
        • Java String field; public String getField() { return field; } public void setField(String field) { this.field = field; }
        • Groovy String field
    15. Groovy’s Improvements
      • Declarative Structure
        • def swing = new SwingBuilder() swing.frame(size:[400, 300], show:true) { borderLayout() scrollPane(constraints:CENTER) { textArea(text: bind { model.script }) } hbox(constraints:SOUTH) { hglue() button("OK", actionPerformed: controller.&okPressed) button("Cancel", actionPerformed: controller.&canceled) } }
    16. Groovy’s Improvements
      • Closures
        • Can be cast to Interfaces
        • Directly Usable for Single Method Interfaces (Runnable et. al.)
      • Concise Syntax
        • Boilerplate Code is Removed
        • Lots of Closure Sensitive Methods Added to Core Classes
      • Meta Object Protocol – i.e. Dynamic Language
        • Allows Any Method to be Called on Any Object
        • Allows Methods to be Intercepted
        • Allows Missing Methods to be Handled
        • Allows Magic to Happen
    17. Grails + Swing -> Griffon
      • Grails
        • Inspired by Rails
        • Groovy as the Language
        • Web as the Domain
        • Java as the Platform
          • Spring
        • Custom Value Added by Framework
          • GORM
          • GSPs
    18. Grails + Swing -> Griffon
      • Griffon
        • Deeply Inspired by Grails
        • Groovy as the Language
        • Desktop/Rich Client as the Domain
        • Java as the Platform
          • Swing
        • Custom Value Added by Framework
          • MVC Groups
          • Packaging
    19. Grails + Swing -> Griffon
      • Differences
        • Fairly Strict Runtime/CLI Separation
        • No Spring at Runtime
        • No J2EE
          • Servlets , EJB, JSP, JMS
    20. Grails + Swing -> Griffon
      • Similarities
        • View Scripts – JSP Pages
        • EDT Event Loop – HTTP Request Loop
        • Source Tree is Partitioned by Role
    21. Griffon’s Unique Values
      • Builders
      • MVC Groups
      • Application Lifecycle Pattern
      • Build Time Packaging
    22. Builders
      • MyBuilder builder = new MyBuilder() builder.parent { child(attr:value, attr2:value, id:'a') favoriteChild(arg) { spoiledGrandchild(inheritance:a) } } bequethKingdom(builder.a)
      • Builders are Groovy Code
        • Nesting Contexts are Closures
        • Nodes are Method Calls
        • Attributes and Arguments are Method Arguments
    23. Builders
      • SwingBuilder
        • One of the Original Builder Samples
        • Re-factored as a FactoryBuilderSupport Builder
      • SwingXBuilder
        • First Builder for a Non-Core Widget Set
      • JideBuilder
      • GraphicsBuilder
    24. Builders
      • UberBuilder
        • Composites Other Builders
        • Intercepts Calls and Dispatches to Approptiate Builder
        • Can Prefix Nodes
        • griffon-app/conf/Builder.groovy – root { 'groovy.swing.SwingBuilder' { controller = ['Threading', 'SupportNodes', 'Binding'] } 'griffon.app.ApplicationBuilder' { view = "*" } } jx { 'groovy.swing.SwingXBuilder' { } }
    25. MVC Groups
      • The MVC Pattern is Great…
        • But Swing Provides a Low Effort to Reward Ratio
      • Lower the Effort
        • Language Level Support for Data Binding
        • Framework Level Support for MVC Triads
      • Increase the Reward
        • Reusability of Triads
    26. MVC Groups – Binding
      • JavaBeans Bound Properties protected PropertyChangeSupport pcs = new PropertyChangeSupport(this) private String myProperty; public String getMyProperty() { return myProperty; } public void setMyProperty(String myProperty) { pcs.firePropertyChange(“myProperty”, this.myProperty, this.myProperty = myProperty); }
      • Groovy Bound Properties @Bindable String myProperty
    27. MVC Groups – View Scripts
      • Views are Groovy Scripts
        • No Class Declarations
        • Looks Like Free-Form Code
        • Compiles to .class
      • Method Contexts are Implied
        • No Required Swing Imports
        • Method Meanings are Provided by the Builder
    28. MVC Groups – Data Injection
      • Methods and Fields are Injected
        • Global Imports
          • createMVCGroup() Method
          • model , view , controller , builder Fields/Properties
        • On a per-builder basis
          • SwingBuilder provides edt , doLater , doOutside
          • Other Builders Can Provide Their Own Methods
          • Injection Controlled by Builder.groovy
    29. Application Lifecycle
      • Follows the JSR-296 Lifecycle stages
        • griffon-app/lifecycle/Initialize.groovy
          • Before Any GUI Work
          • Good Place for Look and Feel Setup
        • griffon-app/lifecycle/Startup.groovy
          • After Startup MVC Groups are Initialized
        • griffon-app/lifecycle/Ready.groovy
          • After the EDT Calms Down
        • griffon-app/lifecycle/Shutdown.groovy
          • After a Shutdown is Successfully Initiated
    30. Packaging
      • How do you…
        • Keep an Applet From Thrashing the Server for BeanInfos?
        • Create a Self-Signed Certificate?
        • Use Pack200
          • On a Signed Jar?
            • Over 1 MB?
        • Create a Draggable Applet?
        • Write a JNLP file?
        • Switch Between the Applet and Object Tags?
          • When do you Use Applet or Object?
    31. Packaging
      • Griffon Handles Standard Packaging Issues
        • Pack 200 quirks
        • Useful Applet Parameters
        • JNLP Generation
        • Uses Sun Java Deployment Toolkit JavaScripts
    32. Room to Grow
      • Plug-ins
          • (Deeply Inspired by Grails 1.1 plug-ins)
        • Existing Plug-ins
          • swingx-builder – SwingX Components
          • jide-builder – Jide-oss Components
          • fest – Swing GUI Testing
          • easyb – Behavior Driven Testing
          • installer – Packages (deb, dmg, rpm) and IzPack
    33.  
    34. More Information
      • 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

    + Danno FerrinDanno Ferrin, 2 years ago

    custom

    1607 views, 6 favs, 0 embeds more stats

    Denver Open Source Users Group Dec 2008 presentatio more

    More info about this document

    CC Attribution License

    Go to text version

    • Total Views 1607
      • 1607 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 6
    • Downloads 32
    Most viewed embeds

    more

    All embeds

    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