griffon: swing just got fun again

25
Griffon: Swing just got fun again James Williams

Upload: james-williams

Post on 20-Aug-2015

2.017 views

Category:

Technology


0 download

TRANSCRIPT

Griffon: Swing just got fun again

James Williams

Agenda

• What is Griffon?• What's un-fun about Swing?• Getting Started• Builders• Griffon MVC• Lifecycle• Add-ons• Plugins• Demos• QA

What's un-fun about Swing?

What's un-fun about Swing?

• not knowing where stuff is

• old school Swing is repetitive

• unresponsive user interfaces

• configuring JNLPs is a nightmare

• signing jars is a pain

• you have to choose between applets and desktop pretty early 

    

What is Griffon?

• desktop framework leveraging Swing and Groovy

• Apache 2 Licensed

• very extensible

• unofficially called "Grails for the desktop"

Griffon Application Structure

Getting Started

• griffon create-app <AppName>

• griffon list-plugins 

• griffon install-plugin <PluginName>

• griffon run-app

• griffon run-applet

• griffon run-webstart

• griffon package

Builders

• DSLs to compose complex structures

• Encapsulate some common conversions 

• Can allow elements from different toolkits to be mixed

• Yield much more readable code than typical Java code

Builders - Sample Code

JFrame frame = new JFrame("My Frame");frame.setSize(200,200);frame.add(new JLabel("Test Label"));

is the equivalent to :

frame (title: "My Frame", size:[200,200]) {    label("Test Label")}

Models

• contain variables referenced by the controller and view

• can use the @Bindable notation to provide binding support

•  are injected into the controller and view at run-time

Views

• can be written in Groovy or Java

• represent a single display in your application

• can mix and match components from different UI toolkits

Demo - Simple Calculator

Griffon Lifecycle

• Initializeo  run before any Swing code is started

• Startupo  run after MVC Groups are initialized

• Readyo  all events have been processed by the EDT

• Shutdowno all cleanup operations go here

UI Threading aka "The Evil EDT"

• doOutside

• doInside

• doLater

• edt

Add-ons

• run-time analog to plugins

• can add or respond to runtime events

• can decorate MVC Groups

Plugin Types

• User Interface Builders

• Testing

• Other JVM Langs

• Bling

• Database

• Miscellaneous

User Interface Builder Plugins

• AbeilleFormBuilder• CSSBuilder• FlamingoBuilder• FxBuilder• GfxBuilder• JIDEBuilder• MacWidgetsBuilder• SwingXBuilder• SwingXtrasBuilder• TrayBuilder• TridentBuilder

Testing Plugins

• Code coverage

• CodeNarc

• EasyB

• Fest

• JDepend

JVM Language Plugins

• LangBridge

• Clojure

• Scala

Bling Plugins

• JGoodiesForms

• Splash Screen

• Transitions

Miscellaneous Plugins

• GPars

• Installer

• JUNG

• Wizard

Demo - SwingPad

Demo - Griffon on Wave

Griffon Links

Download: http://griffon.codehaus.org (includes Greet)

Gr8Forums: http://bit.ly/Griffon-on-GR8Forum

Demos (except Greet): http://github.com/jwill/griffon-testing-grounds/

Griffon Team on Twitter

• @ecspike - James Williams (Me)

• @shemnon - Danno Ferrin

• @aalmiray - Andres Almiray

• @joshareed - Josh Reed

• @jshingler - Jim Shingler