Announcement Announcement Module
No announcement yet.
Using a tree as master in master/detail forms? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using a tree as master in master/detail forms?

    Hi. I found AbstractTableMasterForm is useful. But I have more than one list of objects, and I would like the master form to be on the left side and be a tree, so that I can have a "workspace" style UI, with the master form acts as "navigator", the detail form acts as "editor".
    The tree I want is simple, I would like to group the objects with same class in one subtree.

    But when I tried to replace AbstractTableMasterForm's table with a tree, I was stuck.

    AbstractTableMasterForm builds its "masterTable" on a GlazedTableModel, which is "TableModel that accepts a EventList". Currently don't know much about eventlist, but I guess it is why the master table is clickable(update detail form when a object is clicked).
    So if there is a "AbstractTreeMasterForm", it must build its "masterTree" on a GlazedTreeModel?
    But there is not one, and event the parent class of GlazedTableModel(EventTableModel) doesn't have a counterpart for tree.
    So how could I make a tree clickable just like the table in AbstractTableMasterForm?

    here is my current result, it will switch between two types of sub forms.

  • #2

    EventList comes from the Glazed lists project, and it is a useful extension of a basic List. It does provide for some event handling, but that's not (directly) how the ATMF handles row selection. Take a look at the code (in AbstractMasterForm.installSelectionHandler) and you'll see a selection listener is registered to handle selections in the table.

    Tou your main point, the current incarnation of the master/detail form mechanism assumes that there is only a single detail type. That's going to be your biggest initial limitation on trying to do what you describe. If that assumption was removed, you'd then need to create a whole lot of other supporting classes (like an ObservableEventList counterpart).

    As I think through it, this is really not the way you want to go. Master/details were designed to work with a single collection of uniform types.

    To do what you want, I would recommend that you look at constructing a view that has the layout you describe. A tree on the left and a panel on the right. When an item in the tree is selected, you would reconfigure the right hand pane with a suitable form. You'll need to handle a number of things similar to AbstractMasterForm when it comes to switching objects when outstanding changes are present in the current object, etc.

    I'm in the process of working on a fix for and that will provide an easier mechanism for generating a panel with all the pieces you need for working with a form (title/message area, form, command buttons, autowiring, etc.). As I was working on this, I was giving thought to how to handle exactly the problem you presented. Although it's not a complete solution to your problem, the fix for RCP-193 will certainly help.



    • #3
      thanks for your suggestion! sorry for my bad idea. I am not familiar with swing/spring-rcp, having been writing web apps for years(I hate them!).

      emm, I think it is not a good idea too.
      But currently there is not a complete solution to my problem. And I belive my problem is not so uncommon, what I need is a simple workspace style UI, which can switch between editors when any item is selected.
      Although to modify master/detail is not a good idea, but if I use different types of views, I have to create ObservableEventList anyway,and I think I have to create those revert, cancle and form validation stuff too.
      Indeed I have create many support Classes, my subclass is now longer than AbstractTableMasterForm, if I add ObservableEventTree to it, it will much longer than AbstractMasterForm.

      RCP-193 is about using forms in JInternelFrame?
      I am still confused about forms/dialogs/pages/views, but I do get more clear about them when I write my bad idea


      • #4
        It's not a bad idea - just a difficult implementation option

        You're right in that this is probably a common problem, but spring rich doesn't have a great solution right now. Hopefully some of the things that i have in mind will get us closer, but it will be a little while.

        Not to be a heretic, but you might want to look at the Eclipse RCP project since it is definitely focused on the "workspace" model and probably has a fair amount of support for what you want to accomplish.



        • #5
          but I think eclipse-rcp needs swt? which I have no idea with.
          BTW, if I "constructing a view that has the layout you describe. A tree on the left and a panel on the right. When an item in the tree is selected, you would reconfigure the right hand pane with a suitable form.", I think I also have to rewrite most codes of AbastractTableForm too?


          • #6
            With respect to your needs for a 'workspace' type layout, have you looked at the jide integration with spring rcp?

            It provides for exactly that, with concepts of multiple views and multiple editors/documents with the documents opening as different tabs in a workspace.

            A potential downside is that is that it requires the JIDE libraries, which are not free. On the other hand they are not expensive and provide great value (in my opinion) and I'm pretty sure they will give you a free license for open source projects.



            • #7
              I have heard it but the project I am working on is not opensource, and still not get any fund.