Interface ITreeitem
-
- All Superinterfaces:
IComponent<ITreeitem>,IComposite<ITreeitem,ITreeitemComposite>,IDisable<ITreeitem>,IHtmlBasedComponent<ITreeitem>,IXulElement<ITreeitem>
public interface ITreeitem extends IXulElement<ITreeitem>, IDisable<ITreeitem>, IComposite<ITreeitem,ITreeitemComposite>
ImmutableTreeitemcomponentTreeitem 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 Classes Modifier and Type Interface Description static classITreeitem.BuilderBuilds instances of typeITreeitem.static classITreeitem.UpdaterBuilds an updater of typeITreeitemforUiAgent.smartUpdate(Locator, SmartUpdater).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.StringgetHflex()Return horizontal flex hint of this component.default java.lang.StringgetImage()Returns the image of the firstITreecellit contains.default intgetIndex()Return the index of this itemdefault java.lang.StringgetLabel()Returns the label of the firstITreecellit contains.ITreechildrengetTreechildren()Returns the treechildren that this tree item owns, or null if doesn't have any child.ITreerowgetTreerow()Returns the treerow that this tree item owns (might null).default java.lang.StringgetWidgetClass()Returns the client widget class.default java.lang.StringgetWidth()Returns the width of the component.default booleanisContainer()Returns 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 booleanisRendered()Returns true whether this tree item is rendered at client.default booleanisSelectable()Returns whether it is selectable.default booleanisSelected()Returns whether this item is selected.static ITreeitemof(java.lang.String label)Returns the instance with the given label.static ITreeitemof(java.lang.String label, java.lang.Iterable<? extends ITreeitem> items)Returns the instance with the given label and all sublevel items.static ITreeitemof(java.lang.String label, ITreeitem... items)Returns the instance with the given label and all sublevel items.static ITreeitemofId(java.lang.String id)Returns the instance with the given id.static ITreeitemofTreecells(java.lang.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 ITreeitemofTreerow(ITreerow treerow)Returns the instance with the given treerow.default ITreeitemwithAllComponents(java.lang.Iterable<? extends ITreeitemComposite> elements)Copy the current immutable object with elements that replace the content ofchildren.default ITreeitemwithHflex(java.lang.String hflex)ITreeitemwithImage(java.lang.String image)Returns a copy ofthisimmutable component with the specifiedimage.ITreeitemwithIndex(int index)Returns a copy ofthisimmutable component with the specifiedindex.ITreeitemwithLabel(java.lang.String label)Returns a copy ofthisimmutable component with the specifiedlabel.ITreeitemwithOpen(boolean open)Returns a copy ofthisimmutable component with the specifiedopen.ITreeitemwithSelectable(boolean selectable)Returns a copy ofthisimmutable component with the specifiedselectable.ITreeitemwithSelected(boolean selected)Returns a copy ofthisimmutable component with the specifiedselected.ITreeitemwithTreechildren(ITreechildren treechildren)Returns a copy ofthisimmutable component with the specifiedtreechildren.ITreeitemwithTreerow(ITreerow treerow)Returns a copy ofthisimmutable component with the specifiedtreerow.default ITreeitemwithWidth(java.lang.String width)-
Methods 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, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IDisable
isDisabled, withDisabled
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withZclass, withZIndex
-
Methods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
-
-
-
Field Detail
-
DEFAULT
static final ITreeitem DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zul.sel.Treeitem"- Specified by:
getWidgetClassin interfaceIComponent<ITreeitem>
-
getWidth
@Derived @Nullable default java.lang.String getWidth()
Description copied from interface:IHtmlBasedComponentReturns the width of the component. If not specified,nullis assumed.Default:
null- Specified by:
getWidthin interfaceIHtmlBasedComponent<ITreeitem>
-
withWidth
default ITreeitem withWidth(@Nullable java.lang.String width)
- Specified by:
withWidthin interfaceIHtmlBasedComponent<ITreeitem>- Parameters:
width- The width of the component.Default:
null- Returns:
- A modified copy of the
thisobject
-
getHflex
@Derived @Nullable default java.lang.String getHflex()
Description copied from interface:IHtmlBasedComponentReturn horizontal flex hint of this component.Default:
null- Specified by:
getHflexin interfaceIHtmlBasedComponent<ITreeitem>
-
withHflex
default ITreeitem withHflex(@Nullable java.lang.String hflex)
- Specified by:
withHflexin interfaceIHtmlBasedComponent<ITreeitem>- Parameters:
hflex- The horizontal flex hint.Default:
null- Returns:
- A modified copy of the
thisobject
-
withAllComponents
default ITreeitem withAllComponents(java.lang.Iterable<? extends ITreeitemComposite> elements)
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
@Nullable ITreerow getTreerow()
Returns the treerow that this tree item owns (might null). Each tree items has exactly one tree row.
-
withTreerow
ITreeitem withTreerow(@Nullable ITreerow treerow)
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
@Nullable ITreechildren getTreechildren()
Returns the treechildren that this tree item owns, or null if doesn't have any child.
-
withTreechildren
ITreeitem withTreechildren(@Nullable ITreechildren treechildren)
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
ITreeitem withIndex(int index)
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
@Nullable default java.lang.String getImage()
Returns the image of the firstITreecellit contains.Default:
null
-
withImage
ITreeitem withImage(@Nullable java.lang.String image)
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
@Nullable default java.lang.String getLabel()
Returns the label of the firstITreecellit contains.Default:
null
-
withLabel
ITreeitem withLabel(@Nullable java.lang.String label)
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
ITreeitem withOpen(boolean open)
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
ITreeitem withSelected(boolean selected)
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
ITreeitem withSelectable(boolean selectable)
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
static ITreeitem of(java.lang.String label)
Returns the instance with the given label.- Parameters:
label- The label that the first tree cell holds.
-
of
static ITreeitem of(java.lang.String label, ITreeitem... items)
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
static ITreeitem of(java.lang.String label, java.lang.Iterable<? extends ITreeitem> items)
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
static ITreeitem ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-
ofTreerow
static ITreeitem ofTreerow(ITreerow treerow)
Returns the instance with the given treerow.- Parameters:
treerow- The treerow belongs to this component.
-
ofTreecells
static ITreeitem ofTreecells(ITreecell<IAnyGroup>... treecells)
Returns the instance with the given tree cells.- Parameters:
treecells- All tree cells belong to this component.
-
-