Chapter 1. Welcome to the Griffon revolution
Listing 1.1. Default GroovyEditView
Listing 1.2. Adding menus and a tabbed pane to GroovyEditView.groovy
Listing 1.3. Full source of GroovyEditView.groovy
Listing 1.4. GroovyEditController with two actions
Listing 1.5. FilePanelView with a tab, a text area, and buttons
Listing 1.6. FilePanelModel with required model properties
Listing 1.7. FilePanelController’s full implementation
Listing 1.8. Full source of FilePanelView.groovy
Chapter 2. A closer look at Griffon
Listing 2.1. Contents of griffon-app/conf/Application.groovy
Listing 2.2. Contents of griffon-app/conf/Builder.groovy
Listing 2.3. Environment settings on BuildConfig.groovy
Listing 2.4. Contents of Config.groovy as created by default
Chapter 3. Models and binding
Listing 3.2. FormModel.groovy with enabler logic
Listing 3.4. FormController.groovy
Listing 3.5. JavaBeans bound properties in Java, the long way
Listing 3.6. Bound properties with @Bindable
Listing 3.7. java.util.Map access in Groovy
Listing 3.8. ObservableMap in action
Listing 3.9. ObservableList in action
Listing 3.10. Simple binding example
Listing 3.11. Implicit argument property examples
Listing 3.12. Contextual property binding examples
Listing 3.13. Converting a binding value
Listing 3.14. Validating a binding value
Listing 3.15. MortgageCalcModel.groovy
Listing 3.16. Bindings on the model properties
Listing 3.17. MortgageCalcView.groovy
Listing 3.18. Updated MortgageCalcModel with validation and conversion logic
Chapter 4. Creating a view
Listing 4.1. A bare-bones HelloWorld Swing application
Listing 4.2. “Hello Back” application that reads user input and displays it in Swing
Listing 4.3. “Hello World” application implemented with Groovy’s SwingBuilder
Listing 4.4. “Hello World” with proper threading support
Listing 4.5. Advanced “Hello World” with SwingBuilder
Listing 4.6. Brief layout of SwingPadView.groovy before breaking it up
Listing 4.7. Revised SwingPadView
Listing 4.8. Generated LoginDialogView.groovy script
Listing 4.9. Updated LoginDialogView.groovy
Listing 4.10. Implementation of LoginController
Listing 4.11. LoginView configured with an Abeille Forms form
Chapter 5. Understanding controllers and services
Listing 5.1. FormModel with three bindable properties
Listing 5.2. FormController, which can handle any model properties
Listing 5.3. FormView with two panels: model properties and controller actions
Chapter 6. Understanding MVC groups
Listing 6.1. MVC group declarations in Application.groovy
Listing 6.2. Code injection example
Listing 6.3. Adding an actions member to FilePanel
Listing 6.4. WeatherWidgetController instantiating and using groups
Listing 6.5. WeatherWidgetView wiring up views from the instantiated views
Listing 6.6. Template definition for DialogView.groovy
Listing 6.7. Template definition for DialogModel.groovy
Listing 6.8. Template definition for DialogController.groovy
Chapter 7. Multithreaded applications
Listing 7.1. Java version of SimpleFileViewer
Listing 7.2. RevisedSimpleFileViewer with threading taken into account
Listing 7.3. Groovy version of SimpleFileReader
Listing 7.4. Groovy enhanced readFile()
Listing 7.5. SwingBuilder threading applied to GroovyFileReader
Listing 7.6. Simplified version of selectFile() and readFile()
Listing 7.7. Violating EDT restrictions
Listing 7.8. EDT restriction no longer violated
Listing 7.9. Contents of griffon-app/conf/Builder.groovy
Listing 7.10. Updated configuration found on Builder.groovy
Listing 7.11. Minimal implementation for FileViewerView.groovy without tabs
Listing 7.12. Parameterized tab creation
Listing 7.13. Adding parameterized tabs to the tabbedPane
Listing 7.14. Full implementation of the readFileNoThreading action
Listing 7.15. Full implementation of the readFileWithThreading action
Listing 7.16. Full implementation of the readFileWithWorker action
Listing 7.17. Full implementation of the readFileWithUpdates action
Chapter 8. Listening to notifications
Listing 8.1. Barebones _Events.groovy script listening to a single event
Listing 8.2. EventsController displaying all event-handler options at its disposal
Listing 8.3. PingController sending and handling a custom application event
Listing 8.5. MarcoController.groovy
Listing 8.6. Player.groovy class receiving and sending events
Chapter 9. Testing your application
Listing 9.1. Testing for error outputs in DictionaryService
Listing 9.2. Adding enough code to DictionaryService to turn the test green
Listing 9.3. DictionaryService with a lookup table to store definitions
Listing 9.4. Three tests methods exercising DictionaryService
Listing 9.5. Implementation of DictionaryController
Listing 9.6. Implementation of DictionaryModel
Listing 9.7. Implementation of DictionaryView
Listing 9.8. FEST test for the Dictionary application
Listing 9.9. Test that verifies the Search button is disabled
Listing 9.10. DictionaryServiceSpec with two test methods
Listing 9.11. DictionaryServiceSpec: correct input results
Listing 9.12. Full implementation of the DictionarySpec specification
Listing 9.13. Basic easyb story as created by default
Listing 9.14. easyb story that tests whether a word can be found
Chapter 10. Ship it!
Listing 10.1. Build event handler to override izpack packaging target settings
Chapter 11. Working with plugins
Listing 11.1. Initial contents of a plugin descriptor
Listing 11.2. Initial addon code in TracerGriffonAddon.groovy
Listing 11.3. Intercepting property updates on an observable instance
Listing 11.4. The calculator’s view
Listing 11.5. The calculator’s model
Listing 11.6. The calculator’s controller
Listing 11.7. Updated addon descriptor with additional behavior
Chapter 12. Enhanced looks
Listing 12.1. The groovy.util.Factory interface
Listing 12.2. Defining a custom node using an implicit addon in Builder.groovy
Listing 12.3. Basic builder implementation
Listing 12.4. Some SwingXBuilder components in action
Listing 12.5. JIDE’s CheckBoxList and buttons
Listing 12.6. Swing CSS stylesheet
Listing 12.7. A CSS styled view
Listing 12.8. Drawing a happy house with Groovy
Chapter 13. Griffon in front, Grails in the back
Listing 13.1. RESTful implementation of AuthorController
Listing 13.2. RESTful implementation of BookController
Listing 13.3. Adding some initial data to the application via Bootstrap.groovy
Listing 13.4. The view in all its glory
Listing 13.5. The model with all the properties required by the view
Chapter 14. Productivity tools
Listing 14.1. A default Gradle build file created by the Griffon command