my application-context.xml
my command-context.xmlCode:<?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="application" class="org.springframework.richclient.application.Application"> <constructor-arg index="0" ref="applicationDescriptor" /> <constructor-arg index="1" ref="lifecycleAdvisor" /> </bean> <bean id="applicationDescriptor" class="org.springframework.richclient.application.support.DefaultApplicationDescriptor"> <property name="version" value="1.0" /> <property name="buildId" value="20100304-001" /> </bean> <bean id="lifecycleAdvisor" class="org.springframework.richclient.application.config.DefaultApplicationLifecycleAdvisor"> <property name="windowCommandBarDefinitions" value="config/commands-context.xml" /> <property name="startingPageId" value="initialView" /> <property name="windowCommandManagerBeanName" value="windowCommandManager" /> <property name="menubarBeanName" value="menuBar" /> </bean> <bean id="initialView" class="org.springframework.richclient.application.support.DefaultViewDescriptor"> <property name="viewClass" value="com.mycompany.rcp.ui.MainView" /> </bean> <bean id="applicationEventMulticaster" class="org.springframework.context.event.SimpleApplicationEventMulticaster" /> <bean id="applicationServices" class="org.springframework.richclient.application.support.DefaultApplicationServices" /> <bean id="serviceLocator" class="org.springframework.richclient.application.ApplicationServicesLocator"> <property name="applicationServices" ref="applicationServices" /> </bean> <bean id="applicationObjectConfigurer" depends-on="serviceLocator" class="org.springframework.richclient.application.config.DefaultApplicationObjectConfigurer"> </bean> <bean id="lookAndFeelConfigurer" class="org.springframework.richclient.application.config.JGoodiesLooksConfigurer"> <property name="popupDropShadowEnabled" value="false" /> <property name="theme"> <bean class="com.jgoodies.looks.plastic.theme.ExperienceBlue" /> </property> </bean> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <list> <value>resources.messagesBundles.messagesBundle</value> <value>org.springframework.richclient.application.messages</value> </list> </property> </bean> <bean id="imageResourcesFactory" class="org.springframework.context.support.ResourceMapFactoryBean"> <property name="locations"> <list> <value>classpath:config/images.properties</value> <value>classpath:org/springframework/richclient/image/images.properties</value> </list> </property> </bean> <bean id="imageSource" class="org.springframework.richclient.image.DefaultImageSource"> <constructor-arg index="0" ref="imageResourcesFactory" /> </bean> </beans>
my Main.javaCode:<?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="windowCommandManager" class="org.springframework.richclient.application.support.ApplicationWindowCommandManager"> </bean> <bean id="menuBar" class="org.springframework.richclient.command.CommandGroupFactoryBean"> <property name="members"> <list> <ref bean="fileMenu" /> <ref bean="editMenu"/> <ref bean="toolsMenu"/> <ref bean="myMenu"/> <ref bean="helpMenu" /> </list> </property> </bean> <bean id="fileMenu" class="org.springframework.richclient.command.CommandGroupFactoryBean"> <property name="members"> <list> <bean class="org.springframework.richclient.security.LoginCommand" /> <value>separator</value> <bean class="org.springframework.richclient.command.support.ExitCommand" /> </list> </property> </bean> <bean name="editMenu" class="org.springframework.richclient.command.CommandGroupFactoryBean"> <property name="members"> <list/> </property> </bean> <bean name="toolsMenu" class="org.springframework.richclient.command.CommandGroupFactoryBean"> <property name="members"> <list/> </property> </bean> <bean name="myMenu" class="org.springframework.richclient.command.CommandGroupFactoryBean"> <property name="members"> <list/> </property> </bean> <bean id="helpMenu" class="org.springframework.richclient.command.CommandGroupFactoryBean"> <property name="members"> <list> <ref bean="aboutCommand" /> </list> </property> </bean> <bean id="aboutCommand" class="org.springframework.richclient.command.support.AboutCommand"/> </beans>
my viewCode:import org.springframework.richclient.application.ApplicationLauncher; public class Main { public static void main(String[] args) { new ApplicationLauncher("/config/splash-context.xml", "/config/application-context.xml"); } }
my domain objectCode:import java.awt.BorderLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import org.springframework.richclient.application.support.AbstractView; public class MainView extends AbstractView { @Override protected JComponent createControl() { JPanel panel = new JPanel(new BorderLayout()); //panel.add(new JLabel("Hello, world!")); return panel; } }
my formCode:package com.mycompany.rcp.domain; public class User { private String name; private String lastName; // getter and setter }
when start application then show ONLY menu. But not show my form (UserForm) with text fields?Code:package com.mycompany.rcp.ui; import javax.swing.JComponent; import javax.swing.JPanel; import org.springframework.richclient.form.AbstractForm; import org.springframework.richclient.form.FormModelHelper; import org.springframework.richclient.form.builder.TableFormBuilder; import com.mycompany.rcp.domain.User; public class UserForm extends AbstractForm { public UserForm() { super(FormModelHelper.createFormModel(new User(), "userForm")); } public final JComponent createFormControl() { TableFormBuilder builder = new TableFormBuilder(getBindingFactory()); builder.add("name"); builder.row(); builder.add("lastName"); JPanel panel = (JPanel) builder.getForm(); return panel; } }


Reply With Quote