griffon for the enterprise
DESCRIPTION
Presented at SpringOne2GX 2010 October 21, 2010 Chicago, ILTRANSCRIPT
![Page 1: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/1.jpg)
Chicago, October 19 - 22, 2010
Griffon for the Enterprise
James Williams – BT/Ribbit
![Page 2: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/2.jpg)
About Me
• Co-creator of Griffon
• Creator of SwingXBuilder
• Sofware Engineer at BT/Ribbit
![Page 3: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/3.jpg)
Griffon Team and Contributors
● Andres Almiray ● Danno Ferrin ● Josh Reed ● Jim Shingler • Hamlet D'Arcy • Nick Zhu
![Page 4: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/4.jpg)
Agenda
● Overview of Griffon● Griffon MVC● Plugins and Addons● Application Packaging● Griffon Competitors● Sample Applications and Demos● Summary
![Page 5: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/5.jpg)
What is Griffon?
● Open source desktop rapid development framework● Leverages Java Swing and the Groovy language● Apache 2 Licensed● Extensible using Plugins and Add-ons● Brings a Grails-inspired experience to the desktop
![Page 6: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/6.jpg)
Structure of a Griffon Application
![Page 7: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/7.jpg)
Structure of a Griffon Application
Yes, all of em.
![Page 8: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/8.jpg)
Griffon MVC
Provides a separation of concerns● Models● Views● Controllers
![Page 9: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/9.jpg)
Griffon Lifecycle
● Bootstrap● Initialize● Startup● Shutdown● Stop
![Page 10: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/10.jpg)
Plugins and Addons
Extend existing features in Griffon applications• Plugins
• Addons
Provide features like
• UI toolkits• Databases• XMPP/REST/RPC
• Testing
• Layout Managers
• Bling
![Page 11: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/11.jpg)
Services and Dependency Injection
Griffon has supports the following• Guice
• Spring
• First-class services when DI is not needed
![Page 12: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/12.jpg)
Application Packaging
● Can easily be deployed as – Fat JARs or collection of JARs
– Java WebStart
– Applets
– Zip file● The Installer plugin can also provide the following
– OS specific executables
– Izpack
– JSmooth
![Page 13: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/13.jpg)
Griffon's Competitors
● Apache Pivot● Eclipse RCP● Netbeans Platform● Many wannabes
![Page 14: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/14.jpg)
Apache Pivot
Rapid application framework including:• WTK user interface elements
• Web libraries
• Charts
• LOTS of XML• Base footprint: Unknown but very small
![Page 15: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/15.jpg)
Code Sample
<Window title="Hello WTKX!" maximized="true" xmlns:wtkx="http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk"> <content> <Label text="Hello WTKX!" styles="{font:'Arial bold 24', color:'#ff0000', horizontalAlignment:'center', verticalAlignment:'center'}"/> </content></Window>
![Page 16: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/16.jpg)
Eclipse RCP
Rapid application framework including:• Eclipse Runtime
• SWT
• JFace
• Workbench• Plugins• Base footprint: 12MB
![Page 17: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/17.jpg)
Netbeans Platform
Toolkit powering Netbeans providing:• Java Swing
• OSGI or Netbeans Modules
• Advanced multi-Window system
• Base footprint: 7-8.5MB
![Page 18: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/18.jpg)
Dependency Handling in Griffon
● Gradle is built in under the covers providing● Compile, Test, and Runtime dependency● Integration with Maven repositories ● Integration with Griffon plugin repositories● No OSGI support yet
![Page 19: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/19.jpg)
Using Eclipse UIs in Griffon
WindowsBuilder Pro• A GUI designer product from Instantiations
• Recently released as a free product
• Provides a competitor to Netbeans Matisse
• Creates human-editable code• Generated UIs can be dropped into a Griffon app
![Page 20: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/20.jpg)
Using Netbeans Matisse with Griffon
Netbeans Matisse ...• Uses GroupLayout for the UIs
• Code is not humanly editable
• No alternate LayoutManagers
• griffon generate-view-script <Qualified UI class name>
![Page 21: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/21.jpg)
Demo
![Page 22: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/22.jpg)
Use Case #1 - Databases
Scenario: Create a database viewer application
Requirements:
• Use MongoDB
• Have the ability to do basic functions like:– CRUD operations
– Simple and advanced query
– Retrieve DB statistics
![Page 23: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/23.jpg)
What is MongoDB?
● Document-oriented database• Documents can be nested• Supports MapReduce
• Used by NYT, SourceForge, foursquare, and others
• Libraries for many programming languages
![Page 24: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/24.jpg)
Demo
![Page 25: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/25.jpg)
Code Sample
jxtitledPanel(title:'Settings', border:new DropShadowBorder(Color.BLACK,15), constraints:'w 30%, h 100%') { jxtaskPaneContainer() { taskPane(id:'conxPane', title:'Connections', layout:new MigLayout()) { scrollPane() { panel(id:'conxIcons', layout: new MigLayout())
} button(text:'Add', constraints:'newline, cell 0 1 ', ...) button(text:'Remove', constraints:'cell 0 1') } taskPane(id:'dbPane', title:'Databases', layout:new MigLayout()) taskPane(id:'collPane', title:'Collections', layout:new MigLayout()) }
}
![Page 26: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/26.jpg)
Code Sample
package griffonmongo
import net.miginfocom.swing.MigLayoutframe (title:'Add a Connection', id:'conx', size:[200,200], layout:new
MigLayout()) {label(text:'Name')textField(id:'txtName', columns:15, constraints:'wrap')label(text:'Host')textField(id:'txtHost', columns:15, constraints:'wrap')label(text:'Port')textField(id:'txtPort', columns:4, constraints:'wrap')button('Add')button('Cancel')
}
![Page 27: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/27.jpg)
Use Case #2 – Websockets / Net Comms
Scenario: Use websockets for communication in a chat and slideware app
Requirements:
• Use WebSockets
• Provide simple chat functions
• Allow controlling slideware app with Websockets
![Page 28: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/28.jpg)
What are Web Sockets?
Web Sockets ...• Address the issues of long polling
• Supported natively by Chrome, Opera, and Firefox
• Enabled with Flash in non-compliant browsers
• Enable bi-directional communication between– Web sites
– Web Services
![Page 29: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/29.jpg)
How Websockets work
![Page 30: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/30.jpg)
Griffon Talk Android App
● Had to play nice with websockets● Needed to display information about the current slide● Needed to control the presentation via Wifi● Had to be Android Cupcake (1.5) compatible
![Page 31: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/31.jpg)
Demo
![Page 32: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/32.jpg)
Code Sample
def listener = [processToken:{aEvent, aToken ->
def json = new JSONObject(aToken.toString())switch(json.getString("operation")) {
...case "broadcast":
def sender = json.getString("user")def msg = json.getString("data")model.msgEventList.add("$sender: $msg")
break}
}, processOpened:{aEvent -> println aEvent}, processPacket:{evt, pkt ->
}] as WebSocketClientTokenListener
![Page 33: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/33.jpg)
Code Sample
scrollPane(id:'screenshot', constraints:'w 700px , h 100%')panel (layout:new MigLayout(), constraints:'w 200px, h 100%') {
scrollPane(id:'scroll', constraints:'h 90%, w 200px, wrap'){jxlist(model:model.msgModel, highlighters:
[HighlighterFactory.createSimpleStriping()])}panel (layout:new MigLayout(), constraints:'w 200px'){
comboBox(id:'cbox', items:['Send Message', 'Send Question'], constraints:'wrap')
textArea(id:'msgText', columns:15, lineWrap:true,constraints:'wrap')
button(text:'Send', actionPerformed:{ controller.sendMessage(msgText?.text)})
}}
![Page 34: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/34.jpg)
Use Case #3 – Converting an app
Scenario: A legacy application that has fallen into disrepair
Requirements:
• Most original functionality must be preserved
• A total rewrite has to be optional
![Page 35: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/35.jpg)
NeoeEdit
● Lightweight BSD licensed text editor● Similar to JEdit
• Built using Java and Swing
• Keyword syntax highlighting
![Page 36: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/36.jpg)
Live coding
![Page 37: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/37.jpg)
Stock Tracker App
● Ported from Apache Pivot to Griffon● Reads stock information from Yahoo! Finance● Track changes in stock information in real-time
![Page 38: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/38.jpg)
Demo
![Page 39: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/39.jpg)
Summary
● UI designer support● Work incrementally with your assets.● Griffon has a small footprint.● Extensible with plugins and addons● You don't have to give up your favorite GUI designer.
![Page 40: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/40.jpg)
Links
● Griffon project: http://griffon.codehaus.org• Code samples:
http://github.com/jwill/SpringOne2GXDemos
• jWebSocket: http://jwebsocket.org/
• websocket4j: https://launchpad.net/websocket4j
• NeoeEdit: http://code.google.com/p/neoeedit/
![Page 41: Griffon for the Enterprise](https://reader034.vdocuments.net/reader034/viewer/2022051012/5461f609b1af9f936c8b4c73/html5/thumbnails/41.jpg)
Q&A