|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Listitem
public class Listitem
A list item.
Default getZclass(): z-list-item.(since 3.5.0)
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
HtmlBasedComponent.ExtraCtrl |
| Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
AbstractComponent.Children |
| Field Summary |
|---|
| Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
_zclass, RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH |
| Fields inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
_visible |
| Fields inherited from interface org.zkoss.zk.ui.Component |
|---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
| Constructor Summary | |
|---|---|
Listitem()
|
|
Listitem(java.lang.String label)
|
|
Listitem(java.lang.String label,
java.lang.Object value)
|
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clones the component. |
java.lang.String |
getImage()
Returns the image of the Listcell it contains. |
int |
getIndex()
Returns the index of this item (aka., the order in the listbox). |
java.lang.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. |
Listbox |
getListboxApi()
Returns the list box that it belongs to. |
Listgroup |
getListgroup()
Returns the listgroup that this item belongs to, or null. |
Listgroup |
getListgroupApi()
Returns the listgroup that this item belongs to, or null. |
int |
getMaxlength()
Returns the maximal length of each item's label. |
java.lang.String |
getOuterAttrs()
Returns the exterior attributes for generating the enclosing HTML tag; never return null. |
protected java.lang.String |
getRealSclass()
Returns the real style class that will be generated to the client (when HtmlBasedComponent.getOuterAttrs() is called). |
protected java.lang.String |
getRealStyle()
Returns the real style that will be generated to client (when HtmlBasedComponent.getOuterAttrs() is called). |
java.lang.String |
getSrc()
Deprecated. As of release 3.5.0, it is redundant since it is the same getImage(). |
java.lang.Object |
getValue()
Returns the value. |
java.lang.String |
getZclass()
Returns the ZK Cascading Style class(es) for this component. |
boolean |
insertBefore(Component child,
Component insertBefore)
Inserts a child before the reference child. |
void |
invalidate()
Invalidates this component by setting the dirty flag such that it will be redraw the whole content later. |
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. |
void |
onChildAdded(Component child)
Default: does nothing. |
void |
onChildRemoved(Component child)
Default: does nothing. |
void |
setCheckable(boolean checkable)
Sets whether it is checkable. |
void |
setDisabled(boolean disabled)
Sets whether it is disabled. |
void |
setImage(java.lang.String image)
Sets the image of the Listcell it contains. |
protected void |
setIndex(int index)
|
void |
setLabel(java.lang.String label)
Sets the label of the Listcell it contains. |
void |
setParent(Component parent)
Sets the parent component. |
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 same getSrc(). |
void |
setValue(java.lang.Object value)
Sets the value. |
boolean |
setVisible(boolean visible)
Sets whether this component is visible. |
| Methods inherited from class org.zkoss.zul.impl.XulElement |
|---|
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
focus, getAllOnClickAttrs, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, newExtraCtrl, redraw, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
|---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
|---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Methods inherited from interface org.zkoss.zk.ui.Component |
|---|
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, containsVariable, detach, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, isChildable, isInvalidated, isListenerAvailable, isVisible, redraw, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setId, setMold, setPage, setPageBefore, setVariable, unsetVariable |
| Constructor Detail |
|---|
public Listitem()
public Listitem(java.lang.String label)
public Listitem(java.lang.String label,
java.lang.Object value)
| Method Detail |
|---|
public Listbox getListbox()
It is the same as AbstractComponent.getParent().
public Listbox getListboxApi()
It is the same as AbstractComponent.getParent().
getListboxApi in interface Listitemprotected java.lang.String getRealStyle()
HtmlBasedComponentHtmlBasedComponent.getOuterAttrs() is called).
Default: this method will append width, height and others
to HtmlBasedComponent.setStyle(java.lang.String) (never null).
Use HtmlBasedComponent.getRealStyleFlags() to control what attributes to
exclude.
getRealStyle in class HtmlBasedComponentpublic Listgroup getListgroup()
public Listgroup getListgroupApi()
getListgroupApi in interface Listitemprotected java.lang.String getRealSclass()
HtmlBasedComponentHtmlBasedComponent.getOuterAttrs() is called).
Default: it simply returns the catenation of HtmlBasedComponent.getSclass()
and HtmlBasedComponent.getZclass() (since 3.5.0).
Derived classes might override it to provide, say, dual style classes. For example,
final String sclass = getSclass();
return sclass != null ? sclass + " my-addon": "myaddon";
getRealSclass in class HtmlBasedComponentHtmlBasedComponent.getZclass()public java.lang.String getZclass()
HtmlBasedComponentDefault: null (the default value depends on element).
HtmlBasedComponent.setZclass(java.lang.String)) will completely replace the default style
of a component. In other words, the default style of a component
is associated with the default value of HtmlBasedComponent.getZclass().
Once it is changed, the default style won't be applied at all.
If you want to perform small adjustments, use HtmlBasedComponent.setSclass(java.lang.String)
instead.
getZclass in interface HtmlBasedComponentgetZclass in class HtmlBasedComponentHtmlBasedComponent.getSclass(),
HtmlBasedComponent.getRealSclass()public boolean isCheckable()
Default: true.
isCheckable in interface Listitempublic void setCheckable(boolean checkable)
Default: true.
setCheckable in interface Listitempublic int getMaxlength()
getMaxlength in interface Listitempublic java.lang.Object getValue()
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.
getValue in interface Listitempublic void setValue(java.lang.Object value)
setValue in interface Listitemvalue - 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.
public final boolean isDisabled()
Default: false.
public void setDisabled(boolean disabled)
setDisabled in interface Listitempublic boolean isSelected()
Default: false.
isSelected in interface Listitempublic void setSelected(boolean selected)
setSelected in interface Listitempublic java.lang.String getLabel()
Listcell it contains, or null
if no such cell.
getLabel in interface Listitempublic void setLabel(java.lang.String label)
Listcell it contains.
If it is not created, we automatically create it.
setLabel in interface Listitempublic java.lang.String getSrc()
getImage().
public void setSrc(java.lang.String src)
getSrc().
public java.lang.String getImage()
Listcell it contains.
getImage in interface Listitempublic void setImage(java.lang.String image)
Listcell it contains.
If it is not created, we automatically create it.
setImage in interface Listitempublic final int getIndex()
public boolean isLoaded()
getListbox() is live data,
i.e., Listbox.getModel() is not null.
isLoaded in interface Listitemprotected void setIndex(int index)
public boolean setVisible(boolean visible)
Component
setVisible in interface ComponentsetVisible in class AbstractComponentpublic void setParent(Component parent)
ComponentNote: Component.setParent(org.zkoss.zk.ui.Component) always calls back Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/or Component.removeChild(org.zkoss.zk.ui.Component),
while Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.removeChild(org.zkoss.zk.ui.Component)
always calls back Component.setParent(org.zkoss.zk.ui.Component),
if the parent is changed. Thus, you don't need to override
both Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.setParent(org.zkoss.zk.ui.Component), if you want
to customize the behavior.
setParent in interface ComponentsetParent in class AbstractComponent
public boolean insertBefore(Component child,
Component insertBefore)
ComponentYou could use Component.setParent(org.zkoss.zk.ui.Component) or Component.appendChild(org.zkoss.zk.ui.Component)
instead of this method, unless
you want to control where to put the child.
Note: Component.setParent(org.zkoss.zk.ui.Component) always calls back Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/or Component.removeChild(org.zkoss.zk.ui.Component),
while Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.removeChild(org.zkoss.zk.ui.Component)
always calls back Component.setParent(org.zkoss.zk.ui.Component),
if the parent is changed. Thus, you don't need to override
both Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.setParent(org.zkoss.zk.ui.Component), if you want
to customize the behavior.
insertBefore in interface ComponentinsertBefore in class AbstractComponentchild - the new child to be inserted.insertBefore - the child before which you want the new child
being inserted. If null, the new child is append to the end.
public void invalidate()
ComponentIt can be called only in the request-processing and event-processing phases; excluding the redrawing phase.
invalidate in interface Componentinvalidate in class AbstractComponentpublic void onChildAdded(Component child)
AbstractComponent
onChildAdded in interface ComponentCtrlonChildAdded in class AbstractComponentComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component)public void onChildRemoved(Component child)
AbstractComponent
onChildRemoved in interface ComponentCtrlonChildRemoved in class AbstractComponentComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)public java.lang.String getOuterAttrs()
HtmlBasedComponentUsed only by component developers.
Default: Generates the tooltip text, style, sclass, draggable
and droppable attribute if necessary.
In other words, the corresponding attribute is generated if
HtmlBasedComponent.getTooltiptext(), HtmlBasedComponent.getRealStyle(),
HtmlBasedComponent.getSclass(), HtmlBasedComponent.getDraggable(), HtmlBasedComponent.getDroppable()
are defined.
You have to call both HtmlBasedComponent.getOuterAttrs() and
HtmlBasedComponent.getInnerAttrs() to generate complete attributes.
For simple components that all attributes are put on the outest HTML element, all you need is as follows.
<xx id="${self.uuid}"${self.outerAttrs}${self.innerAttrs}>
If you want to put attributes in a nested HTML element, you
shall use the following pattern. Notice: if HtmlBasedComponent.getInnerAttrs()
in a different tag, the tag must be named with "${self.uuid}!real".
<xx id="${self.uuid}"${self.outerAttrs}>
<yy id="${self.uuid}!real"${self.innerAttrs}>...
Note: This class handles non-deferrable event listeners automatically.
However, you have to invoke AbstractComponent.appendAsapAttr(java.lang.StringBuffer, java.lang.String) for each event
the component handles in HtmlBasedComponent.getOuterAttrs() as follows.
appendAsapAttr(sb, Events.ON_OPEN);
appendAsapAttr(sb, Events.ON_CHANGE);
Theorectically, you could put any attributes in either
HtmlBasedComponent.getInnerAttrs() or HtmlBasedComponent.getOuterAttrs().
However, zkau.js assumes all attributes are put at the outer one.
If you want something different, you have to provide your own
setAttr (refer to how checkbox is implemented).
getOuterAttrs in class XulElementpublic java.lang.Object clone()
Component
clone in interface Componentclone in class AbstractComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||