Interface ITreeitem
- All Superinterfaces:
IComponent<ITreeitem>,IComposite<ITreeitem,,ITreeitemComposite> IDisable<ITreeitem>,IHtmlBasedComponent<ITreeitem>,IXulElement<ITreeitem>
Treeitem component
Treeitem contains a row of data (treerow), and an optional treechildren.
If the component doesn't contain a treechildren, it is a leaf node that doesn't accept any child items.
If it contains a treechildren, it is a branch node that might contain other items.
For a branch node, an +/- button will appear at the beginning of the row,
such that user could open and close the item by clicking on the +/- button.
Support @Action
| Name | Action Type |
|---|---|
| onOpen | ActionData: OpenData
Denotes user has opened or closed a component. It is useful to implement load-on-demand by listening to the onOpen action, and creating components when the first time the component is opened. |
- Author:
- jumperchen
- See Also:
-
Treeitem
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilds instances of typeITreeitem.static classBuilds an updater of typeITreeitemforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetHflex()Return horizontal flex hint of this component.default StringgetImage()Returns the image of the firstITreecellit contains.default intgetIndex()Return the index of this itemdefault StringgetLabel()Returns the label of the firstITreecellit contains.Returns the treechildren that this tree item owns, or null if doesn't have any child.Returns the treerow that this tree item owns (might null).default StringReturns the client widget class.default StringgetWidth()Returns the width of the component.default booleanReturns whether the component is to act as a container which can have sublevel items.default booleanisEmpty()Returns whether to contain any sublevel tree items or not.default booleanisLoaded()Return true whether all children of this tree item, if any, is loaded at clientdefault booleanisOpen()Returns whether this container is open.default booleanReturns true whether this tree item is rendered at client.default booleanReturns whether it is selectable.default booleanReturns whether this item is selected.static ITreeitemReturns the instance with the given label.static ITreeitemReturns the instance with the given label and all sublevel items.static ITreeitemReturns the instance with the given label and all sublevel items.static ITreeitemReturns the instance with the given id.static ITreeitemofTreecells(Iterable<? extends ITreecell<IAnyGroup>> treecells) Returns the instance with the given tree cells.static ITreeitemofTreecells(ITreecell<IAnyGroup>... treecells) Returns the instance with the given tree cells.static ITreeitemReturns the instance with the given treerow.default ITreeitemwithAllComponents(Iterable<? extends ITreeitemComposite> elements) Copy the current immutable object with elements that replace the content ofchildren.default ITreeitemReturns a copy ofthisimmutable component with the specifiedimage.withIndex(int index) Returns a copy ofthisimmutable component with the specifiedindex.Returns a copy ofthisimmutable component with the specifiedlabel.withOpen(boolean open) Returns a copy ofthisimmutable component with the specifiedopen.withSelectable(boolean selectable) Returns a copy ofthisimmutable component with the specifiedselectable.withSelected(boolean selected) Returns a copy ofthisimmutable component with the specifiedselected.withTreechildren(ITreechildren treechildren) Returns a copy ofthisimmutable component with the specifiedtreechildren.withTreerow(ITreerow treerow) Returns a copy ofthisimmutable component with the specifiedtreerow.default ITreeitemMethods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IDisable
isDisabled, withDisabledMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.sel.Treeitem"- Specified by:
getWidgetClassin interfaceIComponent<ITreeitem>
-
getWidth
Description copied from interface:IHtmlBasedComponentReturns the width of the component. If not specified,nullis assumed.Default:
null- Specified by:
getWidthin interfaceIHtmlBasedComponent<ITreeitem>
-
withWidth
- Specified by:
withWidthin interfaceIHtmlBasedComponent<ITreeitem>- Parameters:
width- The width of the component.Default:
null- Returns:
- A modified copy of the
thisobject
-
getHflex
Description copied from interface:IHtmlBasedComponentReturn horizontal flex hint of this component.Default:
null- Specified by:
getHflexin interfaceIHtmlBasedComponent<ITreeitem>
-
withHflex
- Specified by:
withHflexin interfaceIHtmlBasedComponent<ITreeitem>- Parameters:
hflex- The horizontal flex hint.Default:
null- Returns:
- A modified copy of the
thisobject
-
withAllComponents
Description copied from interface:ICompositeCopy the current immutable object with elements that replace the content ofchildren. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Specified by:
withAllComponentsin interfaceIComposite<ITreeitem,ITreeitemComposite> - Parameters:
elements- An iterable of children elements to set- Returns:
- A modified copy of
thisobject
-
getTreerow
Returns the treerow that this tree item owns (might null). Each tree items has exactly one tree row. -
withTreerow
Returns a copy ofthisimmutable component with the specifiedtreerow.Sets the treerow as a child to this component
- Parameters:
treerow- The treerow child.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getTreechildren
Returns the treechildren that this tree item owns, or null if doesn't have any child. -
withTreechildren
Returns a copy ofthisimmutable component with the specifiedtreechildren.Sets the treechildren as a child to this component
- Parameters:
treechildren- The treechildren child.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getIndex
default int getIndex()Return the index of this itemDefault:
-1, meaning not set -
withIndex
Returns a copy ofthisimmutable component with the specifiedindex.Sets the index of this component.
- Parameters:
index- The index of the child from its parent component.Default:
-1, meaning not set.- Returns:
- A modified copy of the
thisobject
-
getImage
Returns the image of the firstITreecellit contains.Default:
null -
withImage
Returns a copy ofthisimmutable component with the specifiedimage.Sets the image of the first
ITreecellit contains.If treerow and treecell are not created, this method create them automatically.
- Parameters:
image- The image of the firstITreecellit contains.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getLabel
Returns the label of the firstITreecellit contains.Default:
null -
withLabel
Returns a copy ofthisimmutable component with the specifiedlabel.Sets the label of the first
ITreecellit contains.If treerow and treecell are not created, this method create them automatically.
- Parameters:
label- The label of the firstITreecellit contains.Default:
null.- Returns:
- A modified copy of the
thisobject
-
isOpen
default boolean isOpen()Returns whether this container is open.Default:
true. -
withOpen
Returns a copy ofthisimmutable component with the specifiedopen.Sets whether this container is open.
- Parameters:
open-falseto hide all sublevel items.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isSelected
default boolean isSelected()Returns whether this item is selected.Default:
false -
withSelected
Returns a copy ofthisimmutable component with the specifiedselected.Sets whether the component is selected.
- Parameters:
selected-trueto select this component.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isLoaded
default boolean isLoaded()Return true whether all children of this tree item, if any, is loaded at clientDefault:
false -
isSelectable
default boolean isSelectable()Returns whether it is selectable.Default:
true. -
isContainer
@Lazy default boolean isContainer()Returns whether the component is to act as a container which can have sublevel items. -
isEmpty
@Lazy default boolean isEmpty()Returns whether to contain any sublevel tree items or not. -
withSelectable
Returns a copy ofthisimmutable component with the specifiedselectable.If the tree is in a checkmark mode, the selectable state will affect the checkable icon to display or not.
- Parameters:
selectable-falseto indicate the checkable icon is not displayed.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isRendered
default boolean isRendered()Returns true whether this tree item is rendered at client. UnlikeisLoaded()which is used to check whether all children of this tree item are loaded.Default:
true -
of
Returns the instance with the given label.- Parameters:
label- The label that the first tree cell holds.
-
of
Returns the instance with the given label and all sublevel items.- Parameters:
label- The label that the first tree cell holds.items- All sublevel items belong to this item
-
of
Returns the instance with the given label and all sublevel items.- Parameters:
label- The label that the first tree cell holds.items- All sublevel items belong to this item
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-
ofTreerow
Returns the instance with the given treerow.- Parameters:
treerow- The treerow belongs to this component.
-
ofTreecells
Returns the instance with the given tree cells.- Parameters:
treecells- All tree cells belong to this component.
-
ofTreecells
Returns the instance with the given tree cells.- Parameters:
treecells- All tree cells belong to this component.
-