org.zkoss.zul
Class Listitem

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.Listitem
All Implemented Interfaces:
Serializable, 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
protected  class Listitem.ExtraCtrl
          A utility class to implement HtmlBasedComponent.getExtraCtrl().
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children
 
Field Summary
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclass
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Listitem()
           
Listitem(String label)
           
Listitem(String label, T value)
           
 
Method Summary
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)
           
 Object clone()
           
 Object getExtraCtrl()
           
 String getImage()
          Returns the image of the Listcell it contains.
 int getIndex()
          Returns the index of this item (a.k.a., the order in the listbox).
 String getLabel()
          Returns the label of the Listcell 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.
 String getMold()
           
 String getSrc()
          Deprecated. As of release 3.5.0, it is redundant since it is the same getImage().
<T> T
getValue()
          Returns the value.
 String getZclass()
           
 boolean isCheckable()
          Returns whether it is checkable.
 boolean isDisabled()
          Returns whether it is disabled.
 boolean isLoaded()
          Returns whether the content of this item is loaded.
 boolean isSelected()
          Returns whether it is selected.
protected  void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
           
 void setCheckable(boolean checkable)
          Sets whether it is checkable.
 void setDisabled(boolean disabled)
          Sets whether it is disabled.
 void setHflex(String flex)
          Deprecated. as of release 6.0.0. To control the size of Listbox related components, please refer to Listbox and Listheader instead.
 void setImage(String image)
          Sets the image of the Listcell it contains.
protected  void setIndex(int index)
           
 void setLabel(String label)
          Sets the label of the Listcell it contains.
 void setSelected(boolean selected)
          Sets whether it is selected.
 void setSrc(String src)
          Deprecated. As of release 3.5.0, it is redundant since it is the same getSrc().
<T> void
setValue(T value)
          Sets the value.
 boolean setVisible(boolean visible)
           
 void setWidth(String width)
          Deprecated. as of release 6.0.0. To control the size of Listbox related components, please refer to Listbox and Listheader instead.
protected  void smartUpdate(String name, boolean value)
           
protected  void smartUpdate(String name, int value)
           
protected  void smartUpdate(String name, Object value)
           
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addScopeListener, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setTemplate, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Listitem

public Listitem()

Listitem

public Listitem(String label)

Listitem

public Listitem(String label,
                T value)
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 String getZclass()
Overrides:
getZclass in class org.zkoss.zk.ui.HtmlBasedComponent

isCheckable

public boolean isCheckable()
Returns whether it is checkable.

Default: true.

Since:
3.0.4

setCheckable

public void setCheckable(boolean checkable)
Sets whether it is checkable.

Note that it is only applied when isCheckmark() of Listbox is true.

Default: true.

Since:
3.0.4

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.


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 String getLabel()
Returns the label of the Listcell it contains, or null if no such cell.


setLabel

public void setLabel(String label)
Sets the label of the Listcell it contains.

If it is not created, we automatically create it.


getSrc

public String getSrc()
Deprecated. As of release 3.5.0, it is redundant since it is the same getImage().


setSrc

public void setSrc(String src)
Deprecated. As of release 3.5.0, it is redundant since it is the same getSrc().


getImage

public String getImage()
Returns the image of the Listcell it contains.


setImage

public void setImage(String image)
Sets the image of the Listcell 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 if getListbox() 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 interface org.zkoss.zk.ui.Component
Overrides:
setVisible in class org.zkoss.zk.ui.AbstractComponent

smartUpdate

protected void smartUpdate(String name,
                           Object value)
Overrides:
smartUpdate in class org.zkoss.zk.ui.AbstractComponent

smartUpdate

protected void smartUpdate(String name,
                           boolean value)
Overrides:
smartUpdate in class org.zkoss.zk.ui.AbstractComponent

smartUpdate

protected void smartUpdate(String name,
                           int value)
Overrides:
smartUpdate in class org.zkoss.zk.ui.AbstractComponent

getMold

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

setWidth

public void setWidth(String width)
Deprecated. as of release 6.0.0. To control the size of Listbox related components, please refer to Listbox and Listheader instead.

Overrides:
setWidth in class org.zkoss.zk.ui.HtmlBasedComponent

setHflex

public void setHflex(String flex)
Deprecated. as of release 6.0.0. To control the size of Listbox related components, please refer to Listbox and Listheader instead.

Overrides:
setHflex in class org.zkoss.zk.ui.HtmlBasedComponent

renderProperties

protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
                         throws IOException
Overrides:
renderProperties in class XulElement
Throws:
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 class org.zkoss.zk.ui.AbstractComponent

beforeParentChanged

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

beforeChildAdded

public void beforeChildAdded(org.zkoss.zk.ui.Component child,
                             org.zkoss.zk.ui.Component refChild)
Specified by:
beforeChildAdded in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
beforeChildAdded in class org.zkoss.zk.ui.AbstractComponent

clone

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

getExtraCtrl

public Object getExtraCtrl()
Specified by:
getExtraCtrl in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
getExtraCtrl in class org.zkoss.zk.ui.HtmlBasedComponent


Copyright © 2013. All rights reserved.