SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
Griffon
Swing just got fun again
James Williams
Agenda
> What's un-fun about Swing?
> What is Griffon?
> Getting Started
> Builders
> Griffon MVC
> Lifecycle
> Plugins/Addons
> Demos
> Q&A
What's un-fun about Swing?
> not knowing where stuff is
> can be very repetitive
> unresponsive user interfaces
> configuring webstart apps is a nightmare
> you're forced to choose between applets and desktop
fairly early
What is Griffon?
> desktop framework leveraging Swing and Groovy
> Apache 2 Licensed
> very extensible with plugins and addons
> allows you to code without worrying about the destination
platform
Griffon Application Structure
Getting Started
> griffon create-app
> griffon run-app
> griffon run-applet
> griffon run-webstart
> griffon package
> griffon list-plugins
> griffon install-plugin
Builders
> DSLs to compose complex object graphs
> Can automatically perform some common conversions
> Yield much more readable code than Java
Would you prefer this ...
public class JavaFrame extends JFrame {
    public JavaFrame() {
        setLayout(new GridLayout(3,1));
        setTitle("Test");
        setSize(100,100);
        add(new JLabel("One"));
        add(new JLabel("Two"));
        add(new JLabel("Three"));
    }

    public static void main(String [ ] args) {
          new JavaFrame().setVisible(true);
      }
}
... or this?

def swing = new SwingBuilder()

swing.frame(size:[100,100], title:'Test', layout:new GridLayout(3,1))
{
    label("One")
    label("Two")
    label("Three")
}.show()
30 sec Swing(X)Builder Quick Guide
> Take the class name (e.g. JFrame)
> Remove the J(X)
> Change the remaining node name to camel-case
> Any fields that follow the JavaBean spec can be passed in
a HashMap
UberBuilder - Builders on steriods
> Allows you to mix and match components
> Avoids collisions by setting up namespaces
UberBuilder - Supported toolkits
> Swing
> SwingX
> JIDE
> Flamingo
> MacWidgets
> SwingXtras
> Fx (JavaFX)
> Gfx (Java2D)
Griffon MVC Groups
> Models
  - can use the @Bindable notation to provide data binding
  - store the data for the MVC Group
> Views
  - represent a single display in your applications
  - can be written in Groovy OR Java
> Controllers
  - the brains of the group
  - can be injected with services
Binding
> general formats:
  - bind{model.property}
  - bind(target:model, targetProperty:'name')
  - bind(source:model, sourceProperty:'name')
> one-way
> mutual binding
Binding and SwingPad Demo
Griffon Lifecycle
> Initialize
  - run before any Swing code is started
> Startup
  - run after MVC Groups are initialized
> Ready
  - run after all events have been processed by the EDT
> Shutdown
  - all cleanup operations should run here
> Stop
  - only used by applets
The Evil Event Dispatching Thread
> edt
  - runs on the EDT using invokeAndWait
> doLater
  - runs on the EDT using invokeLater
> doOutside
  - spins up a thread to run if not already outside the EDT
> withWorker (SwingWorker)
  - for long running tasks where the UI might periodically update
Plugins
> are the delivery method to provide compile-time
functionality:
  - Builders
  - Other JVM Language Support
  - Testing Frameworks
  - Addons
Addons
> add functionality at run-time
> can add or respond to runtime events
> can decorate MVC Groups
Guice Add-on
> injects methods and fields using the @Inject annotation
> Groovy removes the need for binding interfaces to
modules
> smaller footprint and faster than Spring
Guice Configuration
application {
    title='TestGuice'
    startupGroups = ['TestGuice']

   // Should Griffon exit when no Griffon created frames are showing?
   autoShutdown = true

   // If you want some non-standard application class, apply it here
   //frameClass = 'javax.swing.JFrame'
}
/* truncated for brevity */

guice {
    injectInto = ["controller"]
    modules = ['NotifierModule']
}
GuiceController
class TestguiceController {
    // these will be injected by Griffon
    def model
    def view
    @Inject Notifier notifier

    void mvcGroupInit(Map args) {
        // this method is called after model and view are injected
        injector.injectMembers(this)
        // related settings from Application.groovy are injected
        notifier.sendNotification("hi")
    }
}
Griffon Links
> Download: http://griffon.codehaus.org/Download
> Plugins/Addons: http://griffon.codehaus.org/Plugins
> User mailing list: user@griffon.codehaus.org
> Dev mailing list: dev@griffon.codehaus.org
Griffon Team on Twitter
> James Williams (@ecspike)
> Danno Ferrin (@shemnon)
> Andres Almiray (@aalmiray)
> Josh Reed (@joshareed)
> Jim Shingler (@jshingler)
> Griffon News (@theaviary)

