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

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.tensegrity.wpalo.client.ui.mvc.fasttree.FastMSTreeItem
All Implemented Interfaces:
com.google.gwt.user.client.ui.HasHTML, com.google.gwt.user.client.ui.HasText, HasFastMSTreeItems
Direct Known Subclasses:
SelectingFastMSTreeItem

public class FastMSTreeItem
extends com.google.gwt.user.client.ui.UIObject
implements com.google.gwt.user.client.ui.HasHTML, HasFastMSTreeItems

An item that can be contained within a FastTree.

Example


Nested Class Summary
 
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
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
FastMSTreeItem()
          Creates an empty tree item.
FastMSTreeItem(java.lang.String html)
          Constructs a tree item with the given HTML.
FastMSTreeItem(com.google.gwt.user.client.ui.Widget widget)
          Constructs a tree item with the given Widget.
 
Method Summary
 void addItem(FastMSTreeItem item)
          Adds another item as a child to this one.
 FastMSTreeItem addItem(java.lang.String itemText)
          Adds a child tree item containing the specified text.
 FastMSTreeItem addItem(com.google.gwt.user.client.ui.Widget widget)
          Adds a child tree item containing the specified widget.
protected  void afterClose()
          Called after the tree item is closed.
protected  void afterOpen()
          Called after the tree item is opened.
 void becomeInteriorNode()
          Become an interior node.
protected  void beforeClose()
          Called before the tree item is closed.
protected  void beforeOpen()
          Called before the tree item is opened.
protected  boolean beforeSelectionLost()
          Called when tree item is being unselected.
 void collapseAll()
           
protected  void ensureChildren()
          Fired when a tree item receives a request to open for the first time.
 void expandAll()
           
 void fastAddItem(FastMSTreeItem item)
           
 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()
           
 int getControlImageWidth()
          Returns the width of the control open/close image.
 int getDepth()
           
 com.tensegrity.palo.gwt.core.client.models.palo.XElementNode getElementNode()
           
 com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> getFinishHandler()
           
protected  com.google.gwt.user.client.ui.HasFocus getFocusableWidget()
          Returns the widget, if any, that should be focused on if this TreeItem is selected.
 com.google.gwt.user.client.ui.HTML getHtml()
           
 java.lang.String getHTML()
           
 TreeNode getModel()
           
 FastMSTreeItem getParentItem()
          Gets this item's parent.
 java.lang.String getText()
           
 int getTotalSize()
           
 FastMSTree getTree()
          Gets the tree that contains this item.
 com.google.gwt.user.client.ui.Widget getWidget()
          Gets the Widget associated with this tree item.
 XObjectModel getXObjectModel()
           
 boolean hasBeenOpened()
          Has this FastMSTreeItem ever been opened?
 boolean isInteriorNode()
          Does this FastMSTreeItem represent an interior node?
 boolean isLeafNode()
          Is this FastMSTreeItem a leaf node?
 boolean isOpen()
          Is the FastMSTreeItem open? Returns false if the FastMSTreeItem is closed or a leaf node.
 boolean isSelected()
          Determines whether this item is currently selected.
 boolean isShowing()
          Returns whether the tree is currently showing this FastMSTreeItem.
 boolean moveItemDown(FastMSTreeItem item)
           
 boolean moveItemUp(FastMSTreeItem item)
           
protected  void onSelected()
          Called when a tree item is selected.
 void remove()
          Removes this item from its tree.
 void removeItem(FastMSTreeItem item)
          Removes an item from the tree.
 void removeItems()
          Removes all of this item's children.
 void setElementNode(com.tensegrity.palo.gwt.core.client.models.palo.XElementNode nd)
           
 void setFinishHandler(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> finishHandler)
           
 void setHTML(java.lang.String html)
           
 void setModel(TreeNode node)
           
 void setState(boolean open)
          Sets whether this item's children are displayed.
 void setState(boolean open, boolean fireEvents)
          Sets whether this item's children are displayed.
 void setText(java.lang.String text)
           
 void setWidget(com.google.gwt.user.client.ui.Widget widget)
           
 void setXObjectModel(XObjectModel model)
           
 
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, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FastMSTreeItem

public FastMSTreeItem()
Creates an empty tree item.


FastMSTreeItem

public FastMSTreeItem(java.lang.String html)
Constructs a tree item with the given HTML.

Parameters:
html - the item's HTML

FastMSTreeItem

public FastMSTreeItem(com.google.gwt.user.client.ui.Widget widget)
Constructs a tree item with the given Widget.

Parameters:
widget - the item's widget
Method Detail

getHtml

public com.google.gwt.user.client.ui.HTML getHtml()

setFinishHandler

public void setFinishHandler(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> finishHandler)

getFinishHandler

public com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> getFinishHandler()

setModel

public void setModel(TreeNode node)

getModel

public TreeNode getModel()

setXObjectModel

public void setXObjectModel(XObjectModel model)

getXObjectModel

public XObjectModel getXObjectModel()

getDepth

public int getDepth()

fastAddItem

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

addItem

public void addItem(FastMSTreeItem item)
Description copied from interface: HasFastMSTreeItems
Adds another item as a child to this one.

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

moveItemUp

public boolean moveItemUp(FastMSTreeItem item)

moveItemDown

public boolean moveItemDown(FastMSTreeItem item)

addItem

public FastMSTreeItem addItem(java.lang.String itemText)
Description copied from interface: HasFastMSTreeItems
Adds a child tree item containing the specified text.

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

addItem

public FastMSTreeItem addItem(com.google.gwt.user.client.ui.Widget widget)
Description copied from interface: HasFastMSTreeItems
Adds a child 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

becomeInteriorNode

public void becomeInteriorNode()
Become an interior node.


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.

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

getControlImageWidth

public int getControlImageWidth()
Returns the width of the control open/close image. Must be overridden if the TreeItem is using a control image that is not 16 pixels wide.

Returns:
the width of the control image

getHTML

public java.lang.String getHTML()
Specified by:
getHTML in interface com.google.gwt.user.client.ui.HasHTML

getParentItem

public FastMSTreeItem getParentItem()
Gets this item's parent.

Returns:
the parent item

getText

public java.lang.String getText()
Specified by:
getText in interface com.google.gwt.user.client.ui.HasText

getTree

public final FastMSTree getTree()
Gets the tree that contains this item.

Returns:
the containing tree

getWidget

public com.google.gwt.user.client.ui.Widget getWidget()
Gets the Widget associated with this tree item.


hasBeenOpened

public boolean hasBeenOpened()
Has this FastMSTreeItem ever been opened?

Returns:
whether the FastMSTreeItem has ever been opened.

isInteriorNode

public boolean isInteriorNode()
Does this FastMSTreeItem represent an interior node?


isLeafNode

public boolean isLeafNode()
Is this FastMSTreeItem a leaf node?


isOpen

public boolean isOpen()
Is the FastMSTreeItem open? Returns false if the FastMSTreeItem is closed or a leaf node.


isSelected

public boolean isSelected()
Determines whether this item is currently selected.

Returns:
true if it is selected

isShowing

public boolean isShowing()
Returns whether the tree is currently showing this FastMSTreeItem.


remove

public void remove()
Removes this item from its tree.


getTotalSize

public int getTotalSize()

removeItem

public void removeItem(FastMSTreeItem item)
Removes an item from the tree. Note, tree items do not automatically become a leaf node again if the last child is removed. (

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

removeItems

public void removeItems()
Removes all of this item's children.


setHTML

public void setHTML(java.lang.String html)
Specified by:
setHTML in interface com.google.gwt.user.client.ui.HasHTML

setState

public final void setState(boolean open)
Sets whether this item's children are displayed.

Parameters:
open - whether the item is open

setState

public void setState(boolean open,
                     boolean fireEvents)
Sets whether this item's children are displayed.

Parameters:
open - whether the item is open
fireEvents - true to allow open/close events to be fired

expandAll

public void expandAll()

collapseAll

public void collapseAll()

setText

public void setText(java.lang.String text)
Specified by:
setText in interface com.google.gwt.user.client.ui.HasText

setWidget

public void setWidget(com.google.gwt.user.client.ui.Widget widget)

afterClose

protected void afterClose()
Called after the tree item is closed.


afterOpen

protected void afterOpen()
Called after the tree item is opened.


beforeClose

protected void beforeClose()
Called before the tree item is closed.


beforeOpen

protected void beforeOpen()
Called before the tree item is opened.


beforeSelectionLost

protected boolean beforeSelectionLost()
Called when tree item is being unselected. Returning false cancels the unselection.


ensureChildren

protected void ensureChildren()
Fired when a tree item receives a request to open for the first time. Should be overridden in child clases.


getFocusableWidget

protected com.google.gwt.user.client.ui.HasFocus getFocusableWidget()
Returns the widget, if any, that should be focused on if this TreeItem is selected.

Returns:
widget to be focused.

onSelected

protected void onSelected()
Called when a tree item is selected.


getChildren

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

setElementNode

public void setElementNode(com.tensegrity.palo.gwt.core.client.models.palo.XElementNode nd)

getElementNode

public com.tensegrity.palo.gwt.core.client.models.palo.XElementNode getElementNode()