Spring-RCP: VLDocking with history
Sunday, September 23, 2007
Posted by toubsen
If you like the concept of perspectives and views in Eclipse, you probably wish you had something similiar in Spring-RCP. Part of it can be accomplished using VLDocking. Additionally I added the functionality to persist the view state on client exit, to present the user just the same layout on the next application start.
Add VLDocking as a dependency
Add the following dependency to the pom.xml:Add ShowPageMenu command
Modify the definition of the window menu in the commands-context.xml, so that it looks like the following: The last line adds a new menu entry, that lists all ApplicationPages, the following definitions are also necessary in your messages.properties file (adapt the page ids to your page names):Modify views
For VLDocking, views need a different descriptor, exemplified on the initialView: The three added properties at the end configure the VLDocking behaviour. In contrary to the defaults, closing, auto-hiding (hide a tab at the window border, like a FastView in Eclipse) and float (MDI-like behaviour) shall be allowed.Define an ApplicationPage
Now we define a default page. On creation of the page the application tries to read the layout from the file given in the property “initialLayout”. If this doesn't work (e.g. the file does not exist), all views listed in the property “viewDescriptors” will be shown. For each new page, another entry has to be added. All pages do get listed in the window-menu within the ShowPageMenu-submenu. To use one of these pages as starting page for your application, just place its ID in the property “startingPageId” of the lifecycleAdvisor.Automagically save the Layouts
One thing is still missing: The user doesn't have a configuration file for the page layouts in his home directory. For this purpose we register a PageListener on each new window, which saves the layout automatically to the file given in the configuration, if the window gets closed.
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
java,
spring-rcp,
vldocking
. Follow any responses to this post through RSS. You can leave a response, or trackback from your own site.
Subscribe to:
Post Comments (Atom)
Post a Comment