Griffon demo

Post on 25-May-2015

146 views 0 download

Tags:

Transcript of Griffon demo

The Griffon FrameworkAn Investigation by

Jim Kirkbride

What is this Griffon thing anyway?

What Is Griffon?

● Desktop Application Framework● Takes after Grails● MVC-based● Groovy-based● Vastly simplifies writing Swing-based

applications

Why Not Just Use Swing?

● Complex widget hierarchy● Difficult to separate out business logic from

view logic● Difficult to properly manage threading● Difficult to test● Wouldn’t you rather write Groovy?

Getting Started

● gvm install griffon <version>● set GRIFFON_HOME● add GRIFFON_HOME/bin to path● griffon create-app <app name>● You’re in business!

Griffon Project Layout

● Application.groovy○ App title○ Start-up Groups○ MVC Groups

● BuildConfig.groovy○ Environment settings○ Jar Signing○ Dependency resolution

Configuration

Configuration Cont.

● Builder.groovy○ SwingBuilder configuration

● Config.groovy○ Log4j configuration○ Global configuration

Application LifeCycle

● Initialize● Startup● Ready● Shutdown● Stop

About MVC...

MVC

Griffon MVC

● Nothing more than beans with “bindable” properties

● Uses the @Bindable AST transformation● Model != “Domain”!● PropertyChange listeners

Model

View

● Uses the SwingBuilder library to create layouts

● Uses model properties for two-way binding● Converters● Validators

Controller

● Actions defined as closures● Manipulates model values● Used to define threading

Services

● Just like Grails services● Injectable● No transactional capabilities

Application Events

● Built-in events● Custom Events

What About Testing?

● GriffonUnitTestCase● Access to Mock objects● Integration and Unit testing● Decidedly lacking in Acceptance Testing

○ FEST Plugin

Lets talk about everyone’s favorite topic…

Threading!

Threading

● Swing uses the “Event Dispatch Thread”● Makes you write ugly code using

SwingWorker● Is completely simplified in Griffon!

Threading Cont.

● On the EDT:○ execInsideUISync○ execInsideUIAsync

● Outside the EDT:○ execOutsideUI

● isUIThread● execFuture

Eco System

● Griffon still in development● Documentation is spotty at best, downright

wrong at worst● Andres is very active ● Griffon team is really responsive● Tons of plugins (very hit or miss)

Thanks!

LinksGriffonhttp://griffon.codehaus.org/

Griffon Guide (Latest)http://griffon.codehaus.org/guide/latest/guide/index.html

Jim Shingler's Presentation on Griffonhttp://www.slideshare.net/jshingler/griffon-in-front-grails-in-back-presentation

Griffon Demohttps://github.com/jameskbride/griffon-demo

Vending Machine Kata Implementation Examplehttps://github.com/jameskbride/vendingMachineGriffonDemo

Griffon Plugin Directoryhttp://artifacts.griffon-framework.org/category/all/plugins

Griffon ActiveJDBC Pluginhttp://griffon.codehaus.org/Activejdbc+Plugin

Griffon GlazedLists Pluginhttp://griffon.codehaus.org/Glazedlists+Plugin

Griffon FEST Pluginhttp://griffon.codehaus.org/Fest+Pluginhttps://github.com/griffon/griffon-fest-plugin/

Andres Almiray’s Bloghttp://www.jroller.com/aalmiray/