com.tensegrity.wpalo.client.ui.mvc.fasttree
Class FastMSTree

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.tensegrity.wpalo.client.ui.mvc.fasttree.FastMSTree
All Implemented Interfaces:
com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.Focusable, com.google.gwt.user.client.ui.HasFocus, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.SourcesFocusEvents, com.google.gwt.user.client.ui.SourcesKeyboardEvents, HasFastMSTreeItems, java.lang.Iterable<com.google.gwt.user.client.ui.Widget>

public class FastMSTree
extends com.google.gwt.user.client.ui.Panel
implements com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasFocus, HasFastMSTreeItems

A standard hierarchical tree widget. The tree contains a hierarchy of FastMSTreeItems. Explicitly call FastTree.addDefaultCSS() to include the default style sheet.

CSS Style Rules


Nested Class Summary
static interface FastMSTree.DefaultResources
          Resources used.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
static int ADD
           
static int ADDONLY
           
static int INTERVAL
           
static int SELECT
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
FastMSTree(boolean ms)
          Constructs a tree.
 
Method Summary
 void add(com.google.gwt.user.client.ui.Widget widget)
          Adds the widget as a root tree item.
static void addDefaultCSS()
          Add the default style sheet and images.
 void addDoubleClickListener(DoubleClickListener listener)
           
 void addFocusListener(com.google.gwt.user.client.ui.FocusListener listener)
           
 void addItem(FastMSTreeItem item)
          Adds an item to the root level of this tree.
 FastMSTreeItem addItem(java.lang.String itemText)
          Adds a simple tree item containing the specified text.
 FastMSTreeItem addItem(com.google.gwt.user.client.ui.Widget widget)
          Adds a new tree item containing the specified widget.
 void addKeyboardListener(com.google.gwt.user.client.ui.KeyboardListener listener)
           
 void addLoadListener(com.extjs.gxt.ui.client.event.LoadListener listener)
           
 void addMouseListener(com.google.gwt.user.client.ui.MouseListener listener)
           
 void addSelectionCountListener(SelectionCountListener l)
           
 void clear()
          Clears all tree items from the current tree.
 void collapseAll()
           
 void deepExpand(java.util.LinkedHashSet<FastMSTreeItem> nodes)
           
 void deselectTheseItems(java.util.LinkedHashSet<FastMSTreeItem> items)
           
protected  void doAttachChildren()
           
protected  void doDetachChildren()
           
 void ensureItemVisible(FastMSTreeItem item)
           
 void ensurePathOpen(FastMSTreeItem item)
           
 void ensureSelectedItemsVisible()
          Ensures that the currently-selected item is visible, opening its parents and scrolling the tree as necessary.
 void ensureUnselectedItemVisible(FastMSTreeItem item)
           
 void expandAll()
           
 void fastAddItem(FastMSTreeItem item)
           
 void fastSetSelectedItems(java.util.LinkedHashSet<FastMSTreeItem> items)
           
 void fireSelectionNumberChanged()
           
 FastMSTreeItem getChild(int index)
          Gets the child at the specified index.
 int getChildCount()
          Gets the number of children contained in this item.
 int getChildIndex(FastMSTreeItem child)
          Gets the index of the specified child item.
 java.util.ArrayList<FastMSTreeItem> getChildren()
           
 FastMSTreeItem getItem(int index)
          Gets the top-level tree item at the specified index.
 int getItemCount()
          Gets the number of items contained at the root of this tree.
 int getNumberOfSelectedItems()
           
 FastMSTreeItem getRoot()
           
 java.util.LinkedHashSet<FastMSTreeItem> getSelectedItems()
          Gets the currently selected item.
 int getTabIndex()
           
 int getTotalSize()
           
 java.util.ArrayList<FastMSTreeItem> getVisibleItems()
           
 boolean isListenToStateChange()
           
 java.util.Iterator<com.google.gwt.user.client.ui.Widget> iterator()
           
 void loaded(com.extjs.gxt.ui.client.data.LoadEvent le)
           
 boolean moveItemDown(FastMSTreeItem item)
           
 boolean moveItemUp(FastMSTreeItem item)
           
protected  void moveSelectionBar(FastMSTreeItem item)
          Moves the selection bar around the given FastMSTreeItem.
 void moveUnselectedFocus(FastMSTreeItem item)
           
 void onBrowserEvent(com.google.gwt.user.client.Event event)
           
 void onDeselection(FastMSTreeItem item)
           
protected  void onLoad()
           
 void onSelection(FastMSTreeItem item, boolean fireEvents, boolean moveFocus, int mode)
           
protected  void onUnload()
          This method is called immediately before a widget will be detached from the browser's document.
protected  boolean processElementClicked(FastMSTreeItem item)
          This is called when a valid selectable element is clicked in the tree.
 boolean remove(com.google.gwt.user.client.ui.Widget w)
           
 void removeDoubleClickListener(DoubleClickListener listener)
           
 void removeFocusListener(com.google.gwt.user.client.ui.FocusListener listener)
           
 void removeItem(FastMSTreeItem item)
          Removes an item from the root level of this tree.
 void removeItems()
          Removes all items from the root level of this tree.
 void removeKeyboardListener(com.google.gwt.user.client.ui.KeyboardListener listener)
           
 void removeLoadListener(com.extjs.gxt.ui.client.event.LoadListener listener)
           
 void removeSelectionCountListener(SelectionCountListener l)
           
 void selectTheseItems(java.util.LinkedHashSet<FastMSTreeItem> items)
           
 void setAccessKey(char key)
           
 void setFocus(boolean focus)
           
 void setListenToStateChange(boolean listen)
           
 void setMaySelectChildren(boolean childSelect)
           
 void setSelectedItems(java.util.LinkedHashSet<FastMSTreeItem> items)
          Selects a specified item.
 void setSelectedItems(java.util.LinkedHashSet<FastMSTreeItem> items, boolean fireEvents)
          Selects a specified item.
 void setTabIndex(int index)
           
 java.util.Iterator<FastMSTreeItem> treeItemIterator()
          Iterator of tree items.
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, adopt, disown, orphan
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getParent, isAttached, isOrWasAttached, onAttach, onDetach, removeFromParent, 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, onEnsureDebugId, 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
 

Field Detail

SELECT

public static final int SELECT
See Also:
Constant Field Values

ADD

public static final int ADD
See Also:
Constant Field Values

INTERVAL

public static final int INTERVAL
See Also:
Constant Field Values

ADDONLY

public static final int ADDONLY
See Also:
Constant Field Values
Constructor Detail

FastMSTree

public FastMSTree(boolean ms)
Constructs a tree.

Method Detail

setListenToStateChange

public void setListenToStateChange(boolean listen)

isListenToStateChange

public boolean isListenToStateChange()

addDefaultCSS

public static void addDefaultCSS()
Add the default style sheet and images. This method is not called by the Tree and should be called by explicitly by the consumer to include the default style sheet.


add

public void add(com.google.gwt.user.client.ui.Widget widget)
Adds the widget as a root tree item.

Specified by:
add in interface com.google.gwt.user.client.ui.HasWidgets
Overrides:
add in class com.google.gwt.user.client.ui.Panel
Parameters:
widget - widget to add.
See Also:
HasWidgets.add(com.google.gwt.user.client.ui.Widget)

expandAll

public void expandAll()

collapseAll

public void collapseAll()

deepExpand

public void deepExpand(java.util.LinkedHashSet<FastMSTreeItem> nodes)

moveItemUp

public boolean moveItemUp(FastMSTreeItem item)

moveItemDown

public boolean moveItemDown(FastMSTreeItem item)

getTotalSize

public int getTotalSize()

addFocusListener

public void addFocusListener(com.google.gwt.user.client.ui.FocusListener listener)
Specified by:
addFocusListener in interface com.google.gwt.user.client.ui.SourcesFocusEvents

addItem

public void addItem(FastMSTreeItem item)
Adds an item to the root level of this tree.

Specified by:
addItem in interface HasFastMSTreeItems
Parameters:
item - the item to be added

fastAddItem

public void fastAddItem(FastMSTreeItem item)
Specified by:
fastAddItem in interface HasFastMSTreeItems

