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:
java.io.Serializable, java.lang.Cloneable, org.zkoss.zk.ui.Component, 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
protected  class Radio.ExtraCtrl
          A utility class to implement AbstractComponent.getExtraCtrl().
 
Field Summary
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Constructor Summary
Radio()
           
Radio(java.lang.String label)
           
Radio(java.lang.String label, java.lang.String image)
           
 
Method Summary
 java.lang.String getInnerAttrs()
          Returns the inner attributes for generating the HTML radio tag (the name and value attribute).
 java.lang.String getName()
          Returns the name of this radio button.
 Radiogroup getRadiogroup()
          Returns Radiogroup that this radio button belongs to.
 java.lang.String getValue()
          Returns the value.
 boolean isSelected()
          Returns whether it is selected.
protected  java.lang.Object newExtraCtrl()
           
 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 setSelected(boolean selected)
          Sets whether it is selected.
 void setValue(java.lang.String value)
          Sets the value.
 
Methods inherited from class org.zkoss.zul.Checkbox
getLabelAttrs, getOuterAttrs, getTabindex, isChecked, isDisabled, isReadonly, setDisabled, setName, setReadonly, setTabindex
 
Methods inherited from class org.zkoss.zul.impl.LabelImageElement
getImage, getImageContent, getImgTag, getSrc, isImageAssigned, setImage, setImageContent, setSrc
 
Methods inherited from class org.zkoss.zul.impl.LabelElement
getLabel, setLabel
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getAction, getAllOnClickAttrs, getContext, getPopup, getTooltip, setAction, setContext, setPopup, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addEventListener, appendAsapAttr, focus, getDraggable, getDroppable, getHeight, getLeft, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZIndex, isAsapRequired, removeEventListener, setClass, setDraggable, setDroppable, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, clone, containsVariable, detach, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getEventHandler, getExtraCtrl, getFellow, getFellowIfAny, getId, getListenerIterator, getMold, getMoldURI, getNamespace, getPage, getParent, getPropagatee, getRoot, getSpaceOwner, getUuid, getVariable, insertBefore, invalidate, isChildable, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onDrawNewChild, onWrongValue, redraw, removeAttribute, removeAttribute, removeChild, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setVariable, setVisible, smartUpdate, smartUpdate, smartUpdate, toString, unsetVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Radio

public Radio()

Radio

public Radio(java.lang.String label)

Radio

public Radio(java.lang.String label,
             java.lang.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.


isSelected

public final boolean isSelected()
Returns whether it is selected.

Default: false.

Don't override this. Override Checkbox.isChecked() instead.


setSelected

public final 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

getValue

public java.lang.String getValue()
Returns the value.

Default: "".


setValue

public void setValue(java.lang.String value)
Sets the value.

Parameters:
value - the value; If null, it is considered as empty.

getName

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

Overrides:
getName in class Checkbox

getInnerAttrs

public java.lang.String getInnerAttrs()
Returns the inner attributes for generating the HTML radio tag (the name and value attribute).

Used only by component developers.

Overrides:
getInnerAttrs 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

newExtraCtrl

protected java.lang.Object newExtraCtrl()
Overrides:
newExtraCtrl in class Checkbox


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.