org.zkoss.zul
Class Treeitem

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.Treeitem
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.sys.ComponentCtrl

public class Treeitem
extends XulElement

A treeitem.

Event:

  1. onOpen is sent when a tree item is opened or closed by user.
  2. onDoubleClick is sent when user double-clicks the treeitem.
  3. onRightClick is sent when user right-clicks the treeitem.

Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
protected  class Treeitem.ExtraCtrl
          A utility class to implement AbstractComponent.getExtraCtrl().
 
Field Summary
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Constructor Summary
Treeitem()
           
Treeitem(java.lang.String label)
           
Treeitem(java.lang.String label, java.lang.Object value)
           
 
Method Summary
 java.lang.Object clone()
           
protected  java.lang.String getAllOnClickAttrs(boolean ignoreOnClick)
          Returns the attributes for onClick, onRightClick and onDoubleClick by checking whether the corresponding listeners are added, or null if none is added.
 java.lang.String getImage()
          Returns the image of the Treecell it contains.
 java.lang.String getLabel()
          Returns the label of the Treecell it contains, or null if no such cell.
 int getLevel()
          Returns the level this cell is.
 java.lang.String getSrc()
          Returns the src of the Treecell it contains, or null if no such cell.
 Tree getTree()
          Returns the tree owning this item.
 Treechildren getTreechildren()
          Returns the treechildren that this tree item owns, or null if doesn't have any child.
 Treeitem getTreeitem()
          Deprecated.  
 Treerow getTreerow()
          Returns the treerow that this tree item owns (might null).
 java.lang.Object getValue()
          Returns the value.
 boolean insertBefore(org.zkoss.zk.ui.Component child, org.zkoss.zk.ui.Component insertBefore)
           
 void invalidate()
           
protected  boolean isAsapRequired(java.lang.String evtnm)
           
 boolean isContainer()
          Returns whether the element is to act as a container which can have child elements.
 boolean isEmpty()
          Returns whether this element contains no child elements.
 boolean isOpen()
          Returns whether this container is open.
 boolean isSelected()
          Returns whether this item is selected.
protected  java.lang.Object newExtraCtrl()
           
 void onChildRemoved(org.zkoss.zk.ui.Component child)
           
 void setImage(java.lang.String image)
          Sets the image of the Treecell it contains.
 void setLabel(java.lang.String label)
          Sets the label of the Treecell it contains.
 void setOpen(boolean open)
          Sets whether this container is open.
 void setParent(org.zkoss.zk.ui.Component parent)
           
 void setSelected(boolean selected)
          Returns whether this item is selected.
 void setSrc(java.lang.String src)
          Sets the src of the Treecell it contains.
 void setValue(java.lang.Object value)
          Sets the value.
 void smartUpdate(java.lang.String attr, java.lang.String value)
           
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getAction, getContext, getInnerAttrs, getOuterAttrs, getPopup, getTooltip, setAction, setContext, setPopup, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addEventListener, appendAsapAttr, focus, getDraggable, getDroppable, getHeight, getLeft, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZIndex, removeEventListener, setClass, setDraggable, setDroppable, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, containsVariable, detach, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getEventHandler, getExtraCtrl, getFellow, getFellowIfAny, getId, getListenerIterator, getMold, getMoldURI, getNamespace, getPage, getParent, getPropagatee, getRoot, getSpaceOwner, getUuid, getVariable, isChildable, isListenerAvailable, isVisible, onChildAdded, onDrawNewChild, onWrongValue, redraw, removeAttribute, removeAttribute, removeChild, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setVariable, setVisible, smartUpdate, smartUpdate, toString, unsetVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Treeitem

public Treeitem()

Treeitem

public Treeitem(java.lang.String label)

Treeitem

public Treeitem(java.lang.String label,
                java.lang.Object value)
Method Detail

getTreerow

public Treerow getTreerow()
Returns the treerow that this tree item owns (might null). Each tree items has exactly one tree row.


getTreechildren

public Treechildren getTreechildren()
Returns the treechildren that this tree item owns, or null if doesn't have any child.


isContainer

public boolean isContainer()
Returns whether the element is to act as a container which can have child elements.


