N
- Node Identifierpublic class DropDownHierarchy<N>
extends com.google.gwt.user.client.ui.Composite
Displays a hierarchical choice as a series of drop-downs.
For example consider the tree of options
+-- A (can be selected) +-- B +-- C (can be selected) +-- D (can be selected)
Only leaf nodes can be selected. In the above example only A, C and D can be selected. If D is selected then two drop-downs are displayed:
Changing options in the drop-down:
The interfaces Node
, LeafNode
and NonLeafNode
must be implemented
by the application program. They have methods such as getParent and getChildren etc.
The application should register a ChangeListener
with the object to be notified when the user makes a selection.
A node has an identity. For example, in the above example the nodes are objects, but the client may request that node with an internal String id, "D", be selected. In this case "D" is the identity of the node. The identity may be any object type; The NODE_ID generic parameter specifies what type identifies nodes.
A DropDownHierarchy is a GWT widget which may be included in any GWT application. Make sure that the source is available to the GWT compiler (the source is included in the databasesandlife-util.jar) and add the following line to the application's GWT XML file:
<inherits name="com.databasesandlife.util.gwt.dropdownhierarchy.DropdownHierarchy"/>
Modifier and Type | Class and Description |
---|---|
static interface |
DropDownHierarchy.ChangeListener<N> |
static interface |
DropDownHierarchy.LeafNode<N> |
static interface |
DropDownHierarchy.Node<N> |
static class |
DropDownHierarchy.NodeNotFoundException |
static interface |
DropDownHierarchy.NonLeafNode<N> |
Constructor and Description |
---|
DropDownHierarchy(DropDownHierarchy.NonLeafNode<N> rootNode,
N selectedNodeId) |
Modifier and Type | Method and Description |
---|---|
static <N> DropDownHierarchy<N> |
newIgnoreNotFound(DropDownHierarchy.NonLeafNode<N> rootNode,
N selectedNodeId) |
void |
setChangeListener(DropDownHierarchy.ChangeListener<N> c)
When the user makes a selection, this change listener should be called.
|
void |
setSelected(N newSelectedNodeId)
Changes which node is selected.
|
fireEvent, getParent, removeFromParent, sinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
public DropDownHierarchy(DropDownHierarchy.NonLeafNode<N> rootNode, N selectedNodeId) throws DropDownHierarchy.NodeNotFoundException
public static <N> DropDownHierarchy<N> newIgnoreNotFound(DropDownHierarchy.NonLeafNode<N> rootNode, N selectedNodeId)
public void setChangeListener(DropDownHierarchy.ChangeListener<N> c)
public void setSelected(N newSelectedNodeId) throws DropDownHierarchy.NodeNotFoundException