Getting Even Further with Spring RCP (2)
Peter Karich recently mentioned his MyDoggy integration, while also providing a NetBeans project containing, among other things, the integration code as well as code demonstrating how to use his integration. I extracted the MyDoggy/Spring RCP integration classes and created a separate Java library for them:
Then I put the resulting JAR on my own application's classpath and used it as described below to create a simple layout like this:
Here are the relevant MyDoggy pieces in my richclient-application-context.xml. In the first bean, notice that "startingPageId" property, which points to the "startPage" bean. In the "startPage" bean, the initial layout is defined in an external layout.xml file or (if that file is not there or if it is empty) by displaying two of the views injected by the referenced beans:
<bean id="lifecycleAdvisor" class="simple.SimpleLifecycleAdvisor">
<property name="windowCommandBarDefinitions" value="ui/commands-context.xml" />
<property name="windowCommandManagerBeanName" value="windowCommandManager" />
<property name="menubarBeanName" value="menuBar" />
<property name="toolbarBeanName" value="toolBar" />
<property name="startingPageId" value="startPage"/>
<bean id="startPage" class="org.mydoggy.MyDoggyPageDescriptor">
<!-- EITHER use this file if not empty/absent: -->
<!-- OR use these initial views: -->
As indicated in line 14, there's a layout file in XML format, which follows a MyDoggy layout format:
Just like in the case of the VLDocking integration, described earlier, when you move the views in the deployed application around, the layout.xml file is regenerated. The difference is that, while in the case of VLDocking the newly generated file was found in the "build" folder, the regenerated XML file simply replaces the original file in the current version of Peter Karich's MyDoggy integration.
Note: Simply create an empty XML file, in the location and with the name defined by your equivalent of line 14 in the richclient-application-context.xml above. Then, run the application. No views will be shown because the XML file is empty. Then open some of the views. Then close the application. Now... you will see that your XML file is filled with generated code, meaning that you don't need to know anything at all about the tags that constitute the file. You should therefore never need to touch the file at all, unless you know enough about it and want to manually tweak it in some way.
In summary, Peter Karich's MyDoggy integration is really cool. Here's hoping he'll (once he's happy with it) create a project page just like the one by Jonny Wray, so that it becomes easier to get hold of the MyDoggy JAR for integration with Spring RCP.