Class Listitem
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zul.Listitem
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,org.zkoss.zk.ui.Component
,org.zkoss.zk.ui.ext.Scope
,org.zkoss.zk.ui.sys.ComponentCtrl
- Direct Known Subclasses:
Listgroup
,Listgroupfoot
public class Listitem extends XulElement
A list item.Default
getZclass()
: z-listitem (since 5.0.0)- Author:
- tomyeh
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Listitem.ExtraCtrl
A utility class to implementHtmlBasedComponent.getExtraCtrl()
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addMoved(org.zkoss.zk.ui.Component oldparent, org.zkoss.zk.ui.Page oldpg, org.zkoss.zk.ui.Page newpg)
void
beforeChildAdded(org.zkoss.zk.ui.Component child, org.zkoss.zk.ui.Component refChild)
void
beforeParentChanged(org.zkoss.zk.ui.Component parent)
java.lang.Object
clone()
java.lang.Object
getExtraCtrl()
java.lang.String
getImage()
Returns the image of theListcell
it contains.int
getIndex()
Returns the index of this item (a.k.a., the order in the listbox).java.lang.String
getLabel()
Returns the label of theListcell
it contains, or null if no such cell.Listbox
getListbox()
Returns the list box that it belongs to.Listgroup
getListgroup()
Returns the listgroup that this item belongs to, or null.int
getMaxlength()
Returns the maximal length of each item's label.java.lang.String
getMold()
org.zkoss.zk.ui.sys.PropertyAccess
getPropertyAccess(java.lang.String prop)
java.lang.String
getSrc()
Deprecated.As of release 3.5.0, it is redundant since it is the samegetImage()
.<T> T
getValue()
Returns the value.java.lang.String
getZclass()
boolean
isCheckable()
Deprecated.As of release 8.0.0, please useisSelectable()
boolean
isDisabled()
Returns whether it is disabled.boolean
isLoaded()
Returns whether the content of this item is loaded.boolean
isSelectable()
Returns whether it is selectable.boolean
isSelected()
Returns whether it is selected.protected void
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
void
setCheckable(boolean checkable)
Deprecated.As of release 8.0.0, please usesetSelectable(boolean)
void
setDisabled(boolean disabled)
Sets whether it is disabled.void
setHflex(java.lang.String flex)
Deprecated.as of release 6.0.0.void
setImage(java.lang.String image)
Sets the image of theListcell
it contains.protected void
setIndex(int index)
void
setLabel(java.lang.String label)
Sets the label of theListcell
it contains.void
setSelectable(boolean selectable)
Sets whether it is selectable.void
setSelected(boolean selected)
Sets whether it is selected.void
setSrc(java.lang.String src)
Deprecated.As of release 3.5.0, it is redundant since it is the samegetSrc()
.void
setStubonly(boolean stubonly)
Deprecated.as of release 7.0.3.void
setStubonly(java.lang.String stubonly)
Deprecated.as of release 7.0.3.<T> void
setValue(T value)
Sets the value.boolean
setVisible(boolean visible)
void
setWidth(java.lang.String width)
Deprecated.as of release 6.0.0.protected void
smartUpdate(java.lang.String name, boolean value)
protected void
smartUpdate(java.lang.String name, int value)
protected void
smartUpdate(java.lang.String name, java.lang.Object value)
-
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
-
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getListenerIterator, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, invalidatePartial, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setSubBindingAnnotationCount, setTemplate, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
Method Detail
-
getListbox
public Listbox getListbox()
Returns the list box that it belongs to.It is the same as
AbstractComponent.getParent()
.
-
getListgroup
public Listgroup getListgroup()
Returns the listgroup that this item belongs to, or null.- Since:
- 3.5.0
-
getZclass
public java.lang.String getZclass()
- Overrides:
getZclass
in classorg.zkoss.zk.ui.HtmlBasedComponent
-
isCheckable
public boolean isCheckable()
Deprecated.As of release 8.0.0, please useisSelectable()
-
setCheckable
public void setCheckable(boolean checkable)
Deprecated.As of release 8.0.0, please usesetSelectable(boolean)
-
isSelectable
public boolean isSelectable()
Returns whether it is selectable.Default: true.
- Since:
- 8.0.0
-
setSelectable
public void setSelectable(boolean selectable)
Sets whether it is selectable.If the listbox is in a checkmark mode, the selectable state will affect the checkable icon to display or not.
Default: true.
- Parameters:
selectable
-
-
getMaxlength
public int getMaxlength()
Returns the maximal length of each item's label. It is a shortcut of getParent().getMaxlength(); Thus, it works only if the listbox's mold is "select".
-
getValue
public <T> T getValue()
Returns the value.Default: null.
Note: the value is application dependent, you can place whatever value you want.
If you are using listitem with HTML Form (and with the name attribute), it is better to specify a String-typed value.
-
setValue
public <T> void setValue(T value)
Sets the value.- Parameters:
value
- the value.Note: the value is application dependent, you can place whatever value you want.
If you are using listitem with HTML Form (and with the name attribute), it is better to specify a String-typed value.
-
setStubonly
public void setStubonly(java.lang.String stubonly)
Deprecated.as of release 7.0.3.- Specified by:
setStubonly
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
setStubonly
in classorg.zkoss.zk.ui.AbstractComponent
-
setStubonly
public void setStubonly(boolean stubonly)
Deprecated.as of release 7.0.3.- Specified by:
setStubonly
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
setStubonly
in classorg.zkoss.zk.ui.AbstractComponent
-
isDisabled
public boolean isDisabled()
Returns whether it is disabled.Default: false.
-
setDisabled
public void setDisabled(boolean disabled)
Sets whether it is disabled.
-
isSelected
public boolean isSelected()
Returns whether it is selected.Default: false.
-
setSelected
public void setSelected(boolean selected)
Sets whether it is selected.
-
getLabel
public java.lang.String getLabel()
Returns the label of theListcell
it contains, or null if no such cell.
-
setLabel
public void setLabel(java.lang.String label)
Sets the label of theListcell
it contains.If it is not created, we automatically create it.
-
getSrc
public java.lang.String getSrc()
Deprecated.As of release 3.5.0, it is redundant since it is the samegetImage()
.
-
setSrc
public void setSrc(java.lang.String src)
Deprecated.As of release 3.5.0, it is redundant since it is the samegetSrc()
.
-
getImage
public java.lang.String getImage()
Returns the image of theListcell
it contains.
-
setImage
public void setImage(java.lang.String image)
Sets the image of theListcell
it contains.If it is not created, we automatically create it.
-
getIndex
public int getIndex()
Returns the index of this item (a.k.a., the order in the listbox).
-
isLoaded
public boolean isLoaded()
Returns whether the content of this item is loaded. It is meaningful only ifgetListbox()
is live data, i.e.,Listbox.getModel()
is not null.- Since:
- 2.4.0
-
setIndex
protected void setIndex(int index)
-
setVisible
public boolean setVisible(boolean visible)
- Specified by:
setVisible
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
setVisible
in classorg.zkoss.zk.ui.AbstractComponent
-
smartUpdate
protected void smartUpdate(java.lang.String name, java.lang.Object value)
- Overrides:
smartUpdate
in classorg.zkoss.zk.ui.AbstractComponent
-
smartUpdate
protected void smartUpdate(java.lang.String name, boolean value)
- Overrides:
smartUpdate
in classorg.zkoss.zk.ui.AbstractComponent
-
smartUpdate
protected void smartUpdate(java.lang.String name, int value)
- Overrides:
smartUpdate
in classorg.zkoss.zk.ui.AbstractComponent
-
getMold
public java.lang.String getMold()
- Specified by:
getMold
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
getMold
in classorg.zkoss.zk.ui.AbstractComponent
-
setWidth
public void setWidth(java.lang.String width)
Deprecated.as of release 6.0.0. To control the size of Listbox related components, please refer toListbox
andListheader
instead.- Overrides:
setWidth
in classorg.zkoss.zk.ui.HtmlBasedComponent
-
setHflex
public void setHflex(java.lang.String flex)
Deprecated.as of release 6.0.0. To control the size of Listbox related components, please refer toListbox
andListheader
instead.- Overrides:
setHflex
in classorg.zkoss.zk.ui.HtmlBasedComponent
-
renderProperties
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException
- Overrides:
renderProperties
in classXulElement
- Throws:
java.io.IOException
-
addMoved
protected void addMoved(org.zkoss.zk.ui.Component oldparent, org.zkoss.zk.ui.Page oldpg, org.zkoss.zk.ui.Page newpg)
- Overrides:
addMoved
in classorg.zkoss.zk.ui.AbstractComponent
-
getPropertyAccess
public org.zkoss.zk.ui.sys.PropertyAccess getPropertyAccess(java.lang.String prop)
- Specified by:
getPropertyAccess
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
getPropertyAccess
in classXulElement
-
beforeParentChanged
public void beforeParentChanged(org.zkoss.zk.ui.Component parent)
- Specified by:
beforeParentChanged
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
beforeParentChanged
in classorg.zkoss.zk.ui.AbstractComponent
-
beforeChildAdded
public void beforeChildAdded(org.zkoss.zk.ui.Component child, org.zkoss.zk.ui.Component refChild)
- Specified by:
beforeChildAdded
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
beforeChildAdded
in classorg.zkoss.zk.ui.AbstractComponent
-
clone
public java.lang.Object clone()
- Specified by:
clone
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
clone
in classXulElement
-
getExtraCtrl
public java.lang.Object getExtraCtrl()
- Specified by:
getExtraCtrl
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
getExtraCtrl
in classorg.zkoss.zk.ui.HtmlBasedComponent
-
-