Nested Selector?

I’m not sure how to approach this - I hope someone can point me in the right direction

I have a group of objects stored in a file system tree. I can use a Tree object (with a FilesystemContainer) to display the objects and let users select them - no problem.

However, I want to be able to put this into a Combo-Box (if that is possible). The data looks something like this:


  /app/data/Playlist
         - Global
                - A
                      - a1.playlist
                      - a2.playlist
                - B
                      - b1.playlist
        ....
         - Group
        ....
         - Private
               - nbc
                      - pl1.playlist
                      - pl2.playlist
etc. etc.

I would like to create a ComboBox that will let users walk the tree and select one of the leaves. I considered creating 3 tree objects (Global, Group and Private), but I’m not sure how to put them into the combo-box, or how to walk the tree once they are there. Part of what I’m trying to do is minimize screen real-estate use - The combo box takes one line when it is not selected (obviously it will use up the screen when the user tries walking the tree), while the tree takes a minimum of 3 lines (the Global/Group/Private entries). I could create the tree with a single entry above the 3 main entries if that is the only way to do it, but the Combo Box also gives me some explanatory text and formatting more consistent with the rest of my UI.

Can someone tell me the correct way to handle this (if it is even possible) and/or point me at some sample code that does something similar?

Thanks very much!

nbc

Hi Neil,

In it’s simplest form - no, that’s not possible - a Vaadin ComboBox is always just a popup list. This can’t be changed (to my knowledge).

However, to implement your functionality - you could make a custom component (e.g.
CompositeComponent
or
CustomField
) combining a Label with the selected value, and a component to popup and show the tree/change the value. To display the tree as a popup you could use

  • A
    PopupView
    - core vaadin, Simple and quick to try; downside, no control of localtion of popup.
  • The CustomOverlay component from the
    Overlays addon
    for Vaadin 6
  • The
    PopupExtension
    for Vaadin 7. I’ve only experimented with it, but it seems pretty good to me.

Cheers,

Charles.

Thanks for the info - I’ll give that a try…

nbc