public class Chosenbox extends HtmlBasedComponent
Default getZclass()
: z-chosenbox.
It does not create child widgets for each data, so the memory usage is much
lower at the server.
Modifier and Type | Class and Description |
---|---|
protected class |
Chosenbox.ExtraCtrl
A utility class to implement
HtmlBasedComponent.getExtraCtrl() . |
AbstractComponent.Children
_zclass
AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
Chosenbox() |
Modifier and Type | Method and Description |
---|---|
void |
addItemToSelection(java.lang.Object o)
Add an item into selection.
|
void |
clearSelection()
Clear all selected objects.
|
java.lang.Object |
clone()
Clones the component.
|
java.lang.String |
getCreateMessage()
Returns the create message of this component.
|
java.lang.String |
getEmptyMessage()
Returns the emptyMessage of the input of this component.
|
java.lang.Object |
getExtraCtrl()
Returns the client control for this 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 chosenbox, or null if this
chosenbox is not associated with any list data model.
|
java.lang.String |
getName()
Returns the name of this component.
|
java.lang.String |
getNoResultsText()
Returns the no-result text of this component.
|
<T> ItemRenderer<T> |
getRealRenderer() |
int |
getSelectedIndex()
Returns the index of the selected item (-1 if no one is selected).
|
<T> java.util.Set<T> |
getSelectedObjects()
Returns the selected objects.
|
java.lang.String |
getSeparator()
Returns the separate chars 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 |
isCreatable()
Returns whether can create new item.
|
boolean |
isDisabled()
Returns whether it is disabled.
|
boolean |
isOpen() |
void |
onInitRender() |
void |
onInitSelection() |
void |
removeItemFromSelection(java.lang.Object o)
Remove an item from selection.
|
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 |
setCreatable(boolean creatable)
Sets whether can create new item.
|
void |
setCreateMessage(java.lang.String createMessage)
Sets the create message of this component.
|
void |
setDisabled(boolean disabled)
Sets whether it is disabled.
|
void |
setEmptyMessage(java.lang.String emptyMessage)
Sets the emptyMessage of the input of this component.
|
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 chosenbox.
|
void |
setName(java.lang.String name)
Sets the name of the input element of this component.
|
void |
setNoResultsText(java.lang.String noResultsText)
Sets the no-result text of this component.
|
void |
setOpen(boolean open) |
void |
setSelectedIndex(int jsel)
Sets the index of the selected item (-1 if no one is selected).
|
void |
setSelectedObjects(java.util.Collection<?> objects)
Sets the selected objects.
|
void |
setSeparator(java.lang.String separator)
Sets the separate chars of this component.
|
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, onPageAttached, 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, setParent, 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 java.lang.String getZclass()
HtmlBasedComponent
AbstractComponent.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 HtmlBasedComponent
HtmlBasedComponent.getSclass()
public void setOpen(boolean open)
public boolean isOpen()
public boolean isDisabled()
Default: false.
public 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 java.lang.String getEmptyMessage()
Default: null.
The emptyMessage will be displayed in input if nothing selected and not focused.
public void setEmptyMessage(java.lang.String emptyMessage)
The emptyMessage will be displayed in input if nothing selected and not focused.
emptyMessage
- the emptyMessage of the input of this component.public java.lang.String getNoResultsText()
Default: null.
The no-result text will be displayed in popup if nothing match to the input value and can not create either, the syntax "{0}" will be replaced with the input value at client side.
public void setNoResultsText(java.lang.String noResultsText)
The no-result text will be displayed in popup if nothing match to the input value and can not create either, the syntax "{0}" will be replaced with the input value at client side.
noResultsText
- the no-result text of this component.public java.lang.String getCreateMessage()
Default: null.
The create message will be displayed in popup if nothing match to the input value but can create as new label, the syntax "{0}" will be replaced with the input value at client side.
public void setCreateMessage(java.lang.String createMessage)
The create message will be displayed in popup if nothing match to the input value but can create as new label, the syntax "{0}" will be replaced with the input value at client side.
createMessage
- the create message of this component.public java.lang.String getSeparator()
Support: 0-9, A-Z (case insensitive), and ,.;'[]/\-=
Default: null.
The separate chars will work as 'Enter' key, it will not considered as input value but send onSerch or onSearching while key up.
public void setSeparator(java.lang.String separator)
Support: 0-9, A-Z (case insensitive), and ,.;'[]/\-=
The separate chars will work as 'Enter' key, it will not considered as input value but send onSerch or onSelect while key up.
public <T> java.util.Set<T> getSelectedObjects()
public void setSelectedObjects(java.util.Collection<?> objects)
objects
- the objects to select.public int getSelectedIndex()
public void setSelectedIndex(int jsel)
jsel
- the index to select.public boolean isCreatable()
Default: false.
true: will show create message while value of input not exists.
false: will show no result message while value of input not exists.
public void setCreatable(boolean creatable)
Default: false.
true: will show create message while value of input not exists.
false: will show no-result text while value of input not exists.
creatable
- the boolean value.public <T> ItemRenderer<T> getRealRenderer()
public <T> ItemRenderer<T> getItemRenderer()
public <T> ListModel<T> getModel()
public void setModel(ListModel<?> model)
model
- the list model to associate, or null to dis-associate any
previous model.UiException
- if failed to initialize with the modelpublic void clearSelection()
public void addItemToSelection(java.lang.Object o)
o
- the object to add.public void removeItemFromSelection(java.lang.Object o)
o
- the object to remove.protected boolean isChildable()
AbstractComponent
Default: return true (means it can have children).
isChildable
in class AbstractComponent
public void setItemRenderer(ItemRenderer<?> renderer)
getModel()
is not null.
Note: changing a render will not cause the chosenbox to re-render. If you
want it to re-render, you could assign the same model again (i.e.,
setModel(getModel())), 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.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
public void onInitRender()
public void onInitSelection()
public void invalidate()
Component
If 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 Component
invalidate
in class AbstractComponent
public java.lang.Object clone()
Component
clone
in interface Component
clone
in class HtmlBasedComponent
public void sessionWillPassivate(Page page)
ComponentCtrl
Note: only root components are notified by this method.
sessionWillPassivate
in interface ComponentCtrl
sessionWillPassivate
in class AbstractComponent
public void sessionDidActivate(Page page)
ComponentCtrl
Note: only root components are notified by this method.
sessionDidActivate
in interface ComponentCtrl
sessionDidActivate
in class AbstractComponent
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
renderProperties
in class HtmlBasedComponent
java.io.IOException
public void service(AuRequest request, boolean everError)
HtmlBasedComponent
Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
service
in interface ComponentCtrl
service
in class HtmlBasedComponent
everError
- whether any error ever occurred before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
public java.lang.Object getExtraCtrl()
HtmlBasedComponent
Default: creates an instance of HtmlBasedComponent.ExtraCtrl
.
getExtraCtrl
in interface ComponentCtrl
getExtraCtrl
in class HtmlBasedComponent
Cropper
.ComponentCtrl.getExtraCtrl()
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.