addItem

public FastMSTreeItem addItem(java.lang.String itemText)
Adds a simple tree item containing the specified text.

Specified by:
addItem in interface HasFastMSTreeItems
Parameters:
itemText - the text of the item to be added
Returns:
the item that was added

addItem

public FastMSTreeItem addItem(com.google.gwt.user.client.ui.Widget widget)
Adds a new tree item containing the specified widget.

Specified by:
addItem in interface HasFastMSTreeItems
Parameters:
widget - the widget to be added
Returns:
the item that was added

addKeyboardListener

public void addKeyboardListener(com.google.gwt.user.client.ui.KeyboardListener listener)
Specified by:
addKeyboardListener in interface com.google.gwt.user.client.ui.SourcesKeyboardEvents

addMouseListener

public void addMouseListener(com.google.gwt.user.client.ui.MouseListener listener)

clear

public void clear()
Clears all tree items from the current tree.

Specified by:
clear in interface com.google.gwt.user.client.ui.HasWidgets
Overrides:
clear in class com.google.gwt.user.client.ui.Panel

ensureSelectedItemsVisible

public void ensureSelectedItemsVisible()
Ensures that the currently-selected item is visible, opening its parents and scrolling the tree as necessary.


ensurePathOpen

public void ensurePathOpen(FastMSTreeItem item)

ensureUnselectedItemVisible

public void ensureUnselectedItemVisible(FastMSTreeItem item)

ensureItemVisible

public void ensureItemVisible(FastMSTreeItem item)

getChild

public FastMSTreeItem getChild(int index)
Description copied from interface: HasFastMSTreeItems
Gets the child at the specified index.

Specified by:
getChild in interface HasFastMSTreeItems
Parameters:
index - the index to be retrieved
Returns:
the item at that index

getChildCount

public int getChildCount()
Description copied from interface: HasFastMSTreeItems
Gets the number of children contained in this item.

Specified by:
getChildCount in interface HasFastMSTreeItems
Returns:
this item's child count.

getChildren

public java.util.ArrayList<FastMSTreeItem> getChildren()

getChildIndex

public int getChildIndex(FastMSTreeItem child)
Description copied from interface: HasFastMSTreeItems
Gets the index of the specified child item.

Specified by:
getChildIndex in interface HasFastMSTreeItems
Parameters:
child - the child item to be found
Returns:
the child's index, or -1 if none is found

getItem

public FastMSTreeItem getItem(int index)
Gets the top-level tree item at the specified index.

Parameters:
index - the index to be retrieved
Returns:
the item at that index

getItemCount

public int getItemCount()
Gets the number of items contained at the root of this tree.

Returns:
this tree's item count

getSelectedItems

public java.util.LinkedHashSet<FastMSTreeItem> getSelectedItems()
Gets the currently selected item.

Returns:
the selected item

getNumberOfSelectedItems

public int getNumberOfSelectedItems()

addSelectionCountListener

public void addSelectionCountListener(SelectionCountListener l)

removeSelectionCountListener

public void removeSelectionCountListener(SelectionCountListener l)

fireSelectionNumberChanged

public final void fireSelectionNumberChanged()

getTabIndex

public int getTabIndex()
Specified by:
getTabIndex in interface com.google.gwt.user.client.ui.Focusable

iterator

public java.util.Iterator<com.google.gwt.user.client.ui.Widget> iterator()
Specified by:
iterator in interface com.google.gwt.user.client.ui.HasWidgets
Specified by:
iterator in interface java.lang.Iterable<com.google.gwt.user.client.ui.Widget>

onBrowserEvent

public void onBrowserEvent(com.google.gwt.user.client.Event event)
Specified by:
onBrowserEvent in interface com.google.gwt.user.client.EventListener
Overrides:
onBrowserEvent in class com.google.gwt.user.client.ui.Widget

addDoubleClickListener

public void addDoubleClickListener(DoubleClickListener listener)

removeDoubleClickListener

public void removeDoubleClickListener(DoubleClickListener listener)

remove

