Announcement Announcement Module
Collapse
No announcement yet.
Multiple Pages Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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!

    Amad

  • #2
    Any thing Keith...

    Comment


    • #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! :-))

      Keith

      Comment


      • #4
        Afida,
        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

        regards

        Comment


        • #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.

          Thanks

          Amad

          Comment


          • #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.

            Thanks

            Comment


            • #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,

              Comment


              • #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:
                http://forum.springframework.org/showthread.php?t=11737
                ... or replying here and I can try to help describe the little tweaks.

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

                Comment


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

                  Amad

                  Comment


                  • #10
                    Steps to Make Multi-View Page

                    Amad,

                    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 - http://forum.springframework.org/showthread.php?t=11737 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.

                    1.)
                    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.

                    2.)
                    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.

                    Code:
                    public void buildInitialLayout(PageLayoutBuilder builder) {
                      builder.addView(view1Id);
                      builder.addView(view2Id);
                    }
                    3.)
                    Extend AbstractApplicationPage - implement 'addView' to just say 'showView' with the same arguments (the same as DefaultApplicationPage). E.G.:
                    Code:
                    public void addView(String id) {
                     showView(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:
                    Code:
                     PageComponentPane pane = pageComponent.getContext().getPane();
                     pane.requestFocusInWindow();
                     fireFocusGained(pageComponent);
                    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:
                    Code:
                    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:

                    Code:
                    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.
                      this.getPageDescriptor().buildInitialLayout(this);
                      // sets the last component as the active one... you can set anyone you 
                      //want...
                      setActiveComponent();
                    }
                    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:

                    Code:
                    public class FocusNotifier implements FocusListener {
                     
                     public void focusGained(FocusEvent e) {
                        getContext().getPage().showView(this.getId());
                     }
                     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.

                    Comment


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

                      Amad

                      Comment


                      • #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 ?



                        Thanks.

                        Comment


                        • #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 java.net so others can see it and use it and discuss it.

                          Comment

                          Working...
                          X