public class Selectbox
extends org.zkoss.zk.ui.HtmlBasedComponent
Default getZclass(): z-selectbox. It does not create child widgets for
each data, so the memory usage is much lower at the server. However, the
implementation is based on HTML SELECT and OPTION tags, so the functionality
is not as rich as Listbox.
| Constructor and Description |
|---|
Selectbox() |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
<T> ItemRenderer<T> |
getItemRenderer()
Returns the renderer to render each item, or null if the default renderer
is used.
|
<T> ListModel<T> |
getModel()
Returns the model associated with this selectbox, or null if this
selectbox is not associated with any list data model.
|
String |
getName()
Returns the name of this component.
|
<T> ItemRenderer<T> |
getRealRenderer() |
int |
getSelectedIndex()
Returns the index of the selected item (-1 if no one is selected).
|
int |
getTabindex()
Returns the tab order of this component.
|
String |
getZclass() |
void |
invalidate() |
protected boolean |
isChildable() |
boolean |
isDisabled()
Returns whether it is disabled.
|
void |
onInitRender() |
void |
onInitRenderNow() |
void |
onPageAttached(org.zkoss.zk.ui.Page newpage,
org.zkoss.zk.ui.Page oldpage) |
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
service(org.zkoss.zk.au.AuRequest request,
boolean everError) |
void |
sessionDidActivate(org.zkoss.zk.ui.Page page) |
void |
sessionWillPassivate(org.zkoss.zk.ui.Page page) |
void |
setDisabled(boolean disabled)
Sets whether it is disabled.
|
void |
setItemRenderer(ItemRenderer<?> renderer)
Sets the renderer which is used to render each item if
getModel()
is not null. |
void |
setItemRenderer(String clsnm)
Sets the renderer by use of a class name.
|
void |
setModel(ListModel<?> model)
Sets the list model associated with this selectbox.
|
void |
setName(String name)
Sets the name of this component.
|
void |
setParent(org.zkoss.zk.ui.Component parent) |
void |
setSelectedIndex(int jsel)
Selects the item with the given index.
|
void |
setTabindex(int tabindex)
Sets the tab order of this component.
|
focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getPropertyAccess, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflex, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyaddAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowRoots, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerializepublic String getZclass()
getZclass in class org.zkoss.zk.ui.HtmlBasedComponentpublic int getSelectedIndex()
public void setSelectedIndex(int jsel)
public int getTabindex()
Default: 0 (means the same as browser's default).
public void setTabindex(int tabindex)
throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueExceptionpublic <T> ItemRenderer<T> getItemRenderer()
public void setItemRenderer(ItemRenderer<?> renderer)
getModel()
is not null.
Note: changing a render will not cause the selectbox to re-render. If you
want it to re-render, you could assign the same model again (i.e.,
setModel(null) and than setModel(oldModel)), or fire an ListDataEvent event.
renderer - the renderer, or null to use the default.org.zkoss.zk.ui.UiException - if failed to initialize with the modelpublic void setItemRenderer(String clsnm) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException
public boolean isDisabled()
Default: false.
protected boolean isChildable()
isChildable in class org.zkoss.zk.ui.AbstractComponentpublic void setDisabled(boolean disabled)
public String getName()
Default: null.
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
Don't use this method if your application is purely based on ZK's event-driven model.
public void setName(String name)
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
Don't use this method if your application is purely based on ZK's event-driven model.
name - the name of this component.public void setModel(ListModel<?> model)
model - the list model to associate, or null to dissociate any
previous model.org.zkoss.zk.ui.UiException - if failed to initialize with the modelpublic void onInitRender()
public void onInitRenderNow()
public <T> ListModel<T> getModel()
public <T> ItemRenderer<T> getRealRenderer()
public void invalidate()
invalidate in interface org.zkoss.zk.ui.Componentinvalidate in class org.zkoss.zk.ui.AbstractComponentpublic void setParent(org.zkoss.zk.ui.Component parent)
setParent in interface org.zkoss.zk.ui.ComponentsetParent in class org.zkoss.zk.ui.AbstractComponentpublic void onPageAttached(org.zkoss.zk.ui.Page newpage,
org.zkoss.zk.ui.Page oldpage)
onPageAttached in interface org.zkoss.zk.ui.sys.ComponentCtrlonPageAttached in class org.zkoss.zk.ui.AbstractComponentprotected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
throws IOException
renderProperties in class org.zkoss.zk.ui.HtmlBasedComponentIOExceptionpublic void service(org.zkoss.zk.au.AuRequest request,
boolean everError)
service in interface org.zkoss.zk.ui.sys.ComponentCtrlservice in class org.zkoss.zk.ui.HtmlBasedComponentpublic Object clone()
clone in interface org.zkoss.zk.ui.Componentclone in class org.zkoss.zk.ui.HtmlBasedComponentpublic void sessionWillPassivate(org.zkoss.zk.ui.Page page)
sessionWillPassivate in interface org.zkoss.zk.ui.sys.ComponentCtrlsessionWillPassivate in class org.zkoss.zk.ui.AbstractComponentpublic void sessionDidActivate(org.zkoss.zk.ui.Page page)
sessionDidActivate in interface org.zkoss.zk.ui.sys.ComponentCtrlsessionDidActivate in class org.zkoss.zk.ui.AbstractComponentCopyright © 2015. All rights reserved.