SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Welcome to the Desktop Revolution
What is Griffon ?
+                 +

+ Sugar, Spice and everything Nice =
HelloWorld.java

public class HelloWorld {
   String name;

    public void setName(String name)
    { this.name = name; }
    public String getName(){ return name; }

    public String greet()
    { return "Hello "+ name; }

    public static void main(String args[]){
       HelloWorld helloWorld = new HelloWorld();
       helloWorld.setName("Groovy");
       System.err.println( helloWorld.greet() );
    }
}
HelloWorld.groovy

public class HelloWorld {
   String name;

    public void setName(String name)
    { this.name = name; }
    public String getName(){ return name; }

    public String greet()
    { return "Hello "+ name; }

    public static void main(String args[]){
       HelloWorld helloWorld = new HelloWorld();
       helloWorld.setName("Groovy");
       System.err.println( helloWorld.greet() );
    }
}
GroovierHelloWorld.groovy

class HelloWorld {
   String name
   def greet() { "Hello $name" }
}

def helloWorld = new HelloWorld(name:"Groovy")
println helloWorld.greet()
Swing
import   java.awt.GridLayout;
import   java.awt.event.ActionListener;
import   java.awt.event.ActionEvent;
import   javax.swing.JFrame;
import   javax.swing.JTextField;
import   javax.swing.JButton;
import   javax.swing.SwingUtilities;

public class JavaFrame {
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run() {
        JFrame frame = buildUI();
        frame.setVisible(true);
      }
    });
  }
 // next page ...
// continued ...
    private static JFrame buildUI() {
      JFrame frame = new JFrame("JavaFrame");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.getContentPane().setLayout(
          new GridLayout(3,1) );
      final JTextField input = new JTextField(20);
      final JTextField output = new JTextField(20);
      output.setEditable(false);
      JButton button = new JButton("Click me!");
      button.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent event) {
           output.setText(input.getText());
        }
      });
      frame.getContentPane().add(input);
      frame.getContentPane().add(button);
      frame.getContentPane().add(output);
      frame.pack();
      return frame;
    }
}
●   The light at the end of the tunnel...
import groovy.swing.SwingBuilder
import static javax.swing.JFrame.EXIT_ON_CLOSE

new SwingBuilder().edt {
  frame(title: "GroovyFrame", pack: true, visible: true,
         defaultCloseOperation: EXIT_ON_CLOSE) {
    gridLayout(cols: 1, rows: 3)
    textField(id: "input", columns: 20)
    button("Click me!", actionPerformed: {
       output.text = input.text
    })
    textField(id: "output", columns: 20, editable: false)
  }
}
What is going on?

Each node is syntactically a method call
All of these method calls are dynamically dispatched
   Most don’t actually exist in bytecode
Child closures create hierarchical relations
   Child widgets are added to parent containers
SwingBuilder node names are derived from Swing classes
   Remove the leading ‘J’ from a Swing class when present
SwingBuilder also supports some AWT classes like layouts
Threads
●
Threading and the EDT

All painting and UI operations must be done in the EDT
   Anything else should be outside the EDT
Swing has SwingUtilities using Runnable
Java 6 technology adds SwingWorker
However, closures are Groovy
      For code inside EDT
         edt { 
 }
         doLater { 
 }
      For code outside EDT
         doOutside { 
 }
      Build UI on the EDT
         SwingBuilder.build { 
 }
Threading Example

action( id: 'countdown', name: 'Start Countdown',
  closure: { evt ->
    int count = lengthSlider.value
    status.text = count

      while ( --count >= 0 ) {
        sleep( 1000 )
              status.text = count
      }

        status.background = Color.RED


})
Threading Example

action( id: 'countdown', name: 'Start Countdown',
   closure: { evt ->
     int count = lengthSlider.value
     status.text = count
     doOutside {
       while ( --count >= 0 ) {
         sleep( 1000 )
         edt { status.text = count }
       }
       doLater {
         status.background = Color.RED
       }
     }
})
Binding
Binding Example

import groovy.swing.SwingBuilder

