There are many tools for making initial GUI (e.g Matisse). But in a complex application the GUI is not static. And many of those tools simply fails to help you when it comes to modifying the GUI at runtime.
I like the Groovy approach for building the GUI. The code using SwingBuilder is clear, readable and maintainable. I also like the Griffon approach for clear separation of models, controllers and views. But what about modifying the GUI at runtime? I mean how easy/difficult is to add some new components to existing (and visible) container or remove some components from it using Griffon/Groovy.
The tabGroup id: property sets a variable on the current builder. Any code can refer to that JTabbedPane by using that variable name. On a controller we have this
Notice the controller has a 'view' property. Views share variables with the builder that created them, in our case it shares the tabGroup variable. Calling createMVCGroup() with those settings embeds a new tab into the tabGroup tabbedPane.
Another way to do it would be using the builder explicitly from within the controller
Joined: Feb 24, 2009
Andres, thank you for the excellent explanation