Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: View with JTree on Left, TreeNode Properties on Right

  1. #1
    Join Date
    Sep 2004
    Location
    Vancouver, BC, Canada
    Posts
    135

    Default View with JTree on Left, TreeNode Properties on Right

    I'm trying to create a View that has a JTree on the left and a JPanel on the right that shows the properties of the currently selected TreeNode. Ideally, the JTree and the JPanel would be contained by a JSplitPane.

    The data in the JTree is a tree of countries, each country's provinces (i.e. states) and each province's cities. For example:

    Code:
    Countries (root node)
    |----Canada
          |----British Columbia
                |----Vancouver
                |----Victoria
          |----Ontario
                |----Ottawa
                |----Toronto
    |----USA
          |----California
                |----San Francisco
                |----San Jose
          |----Washington
                |----Seattle
                |----Redmond
    When you select a country in the tree, the properties panel on the right displays that country's name, country code and other properties. When you select a province, the panel displays that province's name, province code and other properties. When you select a city...well, you get the idea! Of course, the exact properties that get displayed on the panel depend on the type of the selected tree node.

    Using the VetManagerView in the Petclinic sample as a starting point, I was easily and quickly able to display the tree and populate it with data. Now I want to add the properties panel to the right side. How should I structure this in terms of Spring Rich Client classes? In other words, which Spring Rich Client classes should I be using? In particular, which implementation of FormModel (if any) should I use as backing for the properties panel?

    I looked for examples in this forum but I couldn't find anything that exactly fit my requirements. Any help (especially sample code) would be greatly appreciated. For now, I'll keep plugging away at it.

    Joe

  2. #2
    Join Date
    Sep 2004
    Location
    Ghent, Belgium
    Posts
    224

    Default

    when you create the control of your view, create a JSplitPane, with on the left the tree and on the right a JPanel with CardLayout.

    add the possible form components to the panel with the cardlayout, also add an empty JPanel.

    add selectionlisteners to the tree that show the appropriate panel on the right, and set the selected item as the formmodel. If the selection is invalid (multiple selection or no selection at all), show the empty panel.

    If the user makes a selection and the current formmodel is dirty, commit the changes.

    Hope this helps.

    Peter

  3. #3
    Join Date
    Aug 2004
    Posts
    203

    Default

    I try integrate infonode docking window in rcp
    I finish for 2-3 days

    first screenshot :

    http://www.snpe.co.yu/spring-idw.png

    regards

  4. #4
    Join Date
    Aug 2004
    Location
    Northridge, CA
    Posts
    151

    Default

    snpe,

    This looks great. Is it possible you can share your code with us. Also is InfoNode open source and available under GPL?

    Amad

  5. #5
    Join Date
    Aug 2004
    Posts
    203

    Default

    yes,
    It don't work too good for now.I have a problem with empty tabWindow (when user close all view in any tab) and when I resolve this I will send code

    infonode is GPL and I don't know can be integrate with (Apache licence), but Linux is GPL, too

    regards

  6. #6
    Join Date
    Sep 2004
    Location
    Vancouver, BC, Canada
    Posts
    135

    Default

    Quote Originally Posted by pdbruycker
    when you create the control of your view, create a JSplitPane, with on the left the tree and on the right a JPanel with CardLayout.

    add the possible form components to the panel with the cardlayout, also add an empty JPanel.

    add selectionlisteners to the tree that show the appropriate panel on the right, and set the selected item as the formmodel. If the selection is invalid (multiple selection or no selection at all), show the empty panel.

    If the user makes a selection and the current formmodel is dirty, commit the changes.

    Hope this helps.

    Peter
    Thanks, Pete. That approach worked fine for me. Due to my lack of experience with the Spring Rich Client API, I assumed the solution would be more complicated and involve more of the API's classes and less Swing. I'm glad to see it was quite easy.

    Cheers,
    Joe

  7. #7
    Join Date
    Aug 2004
    Posts
    203

    Default

    Keith make big changes with ApplicationWindow and ApplicationPage

    I neee more times for integrate docking window

    regards

  8. #8
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Hopefully you'll find it easier now snpe, that refining was overdue :-)

    Looking forward to seeing it - Keith
    Keith Donald
    Core Spring Development Team

  9. #9
    Join Date
    Aug 2004
    Posts
    203

    Default

    see my another trade (or rcp-dev mailing list) - I make simple example

    I need setter for contro and pagel in ApplicationWindow

    It isn't easer for me , it is same like before - I have to learn again

    regards

  10. #10
    Join Date
    Aug 2004
    Location
    Northridge, CA
    Posts
    151

    Default

    snpe, the link you had provided is broken.

    http://www.snpe.co.yu/snpepeclinic.tar.bz2

    Amad

Similar Threads

  1. FlowExecutionStorage in a DB
    By cacho in forum Web Flow
    Replies: 7
    Last Post: Oct 19th, 2009, 03:36 PM
  2. Binding composite properties with DataBinder
    By dhewitt in forum Architecture
    Replies: 16
    Last Post: Jun 1st, 2007, 06:22 AM
  3. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 PM
  4. Content Provider vs View Model
    By Martin Kersten in forum Swing
    Replies: 21
    Last Post: Mar 10th, 2005, 02:25 PM
  5. Replies: 0
    Last Post: Aug 20th, 2004, 08:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •