Announcement Announcement Module
Collapse
No announcement yet.
beginner questions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • beginner questions

    sorry for that questions, but i am new to spring rcp and although i found the (very good) documentation pdf in this forum, it`s still hard to find information about even the most simple things :-(

    views:
    how can i show a view without its header and that light-blue border arround it?

    forms:
    i built a form using builder and have a problem with validation.. when i change to another view the tiny red X in the lower-left corner is still showing up.. is this a bug?

  • #2
    > it`s still hard to find information about even the most simple things :-(

    Please see:
    http://karussell.wordpress.com/2009/...-client-links/

    > views: how can i show a view without its header and that light-blue border arround it?

    You could try to use the tabbed container. In the application-context.xml you can replace the applicationPageFactory:
    Code:
    <bean id="applicationPageFactory" depends-on="serviceLocator"
                class="de.timefinder.core.ui.tabbed.TabbedApplicationPageFactory">
    </bean>
    and then use the following as startPage:
    Code:
    <bean id="startPage" class="org.springframework.richclient.application.support.MultiViewPageDescriptor">
            <property name="viewDescriptors">
                <list>
                    <value>myView1</value>
                    <value>myView2</value>
                </list>
            </property>
        </bean>
    > is this a bug?

    It seems to be one:
    http://jira.springsource.org/browse/RCP-599

    Comment


    • #3
      thx for your answer and the helpful link, but i still have the problem that i cant find a way to remove header and the blue border arround my view

      application-context.xml:
      Code:
      	<bean id="initialView"
      		class="org.springframework.richclient.application.support.DefaultViewDescriptor">
      		<property name="viewClass" value="rcpTest.gui.InitialView" />
      	</bean>
      initialview.java
      Code:
      public class InitialView extends AbstractView{
      protected JComponent createControl()

      maybe there is another class for views available? or something like a factory where i can define the standard appearence for my views?

      Comment


      • #4
        Which applicationPageFactory did you try?
        Could you post a screenshot?

        If you don't like the view (which 'returns' JComponent) couldn't you replace it via the createControl method?

        Comment


        • #5
          i already tried to use none(standard), tabbed and desktop.. all worked fine, but the results were not what i was looking for

          if you take a look at the screenshot: all i want is just a "clean start".. i want to see the normal window-header and the menu bar, but i dont want to see the light-blue header of the view below and the light-blue border arround that view

          so what i am looking for is just a view without anything special

          Comment


          • #6
            Okay. I see.
            You are using a docking manager as I guess from the screenshot.
            And when using a docking manager several windows could be opened and you can drag them around. But if you want to drag them around you have to pick one window at the blue title bar to do so. How would you drag them without this bar?

            I think you can hide this bar (although I am not sure because I am using mydoggy as my docking system), but you should be able to simple return a JPanel (in YourView.createControl) instead of using a full blown docking system.
            Does this help?

            Comment


            • #7
              even if i return an empty panel, the header and border are still there:
              Code:
              public class InitialView extends AbstractView {
              
              	private JPanel panel = new JPanel();
              
              	protected JComponent createControl() {
                           return panel;
                      }
              
              }
              hmm if my code really uses a docking manager, then i have no idea where it is defined, cant find anything like that in my application-context.xml

              Comment


              • #8
                Hi,

                what you are seeing is an example of SimpleInternalFrame which is designed to replace JInternalFrame. It is constructed as the control within DefaultPageComponentPane. The DefaultPageComponentPane is constructed in the DefaultPageComponentPaneFactory.

                As these names suggest they are defaults and can be overridden. You can inject your own implementation of PageComponentPaneFactory into ApplicationServices and thus produce your own component panes.

                Seems a little complex but the price you pay for flexibility.

                hope that clears things up.

                Jonny

                Comment


                • #9
                  Ah, okay. Thanks Jonny for this clarification.
                  So, this means you have to replace:
                  Code:
                  <bean id="applicationPageFactory" depends-on="serviceLocator"            
                  class="org.springframework.richclient.application.tabbed.TabbedApplicationPageFactory">
                  </bean>
                  ... with your own implementation.

                  So, simply take a look at this class how it is implemented and replace the JTabedPane with a JPanel.

                  Comment


                  • #10
                    Actually to change the implementation of the frame used by the pages you don't need to replace the ApplicationPageFactory but rather the PageComponentPaneFactory. You do this by injecting the replacement into application services:

                    Code:
                    <bean id="applicationServices"
                            class="org.springframework.richclient.application.support.DefaultApplicationServices">
                    
                    ... various service definitions
                    
                    <property name="pageComponentPaneFactoryId" value="pageComponentPaneFactory" />
                    
                    </bean>
                    where pageComponentPaneFactory is an implementation of PageComponentPaneFactory.

                    In general, looking at application services for injectable beans is a great place to start to look when wanting to override the default behaviour.

                    Note there is a class SimplePageComponentPane and associated factory. I've never used them but they look like they might do what was requested. So, following what I mentioned above, injecting a bean of type SimplePageComponentPaneFactory into the application services is all that needs to be done to try this out.

                    Jonny

                    Comment


                    • #11
                      hmm after all the time i tried to get rid of it i somehow started to like the header, so after removing it using jwrays hint it felt like there is something missing
                      so maybe i will keep it this time, but nice to know for future projekts!!

                      anyway: thanks a lot for your help guys!

                      Comment


                      • #12
                        That's funny, probably a reflection of the process the original developers went through.

                        But, you should have a better understanding of one way a Spring RCP application can be customized now, by the injection of none default implementations of various services.

                        Jonny

                        Comment


                        • #13
                          sorry to bother you again, but i have another problem:
                          i got 2views, and i want the view to change when i hit a specific button

                          i tried to do this by just excecuting a viewTest command defined in my commands-context.xml

                          commands-context.xml
                          Code:
                          	<bean id="windowCommandManager"
                          		class="org.springframework.richclient.application.support.ApplicationWindowCommandManager">
                          		<property name="sharedCommandIds">
                          			<list>
                          				...
                          				<value>testCommand</value>
                          				...
                          			</list>
                          		</property>
                          	</bean>
                          and
                          Code:
                          <bean id="testCommand" class="org.springframework.richclient.command.support.ShowViewCommand">
                          		<property name="viewDescriptor" ref="testView" />
                          	</bean>

                          following the pdf-documentation i found in this forum i tried to get this command in the application with
                          Code:
                          ActionCommand test =(ActionCommand)Application.instance().getActiveWindow().getCommandManager().getCommand("testCommand");
                          and tried test.execute() to trigger the change view command


                          but it doesnt work, test.getActionCommand() returns null, why is that?

                          Comment


                          • #14
                            Not exactly sure as I've never used a command like that before (getting it explicitly from the command manager) but my guess is that since you haven't added the command to anything visual (menu bar etc) the action command does not exist,

                            Let's revisit. You are trying to have one command that toggles between two views, or two commands each responsible for activating its own view?

                            Let's assume the second. First off, you don't need shared commands. That's a more advanced concept in which a global command (eg save) can have its behavior changed depending on which view is active by defining an executor for that command.

                            Here's an example from one of my applications that sets up a menu of show view commands and adds it to the menuBar of an application, along with a couple of other menus.

                            Code:
                            <bean id="menuBar" 
                            		class="org.springframework.richclient.command.CommandGroupFactoryBean" >
                            	<property name="members">
                            		<list>
                            			<ref bean="fileMenu"/>
                            			<ref bean="viewMenu" />
                            			<ref bean="helpMenu"/>
                            		</list>
                            	</property>
                            </bean>
                            
                            <bean id="viewMenu" 
                                    class="org.springframework.richclient.command.CommandGroupFactoryBean">
                                    <property name="members">
                                        <list>
                                            <bean class="org.springframework.richclient.command.support.ShowViewCommand" >
                                                <property name="viewDescriptor" ref="testView" />
                                            </bean>
                                            <bean class="org.springframework.richclient.command.support.ShowViewCommand" >
                                                <property name="viewDescriptor" ref="testView" />
                                            </bean>
                                            <bean class="org.springframework.richclient.command.support.ShowViewCommand" >
                                                <property name="viewDescriptor" ref="testView" />
                                            </bean>
                                        </list>
                                 </property>
                            </bean>
                            The best place to look for this stuff is the example applications. They all have examples of how to configure commands and menus.

                            Jonny

                            Comment


                            • #15
                              hi

                              thank you for your advice, but i already tried that: changing the view via menuBar works fine, but it doesnt solve my problem, i am still unable to do it in my class

                              i got a jtable in my first view, and if the user presses the "ok" button i check if there is really something selected in the table, and if so i execute the testView command.
                              i even tested xxx.execute(), it works perfectly for all commands defined in that class, so the real problem seems to be:

                              why does the commandManager return null instead of the command?

                              Comment

                              Working...
                              X