Weitere ähnliche Inhalte

Was ist angesagt?

sbt 0.10 for beginners?
sbt 0.10 for beginners?sbt 0.10 for beginners?
sbt 0.10 for beginners?k4200
 
Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01rhemsolutions
 
Lifthub (rpscala #31)
Lifthub (rpscala #31)Lifthub (rpscala #31)
Lifthub (rpscala #31)k4200
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016Hendrik Ebbers
 
Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring IO '15 - Developing microservices, Spring Boot or Grails?Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring IO '15 - Developing microservices, Spring Boot or Grails?Fátima Casaú Pérez
 
Making React Native UI Components with Swift
Making React Native UI Components with SwiftMaking React Native UI Components with Swift
Making React Native UI Components with SwiftRay Deck
 
Spring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trendsSpring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trendsArawn Park
 

Was ist angesagt? (10)

jQuery plugin & testing with Jasmine
jQuery plugin & testing with JasminejQuery plugin & testing with Jasmine
jQuery plugin & testing with Jasmine
 
sbt 0.10 for beginners?
sbt 0.10 for beginners?sbt 0.10 for beginners?
sbt 0.10 for beginners?
 
Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01
 
Griffon Presentation
Griffon PresentationGriffon Presentation
Griffon Presentation
 
Lifthub (rpscala #31)
Lifthub (rpscala #31)Lifthub (rpscala #31)
Lifthub (rpscala #31)
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
 
Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring IO '15 - Developing microservices, Spring Boot or Grails?Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring IO '15 - Developing microservices, Spring Boot or Grails?
 
Making React Native UI Components with Swift
Making React Native UI Components with SwiftMaking React Native UI Components with Swift
Making React Native UI Components with Swift
 
Spring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trendsSpring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trends
 
Ng2 cli v1
Ng2 cli v1Ng2 cli v1
Ng2 cli v1
 

Ähnlich wie Griffon: Swing just got fun again

Griffon: Swing just got fun again
Griffon: Swing just got fun againGriffon: Swing just got fun again
Griffon: Swing just got fun againJames Williams
 
Porting legacy apps to Griffon
Porting legacy apps to GriffonPorting legacy apps to Griffon
Porting legacy apps to GriffonJames Williams
 
Web Applications with AngularJS
Web Applications with AngularJSWeb Applications with AngularJS
Web Applications with AngularJSPhilipp Burgmer
 
JavaOne 2009 BOF-5189 Griffon In Depth
JavaOne 2009 BOF-5189 Griffon In DepthJavaOne 2009 BOF-5189 Griffon In Depth
JavaOne 2009 BOF-5189 Griffon In DepthDanno Ferrin
 
From Zero to Cloud in 12 Easy Factors
From Zero to Cloud in 12 Easy FactorsFrom Zero to Cloud in 12 Easy Factors
From Zero to Cloud in 12 Easy FactorsEd King
 
Considerations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke siteConsiderations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke siteEngage Software
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
Grails beginners workshop
Grails beginners workshopGrails beginners workshop
Grails beginners workshopJacobAae
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend FrameworkAdam Culp
 
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSKarlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSPhilipp Burgmer
 
Models, controllers and views
Models, controllers and viewsModels, controllers and views
Models, controllers and viewspriestc
 
Introduction to Zend Framework 2
Introduction to Zend Framework 2Introduction to Zend Framework 2
Introduction to Zend Framework 2John Coggeshall
 
Grails Plugin
Grails PluginGrails Plugin
Grails Pluginguligala
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and FriendsYun Zhi Lin
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntônio Roberto Silva
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
JavaFX / JacpFX interaction with JSR356 WebSockets
JavaFX / JacpFX interaction with JSR356 WebSocketsJavaFX / JacpFX interaction with JSR356 WebSockets
JavaFX / JacpFX interaction with JSR356 WebSocketsAndy Moncsek
 

Ähnlich wie Griffon: Swing just got fun again (20)

Griffon: Swing just got fun again
Griffon: Swing just got fun againGriffon: Swing just got fun again
Griffon: Swing just got fun again
 
Porting legacy apps to Griffon
Porting legacy apps to GriffonPorting legacy apps to Griffon
Porting legacy apps to Griffon
 
Web Applications with AngularJS
Web Applications with AngularJSWeb Applications with AngularJS
Web Applications with AngularJS
 
JavaOne 2009 BOF-5189 Griffon In Depth
JavaOne 2009 BOF-5189 Griffon In DepthJavaOne 2009 BOF-5189 Griffon In Depth
JavaOne 2009 BOF-5189 Griffon In Depth
 
From Zero to Cloud in 12 Easy Factors
From Zero to Cloud in 12 Easy FactorsFrom Zero to Cloud in 12 Easy Factors
From Zero to Cloud in 12 Easy Factors
 
Considerations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke siteConsiderations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke site
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
Grails beginners workshop
Grails beginners workshopGrails beginners workshop
Grails beginners workshop
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend Framework
 
2007 Zend Con Mvc
2007 Zend Con Mvc2007 Zend Con Mvc
2007 Zend Con Mvc
 
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSKarlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
 
Models, controllers and views
Models, controllers and viewsModels, controllers and views
Models, controllers and views
 
Introduction to Zend Framework 2
Introduction to Zend Framework 2Introduction to Zend Framework 2
Introduction to Zend Framework 2
 
Grails Plugin
Grails PluginGrails Plugin
Grails Plugin
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
Camel_From_The_Field
Camel_From_The_FieldCamel_From_The_Field
Camel_From_The_Field
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
JavaFX / JacpFX interaction with JSR356 WebSockets
JavaFX / JacpFX interaction with JSR356 WebSocketsJavaFX / JacpFX interaction with JSR356 WebSockets
JavaFX / JacpFX interaction with JSR356 WebSockets
 

Mehr von James Williams

Introduction to WebGL and Three.js
Introduction to WebGL and Three.jsIntroduction to WebGL and Three.js
Introduction to WebGL and Three.jsJames Williams
 
Intro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingIntro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingJames Williams
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsJames Williams
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to GriffonJames Williams
 
Griffon for the Enterprise
Griffon for the EnterpriseGriffon for the Enterprise
Griffon for the EnterpriseJames Williams
 
Game programming with Groovy
Game programming with GroovyGame programming with Groovy
Game programming with GroovyJames Williams
 
Java development with MongoDB
Java development with MongoDBJava development with MongoDB
Java development with MongoDBJames Williams
 
Using MongoDB With Groovy
Using MongoDB With GroovyUsing MongoDB With Groovy
Using MongoDB With GroovyJames Williams
 
Creating Voice Powered Apps with Ribbit
Creating Voice Powered Apps with RibbitCreating Voice Powered Apps with Ribbit
Creating Voice Powered Apps with RibbitJames Williams
 
Extending Groovys Swing User Interface in Builder to Build Richer Applications
Extending Groovys Swing User Interface in Builder to Build Richer ApplicationsExtending Groovys Swing User Interface in Builder to Build Richer Applications
Extending Groovys Swing User Interface in Builder to Build Richer ApplicationsJames Williams
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyJames Williams
 

Mehr von James Williams (14)

Introduction to WebGL and Three.js
Introduction to WebGL and Three.jsIntroduction to WebGL and Three.js
Introduction to WebGL and Three.js
 
Intro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingIntro to HTML5 Game Programming
Intro to HTML5 Game Programming
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web Apps
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
Griffon for the Enterprise
Griffon for the EnterpriseGriffon for the Enterprise
Griffon for the Enterprise
 
Game programming with Groovy
Game programming with GroovyGame programming with Groovy
Game programming with Groovy
 
Java development with MongoDB
Java development with MongoDBJava development with MongoDB
Java development with MongoDB
 
Enterprise Griffon
Enterprise GriffonEnterprise Griffon
Enterprise Griffon
 
Using MongoDB With Groovy
Using MongoDB With GroovyUsing MongoDB With Groovy
Using MongoDB With Groovy
 
Creating Voice Powered Apps with Ribbit
Creating Voice Powered Apps with RibbitCreating Voice Powered Apps with Ribbit
Creating Voice Powered Apps with Ribbit
 
Extending Groovys Swing User Interface in Builder to Build Richer Applications
Extending Groovys Swing User Interface in Builder to Build Richer ApplicationsExtending Groovys Swing User Interface in Builder to Build Richer Applications
Extending Groovys Swing User Interface in Builder to Build Richer Applications
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with Groovy
 
Android Development
Android DevelopmentAndroid Development
Android Development
 
SVCC Intro to Grails
SVCC Intro to GrailsSVCC Intro to Grails
SVCC Intro to Grails
 

Kürzlich hochgeladen

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 

Kürzlich hochgeladen (20)

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 

Griffon: Swing just got fun again

  • 1. Griffon Swing just got fun again James Williams
  • 2. Agenda > What's un-fun about Swing? > What is Griffon? > Getting Started > Builders > Griffon MVC > Lifecycle > Plugins/Addons > Demos > Q&A
  • 3. What's un-fun about Swing? > not knowing where stuff is > can be very repetitive > unresponsive user interfaces > configuring webstart apps is a nightmare > you're forced to choose between applets and desktop fairly early
  • 4. What is Griffon? > desktop framework leveraging Swing and Groovy > Apache 2 Licensed > very extensible with plugins and addons > allows you to code without worrying about the destination platform
  • 6. Getting Started > griffon create-app > griffon run-app > griffon run-applet > griffon run-webstart > griffon package > griffon list-plugins > griffon install-plugin
  • 7. Builders > DSLs to compose complex object graphs > Can automatically perform some common conversions > Yield much more readable code than Java
  • 8. Would you prefer this ... public class JavaFrame extends JFrame { public JavaFrame() { setLayout(new GridLayout(3,1)); setTitle("Test"); setSize(100,100); add(new JLabel("One")); add(new JLabel("Two")); add(new JLabel("Three")); } public static void main(String [ ] args) { new JavaFrame().setVisible(true); } }
  • 9. ... or this? def swing = new SwingBuilder() swing.frame(size:[100,100], title:'Test', layout:new GridLayout(3,1)) { label("One") label("Two") label("Three") }.show()
  • 10. 30 sec Swing(X)Builder Quick Guide > Take the class name (e.g. JFrame) > Remove the J(X) > Change the remaining node name to camel-case > Any fields that follow the JavaBean spec can be passed in a HashMap
  • 11. UberBuilder - Builders on steriods > Allows you to mix and match components > Avoids collisions by setting up namespaces
  • 12. UberBuilder - Supported toolkits > Swing > SwingX > JIDE > Flamingo > MacWidgets > SwingXtras > Fx (JavaFX) > Gfx (Java2D)
  • 13. Griffon MVC Groups > Models - can use the @Bindable notation to provide data binding - store the data for the MVC Group > Views - represent a single display in your applications - can be written in Groovy OR Java > Controllers - the brains of the group - can be injected with services
  • 14. Binding > general formats: - bind{model.property} - bind(target:model, targetProperty:'name') - bind(source:model, sourceProperty:'name') > one-way > mutual binding
  • 16. Griffon Lifecycle > Initialize - run before any Swing code is started > Startup - run after MVC Groups are initialized > Ready - run after all events have been processed by the EDT > Shutdown - all cleanup operations should run here > Stop - only used by applets
  • 17. The Evil Event Dispatching Thread > edt - runs on the EDT using invokeAndWait > doLater - runs on the EDT using invokeLater > doOutside - spins up a thread to run if not already outside the EDT > withWorker (SwingWorker) - for long running tasks where the UI might periodically update
  • 18. Plugins > are the delivery method to provide compile-time functionality: - Builders - Other JVM Language Support - Testing Frameworks - Addons
  • 19. Addons > add functionality at run-time > can add or respond to runtime events > can decorate MVC Groups
  • 20. Guice Add-on > injects methods and fields using the @Inject annotation > Groovy removes the need for binding interfaces to modules > smaller footprint and faster than Spring
  • 21. Guice Configuration application { title='TestGuice' startupGroups = ['TestGuice'] // Should Griffon exit when no Griffon created frames are showing? autoShutdown = true // If you want some non-standard application class, apply it here //frameClass = 'javax.swing.JFrame' } /* truncated for brevity */ guice { injectInto = ["controller"] modules = ['NotifierModule'] }
  • 22. GuiceController class TestguiceController { // these will be injected by Griffon def model def view @Inject Notifier notifier void mvcGroupInit(Map args) { // this method is called after model and view are injected injector.injectMembers(this) // related settings from Application.groovy are injected notifier.sendNotification("hi") } }
  • 23. Griffon Links > Download: http://griffon.codehaus.org/Download > Plugins/Addons: http://griffon.codehaus.org/Plugins > User mailing list: user@griffon.codehaus.org > Dev mailing list: dev@griffon.codehaus.org
  • 24. Griffon Team on Twitter > James Williams (@ecspike) > Danno Ferrin (@shemnon) > Andres Almiray (@aalmiray) > Josh Reed (@joshareed) > Jim Shingler (@jshingler) > Griffon News (@theaviary)