|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Tree
org.cafesip.gwtcomp.client.ui.SuperTree
public class SuperTree
An extension of the GWT Tree that allows multiple selection of tree items and
includes comprehensive support for context-sensitive popup menu among other
things. The main feature of the objects is the ability for the application to
define different popup menus at every unique level of the tree. For example,
if a tree is displaying countries, its states and cities within a state, it
is possible to define a different popup menu at the country-level,
state-level and city-level without having to attach a popup menu for
individual items although that is possible as well. In order to utilize the
feature, the application must use
SuperTreeItem instead of the GWT
TreeItem object to define the tree hierarchy. Each object of the type
SuperTreeItem has an integer "type" attribute that must be specified. A level
is specified as a string formatted as W.X.Y.Z.... where W, X, Y, Z are types.
The dots are used to specify the hierarchy. For example, if the country has
the type 1, state has the type 2 and the city has the type 3, the level 1.2.3
is used to specify a context menu for the city that is placed in the tree as
Country->State->City. The context-menu is popped up by using the right-click.
Note that the application must not use the type value of 0. That value is
reserved for objects of the type TreeItem.
If the tree has multi-selection enabled, the user can select more than one tree item by clicking on the tree item while pressing the CTRL key. The user can select multiple items belonging to the same level only. Therefore, in conjuction with the the context-senstive popup menu, the user can select multiple items of the same level and popup the menu.
The application can also define their own tree listener for listening to tree
selection, tree expand and collapse and popup events. For more details, see
the SuperTreeListener class.
CSS Style Rules:
Screen-Shots:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.Tree |
|---|
Tree.Resources |
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
| Field Summary |
|---|
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX |
| Constructor Summary | |
|---|---|
SuperTree()
A constructor for this class. |
|
SuperTree(Tree.Resources images)
A constructor for this class. |
|
| Method Summary | |
|---|---|
TreeItem |
addItem(String itemText)
|
void |
addItem(SuperTreeItem item)
Add a SuperTree object to the root of the tree. |
void |
addItem(TreeItem item)
|
TreeItem |
addItem(Widget widget)
|
void |
addTreeListener(SuperTreeListener listener)
Add a tree listener. |
static String |
getLevel(TreeItem item)
Convenience method for finding the level of any given tree items. |
TreeItem |
getSelectedItem()
|
TreeItem[] |
getSelectedItems()
Returns the selected items. |
boolean |
isMultiSelectionEnabled()
Returns if multi-selection is enabled. |
protected static void |
preventBrowserContextMenu(JavaScriptObject element)
|
void |
removeContextMenu(String level)
Remove the context menu at a given level. |
void |
removeTreeListener(SuperTreeListener listener)
Removes the tree listener. |
void |
setContextMenu(String level,
PopupMenu contextMenu)
Sets the context menu for a given level. |
void |
setMultiSelectionEnabled(boolean multiSelectionEnabled)
Enables or disables multi-selection. |
void |
setSelectedItem(TreeItem item)
|
void |
setSelectedItem(TreeItem item,
boolean fireEvents)
|
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onUnload, removeFromParent, setLayoutData, sinkEvents |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Constructor Detail |
|---|
public SuperTree()
public SuperTree(Tree.Resources images)
images - the image bundle.| Method Detail |
|---|
protected static void preventBrowserContextMenu(JavaScriptObject element)
public TreeItem addItem(String itemText)
addItem in class Tree
Note that all the items in the tree are converted to GWT HTML object
before adding to the tree. Therefore, the GWT Tree.getText() method
will return a null.
public void addItem(SuperTreeItem item)
item - item to add.public void addItem(TreeItem item)
addItem in class TreeTree.addItem(com.google.gwt.user.client.ui.TreeItem)public TreeItem addItem(Widget widget)
addItem in class TreeTree.addItem(com.google.gwt.user.client.ui.Widget)public void addTreeListener(SuperTreeListener listener)
listener - the listener object.public static String getLevel(TreeItem item)
item - a tree item.
public TreeItem getSelectedItem()
getSelectedItem in class Tree
Note that if multi-selection is enabled, this method returns the
item selected first. For trees with multi-selection, the
getSelectedItems() method must be used.
public TreeItem[] getSelectedItems()
public boolean isMultiSelectionEnabled()
public void removeContextMenu(String level)
level - public void removeTreeListener(SuperTreeListener listener)
listener - listener to remove.
public void setContextMenu(String level,
PopupMenu contextMenu)
level - the level to setcontextMenu - the context menu object.public void setMultiSelectionEnabled(boolean multiSelectionEnabled)
multiSelectionEnabled - The multiSelectionEnabled to set.public void setSelectedItem(TreeItem item)
setSelectedItem in class TreeTree.setSelectedItem(com.google.gwt.user.client.ui.TreeItem)
public void setSelectedItem(TreeItem item,
boolean fireEvents)
setSelectedItem in class TreeTree.setSelectedItem(com.google.gwt.user.client.ui.TreeItem,
boolean)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||