Issue Details (XML | Word | Printable)

Key: RCP-421
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Mathias Broekelmann
Reporter: Rogan Dawes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Rich Client Project

Initial implementation of support for VLDocking framework

Created: 16/Oct/06 03:01 PM   Updated: 30/Oct/08 02:16 PM   Resolved: 15/Jan/07 05:00 PM
Component/s: Core
Affects Version/s: 1.0.0
Fix Version/s: 1.0.0

Time Tracking:
Not Specified

File Attachments: 1. Java Source File ViewDescriptorDockable.java (3 kB)
2. Java Source File VLDockingApplicationPage.java (11 kB)
3. Java Source File VLDockingApplicationPage.java (7 kB)
4. Java Source File VLDockingApplicationPageFactory.java (0.9 kB)
5. Java Source File VLDockingApplicationPageFactory.java (1 kB)
6. Java Source File VLDockingLayoutBuilder.java (0.4 kB)
7. Java Source File VLDockingLayoutManager.java (0.4 kB)
8. Java Source File VLDockingPageDescriptor.java (1 kB)
9. Java Source File VLDockingPageDescriptor.java (0.6 kB)
10. Java Source File VLDockingViewDescriptor.java (2 kB)
11. Java Source File VLDockingViewDescriptor.java (2 kB)

Environment: Windows XP SP2, JDK 1.5.0_06


 Description  « Hide

Attached please find supporting classes providing integration support for the VLDocking framework.

VLDocking provides similar features to FlexDock, but appears to be a lot more actively developed. It is available under a dual license - CeCILL (French GPL compatible) and a commercial licence.

I found it to be very easy to implement basic support, using the mdi DesktopPage classes as a template. I put them under org.springframework.richclient.application.vldocking, in parallel with the flexdock package.

At this stage, there is no support for persisting a layout to disk and reloading it. I am a little concerned that the Docking framework would end up knowing about PageComponents that the ApplicationPage doesn't know about.

The approach is as follows:

Define and reference an instance of VLDockingApplicationPageFactory as the applicationPageFactoryId in ApplicationServices.

e.g.

<bean id="applicationPageFactory" depends-on="serviceLocator"
class="org.springframework.richclient.application.vldocking.VLDockingApplicationPageFactory" lazy-init="false">
</bean>

<bean id="applicationServices"
class="org.springframework.richclient.application.support.DefaultApplicationServices">
<property name="applicationPageFactoryId"><idref bean="applicationPageFactory" /></property>
</bean>

Define your views using VLDockingViewDescriptor's, which allow you to control closability, etc of your docked views.

e.g.

<bean id="initialView-2"
class="org.springframework.richclient.application.vldocking.VLDockingViewDescriptor">
<property name="viewClass">
<value>net.za.dawes.InitialView</value>
</property>
<property name="autoHideEnabled"><value>true</value></property>
</bean>

As one would use mdi.DesktopApplicationPage to define a number of PageComponents (Views) that should be displayed on startup, one can do exactly the same for VLDockingApplicationPage:

<bean id="initialPage"
class="org.springframework.richclient.application.mdi.DesktopPageDescriptor">
<property name="viewDescriptors">
<list>
<value>initialView</value>
<value>initialView-1</value>
<value>initialView-2</value>
</list>
</property>
</bean>

And then refer to the initialPage in your LifecycleAdvisor as usual.

This will use a default VLDockingLayoutBuilder strategy that simply adds each View into a JTabbedPane. Most people will want to implement something more userfriendly, and can do so by implementing VLDOckingLayoutBuilder, which defines the following methods:

void addDockable(DockingDesktop desktop, Dockable dockable);

void layoutDockables(DockingDesktop desktop);

Implementations can decide exactly where each Dockable should be added to the DockingDesktop, relative to any other Dockables that have already been added, at the time they are added. A useful implementation would be able to save the positions of Dockables in a Desktop to a file, and put the Dockables back into approximately the same positions that they were in previously. This could be tricky, however, since a lot would depend on the order in which components are restored.

Similarly, by providing an implementation of layoutDockables(DockingDesktop desktop), the user can rearrange the existing Dockables in the DockingDesktop according to a previously saved schema (or using a definition created by the VLDocking Layout Manager tool)



Rogan Dawes added a comment - 11/Jan/07 09:01 AM

Here is an updated version of the VLDocking support.

It now supports automatic persisting of the workspace to disk. I developed this against v 2.1.3, although it might work for earlier revisions.

The approach has not changed significantly:

