SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
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)

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Mais de 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
 

Último

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 

Último (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

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)