public class Selectbox extends 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.
HtmlBasedComponent.ExtraCtrlAbstractComponent.Children_zclassAPPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPECE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE| Constructor and Description |
|---|
Selectbox() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Clones the component.
|
<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.
|
java.lang.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.
|
java.lang.String |
getZclass()
Returns the ZK Cascading Style class(es) for this component.
|
void |
invalidate()
Invalidates this component by setting the dirty flag
such that it will be redraw the whole content of this
component and its dependences later.
|
protected boolean |
isChildable()
Returns whether this component can have a child.
|
boolean |
isDisabled()
Returns whether it is disabled.
|
void |
onInitRender() |
void |
onInitRenderNow() |
void |
onPageAttached(Page newpage,
Page oldpage)
Default: handles special event listeners.
|
protected void |
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing
tags and children.
|
void |
service(AuRequest request,
boolean everError)
Processes an AU request.
|
void |
sessionDidActivate(Page page)
Notification that the session, which owns this component,
has just been activated (a.k.a., deserialized).
|
void |
sessionWillPassivate(Page page)
Notification that the session, which owns this component,
is about to be passivated (a.k.a., serialized).
|
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(java.lang.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(java.lang.String name)
Sets the name of this component.
|
void |
setParent(Component parent)
Sets the parent component.
|
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 java.lang.String getZclass()
HtmlBasedComponentAbstractComponent.getMold()).
Default: 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 class HtmlBasedComponentHtmlBasedComponent.getSclass()public 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 WrongValueException
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.UiException - if failed to initialize with the modelpublic void setItemRenderer(java.lang.String clsnm)
throws java.lang.ClassNotFoundException,
java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundExceptionjava.lang.NoSuchMethodExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionjava.lang.reflect.InvocationTargetExceptionpublic boolean isDisabled()
Default: false.
protected boolean isChildable()
AbstractComponentDefault: return true (means it can have children).
isChildable in class AbstractComponentpublic void setDisabled(boolean disabled)
public java.lang.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(java.lang.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.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()
ComponentIf the application is totally controlled by the server side (i.e., you don't write client codes), you rarely need to access this method.
It can be called only in the request-processing and event-processing phases. However, it is NOT allowed in the rendering phase.
invalidate in interface Componentinvalidate 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 AbstractComponentpublic void onPageAttached(Page newpage, Page oldpage)
AbstractComponentonPageAttached in interface ComponentCtrlonPageAttached in class AbstractComponentnewpage - the new page (never null).oldpage - the previous page, if any, or null if it didn't
belong to any page.ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponentrenderProperties in class HtmlBasedComponentjava.io.IOExceptionpublic void service(AuRequest request, boolean everError)
HtmlBasedComponentDefault: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
service in interface ComponentCtrlservice in class HtmlBasedComponenteverError - whether any error ever occurred before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)public java.lang.Object clone()
Componentclone in interface Componentclone in class HtmlBasedComponentpublic void sessionWillPassivate(Page page)
ComponentCtrlNote: only root components are notified by this method.
sessionWillPassivate in interface ComponentCtrlsessionWillPassivate in class AbstractComponentpublic void sessionDidActivate(Page page)
ComponentCtrlNote: only root components are notified by this method.
sessionDidActivate in interface ComponentCtrlsessionDidActivate in class AbstractComponentCopyright © 2005-2011 Potix Corporation. All Rights Reserved.