isEmpty

public boolean isEmpty()
Returns whether this element contains no child elements.


getValue

public java.lang.Object getValue()
Returns the value. It could be anything you want.

Default: null.

Note: the value is not sent to the browser, so it is OK to be anything.


setValue

public void setValue(java.lang.Object value)
Sets the value.

Parameters:
value - the value. Note: the value is not sent to the browser, so it is OK to be anything.

isOpen

public boolean isOpen()
Returns whether this container is open.

Default: true.


setOpen

public void setOpen(boolean open)
Sets whether this container is open.


isSelected

public boolean isSelected()
Returns whether this item is selected.


setSelected

public void setSelected(boolean selected)
Returns whether this item is selected.


getLevel

public int getLevel()
Returns the level this cell is. The root is level 0.


getLabel

public java.lang.String getLabel()
Returns the label of the Treecell it contains, or null if no such cell.


setLabel

public void setLabel(java.lang.String label)
Sets the label of the Treecell it contains.

If it is not created, we automatically create it.


getSrc

public java.lang.String getSrc()
Returns the src of the Treecell it contains, or null if no such cell.


setSrc

public void setSrc(java.lang.String src)
Sets the src of the Treecell it contains.

If it is not created, we automatically create it.

The same as setImage(java.lang.String).


getImage

public java.lang.String getImage()
Returns the image of the Treecell it contains.

The same as getImage().


setImage

public void setImage(java.lang.String image)
Sets the image of the Treecell it contains.

If it is not created, we automatically create it.

The same as setSrc(java.lang.String).


getTreeitem

public Treeitem getTreeitem()
Deprecated. 

Returns the nestest ancestor Treeitem, if any, or null if it is the top-level Treeitem. By top-level we mean the first level of a Tree.

Deprecated since 2.4.1, due to too confusing.


getTree

public Tree getTree()
Returns the tree owning this item.


getAllOnClickAttrs

protected java.lang.String getAllOnClickAttrs(boolean ignoreOnClick)
Returns the attributes for onClick, onRightClick and onDoubleClick by checking whether the corresponding listeners are added, or null if none is added.

Implementation Note: it is declared here to make it accessible by Treerow.

Overrides:
getAllOnClickAttrs in class XulElement
Parameters:
ignoreOnClick - whether to ignore onClick

isAsapRequired

protected boolean isAsapRequired(java.lang.String evtnm)
Overrides:
isAsapRequired in class org.zkoss.zk.ui.HtmlBasedComponent

smartUpdate

public void smartUpdate(java.lang.String attr,
                        java.lang.String value)
Specified by:
smartUpdate in interface org.zkoss.zk.ui.Component
Overrides:
smartUpdate in class org.zkoss.zk.ui.AbstractComponent

setParent

public void setParent(org.zkoss.zk.ui.Component parent)
Specified by:
setParent in interface org.zkoss.zk.ui.Component
Overrides:
setParent in class org.zkoss.zk.ui.AbstractComponent

insertBefore

public boolean insertBefore(org.zkoss.zk.ui.Component child,
                            org.zkoss.zk.ui.Component insertBefore)
Specified by:
insertBefore in interface org.zkoss.zk.ui.Component
Overrides:
insertBefore in class org.zkoss.zk.ui.AbstractComponent

onChildRemoved

public void onChildRemoved(org.zkoss.zk.ui.Component child)
Specified by:
onChildRemoved in interface org.zkoss.zk.ui.Component
Overrides:
onChildRemoved in class org.zkoss.zk.ui.AbstractComponent

invalidate

public void invalidate()
Specified by:
invalidate in interface org.zkoss.zk.ui.Component
Overrides:
invalidate in class org.zkoss.zk.ui.AbstractComponent

clone

public java.lang.Object clone()
Specified by:
clone in interface org.zkoss.zk.ui.Component
Overrides:
clone in class org.zkoss.zk.ui.AbstractComponent

newExtraCtrl

protected java.lang.Object newExtraCtrl()
Overrides:
newExtraCtrl in class org.zkoss.zk.ui.HtmlBasedComponent


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.