new SwingBuilder().edt {
  frame( title: "Binding Test", size: [200, 120],
         visible: true ) {
    gridLayout( cols: 1, rows: 2 )
    textField( id: "t1" )
    textField( id: "t2", editable: false )
  }

    bind(source: t1, sourceProperty: "text",
         target: t2, targetProperty: "text")
}
Binding Example

import groovy.swing.SwingBuilder

new SwingBuilder().edt {
  frame( title: "Binding Test", size: [200, 120],
         visible: true ) {
    gridLayout( cols: 1, rows: 2 )
    textField( id: "t1" )
    textField( id: "t2", editable: false,
      text: bind(source: t1,
                 sourceProperty: "text") )
  }
}
Binding Example

import groovy.swing.SwingBuilder

new SwingBuilder().edt {
  frame( title: "Binding Test", size: [200, 120],
         visible: true ) {
    gridLayout( cols: 1, rows: 2 )
    textField( id: "t1" )
    textField( id: "t2", editable: false,
      text: bind{ t1.text } )
  }
}
Convention over Configuration
Don't repeat yourself (DRY)
MVC Pattern
Testing supported “out of the box”
Automate repetitive tasks
Convention over Configuration

Java Desktop Application Conventions are MIA
  Very few official examples
  No Blueprints (Like Java EE Blueprints)
We have to create our own
Following Grails Patterns
  Source Files Segregated by Role
Standardize App Lifecycle (like JSR-296)
Automated Packaging (App, WebStart, Applet)
Lyfecycle Scripts

Lifecycle Scripts are in griffon-app/lifecycle
Lifecycle Events modeled after JSR-296

Initialize
Startup
Ready
Shutdown
Don't Repeat Yourself

How? Use a Dynamic Language!
  With Closures/Blocks
  With terse property syntax
  myJTextArea.text = "Fires Property Change"
  With terse eventing syntax
  button.actionPerformed = {println 'hi'}
  With Rich Annotation Support
  @Bindable String aBoundProperty

Most of this impacts the View Layer
  See JavaOne 2008 TS-5098 - Building Rich
  Applications with Groovy's SwingBuilder
Built-in Testing

Griffon has built in support for testing
  create-mvc script creates a test file in
  test/integration
     Uses GroovyTestCase
     See JavaOne 2008 TS-5101 – Boosting your Testing
     Productivity with Groovy
     Griffon doesn’t write the test for you
  test-app script executes the tests for you
     Bootstraps the application for you
     Everything up to instantiating MVC Groups
Testing Plugins

Sometimes apps need more involved testing
  fest
     Fluent interface for functional swing testing
  easyb
     Behavioral Driven Development
  code-coverage – Cobertura
     Line Coverage Metrics
  jdepend
     Code quality metrics
  codenarc
     Static code analysis
Automate Tasks

command line interface
Scripts and events
plugins
  builders: SwingX, JIDE, Flamingo, Trident , CSS,
  JavaFX and more
  miscellaneous: installer (IzPack, RPM, OSX app
  bundles), Splash, Wizard, Scala
Griffon's
●

Roadmap
Resources

http://griffon.codehaus.org
http://griffon.codehaus.org/Builders
http://griffon.codehaus.org/Plugins
http://groovy.dzone.com
twitter: @theaviary
Griffon in Action (2010)




●   http://manning.com/almiray
●   http://groovymag.com




Groovy, Grails, Griffon and more!
Questions
Thank you!
●
Image Credits

http://www.flickr.com/photos/fadderuri/841064754/
http://www.flickr.com/photos/colorloose/3539708679/
http://www.flickr.com/photos/icultist/2842153495/
http://www.flickr.com/photos/bishi/2313888267/
http://www.flickr.com/photos/kirimobile/2581287574/
http://www.flickr.com/photos/chelseaaaaaa/3564365301/
http://www.flickr.com/photos/psd/2086641/

Weitere Àhnliche Inhalte

Was ist angesagt?

2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language ViewerStian Soiland-Reyes
 
Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015Jorge Franco Leza
 
(Even more) Rapid App Development with RubyMotion
(Even more) Rapid App Development with RubyMotion(Even more) Rapid App Development with RubyMotion
(Even more) Rapid App Development with RubyMotionStefan Haflidason
 
GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017sascha_klein
 
Groovy on the shell
Groovy on the shellGroovy on the shell
Groovy on the shellsascha_klein
 
Intro
IntroIntro
Introbspremo
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Codenoamt
 
History & Practices for UniRx(EN)
History & Practices for UniRx(EN)History & Practices for UniRx(EN)
History & Practices for UniRx(EN)Yoshifumi Kawai
 
Reverse Engineering Malicious Javascript
Reverse Engineering Malicious JavascriptReverse Engineering Malicious Javascript
Reverse Engineering Malicious JavascriptYusuf Motiwala
 
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode ObjectsEWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode ObjectsRob Tweed
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Derek Willian Stavis
 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails IntroductionEric Weimer
 
AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015Florian Hopf
 
AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015Florian Hopf
 
A Deeper Look at Cargo
A Deeper Look at CargoA Deeper Look at Cargo
A Deeper Look at CargoAnton Weiss
 
hacking with node.JS
hacking with node.JShacking with node.JS
hacking with node.JSHarsha Vashisht
 
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...Yoshifumi Kawai
 
The Web Becomes Graceful
The Web Becomes GracefulThe Web Becomes Graceful
The Web Becomes Gracefulcolorhook
 
Salt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientSalt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientMayflower GmbH
 

Was ist angesagt? (20)

2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer
 
Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015
 
(Even more) Rapid App Development with RubyMotion
(Even more) Rapid App Development with RubyMotion(Even more) Rapid App Development with RubyMotion
(Even more) Rapid App Development with RubyMotion
 
GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017
 
Groovy on the shell
Groovy on the shellGroovy on the shell
Groovy on the shell
 
Intro
IntroIntro
Intro
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
History & Practices for UniRx(EN)
History & Practices for UniRx(EN)History & Practices for UniRx(EN)
History & Practices for UniRx(EN)
 
Reverse Engineering Malicious Javascript
Reverse Engineering Malicious JavascriptReverse Engineering Malicious Javascript
Reverse Engineering Malicious Javascript
 
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode ObjectsEWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!
 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails Introduction
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JAX 2015
 
AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015
AnwendungsfĂ€lle fĂŒr Elasticsearch JavaLand 2015
 
A Deeper Look at Cargo
A Deeper Look at CargoA Deeper Look at Cargo
A Deeper Look at Cargo
 
hacking with node.JS
hacking with node.JShacking with node.JS
hacking with node.JS
 
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
 
The Web Becomes Graceful
The Web Becomes GracefulThe Web Becomes Graceful
The Web Becomes Graceful
 
Salt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientSalt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native Client
 

Andere mochten auch

JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...Stephen Chin
 
Griffon for the Enterprise
Griffon for the EnterpriseGriffon for the Enterprise
Griffon for the EnterpriseJames Williams
 
GroovyFX: or how to program JavaFX easily
GroovyFX: or how to program JavaFX easily GroovyFX: or how to program JavaFX easily
GroovyFX: or how to program JavaFX easily Russel Winder
 
Using MongoDB With Groovy
Using MongoDB With GroovyUsing MongoDB With Groovy
Using MongoDB With GroovyJames Williams
 
Responsive Design for the Web
Responsive Design for the WebResponsive Design for the Web
Responsive Design for the Webjonbuda
 
Programa semana da leitura 2011
Programa semana da leitura 2011Programa semana da leitura 2011
Programa semana da leitura 2011Fernanda Gonçalves
 
Barometrul antreprenoriatului romanesc 2012
Barometrul antreprenoriatului romanesc 2012Barometrul antreprenoriatului romanesc 2012
Barometrul antreprenoriatului romanesc 2012Mihaela Matei
 
#CannesLions 2014: Day 1 Recap #OgilvyCannes
#CannesLions 2014: Day 1 Recap #OgilvyCannes#CannesLions 2014: Day 1 Recap #OgilvyCannes
#CannesLions 2014: Day 1 Recap #OgilvyCannesOgilvy
 
lyleresume2015-2
lyleresume2015-2lyleresume2015-2
lyleresume2015-2Janet Lyle
 
