Creating JTaskPanes with the Spring Rich Client Project (Spring Rich)

The library ships with a jar file (l2fprod-common-springrcp.jar) providing integration with the Spring Rich Client Project. What does it mean? For JTaskPane, it means you will be able to build a JTaskPane the same way you are assembling menubars, toolbars, popup menus - through an xml description.

Note: Spring Rich integration has just been added to the library for the JTaskPane. Your feedback on the integration is highly welcome.

As example, suppose you are assembling a popup menu with Spring Rich, this menu is made of several actions (or commands). The definition of the popup menu in your xml file will look like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans> ... <bean id="popUp"
class="org.springframework.richclient.command.CommandGroupFactoryBean">
<property name="members">
<list>
<value>newCommand</value>
<value>propertiesCommand</value>
<value>deleteCommand</value>
</list> </property>
</bean>
... </beans>

where newCommand, propertiesCommand and deleteCommand are the items which will appear in the popup menu. Later to instantiate the popup, you'll do something like:

CommandGroup group = getWindowCommandManager().getCommandGroup("popUp");
JPopupMenu popupMenu = group.createPopupMenu();

Our goal with the Spring Rich integration is to be able to do the same with JTaskPanes. Basically in our view implementation, we want to create a JTaskPane with:

JTaskPaneCommandGroup group =
 (JTaskPaneCommandGroup)getWindowCommandManager().getCommandGroup("contextTasks");
JTaskPane taskpane = group.createTaskPane();

where the contextTasks is defined as follow in the same file as the previous popUp:

<bean id="contextTasks"
      class="com.l2fprod.common.springrcp.JTaskPaneFactoryBean">
  <property name="members">
    <list>
      <ref bean="commonTasks" />
    </list>
  </property>
</bean>

<bean id="commonTasks"
      class="com.l2fprod.common.springrcp.JTaskPaneGroupFactoryBean">
  <property name="members">
    <list>
      <value>newCommand</value>
      <value>propertiesCommand</value>
      <value>deleteCommand</value>
    </list>
  </property>
</bean>

Note the reference to the JTaskPaneGroup commonTasks. In turn, this JTaskPaneGroup references commands newCommand, propertiesCommand and deleteCommand. These commands will be turned into actions (and hyperlinks) in the JTaskPaneGroup.

References


 
Copyright © 2004-2006 L2FProd.com