Sun 22 Jul 2007
On July 18th Eitan released a new version of JMatter, which includes many improvements and support for forms created with Abeille Form Designer (more on that later), but there is also another feature currently in svn that will give you more freedom in the regard of what a command may return. JMatter commands may return 3 values, handled by the framework as
JMatter comes with another demo-app called Sympster, which is a Symposium Manager, modeled after the format of the NoFluffJustStuff Symposiums; each Symposium has a Venue, a venue may be a Hotel, a Conference Center or a Campus. As it currently stands a Venue only has a name and a list of rooms, we're going to add an address so that we can map it. We're going to use Groovy for the view because it is so simple to create custom UIs by hand with it (see previous post) and also because configuring JXMapViewer with it is pretty straightforward, as Guillaume Alleon and Guillaume Laforge show here and here.

Because it is a generic view, it doesn't have a title nor a custom icon. There may be an option in the future to do just that, perhaps with clientProperties or with a properties file. The point is that we concentrated our efforts on modifying the Model and provided a custom view without having to merge the view with the framework itself. These type of views may come in handy when doing quick app prototyping and then when the design has been approved you can get fancy with icons, colors and custom names & labels.
Keep on Grooving! and don't forget to stop by JMatter if you're into form-based business applications on the desktop
groovy howto jmatter swing
String - will display a short message (like Growl in MacOS X) DomainClass - will display the view that belongs to that class View - will display the view as is
But now we have a fourth option: JComponent, when one is returned the framework will automatically wrap it in a generic View, relieving the developer of creating such a view. There is already demo-app bundled with JMatter (Self) which has a command that will display a JPanel with animations, so I thought that it may be great to test the fourth option and what better way to do it by embedding Google Maps support into the app, don't you think?JMatter comes with another demo-app called Sympster, which is a Symposium Manager, modeled after the format of the NoFluffJustStuff Symposiums; each Symposium has a Venue, a venue may be a Hotel, a Conference Center or a Campus. As it currently stands a Venue only has a name and a list of rooms, we're going to add an address so that we can map it. We're going to use Groovy for the view because it is so simple to create custom UIs by hand with it (see previous post) and also because configuring JXMapViewer with it is pretty straightforward, as Guillaume Alleon and Guillaume Laforge show here and here.
Download a copy of JMatter from svn (http://svn.jmatter.org) Copy the Address class from demo-app/CustomUI to demo-app/Symspter
We could have used a built-in type (USAddress) but we'll stick with this one for the time being Modify Venue, adding an Address field, some metadata and the command that will launch the Map
You'll find more info on the framework's metadata here. Modify Address, adding a custom
Let's create the view, because any JComponent will be wrapped into a generic view we can extend from JPanel or JXMapViewer directly. Looking for more information on how JXMapViewer could be customized I found JXMapKit which will also display Waypoints (this little red & blue markers you can see on Google Maps when searching for an address), so I went with it
Before compiling the app, we have to do a little hack. JMatter bundles two different versions of swingx (2007_02_15 & 2007_06_17), unfortunately for us, the SwingX team has made some changes in the api that make those versions binary incompatible. Exchange swingx_2007_02_15 with swingx_2007_06_17.jar on modules/ds-swing/lib, compile it and make adjustments. It turns out that
We're ready to compile and test the app, type 'ant schema-export run' and if everything is ok and after a bit of JMatter magic... you should see a login screen, type in admin/admin as user/password and we're in!
We could have used a built-in type (USAddress) but we'll stick with this one for the time being Modify Venue, adding an Address field, some metadata and the command that will launch the Map
You'll find more info on the framework's metadata here. Modify Address, adding a custom
toString method which will be very helpful when translating the address into geo coordinatesLet's create the view, because any JComponent will be wrapped into a generic view we can extend from JPanel or JXMapViewer directly. Looking for more information on how JXMapViewer could be customized I found JXMapKit which will also display Waypoints (this little red & blue markers you can see on Google Maps when searching for an address), so I went with it
Before compiling the app, we have to do a little hack. JMatter bundles two different versions of swingx (2007_02_15 & 2007_06_17), unfortunately for us, the SwingX team has made some changes in the api that make those versions binary incompatible. Exchange swingx_2007_02_15 with swingx_2007_06_17.jar on modules/ds-swing/lib, compile it and make adjustments. It turns out that
com.u2d.ui.desktop.MsgPnl$MsgPanelPainter should now implement doPaint instead of paintBackground, so its just a matter of wrapping one over the another, recompile and copy the new ds-swing.jar into jmatter/lib/runtime Don't forget to add the required libraries into Symspter/lib/runtime, download the 2007_06_07 version of swing-ws (includes JXMapViewer), put the swingx-ws.jar, and all co-bundled jars (except json.jar, it's already included by JMatter) Because we're using a custom view with Groovy, and the domain class references it but its coded in Java we'll need to enabled the joint compilation, which is explained here, substitute the javac call on the compile target withWe're ready to compile and test the app, type 'ant schema-export run' and if everything is ok and after a bit of JMatter magic... you should see a login screen, type in admin/admin as user/password and we're in!
Create a new Venue, right-click on the Venue icon and select 'New' on the menu Select a venue type, I went with 'Hotel' Fill up the venue data, notice that there are two tabs, the second one being the address of the venue. I configured the Hotel with the addres from the G2One meeting that took place this year. Save it and notice that a new command 'Show in Map' has appeared, click it and you should be able to see the address mapped into Google Maps

Because it is a generic view, it doesn't have a title nor a custom icon. There may be an option in the future to do just that, perhaps with clientProperties or with a properties file. The point is that we concentrated our efforts on modifying the Model and provided a custom view without having to merge the view with the framework itself. These type of views may come in handy when doing quick app prototyping and then when the design has been approved you can get fancy with icons, colors and custom names & labels.
Keep on Grooving! and don't forget to stop by JMatter if you're into form-based business applications on the desktop

groovy howto jmatter swing
About me











![[image]](http://mowser.com/img?url=http%3A%2F%2Fjroller.com%2Fresources%2Fa%2Faalmiray%2Fimtd4.gif)
![[image]](http://mowser.com/img?url=http%3A%2F%2Fjroller.com%2Fresources%2Fa%2Faalmiray%2Frss_weblogs.gif)
![[image]](http://mowser.com/img?url=http%3A%2F%2Fwww.blogburst.com%2FResources%2FImages%2Fblogburst_80x15.gif%3Fid%3DB8FvOsgxNdOKCYKtvrW8bRD)
![[image]](http://mowser.com/img?url=http%3A%2F%2Fwww.javablogs.com%2Fimages%2Fjavablog-small.gif)
![[image]](http://mowser.com/img?url=http%3A%2F%2Fjroller.com%2Fresources%2Fa%2Faalmiray%2Fgroovyblogs_80x15.png)






