Your SlideShare is downloading. ×
0
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
Griffon - Making Swing Fun Again
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 - Making Swing Fun Again

3,571

Published on

Denver Open Source Users Group Dec 2008 presentation

Denver Open Source Users Group Dec 2008 presentation

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

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

    ×