Class Radio
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,Component
,Disable
,Scope
,ComponentCtrl
public class Radio extends Checkbox
A radio button.Radio buttons without a ancestor
Radiogroup
is considered as the same group. The nearest ancestorRadiogroup
is the group that the radio belongs to. See alsogetRadiogroup()
.Event:
CheckEvent
is sent when a checkbox is checked or unchecked by user.
- Author:
- tomyeh
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.zkoss.zul.Checkbox
Checkbox.State
-
Nested classes/interfaces inherited from class org.zkoss.zul.impl.LabelImageElement
LabelImageElement.ExtraCtrl
-
Nested 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
_zclass
-
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
-
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Clones the component.java.lang.String
getName()
Returns the name of this radio button.Radiogroup
getRadiogroup()
ReturnsRadiogroup
that this radio button belongs to.java.lang.String
getZclass()
Returns the Style of radio labelboolean
isSelected()
Returns whether it is selected.void
onPageAttached(Page newpage, Page oldpage)
Default: handles special event listeners.void
onPageDetached(Page page)
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
setChecked(boolean checked)
Sets the radio is checked and unchecked the others in the same radio group (Radiogroup
.void
setParent(Component parent)
Sets the parent component.void
setRadiogroup(java.lang.String radiogroupId)
Associates the radiogroup to this radio component by giving ID.void
setRadiogroup(Radiogroup radiogroup)
Associates the radiogroup to this radio component.void
setSelected(boolean selected)
Sets whether it is selected.-
Methods inherited from class org.zkoss.zul.Checkbox
getAutodisable, getState, getValue, isChecked, isChildable, isDisabled, isIndeterminate, setAutodisable, setDisabled, setIndeterminate, setMold, setName, setValue, updateByClient
-
Methods inherited from class org.zkoss.zul.impl.LabelImageElement
getExtraCtrl, getHoverImage, getHoverImageContent, getIconSclass, getIconSclasses, getIconTooltip, getIconTooltips, getImage, getImageContent, getPropertyAccess, isImageAssigned, setHoverImage, setHoverImageContent, setHoverImageContent, setIconSclass, setIconSclasses, setIconTooltip, setIconTooltips, setImage, setImageContent, setImageContent
-
Methods inherited from class org.zkoss.zul.impl.LabelElement
getLabel, renderCrawlable, setLabel
-
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, 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, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
-
Methods 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, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, 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, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setPage, setPageBefore, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
Method Detail
-
getRadiogroup
public Radiogroup getRadiogroup()
ReturnsRadiogroup
that this radio button belongs to. It is the nearest ancestorRadiogroup
. In other words, it searches up the parent, parent's parent and so on for anyRadiogroup
instance. If found this radio belongs the found radiogroup. If not, this radio itself is a group.
-
setRadiogroup
public void setRadiogroup(Radiogroup radiogroup)
Associates the radiogroup to this radio component. The radio automatically belongs to the nearest ancestral radiogroup. Use this method only if the radio group is not one of its ancestors.- Since:
- 5.0.4
-
setRadiogroup
public void setRadiogroup(java.lang.String radiogroupId)
Associates the radiogroup to this radio component by giving ID. The radio automatically belongs to the nearest ancestral radiogroup. Use this method only if the radio group is not one of its ancestors.- Parameters:
radiogroupId
- the ID of the radiogroup. To specify UUID, use the format:uuid(comp_uuid)
.- Since:
- 5.0.4
-
isSelected
public boolean isSelected()
Returns whether it is selected.Default: false.
Don't override this. Override
Checkbox.isChecked()
instead.
-
setSelected
public void setSelected(boolean selected)
Sets whether it is selected.Don't override this. Override
setChecked(boolean)
instead.The same as
setChecked(boolean)
.
-
setChecked
public void setChecked(boolean checked)
Sets the radio is checked and unchecked the others in the same radio group (Radiogroup
.- Overrides:
setChecked
in classCheckbox
-
getName
public java.lang.String getName()
Returns the name of this radio button.Don't use this method if your application is purely based on ZK's event-driven model.
It is readonly, and it is generated automatically to be the same as its parent's name (
Radiogroup.getName()
).
-
getZclass
public java.lang.String getZclass()
Returns the Style of radio labelDefault: "z-radio"
Since 3.5.1
- Overrides:
getZclass
in classCheckbox
- See Also:
HtmlBasedComponent.getSclass()
-
setParent
public void setParent(Component parent)
Description copied from interface:Component
Sets the parent component.Note:
Component.setParent(org.zkoss.zk.ui.Component)
always calls backComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/orComponent.removeChild(org.zkoss.zk.ui.Component)
, whileComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
andComponent.removeChild(org.zkoss.zk.ui.Component)
always calls backComponent.setParent(org.zkoss.zk.ui.Component)
, if the parent is changed. Thus, you don't need to override bothComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
andComponent.setParent(org.zkoss.zk.ui.Component)
, if you want to customize the behavior.- Specified by:
setParent
in interfaceComponent
- Overrides:
setParent
in classAbstractComponent
-
renderProperties
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
Description copied from class:HtmlBasedComponent
Renders the content of this component, excluding the enclosing tags and children.- Overrides:
renderProperties
in classCheckbox
- Throws:
java.io.IOException
-
service
public void service(AuRequest request, boolean everError)
Processes an AU request.- Specified by:
service
in interfaceComponentCtrl
- Overrides:
service
in classCheckbox
everError
- whether any error ever occurred before processing this request.- Since:
- 5.0.0
- See Also:
AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
-
onPageDetached
public void onPageDetached(Page page)
Description copied from class:AbstractComponent
Default: handles special event listeners.- Specified by:
onPageDetached
in interfaceComponentCtrl
- Overrides:
onPageDetached
in classAbstractComponent
- Parameters:
page
- the previous page (never null)- See Also:
ComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)
-
onPageAttached
public void onPageAttached(Page newpage, Page oldpage)
Description copied from class:AbstractComponent
Default: handles special event listeners.- Specified by:
onPageAttached
in interfaceComponentCtrl
- Overrides:
onPageAttached
in 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:
ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)
-
clone
public java.lang.Object clone()
Description copied from interface:Component
Clones the component. All of its children and descendants are cloned. Also, ID are preserved.- Specified by:
clone
in interfaceComponent
- Overrides:
clone
in classLabelImageElement
- Returns:
- the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.
-
-