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>
ImmutableTreeitem
componentTreeitem 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 class
ITreeitem.Builder
Builds instances of typeITreeitem
.static class
ITreeitem.Updater
Builds an updater of typeITreeitem
forUiAgent.smartUpdate(Locator, SmartUpdater)
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.String
getHflex()
Return horizontal flex hint of this component.default java.lang.String
getImage()
Returns the image of the firstITreecell
it contains.default int
getIndex()
Return the index of this itemdefault java.lang.String
getLabel()
Returns the label of the firstITreecell
it contains.ITreechildren
getTreechildren()
Returns the treechildren that this tree item owns, or null if doesn't have any child.ITreerow
getTreerow()
Returns the treerow that this tree item owns (might null).default java.lang.String
getWidgetClass()
Returns the client widget class.default java.lang.String
getWidth()
Returns the width of the component.default boolean
isContainer()
Returns whether the component is to act as a container which can have sublevel items.default boolean
isEmpty()
Returns whether to contain any sublevel tree items or not.default boolean
isLoaded()
Return true whether all children of this tree item, if any, is loaded at clientdefault boolean
isOpen()
Returns whether this container is open.default boolean
isRendered()
Returns true whether this tree item is rendered at client.default boolean
isSelectable()
Returns whether it is selectable.default boolean
isSelected()
Returns whether this item is selected.static ITreeitem
of(java.lang.String label)
Returns the instance with the given label.static ITreeitem
of(java.lang.String label, java.lang.Iterable<? extends ITreeitem> items)
Returns the instance with the given label and all sublevel items.static ITreeitem
of(java.lang.String label, ITreeitem... items)
Returns the instance with the given label and all sublevel items.static ITreeitem
ofId(java.lang.String id)
Returns the instance with the given id.static ITreeitem
ofTreecells(java.lang.Iterable<? extends ITreecell<IAnyGroup>> treecells)
Returns the instance with the given tree cells.static ITreeitem
ofTreecells(ITreecell<IAnyGroup>... treecells)
Returns the instance with the given tree cells.static ITreeitem
ofTreerow(ITreerow treerow)
Returns the instance with the given treerow.default ITreeitem
withAllComponents(java.lang.Iterable<? extends ITreeitemComposite> elements)
Copy the current immutable object with elements that replace the content ofchildren
.default ITreeitem
withHflex(java.lang.String hflex)
ITreeitem
withImage(java.lang.String image)
Returns a copy ofthis
immutable component with the specifiedimage
.ITreeitem
withIndex(int index)
Returns a copy ofthis
immutable component with the specifiedindex
.ITreeitem
withLabel(java.lang.String label)
Returns a copy ofthis
immutable component with the specifiedlabel
.ITreeitem
withOpen(boolean open)
Returns a copy ofthis
immutable component with the specifiedopen
.ITreeitem
withSelectable(boolean selectable)
Returns a copy ofthis
immutable component with the specifiedselectable
.ITreeitem
withSelected(boolean selected)
Returns a copy ofthis
immutable component with the specifiedselected
.ITreeitem
withTreechildren(ITreechildren treechildren)
Returns a copy ofthis
immutable component with the specifiedtreechildren
.ITreeitem
withTreerow(ITreerow treerow)
Returns a copy ofthis
immutable component with the specifiedtreerow
.default ITreeitem
withWidth(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:
getWidgetClass
in interfaceIComponent<ITreeitem>
-
getWidth
@Derived @Nullable default java.lang.String getWidth()
Description copied from interface:IHtmlBasedComponent
Returns the width of the component. If not specified,null
is assumed.Default:
null
- Specified by:
getWidth
in interfaceIHtmlBasedComponent<ITreeitem>
-
withWidth
default ITreeitem withWidth(@Nullable java.lang.String width)
- Specified by:
withWidth
in interfaceIHtmlBasedComponent<ITreeitem>
- Parameters:
width
- The width of the component.Default:
null
- Returns:
- A modified copy of the
this
object
-
getHflex
@Derived @Nullable default java.lang.String getHflex()
Description copied from interface:IHtmlBasedComponent
Return horizontal flex hint of this component.Default:
null
- Specified by:
getHflex
in interfaceIHtmlBasedComponent<ITreeitem>
-
withHflex
default ITreeitem withHflex(@Nullable java.lang.String hflex)
- Specified by:
withHflex
in interfaceIHtmlBasedComponent<ITreeitem>
- Parameters:
hflex
- The horizontal flex hint.Default:
null
- Returns:
- A modified copy of the
this
object
-
withAllComponents
default ITreeitem withAllComponents(java.lang.Iterable<? extends ITreeitemComposite> elements)
Description copied from interface:IComposite
Copy 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:
withAllComponents
in interfaceIComposite<ITreeitem,ITreeitemComposite>
- Parameters:
elements
- An iterable of children elements to set- Returns:
- A modified copy of
this
object
-
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 ofthis
immutable 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
this
object
-
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 ofthis
immutable 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
this
object
-
getIndex
default int getIndex()
Return the index of this itemDefault:
-1
, meaning not set
-
withIndex
ITreeitem withIndex(int index)
Returns a copy ofthis
immutable 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
this
object
-
getImage
@Nullable default java.lang.String getImage()
Returns the image of the firstITreecell
it contains.Default:
null
-
withImage
ITreeitem withImage(@Nullable java.lang.String image)
Returns a copy ofthis
immutable component with the specifiedimage
.Sets the image of the first
ITreecell
it contains.If treerow and treecell are not created, this method create them automatically.
- Parameters:
image
- The image of the firstITreecell
it contains.Default:
null
.- Returns:
- A modified copy of the
this
object
-
getLabel
@Nullable default java.lang.String getLabel()
Returns the label of the firstITreecell
it contains.Default:
null
-
withLabel
ITreeitem withLabel(@Nullable java.lang.String label)
Returns a copy ofthis
immutable component with the specifiedlabel
.Sets the label of the first
ITreecell
it contains.If treerow and treecell are not created, this method create them automatically.
- Parameters:
label
- The label of the firstITreecell
it contains.Default:
null
.- Returns:
- A modified copy of the
this
object
-
isOpen
default boolean isOpen()
Returns whether this container is open.Default:
true
.
-
withOpen
ITreeitem withOpen(boolean open)
Returns a copy ofthis
immutable component with the specifiedopen
.Sets whether this container is open.
- Parameters:
open
-false
to hide all sublevel items.Default:
true
.- Returns:
- A modified copy of the
this
object
-
isSelected
default boolean isSelected()
Returns whether this item is selected.Default:
false
-
withSelected
ITreeitem withSelected(boolean selected)
Returns a copy ofthis
immutable component with the specifiedselected
.Sets whether the component is selected.
- Parameters:
selected
-true
to select this component.Default:
false
.- Returns:
- A modified copy of the
this
object
-
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 ofthis
immutable 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
-false
to indicate the checkable icon is not displayed.Default:
true
.- Returns:
- A modified copy of the
this
object
-
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.
-
ofId
static ITreeitem ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id
- The id to identify this component
-
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
-
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.
-
-