Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Rogan Dawes <lists <at> dawes.za.net>
Subject: Re: Spring Rich and FlexDock
Newsgroups: gmane.comp.java.springframework.rcp.devel
Date: Thursday 21st September 2006 12:32:13 UTC (over 11 years ago)
Peter De Bruycker wrote:
> you have to set the initial view(s) in your perspective:
> 
> public class SamplePerspectiveFactory implements PerspectiveFactory {
> 
>        public Perspective getPerspective(String persistentId) {
>                Perspective perspective = new Perspective(persistentId,
> "Perspective1");
>                LayoutSequence sequence =
perspective.getInitialSequence(true);
> 
>                // add the view with id "initialView-1"
>                sequence.add("initialView-1");
>                // add the view with id "initialView-2" to the ease of
> "initialView-1"
>                sequence.add("initialView-2", "initialView-1,
> DockingConstants.EAST_REGION, .3f);
> 
>                return perspective;
>        }
> }
> 
> 
> hope this helps,
> 
> Peter
> 

Ok, you pointed me in the right direction. To echo my previous email for
the record, the way to do it is something like:

In the richclient-application-context.xml, add the following bean:


     true
     
         
     
     
         blah
     


and reference it in the application services bean:


     


Define your views (floatable components in the page) in the context,
using FlexDockViewDescriptor, so you can control the pinnable and
closable attributes:


     
         za.net.dawes.InitialView
     
     false
     false



     
         za.net.dawes.InitialView
     
     false
     false


Create an implementation of the PerspectiveFactory:

net.za.dawes.SamplePerspectiveFactory.java:

package za.net.dawes;

import org.flexdock.perspective.LayoutSequence;
import org.flexdock.perspective.Perspective;
import org.flexdock.perspective.PerspectiveFactory;

public class SamplePerspectiveFactory implements PerspectiveFactory {

     public Perspective getPerspective(String persistentId) {
         Perspective perspective = new Perspective(persistentId,
"Perspective1");
         LayoutSequence sequence = perspective.getInitialSequence(true);
         // add the view with id "initialView-1"
         sequence.add("initialView-1");
         // add the view with id "initialView-2"
         // to the east of "initialView-1"
         sequence.add("initialView-2", "initialView-1",
DockingConstants.EAST_REGION, .3f);
		return perspective;
	}
}

And you should be good to go.

The main mistakes I made in my previous attempt, were not setting the
defaultPerspective in the FlexDockApplicationPageFactory definition,
(this was responsible for the NullPointerException) and not actually
creating a proper/usable perspective in my PerspectiveFactory.

A couple of things which leave me a little uneasy:

1. What happens with the LifeCycleAdvisor's startingPageId? You have to
specify this, but it doesn't seem to be used. Perhaps if it exists in
the default perspective, it should be the selected/focused View?

2. Opening a new window threw the same NullPointerException that I had
previously:

java.lang.NullPointerException
	at
org.springframework.richclient.application.flexdock.FlexDockApplicationPage.loadLayout(FlexDockApplicationPage.java:185)

Maybe the defaultPerspective is becoming unset somehow?

Question:

Would it make sense to have a DefaultFlexDockPerspectiveFactory that can
accept a Map of perspectiveids to a collection of FlexDockViewDescriptors?

wild e.g.:


   
     
       
         Perspective1
         
           initialView-1
           initialView-2
         
       
     
   


Or maybe define a FlexDockPerspectiveDescriptor that allows you to
describe how the component views are laid out somehow, and pass those to
a DefaultPerspectiveFactory? Maybe it won't be able to accommodate the
full flexibility of a programmatically created perspective, but it would
be a reasonable start for less demanding uses.

What do you think?

Also, how can one dynamically add a new View to a Perspective?

Rogan


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
 
CD: 2ms