Semantic Web Intro - St. Patrick's Day 2016 Update
Semantic Web Intro - St. Patrick's Day 2016 UpdateSemantic Web Intro - St. Patrick's Day 2016 Update
Semantic Web Intro - St. Patrick's Day 2016 UpdateEric Franzon
 
Introduction to Swift
Introduction to SwiftIntroduction to Swift
Introduction to SwiftMatteo Battaglio
 

Andere mochten auch (14)

JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
JavaFX 2.0 With Alternative Languages - Groovy, Clojure, Scala, Fantom, and V...
 
Griffon for the Enterprise
Griffon for the EnterpriseGriffon for the Enterprise
Griffon for the Enterprise
 
GroovyFX: or how to program JavaFX easily
GroovyFX: or how to program JavaFX easily GroovyFX: or how to program JavaFX easily
GroovyFX: or how to program JavaFX easily
 
Using MongoDB With Groovy
Using MongoDB With GroovyUsing MongoDB With Groovy
Using MongoDB With Groovy
 
Responsive Design for the Web
Responsive Design for the WebResponsive Design for the Web
Responsive Design for the Web
 
Programa semana da leitura 2011
Programa semana da leitura 2011Programa semana da leitura 2011
Programa semana da leitura 2011
 
Grecia
GreciaGrecia
Grecia
 
Barometrul antreprenoriatului romanesc 2012
Barometrul antreprenoriatului romanesc 2012Barometrul antreprenoriatului romanesc 2012
Barometrul antreprenoriatului romanesc 2012
 
#CannesLions 2014: Day 1 Recap #OgilvyCannes
#CannesLions 2014: Day 1 Recap #OgilvyCannes#CannesLions 2014: Day 1 Recap #OgilvyCannes
#CannesLions 2014: Day 1 Recap #OgilvyCannes
 
lyleresume2015-2
lyleresume2015-2lyleresume2015-2
lyleresume2015-2
 
Semantic Web Intro - St. Patrick's Day 2016 Update
Semantic Web Intro - St. Patrick's Day 2016 UpdateSemantic Web Intro - St. Patrick's Day 2016 Update
Semantic Web Intro - St. Patrick's Day 2016 Update
 
3
33
3
 
Introduction to Swift
Introduction to SwiftIntroduction to Swift
Introduction to Swift
 
Top 10 Famous Motivational Speakers
Top 10 Famous Motivational SpeakersTop 10 Famous Motivational Speakers
Top 10 Famous Motivational Speakers
 

Ähnlich wie Desktop Revolution: Introduction to Griffon and Groovy GUI Development

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 SpringKiyotaka Oku
 
Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-
Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-
Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-Tsuyoshi Yamamoto
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx WorkshopDierk König
 
Groovy-er desktop applications with Griffon
Groovy-er desktop applications with GriffonGroovy-er desktop applications with Griffon
Groovy-er desktop applications with GriffonEric Wendelin
 
Groovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With GriffonGroovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With GriffonMatthew McCullough
 
CodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilderCodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilderAndres Almiray
 
ćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚Șン
ćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚Șăƒłćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚Șン
ćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚ȘンTsuyoshi Yamamoto
 
The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agentsRafael Winterhalter
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to GriffonJames Williams
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.Mark Rees
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applicationsrohitnayak
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
mobl
moblmobl
moblzefhemel
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?Murat Can ALPAY
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Murat Yener
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance TuningMinh Hoang
 
Desarrollo para Android con Groovy
Desarrollo para Android con GroovyDesarrollo para Android con Groovy
Desarrollo para Android con GroovySoftware Guru
 

Ähnlich wie Desktop Revolution: Introduction to Griffon and Groovy GUI Development (20)

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-
Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-
Grails 1.2 æŽąæ€œéšŠ -æ–°ăŸăȘè–æŻă‚’ă‚‚ăšă‚ăŠăƒ»ăƒ»ăƒ»-
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx Workshop
 
Groovy-er desktop applications with Griffon
Groovy-er desktop applications with GriffonGroovy-er desktop applications with Griffon
Groovy-er desktop applications with Griffon
 
Groovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With GriffonGroovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With Griffon
 
CodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilderCodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilder
 
ćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚Șン
ćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚Șăƒłćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚Șン
ćć€ć±‹SGGAE/Jć‹‰ćŒ·äŒš Grails、Gaelykでハンă‚șă‚Șン
 
The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agents
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applications
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
mobl
moblmobl
mobl
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
 
Desarrollo para Android con Groovy
Desarrollo para Android con GroovyDesarrollo para Android con Groovy
Desarrollo para Android con Groovy
 

Mehr von Andres Almiray

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoAndres Almiray
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianzaAndres Almiray
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidenciaAndres Almiray
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersAndres Almiray
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersAndres Almiray
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersAndres Almiray
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightAndres Almiray
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryAndres Almiray
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpcAndres Almiray
 
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryAndres Almiray
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spinAndres Almiray
 
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouAndres Almiray
 
What I wish I knew about Maven years ago
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years agoAndres Almiray
 
What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years agoAndres Almiray
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in techAndres Almiray
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Andres Almiray
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with GradleAndres Almiray
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleAndres Almiray
 
Gradle ex-machina
Gradle ex-machinaGradle ex-machina
Gradle ex-machinaAndres Almiray
 

Mehr von Andres Almiray (20)

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianza
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidencia
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven Puzzlers
 
Maven Puzzlers
Maven PuzzlersMaven Puzzlers
Maven Puzzlers
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpc
 
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and Layrry
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spin
 
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and You
 
What I wish I knew about Maven years ago
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years ago
 
What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years ago
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in tech
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with Gradle
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
 
Gradle ex-machina
Gradle ex-machinaGradle ex-machina
Gradle ex-machina
 

KĂŒrzlich hochgeladen

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