public boolean remove(com.google.gwt.user.client.ui.Widget w)
Specified by:
remove in interface com.google.gwt.user.client.ui.HasWidgets
Specified by:
remove in class com.google.gwt.user.client.ui.Panel

removeFocusListener

public void removeFocusListener(com.google.gwt.user.client.ui.FocusListener listener)
Specified by:
removeFocusListener in interface com.google.gwt.user.client.ui.SourcesFocusEvents

removeItem

public void removeItem(FastMSTreeItem item)
Removes an item from the root level of this tree.

Specified by:
removeItem in interface HasFastMSTreeItems
Parameters:
item - the item to be removed

removeItems

public void removeItems()
Removes all items from the root level of this tree.


removeKeyboardListener

public void removeKeyboardListener(com.google.gwt.user.client.ui.KeyboardListener listener)
Specified by:
removeKeyboardListener in interface com.google.gwt.user.client.ui.SourcesKeyboardEvents

setAccessKey

public void setAccessKey(char key)
Specified by:
setAccessKey in interface com.google.gwt.user.client.ui.Focusable

setFocus

public void setFocus(boolean focus)
Specified by:
setFocus in interface com.google.gwt.user.client.ui.Focusable

setSelectedItems

public void setSelectedItems(java.util.LinkedHashSet<FastMSTreeItem> items)
Selects a specified item.

Parameters:
item - the item to be selected, or null to deselect all items

fastSetSelectedItems

public void fastSetSelectedItems(java.util.LinkedHashSet<FastMSTreeItem> items)

setSelectedItems

public void setSelectedItems(java.util.LinkedHashSet<FastMSTreeItem> items,
                             boolean fireEvents)
Selects a specified item.

Parameters:
item - the item to be selected, or null to deselect all items
fireEvents - true to allow selection events to be fired

setTabIndex

public void setTabIndex(int index)
Specified by:
setTabIndex in interface com.google.gwt.user.client.ui.Focusable

treeItemIterator

public java.util.Iterator<FastMSTreeItem> treeItemIterator()
Iterator of tree items.


doAttachChildren

protected void doAttachChildren()
Overrides:
doAttachChildren in class com.google.gwt.user.client.ui.Panel

doDetachChildren

protected void doDetachChildren()
Overrides:
doDetachChildren in class com.google.gwt.user.client.ui.Panel

getRoot

public FastMSTreeItem getRoot()

moveSelectionBar

protected void moveSelectionBar(FastMSTreeItem item)
Moves the selection bar around the given FastMSTreeItem.

Parameters:
item - the item to move selection bar to

onLoad

protected void onLoad()
Overrides:
onLoad in class com.google.gwt.user.client.ui.Panel

onDeselection

public void onDeselection(FastMSTreeItem item)

selectTheseItems

public void selectTheseItems(java.util.LinkedHashSet<FastMSTreeItem> items)

deselectTheseItems

public void deselectTheseItems(java.util.LinkedHashSet<FastMSTreeItem> items)

setMaySelectChildren

public void setMaySelectChildren(boolean childSelect)

onSelection

public void onSelection(FastMSTreeItem item,
                        boolean fireEvents,
                        boolean moveFocus,
                        int mode)

onUnload

protected void onUnload()
This method is called immediately before a widget will be detached from the browser's document.

Overrides:
onUnload in class com.google.gwt.user.client.ui.Panel

processElementClicked

protected boolean processElementClicked(FastMSTreeItem item)
This is called when a valid selectable element is clicked in the tree. Subclasses can override this method to decide whether or not FastTree should keep processing the element clicked. For example, a subclass may decide to return false for this method if selecting a new item in the tree is subject to asynchronous approval from other components of the application.


moveUnselectedFocus

public void moveUnselectedFocus(FastMSTreeItem item)

addLoadListener

public void addLoadListener(com.extjs.gxt.ui.client.event.LoadListener listener)

removeLoadListener

public void removeLoadListener(com.extjs.gxt.ui.client.event.LoadListener listener)

loaded

public void loaded(com.extjs.gxt.ui.client.data.LoadEvent le)

getVisibleItems

public java.util.ArrayList<FastMSTreeItem> getVisibleItems()