org.zkoss.zul
Class Radio

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.impl.LabelElement
                  extended by org.zkoss.zul.impl.LabelImageElement
                      extended by org.zkoss.zul.Checkbox
                          extended by org.zkoss.zul.Radio
All Implemented Interfaces:
Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Disable, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl

public class Radio
extends Checkbox

A radio button.

Radio buttons without a ancestor Radiogroup is considered as the same group. The nearest ancestor Radiogroup is the group that the radio belongs to. See also getRadiogroup().

Event:

  1. 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.impl.LabelImageElement
LabelImageElement.ExtraCtrl
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children
 
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
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Radio()
           
Radio(String label)
           
Radio(String label, String image)
           
 
Method Summary
 String getName()
          Returns the name of this radio button.
 Radiogroup getRadiogroup()
          Returns Radiogroup that this radio button belongs to.
 String getZclass()
          Returns the Style of radio label Default: "z-radio" Since 3.5.1
 boolean isSelected()
          Returns whether it is selected.
 void onPageDetached(org.zkoss.zk.ui.Page page)
           
protected  void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
           
 void service(org.zkoss.zk.au.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(org.zkoss.zk.ui.Component parent)
           
 void setRadiogroup(Radiogroup radiogroup)
          Associates the radiogroup to this radio component.
 void setRadiogroup(String radiogroupId)
          Associates the radiogroup to this radio component by giving ID.
 void setSelected(boolean selected)
          Sets whether it is selected.
 
Methods inherited from class org.zkoss.zul.Checkbox
getAutodisable, getTabindex, getValue, isChecked, isChildable, isDisabled, setAutodisable, setDisabled, setName, setTabindex, setValue, updateByClient
 
Methods inherited from class org.zkoss.zul.impl.LabelImageElement
clone, getExtraCtrl, getHoverImage, getHoverImageContent, getIconSclass, getImage, getImageContent, getSrc, isImageAssigned, setHoverImage, setHoverImageContent, setHoverImageContent, setIconSclass, setImage, setImageContent, setImageContent, setSrc
 
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, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, 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, setZIndexDirectly
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setStubonly, setStubonly, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Radio

public Radio()

Radio

public Radio(String label)

Radio

public Radio(String label,
             String image)
Method Detail

getRadiogroup

public Radiogroup getRadiogroup()
Returns Radiogroup that this radio button belongs to. It is the nearest ancestor Radiogroup. In other words, it searches up the parent, parent's parent and so on for any Radiogroup 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(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 class Checkbox

getName

public 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()).

Overrides:
getName in class Checkbox

getZclass

public String getZclass()
Returns the Style of radio label

Default: "z-radio"

Since 3.5.1

Overrides:
getZclass in class Checkbox

setParent

public void setParent(org.zkoss.zk.ui.Component parent)
Specified by:
setParent in interface org.zkoss.zk.ui.Component
Overrides:
setParent in class org.zkoss.zk.ui.AbstractComponent

renderProperties

protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
                         throws IOException
Overrides:
renderProperties in class Checkbox
Throws:
IOException

service

public void service(org.zkoss.zk.au.AuRequest request,
                    boolean everError)
Processes an AU request.

Specified by:
service in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
service in class Checkbox
Since:
5.0.0

onPageDetached

public void onPageDetached(org.zkoss.zk.ui.Page page)
Specified by:
onPageDetached in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
onPageDetached in class org.zkoss.zk.ui.AbstractComponent


Copyright © 2013. All rights reserved.