In your richclient-application-context.xml:

Define the PageFactory:

<bean id="applicationPageFactory" depends-on="serviceLocator"
class="org.springframework.richclient.application.vldocking.VLDockingApplicationPageFactory" lazy-init="false">
</bean>

Define your views, using either the standard ViewDescriptors, or else VLDockingViewDescriptor, which allows you to specify docking properties such as closable, floatable, maximisable, etc.

<bean id="initialView"
class="org.springframework.richclient.application.vldocking.VLDockingViewDescriptor">
<property name="viewClass">
<value>my.view.class.name</value>
</property>
<property name="autoHideEnabled"><value>true</value></property>
<property name="closeEnabled"><value>true</value></property>
</bean>

Define your pages. You can either provide a list of Views which should be displayed, or else provide an XML layout file (or both). If the desktop contains 0 Views after being loaded, the list of Views will be opened.

<bean id="defaultDesktopPage"
class="org.springframework.richclient.application.vldocking.VLDockingPageDescriptor">
<property name="viewDescriptors">
<list>
<value>initialView</value>
<value>initialView-1</value>
<value>initialView-2</value>
</list>
</property>
<property name="initialLayout">
<bean class="org.springframework.core.io.ClassPathResource">
<constructor-arg type="java.lang.String">
<value>/ui/desktopLayout.xml</value>
</constructor-arg>
</bean>
</property>
</bean>

You can also specify a layoutManager (implements VLDockingLayoutManager) as a property of the page, which will be called to place the Dockable in a particular location in the DockingDesktop, or customize the desktop when Dockables are removed.

If the Resource you supply to the Page as the initialLayout refers to a writable file, the page will write out the current layout when the page is closed.


Rogan Dawes added a comment - 11/Jan/07 09:07 AM

v2


Rogan Dawes added a comment - 11/Jan/07 09:08 AM

v2


Rogan Dawes added a comment - 11/Jan/07 09:11 AM

v2


Rogan Dawes added a comment - 11/Jan/07 09:12 AM

v2


Rogan Dawes added a comment - 11/Jan/07 09:13 AM

v2


Mathias Broekelmann added a comment - 15/Jan/07 05:00 PM

Hi Rogan,

thanks for your contribution.

I did a look at that stuff and find it really good. So I added a vldocking module to spring rich and imported everything into that module. I also created a new simple sample application to make it easy for trying out vldocking support of spring rich. See samples/vldocking. Feel free to make that sample a better one. It is currently based on simple sample and don't uses much of vldocking. But you already manage views.

But IMO we also have to figure out if we can use vldocking without violating the CeCill licence (see http://www.cecill.info/index.en.html). I hope that it is not a problem if we have a copy of the vldocking.jar in our repository.


Rogan Dawes added a comment - 17/Jan/07 02:37 AM

Hi Mathias,

Thanks for checking this in. Just one question:

You seem to have moved the package that this was in from richclient.application.vldocking (similar to richclient.application.flexdock) to just richclient.vldocking. Is there a specific reason for this? Do you plan to move the flexdock package as well to match?

I agree that there may be problems with distributing this from the Spring Rich repo. I think that I probably need to add some documentation to the supporting classes to make sure that people know that if they make use of vldocking in a commercial app, that they need to make sure that they are complying with the license.

Regards,

Rogan


Mathias Broekelmann added a comment - 22/Jan/07 07:26 AM

I was a little bit confused by the package application. I should have had a better look at the sandbox package where everything about views is placed in that package. So now I think it is much better to place it again under the application package. I will do this shortly. But I'm still a little bit puzzled if the name application really fits to all that different view, page and docking implementations.


Rogan Dawes added a comment - 23/Jan/07 02:39 AM

Does anyone have objections to me implementing the Page-level analog of ViewDescriptorRegistry? i.e PageDescriptorRegistry interface, BeanFactoryPageDescriptorRegistry implementation, and relevant ImplBuilder classes in DefaultApplicationServices. It would probably also need an extension to the PageDescriptor interface to include createShowPageCommand() and getShowPageCommandLabel()

The idea is that in a docking framework, the "perspectives", or dock layouts are represented by Page implementations which contain a number of Views. In order to switch between perspectives, one simply chooses a different Page to show. One could obviously implement ShowPageCommand manually for each PageDescriptor, but it seems to be something that would fit into the framework quite naturally.

Opinions?


Mathias Broekelmann added a comment - 23/Jan/07 04:24 AM

Sounds good!

But try to use a new JIRA issue for that.