Announcement Announcement Module
Collapse
No announcement yet.
UI Framework -- Please Help! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • UI Framework -- Please Help!

    Spring RCP's UI Framework hasn't yet clicked in my mind. So, please forgive me if my question seems silly.

    My main application view is split into two panes, a left pane that contains an actionsTreeView, and a right pane that is supposed to display the result of the execution of an action selected from the actionsTreeView.

    I can capture the user-selected action, execute it and acquire the resultView, but I don't know how to target that returnView to display in the right-hand-side pane of my application's main view. In fact, I need to learn how to display a view to any desired target location on a page.

    Can someone please enlighten me?

    Thanks.

  • #2
    Unfortunately this is not yet 'officially' supported out-of-the-box by the framework. :-(

    What we want is this:
    - A view shows some objects on the left.
    - A user selects one of those objects (perhaps double clicks)
    - This triggers an editor to open in an editor area to edit the object.
    - The user may select any number of other objects and open any number of editors
    - Editors, once opened, can become dirty, closed, and/or saved.

    We are working on an public API to accomplish this, and a default simple implementation (no docking), plus more advanced implementations integrating better windowing systems like InfoNode and Jide.

    Basically, the application page interface has an "openEditor" method that accepts an editor ID and an editor input. So on a double click in your "LeftObjectView", the "OpenEditorCommand" attached to your view would simply call applicationPage.openEditor("myEditor", getSelectedObject()) and you're done. The editor will automatically open a new tab thats movable/dockable/etc. That's the vision.

    For now I'd suggest a simple home grown implementation. Implement a single a Spring Rich View that extends AbstractView. Have it encapsulate the construction of your JSplitPane (in createControl()), adding in your left and right components. Within the internals of this view implementation, listen to your left component for selection events. On selection, update the right component. In other words, manage that yourself, encapsulate it within your single Spring Rich "view".

    Keith

    Comment


    • #3
      Thanks, Keith,

      The way you suggested is exactly the way I'm doing it now. I thought that surely there must be a much more elegant way in Spring RCP that I hadn't yet discovered. For instance, since you can do: page.showView(viewID) I thought it was possible to have container-components of a page behave like a page or have page manage its container-components like:

      page.showView(containerComponentInPage,viewID);

      I'm looking forward to further development of the Spring RCP Ui Framework.

      Comment


      • #4
        I believe the page and view support is still being developed/evolved. I had a similar need to yours. Based on how page/views are defined in spring-rich now, ApplicationPage seems to be the logical place to manage arranging views - so I created my own custom ApplicationPage that defines the left hand side component (in your case the tree component), and then an area for views on the right hand side. Spring currently uses ApplicationPage (and PageLayoutBuilder, which DefaultApplicationPage implements as well) to manage views in the application window, so in my ApplicationPage, when showView(...) or addView(...) are called, I simply place the view(s) to the right hand side (of the tree component). The next trick is to get Spring to use your new ApplicationPage instead of DefaultApplicationPage. This is easy: simply define your ApplicationPage in the application-context as a bean named "defaultApplicationPagePrototype" (note, it must not be a singleton as Spring will create a new instance for each ApplicationWindow). In order for this to work, your ApplicationPage must extend DefaultApplicationPage, as DefaultApplicationWindow tries to do a cast to DefaultApplicationPage. If you cannot extend DefaultApplicationPage for whatever reason, then you will also have to supply your own ApplicationWindow implementation that uses your specific ApplicationPage implementation. Supplying your own default ApplicationWindow is similar to supplying a default ApplicationPage, just create a bean in your application-context named, "applicationWindowPrototype" (again, this must not be a singleton). It is still up to you to decide how you want to handle the actions/commands in the tree - but it is possible at this point to call applicationWindow.getPage().showView(...) to swap out the right hand side with a particular View.
        Once the editor support is in, that will definitely be the way to go - until then, this is a workable alternative.

        - Andy

        Comment


        • #5
          It's refreshing to see workable alternatives while the framework is being developed. :-)

          If there were only 48 hours in a day...!

          Comment


          • #6
            Andy,

            Once the editor support is in, that will definitely be the way to go - until then, this is a workable alternative.
            Would it be nice if you could contribute your code to rcp cvs; and would it be great if rcp team can merge your "alternative" before 'officially' supported out-of-the-box by the framework. ( Maybe could be put under "contribution" direcotry ).

            linwei

            Comment

            Working...
            X