|
#1
|
|||
|
|||
|
Hi,
The sandbox of the 0.2.1 release contains some classes for the integration with flexdock. I tried to configure them by changing the applicationPageFactory in the application context, but I got a nullpointer (see below). Has anyone actually succeeded to make this work? Am I missing something? Thx 01:01:33,218 ERROR [ApplicationLauncher] Exception occured initializing Application bean java.lang.NullPointerException at be.somko.rcrm.client.gui.view.flexdock.FlexDockApp licationPage.loadLayout(FlexDockApplicationPage.ja va:194) at be.somko.rcrm.client.gui.view.flexdock.FlexDockApp licationPageFactory.createApplicationPage(FlexDock ApplicationPageFactory.java:67) at org.springframework.richclient.application.support .AbstractApplicationWindow.createPage(AbstractAppl icationWindow.java:226) at org.springframework.richclient.application.support .AbstractApplicationWindow.createPage(AbstractAppl icationWindow.java:212) at org.springframework.richclient.application.support .AbstractApplicationWindow.showPage(AbstractApplic ationWindow.java:161) at org.springframework.richclient.application.Applica tion.openWindow(Application.java:148) at org.springframework.richclient.application.Applica tion.start(Application.java:210) at org.springframework.richclient.application.Applica tionLauncher.launchMyRichClient(ApplicationLaunche r.java:223) at org.springframework.richclient.application.Applica tionLauncher.<init>(ApplicationLauncher.java:103) at be.somko.rcrm.client.Startup.main(Startup.java:19) |
|
#2
|
|||
|
|||
|
I don't remember exactly as I just played a bit with flexdock integration a couple of months ago... I think you should implement a flexdock PerspectiveFactory that supplies the initial view layout, and inject it into the FlexDockApplicationPageFactoryBean, like this:
Code:
<bean id="flexdockApplicationPageFactory"
class="org.springframework.richclient.application.flexdock.FlexDockApplicationPageFactory">
<property name="floatingEnabled" value="true" />
<property name="defaultPerspective" value="defaultPerspective" />
<property name="perspectiveFactory">
<bean class="com.mycompany.myproject.MyPerspectiveFactory">
<property name="dockableIds">
<list>
<value>fooView</value>
<value>barView</value>
<value>bazView</value>
</list>
</property>
</bean>
</property>
</bean>
Code:
package com.mycompany.myproject;
import java.util.List;
import org.flexdock.perspective.LayoutSequence;
import org.flexdock.perspective.Perspective;
import org.flexdock.perspective.PerspectiveFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
public class MyPerspectiveFactory implements PerspectiveFactory, InitializingBean {
private List<String> dockableIds;
public Perspective getPerspective(String perspectiveId) {
Perspective perspective = new Perspective(perspectiveId, perspectiveId);
LayoutSequence sequence = perspective.getInitialSequence(true);
String prevDockableId = null;
for (String dockableId : this.dockableIds) {
sequence.add(dockableId, prevDockableId);
prevDockableId = dockableId;
}
return perspective;
}
public void afterPropertiesSet() throws Exception {
Assert.notEmpty(this.dockableIds, "No dockable ids specified");
}
public List<String> getDockableIds() {
return dockableIds;
}
public void setDockableIds(List<String> dockableIds) {
this.dockableIds = dockableIds;
}
}
Have fun, Andrius |
|
#3
|
|||
|
|||
|
Hi,
I am currently developing an application and I have succesfully used flexdock. It is not trivial, but it is not too complex either. The three interesting integration classes are:
Because I needed some customized functionality (namely the ability to control whether a "view" would have a title or not), I created my own classes, which inherit from the above classes:
Also, I have JOverseerPerspectiveFactory which implements PerspectiveFactory. This you will have to implement, regardless of whether you subclass the above classes. Here is what I did to make flexdock work: * Added the declaration for JOversserApplicationPageFactory to application-context.xml as follows: Code:
<bean id="joverseerApplicationPageFactory" depends-on="serviceLocator"
class="org.joverseer.ui.flexdock.JOversserApplicationPageFactory" lazy-init="false">
<property name="floatingEnabled"><value>true</value></property>
<property name="perspectiveFactory">
<bean class="org.joverseer.ui.flexdock.JOverseerPerspectiveFactory"></bean>
</property>
<property name="defaultPerspective">
<value>joverseer</value>
</property>
</bean>
* Registered the application page factory with my services (again in application-context.xml): Code:
<bean id="applicationServices"
class="org.springframework.richclient.application.support.DefaultApplicationServices">
<property name="imageSourceId"><idref bean="imageSource"/></property>
<property name="formComponentInterceptorFactoryId"><idref bean="formComponentInterceptorFactory"/></property>
<property name="applicationObjectConfigurerId"><idref bean="applicationObjectConfigurer" /></property>
<property name="applicationPageFactoryId"><idref bean="joverseerApplicationPageFactory"/></property>
<property name="binderSelectionStrategyId"><idref bean="binderSelectionStrategy"/></property>
<property name="conversionServiceId"><idref bean="conversionService"/></property>
</bean>
Code:
<bean id="characterListView"
class="org.joverseer.ui.flexdock.JOverseerViewDescriptor">
<property name="viewClass">
<value>org.joverseer.ui.listviews.CharacterListView</value>
</property>
<property name="closable"><value>true</value></property>
<property name="pinnable"><value>true</value></property>
</bean>
Code:
public class JOverseerPerspectiveFactory implements PerspectiveFactory {
public Perspective getPerspective(String persistentId) {
List<DockingState> dss = new ArrayList<DockingState>();
DockingState ds = new DockingState("mapView");
dss.add(ds);
ds = new DockingState("characterListView");
ds.setRegion(DockingConstants.SOUTH_REGION);
ds.setRelativeParentId("mapView");
ds.setSplitRatio(.3f);
dss.add(ds);
ds = new DockingState("populationCenterListView");
ds.setRegion(DockingConstants.CENTER_REGION);
ds.setRelativeParentId("characterListView");
ds.setSplitRatio(1f);
dss.add(ds);
ds = new DockingState("nationEconomyListView");
ds.setRegion(DockingConstants.CENTER_REGION);
ds.setRelativeParentId("characterListView");
ds.setSplitRatio(1f);
dss.add(ds);
// ... more views here
return createPerspective("joverseer", dss);
}
private Perspective createPerspective(String perspectiveId, java.util.List<DockingState> dockingStates) {
Perspective perspective = new Perspective(perspectiveId, perspectiveId);
LayoutSequence sequence = perspective.getInitialSequence(true);
for (DockingState dockingState : dockingStates) {
if( dockingState.getRelativeParentId() != null)
sequence.add(dockingState.getDockableId(), dockingState.getRelativeParentId(), dockingState.getRegion(), dockingState.getSplitRatio());
else
sequence.add(dockingState.getDockableId());
}
return perspective;
}
- declare the flexdock application page factory in application-context.xml - delcare your views as FlexdockViewDescriptors (or a subclass) - implement a PerspectiveFactory I hope the above is of some help. Feel free to ask more questions if you find more problems. Marios |
![]() |
| Thread Tools | |
| Display Modes | |
|
|