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

  • Multiple Pages

    I need to have multiple pages in my application, each Page is differnet context and consists of set of views. Each page has multiple views. Up untill now i have been using views as alternative to having multiple pages and I had all my views as static components added to a view. But now as spring-richclient is moving towards allowing multiple views per page. I need to define multiple pages and I don't know how to do that. Also I would like to have a ShowPage command similar to showView command to switch between different pages. Also even though I have multiple pages I only need to show a page per window.

    Any ideas!


  • #2
    Any thing Keith...


    • #3
      We're working on it! Jim specifically is working in this area right now, as I took care of several issues with the Rules subsystem this weekend.

      Hang in there; it's not a case of the capability being there but not documented--it's just not done yet. As soon as we have it you'll see it in Petclinic. This stuff is quite involved, and it's important we get it right (I also have various other money-making priorities myself to juggle! :-))



      • #4
        You can do it with infonode docking - There is features that save layout and You can have more layouts with differents set tabs,views and You can save and load layout from menu or program

        I will add layouts in next version snpepetclinic



        • #5
          Thanks Keith and snpe. I will wait no problem. I also understand Keith that you have to address the money-making priorities. I just wanted to to get some idea on when or If.




          • #6
            Just to be clear, what I was looking is soemthing similar to Mail client. Where I have Main mail page, Address book and Calendar page. And each of these pages have multiple views i.e. Main Mail view would have Folder Tree, messages view and message detail view and quick address book view.

            I am pretty sure that everyone knows what I was talking about, just wanted to clear it in case.



            • #7
              Hey guys, any word on this?

              My current requirement is that I have multiple 'views' in a 'page' - each view basically being a scrollpane containing a unique widget (lets say a tree in one view, and a table in another). The main reason I am interested in using multiple views is so I can have multiple executors that are view-centric for a single command (lets say 'delete').

              If I were to tackle this myself, does this sound like a legitimate approach:

              1.) Implement a new PageDescriptor that supports multiple views in the buildInitialLayout method.

              2.) Implement an ApplicationPage instance that supports multiple views via the page layout builder api (potentially in itself, or in an external pluggable layout builder object). Also override the giveFocusTo method to target a given view with focus without dumping the entire control set.

              3.) Respond to 'implicit' user focus changes in each view (implicit meaning focus simply by a mouse click or tab press - since the single view model enforces commands to be invoked through menus to open a new view, this callback wouldn't be neccessary) by firing the ShowViewCommand available through the DefaultViewDescriptor API - this will retarget the command executors.

              I haven't tried this yet, nor have I spent much time sifting through snpe's infonode proof of concept yet, but does this sound generally like the correct approach?

              Thanks guys,


              • #8
                Hey guys - I just went through the exercise of implementing this, and, thanks to some information on the Forms on a JInternalPane thread, I was able to figure out by using the application page how to fire focus changes - which is exactly what I needed. It's working like a charm.

                Afida, if you want any help getting through this process on your own I would recommend checking out this thread - the implementation is for internal panes, but it can work for other implementations such as a split pane:
                ... or replying here and I can try to help describe the little tweaks.

                Last edited by robyn; May 14th, 2006, 05:41 PM.


                • #9
                  rjlorimer, thank, If you also describe you tweaks here it would be greate.



                  • #10
                    Steps to Make Multi-View Page


                    I will do my best to describe what I have done which seems to work - Keith/Team, feel free to correct me anywhere I speak incorrectly.

                    Also, most of my guidance came from the post I mentioned earlier - which implements what you and I have been looking for, but rather than using splitpanes it uses internal frames.

                    To create a multi-view page, you have to create custom implementations of PageDescriptor, ApplicationPage, and ApplicationWindow.

                    First, extend DefaultApplicationWindow (mine is DualViewWindow) and override the 'createPage(PageDescriptor)' method - this method in the default implementation creates a DefaultApplicationPage instance - you want to override it to provide your custom application page object.

                    Create an implementation of the PageDescriptor interface that supports multiple views (mine supports two -DualViewPageDescriptor), and then implement the 'buildInitialLayout' method to work with the 'PageLayoutBuilder' instance to 'install' the views in a logical order.

                    public void buildInitialLayout(PageLayoutBuilder builder) {
                    Extend AbstractApplicationPage - implement 'addView' to just say 'showView' with the same arguments (the same as DefaultApplicationPage). E.G.:
                    public void addView(String id) {
                    Set up your control objects in this class (e.g. split pane) as variables:
                    private JSplitPane splitPane;

                    and override three methods (at least):
                    giveFocusTo - implement this method to target each element under the split pane as neccessary - here is my implementation:
                     PageComponentPane pane = pageComponent.getContext().getPane();
                    createPageComponent - This method wants you to produce the control for a page component (downstream from a showView request), and wire it up to the control. Think of this method as being in mid process of preparing the control for a particular view, and putting it into the control for the page. Here is my implementation:
                    PageComponent pageComponent = descriptor.createPageComponent();
                    pageComponent.setContext(new DefaultViewContext(this, new PageComponentPane(pageComponent)));		splitPane.add(pageComponent.getContext().getPane().getControl());
                    return pageComponent;
                    getControl - this is the start of the entire process for an ApplicationPage (the method which eventually causes createPageComponent to be called for each view) - this is where you want to set up your page's control, and prepare it for the subsequent 'createPageComponent' calls:

                    if(splitPane == null) {
                      splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
                      // this method causes createPageComponent to be invoked
                      // for each view... which puts the views into the split pane.
                      // sets the last component as the active one... you can set anyone you 
                    return splitPane;
                    Finally, you want to ensure that focus requests on the view are sent through the infrastructure of spring rich, and you do so by utilizing the showView method...

                    If one of your views (extending AbstractView) has a certain jcomponent in it, you can notify spring of focus changes by saying:

                    public class FocusNotifier implements FocusListener {
                     public void focusGained(FocusEvent e) {
                     public void focusLost(FocusEvent e) { }
                    attach this listener to anything in the view of significance that can gain focus - this will ensure that the commands will be updated when focus is gained implicitly (e.g. outside the invocation of a show view command).
                    Last edited by robyn; May 14th, 2006, 05:47 PM.


                    • #11
                      Thanks rj, that was great, I will let you how it goes.



                      • #12
                        May I have more than one ApplicationPage ? I need one page like snpepetclinic have muiltiple views and other like DefaultApplicationPage. How to config it and switch one to the other ?



                        • #13
                          We did a similar thing as rjlorimer for jide docking

                          Jonny Wray and I looked at the internal frame code that was put in JIRA and adapted that for the jide framework.

                          We have working code, just slightly different from each other. We are working with the jide folks to put it on so others can see it and use it and discuss it.