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
.
Modifier and Type | Class and Description |
---|---|
protected class |
Selectbox.ExtraCtrl
A utility class to implement
HtmlBasedComponent.getExtraCtrl() . |
Constructor and Description |
---|
Selectbox() |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
Object |
getExtraCtrl() |
<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).
|
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.
|
focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getPropertyAccess, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, addCallback, 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, getCallback, 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, 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, insertBefore, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, 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, willSerialize
public String getZclass()
getZclass
in class org.zkoss.zk.ui.HtmlBasedComponent
public int getSelectedIndex()
public void setSelectedIndex(int jsel)
public <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.AbstractComponent
public 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.Component
invalidate
in class org.zkoss.zk.ui.AbstractComponent
public void setParent(org.zkoss.zk.ui.Component parent)
setParent
in interface org.zkoss.zk.ui.Component
setParent
in class org.zkoss.zk.ui.AbstractComponent
public void onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage)
onPageAttached
in interface org.zkoss.zk.ui.sys.ComponentCtrl
onPageAttached
in class org.zkoss.zk.ui.AbstractComponent
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException
renderProperties
in class org.zkoss.zk.ui.HtmlBasedComponent
IOException
public void service(org.zkoss.zk.au.AuRequest request, boolean everError)
service
in interface org.zkoss.zk.ui.sys.ComponentCtrl
service
in class org.zkoss.zk.ui.HtmlBasedComponent
public Object clone()
clone
in interface org.zkoss.zk.ui.Component
clone
in class org.zkoss.zk.ui.HtmlBasedComponent
public void sessionWillPassivate(org.zkoss.zk.ui.Page page)
sessionWillPassivate
in interface org.zkoss.zk.ui.sys.ComponentCtrl
sessionWillPassivate
in class org.zkoss.zk.ui.AbstractComponent
public void sessionDidActivate(org.zkoss.zk.ui.Page page)
sessionDidActivate
in interface org.zkoss.zk.ui.sys.ComponentCtrl
sessionDidActivate
in class org.zkoss.zk.ui.AbstractComponent
public Object getExtraCtrl()
getExtraCtrl
in interface org.zkoss.zk.ui.sys.ComponentCtrl
getExtraCtrl
in class org.zkoss.zk.ui.HtmlBasedComponent
Copyright © 2018. All rights reserved.