Package org.zkoss.zul
Class Radiogroup
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Radiogroup
- All Implemented Interfaces:
Serializable,Cloneable,Component,Disable,Scope,ComponentCtrl
A radio group.
Note: To support the versatile layout, a radio group accepts any kind of
children, including Radio. On the other hand, the parent of
a radio, if any, must be a radio group.
- Author:
- tomyeh
- 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 TypeMethodDescriptionappendItem(String label, String value) Appends a radio button.clone()Clones the component.getItemAtIndex(int index) Returns the radio button at the specified index.intReturns the number of radio buttons in this group.getItems()Returns a readonly list ofRadio.<T> ListModel<T>getModel()Returns the list model associated with this radiogroup, or null if this radiogroup is not associated with any list data model.getName()Returns the name of this group of radio buttons.Returns the orient.<T> RadioRenderer<T>Returns the renderer to render each radio, or null if the default renderer is used.intReturns the index of the selected radio button (-1 if no one is selected).Returns the selected radio button.booleanReturns whether it is disabled.voidonChildAdded(Component child) Default: handles special event listeners.voidonInitRender(Event data) For model renderingvoidonPageAttached(Page newpage, Page oldpage) Default: handles special event listeners.voidonPageDetached(Page page) Default: handles special event listeners.removeItemAt(int index) Removes the child radio button in the radio group at the given index.protected voidrenderProperties(ContentRenderer renderer) Renders the content of this component, excluding the enclosing tags and children.voidProcesses an AU request.voidsetDisabled(boolean disabled) Sets whether the radiogroup is disabled.voidSets the list model associated with this radiogroup.voidSets the name of this group of radio buttons.voidSets the orient.voidsetRadioRenderer(String clsnm) Sets the renderer by use of a class name.voidsetRadioRenderer(RadioRenderer<?> renderer) Sets the renderer which is used to render each row ifgetModel()is not null.voidsetSelectedIndex(int jsel) Deselects all of the currently selected radio button and selects the radio button with the given index.voidsetSelectedItem(Radio item) Deselects all of the currently selected radio buttons and selects the given radio button.Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, 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, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, 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, sessionDidActivate, sessionWillPassivate, 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
-
Radiogroup
public Radiogroup()
-
-
Method Details
-
getOrient
Returns the orient.Default: "horizontal".
-
setOrient
Sets the orient.- Parameters:
orient- either "horizontal" or "vertical".- Throws:
WrongValueException
-
getItems
Returns a readonly list ofRadio. Note: any update to the list won't affect the state of this radio group.- Since:
- 5.0.4
-
getItemAtIndex
Returns the radio button at the specified index. -
getItemCount
public int getItemCount()Returns the number of radio buttons in this group. -
getSelectedIndex
public int getSelectedIndex()Returns the index of the selected radio button (-1 if no one is selected). Note: The index of the external radio button could be unintuitive since radio group always count descendant radio before external radio. -
setSelectedIndex
public void setSelectedIndex(int jsel) Deselects all of the currently selected radio button and selects the radio button with the given index. -
getSelectedItem
Returns the selected radio button. -
setSelectedItem
Deselects all of the currently selected radio buttons and selects the given radio button. -
appendItem
Appends a radio button. -
removeItemAt
Removes the child radio button in the radio group at the given index.- Returns:
- the removed radio button.
-
getName
Returns the name of this group of radio buttons. All child radio buttons shared the same name (Radio.getName()).Default: automatically generated a unique name
Don't use this method if your application is purely based on ZK's event-driven model.
-
setName
Sets the name of this group of radio buttons. All child radio buttons shared the same name (Radio.getName()).Don't use this method if your application is purely based on ZK's event-driven model.
-
isDisabled
public boolean isDisabled()Returns whether it is disabled.Default: false.
- Specified by:
isDisabledin interfaceDisable- Since:
- 9.6.0
-
setDisabled
public void setDisabled(boolean disabled) Sets whether the radiogroup is disabled. All the radios belong to this radiogroup will be set to disabled or not disabled as well. Notice: Once a radio is added to a disabled radiogroup (including external radio), the radio will be set to disabled too.- Specified by:
setDisabledin interfaceDisable- Parameters:
disabled- whether the radiogroup is disabled- Since:
- 9.6.0
-
renderProperties
Description copied from class:HtmlBasedComponentRenders the content of this component, excluding the enclosing tags and children.- Overrides:
renderPropertiesin classXulElement- Throws:
IOException
-
getModel
Returns the list model associated with this radiogroup, or null if this radiogroup is not associated with any list data model.- Since:
- 6.0.0
-
setModel
Sets the list model associated with this radiogroup. If a non-null model is assigned, no matter whether it is the same as the previous, it will always cause re-render.- Parameters:
model- the list model to associate, or null to dis-associate any previous model.- Throws:
UiException- if failed to initialize with the model- Since:
- 6.0.0
-
onInitRender
For model rendering- Parameters:
data-
-
getRadioRenderer
Returns the renderer to render each radio, or null if the default renderer is used.- Since:
- 6.0.0
-
setRadioRenderer
Sets the renderer which is used to render each row ifgetModel()is not null.Note: changing a render will not cause the radiogroup to re-render. If you want it to re-render, you could assign the same model again (i.e., setModel(getModel())), or fire an
ListDataEventevent.- Parameters:
renderer- the renderer, or null to use the default.- Throws:
UiException- if failed to initialize with the model- Since:
- 6.0.0
-
setRadioRenderer
public void setRadioRenderer(String clsnm) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException Sets the renderer by use of a class name. It creates an instance automatically. -
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 classXulElement- Returns:
- the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.
-
service
Processes an AU request.- Specified by:
servicein interfaceComponentCtrl- Overrides:
servicein classHtmlBasedComponenteverError- whether any error ever occurred before processing this request.- Since:
- 10.0.0
- 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:
-
onChildAdded
Description copied from class:AbstractComponentDefault: handles special event listeners.- Specified by:
onChildAddedin interfaceComponentCtrl- Overrides:
onChildAddedin classAbstractComponent- See Also:
-