KĂŒrzlich hochgeladen (20)

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Desktop Revolution: Introduction to Griffon and Groovy GUI Development

  • 1. Welcome to the Desktop Revolution
  • 3.
  • 4. + + + Sugar, Spice and everything Nice =
  • 5.
  • 6. HelloWorld.java public class HelloWorld { String name; public void setName(String name) { this.name = name; } public String getName(){ return name; } public String greet() { return "Hello "+ name; } public static void main(String args[]){ HelloWorld helloWorld = new HelloWorld(); helloWorld.setName("Groovy"); System.err.println( helloWorld.greet() ); } }
  • 7. HelloWorld.groovy public class HelloWorld { String name; public void setName(String name) { this.name = name; } public String getName(){ return name; } public String greet() { return "Hello "+ name; } public static void main(String args[]){ HelloWorld helloWorld = new HelloWorld(); helloWorld.setName("Groovy"); System.err.println( helloWorld.greet() ); } }
  • 8. GroovierHelloWorld.groovy class HelloWorld { String name def greet() { "Hello $name" } } def helloWorld = new HelloWorld(name:"Groovy") println helloWorld.greet()
  • 9.
  • 10. Swing
  • 11. import java.awt.GridLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JButton; import javax.swing.SwingUtilities; public class JavaFrame { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { JFrame frame = buildUI(); frame.setVisible(true); } }); } // next page ...
  • 12. // continued ... private static JFrame buildUI() { JFrame frame = new JFrame("JavaFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout( new GridLayout(3,1) ); final JTextField input = new JTextField(20); final JTextField output = new JTextField(20); output.setEditable(false); JButton button = new JButton("Click me!"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event) { output.setText(input.getText()); } }); frame.getContentPane().add(input); frame.getContentPane().add(button); frame.getContentPane().add(output); frame.pack(); return frame; } }
  • 13. ● The light at the end of the tunnel...
  • 14. import groovy.swing.SwingBuilder import static javax.swing.JFrame.EXIT_ON_CLOSE new SwingBuilder().edt { frame(title: "GroovyFrame", pack: true, visible: true, defaultCloseOperation: EXIT_ON_CLOSE) { gridLayout(cols: 1, rows: 3) textField(id: "input", columns: 20) button("Click me!", actionPerformed: { output.text = input.text }) textField(id: "output", columns: 20, editable: false) } }
  • 15. What is going on? Each node is syntactically a method call All of these method calls are dynamically dispatched Most don’t actually exist in bytecode Child closures create hierarchical relations Child widgets are added to parent containers SwingBuilder node names are derived from Swing classes Remove the leading ‘J’ from a Swing class when present SwingBuilder also supports some AWT classes like layouts
  • 17. Threading and the EDT All painting and UI operations must be done in the EDT Anything else should be outside the EDT Swing has SwingUtilities using Runnable Java 6 technology adds SwingWorker However, closures are Groovy For code inside EDT edt { 
 } doLater { 
 } For code outside EDT doOutside { 
 } Build UI on the EDT SwingBuilder.build { 
 }
  • 18. Threading Example action( id: 'countdown', name: 'Start Countdown', closure: { evt -> int count = lengthSlider.value status.text = count while ( --count >= 0 ) { sleep( 1000 ) status.text = count } status.background = Color.RED })
  • 19. Threading Example action( id: 'countdown', name: 'Start Countdown', closure: { evt -> int count = lengthSlider.value status.text = count doOutside { while ( --count >= 0 ) { sleep( 1000 ) edt { status.text = count } } doLater { status.background = Color.RED } } })
  • 21. Binding Example import groovy.swing.SwingBuilder new SwingBuilder().edt { frame( title: "Binding Test", size: [200, 120], visible: true ) { gridLayout( cols: 1, rows: 2 ) textField( id: "t1" ) textField( id: "t2", editable: false ) } bind(source: t1, sourceProperty: "text", target: t2, targetProperty: "text") }
  • 22. Binding Example import groovy.swing.SwingBuilder new SwingBuilder().edt { frame( title: "Binding Test", size: [200, 120], visible: true ) { gridLayout( cols: 1, rows: 2 ) textField( id: "t1" ) textField( id: "t2", editable: false, text: bind(source: t1, sourceProperty: "text") ) } }
  • 23. Binding Example import groovy.swing.SwingBuilder new SwingBuilder().edt { frame( title: "Binding Test", size: [200, 120], visible: true ) { gridLayout( cols: 1, rows: 2 ) textField( id: "t1" ) textField( id: "t2", editable: false, text: bind{ t1.text } ) } }
  • 24.
  • 25. Convention over Configuration Don't repeat yourself (DRY) MVC Pattern Testing supported “out of the box” Automate repetitive tasks
  • 26. Convention over Configuration Java Desktop Application Conventions are MIA Very few official examples No Blueprints (Like Java EE Blueprints) We have to create our own Following Grails Patterns Source Files Segregated by Role Standardize App Lifecycle (like JSR-296) Automated Packaging (App, WebStart, Applet)
  • 27.
  • 28. Lyfecycle Scripts Lifecycle Scripts are in griffon-app/lifecycle Lifecycle Events modeled after JSR-296 Initialize Startup Ready Shutdown
  • 29. Don't Repeat Yourself How? Use a Dynamic Language! With Closures/Blocks With terse property syntax myJTextArea.text = "Fires Property Change" With terse eventing syntax button.actionPerformed = {println 'hi'} With Rich Annotation Support @Bindable String aBoundProperty Most of this impacts the View Layer See JavaOne 2008 TS-5098 - Building Rich Applications with Groovy's SwingBuilder
  • 30. Built-in Testing Griffon has built in support for testing create-mvc script creates a test file in test/integration Uses GroovyTestCase See JavaOne 2008 TS-5101 – Boosting your Testing Productivity with Groovy Griffon doesn’t write the test for you test-app script executes the tests for you Bootstraps the application for you Everything up to instantiating MVC Groups
  • 31. Testing Plugins Sometimes apps need more involved testing fest Fluent interface for functional swing testing easyb Behavioral Driven Development code-coverage – Cobertura Line Coverage Metrics jdepend Code quality metrics codenarc Static code analysis
  • 32. Automate Tasks command line interface Scripts and events plugins builders: SwingX, JIDE, Flamingo, Trident , CSS, JavaFX and more miscellaneous: installer (IzPack, RPM, OSX app bundles), Splash, Wizard, Scala
  • 35. Griffon in Action (2010) ● http://manning.com/almiray
  • 36. ● http://groovymag.com Groovy, Grails, Griffon and more!