Class Cascader<E>
- Type Parameters:
E- Element type in model
- All Implemented Interfaces:
Serializable,Cloneable,Component,Disable,Scope,ComponentCtrl
Available in ZK EE.
Default getZclass(): z-cascader.
- Since:
- 9.0.0
- Author:
- jameschu
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
HtmlBasedComponent.ExtraCtrlNested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo -
Field Summary
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones the component.Returns the converter that generates the label text shown in the cascader from selected items, or null to use the default implementation.Returns the renderer to render each item, or null if the default renderer is used.getModel()Returns the model associated with this cascader, or null if this cascader is not associated with any tree data model.Returns the placeholder text.Returns the selected item.Returns all selected items.Returns the ZK Cascading Style class for this component.voidInvalidates this component by setting the dirty flag such that it will be redraw the whole content of this component and its dependencies later.booleanReturns whether it is disabled.booleanisOpen()Returns whether this cascader is open.voidHandles a private event, onInitRender.voidonPageAttached(Page newpage, Page oldpage) Default: handles special event listeners.voidonPageDetached(Page page) Default: handles special event listeners.protected voidrenderProperties(ContentRenderer renderer) Renders the content of this component, excluding the enclosing tags and children.voidProcesses an AU request.voidsessionDidActivate(Page page) Notification that the session, which owns this component, has just been activated (a.k.a., deserialized).voidsessionWillPassivate(Page page) Notification that the session, which owns this component, is about to be passivated (a.k.a., serialized).voidsetDisabled(boolean disabled) Sets whether it is disabled.voidsetItemConverter(String clsnm) Sets the converter by use of a class name.voidsetItemConverter(Converter<Collection<E>, String> converter) Sets the converter that generates the label text shown in the cascader from selected items.voidsetItemRenderer(String clsnm) Sets the renderer by use of a class name.voidsetItemRenderer(ItemRenderer<E> renderer) Sets the renderer which is used to render each item ifgetModel()is not null.voidSets the tree model associated with this cascader.voidsetOpen(boolean open) Drops down or closes the list of items.voidsetPlaceholder(String placeholder) Sets the placeholder text that is displayed when the selected item is empty.voidsetSelectedItem(E item) Deselects selected item and selects the given item.Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getPropertyAccess, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setSkeleton, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, 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, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getStubonlyDescendants, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Constructor Details
-
Cascader
public Cascader()
-
-
Method Details
-
getModel
Returns the model associated with this cascader, or null if this cascader is not associated with any tree data model. -
setModel
Sets the tree model associated with this cascader.- Parameters:
model- the list model to associate, or null to dis-associate any previous model. If not null, it must implementSelectable.- Throws:
UiException- if failed to initialize with the model
-
onInitRender
public void onInitRender()Handles a private event, onInitRender. It is used only for implementation, and you rarely need to invoke it explicitly. -
getItemRenderer
Returns the renderer to render each item, or null if the default renderer is used. -
setItemRenderer
Sets the renderer which is used to render each item ifgetModel()is not null.Note: changing a render will cause the cascader to re-render.
- Parameters:
renderer- the renderer, or null to use the default.
-
setItemRenderer
Sets the renderer by use of a class name. It creates an instance automatically.- Parameters:
clsnm- The class name- Throws:
ReflectiveOperationException- if failed to initialize the renderer
-
getItemConverter
Returns the converter that generates the label text shown in the cascader from selected items, or null to use the default implementation. (joining by slashes, i.g. "A/B/C") -
setItemConverter
Sets the converter that generates the label text shown in the cascader from selected items.- Parameters:
converter- the converter, or null to use the default implementation.
-
setItemConverter
Sets the converter by use of a class name. It creates an instance automatically.- Parameters:
clsnm- The class name- Throws:
ReflectiveOperationException- if failed to initialize the converter
-
getPlaceholder
Returns the placeholder text. -
setPlaceholder
Sets the placeholder text that is displayed when the selected item is empty. -
isOpen
public boolean isOpen()Returns whether this cascader is open.Default: false.
-
setOpen
public void setOpen(boolean open) Drops down or closes the list of items. -
isDisabled
public boolean isDisabled()Description copied from interface:DisableReturns whether it is disabled.Default: false.
- Specified by:
isDisabledin interfaceDisable
-
setDisabled
public void setDisabled(boolean disabled) Description copied from interface:DisableSets whether it is disabled.- Specified by:
setDisabledin interfaceDisable
-
getSelectedItems
Returns all selected items. -
getSelectedItem
Returns the selected item. -
setSelectedItem
Deselects selected item and selects the given item. -
renderProperties
Description copied from class:HtmlBasedComponentRenders the content of this component, excluding the enclosing tags and children.- Overrides:
renderPropertiesin classHtmlBasedComponent- Throws:
IOException
-
service
Description copied from class:HtmlBasedComponentProcesses an AU request.Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
- Specified by:
servicein interfaceComponentCtrl- Overrides:
servicein classHtmlBasedComponenteverError- whether any error ever occurred before processing this request.- See Also:
-
onPageAttached
Description copied from class:AbstractComponentDefault: handles special event listeners.- Specified by:
onPageAttachedin interfaceComponentCtrl- Overrides:
onPageAttachedin classAbstractComponent- Parameters:
newpage- the new page (never null).oldpage- the previous page, if any, or null if it didn't belong to any page.- See Also:
-
onPageDetached
Description copied from class:AbstractComponentDefault: handles special event listeners.- Specified by:
onPageDetachedin interfaceComponentCtrl- Overrides:
onPageDetachedin classAbstractComponent- Parameters:
page- the previous page (never null)- See Also:
-
invalidate
public void invalidate()Description copied from interface:ComponentInvalidates this component by setting the dirty flag such that it will be redraw the whole content of this component and its dependencies later. And, the widget associated with this component and all its descendant at the client will be deleted and recreated, too.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.
- Specified by:
invalidatein interfaceComponent- Overrides:
invalidatein classAbstractComponent
-
clone
Description copied from interface:ComponentClones the component. All of its children and descendants are cloned. Also, ID are preserved.- Specified by:
clonein interfaceComponent- Overrides:
clonein classHtmlBasedComponent- Returns:
- the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.
-
sessionWillPassivate
Description copied from interface:ComponentCtrlNotification that the session, which owns this component, is about to be passivated (a.k.a., serialized).Note: only root components are notified by this method.
- Specified by:
sessionWillPassivatein interfaceComponentCtrl- Overrides:
sessionWillPassivatein classAbstractComponent
-
sessionDidActivate
Description copied from interface:ComponentCtrlNotification that the session, which owns this component, has just been activated (a.k.a., deserialized).Note: only root components are notified by this method.
- Specified by:
sessionDidActivatein interfaceComponentCtrl- Overrides:
sessionDidActivatein classAbstractComponent
-
getZclass
Description copied from class:HtmlBasedComponentReturns the ZK Cascading Style class for this component. It usually depends on the implementation of the mold (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 ofHtmlBasedComponent.getZclass(). Once it is changed, the default style won't be applied at all. If you want to perform small adjustments, useHtmlBasedComponent.setSclass(java.lang.String)instead.- Overrides:
getZclassin classHtmlBasedComponent- See Also:
-