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, HtmlBasedComponent, Component, Disable, Scope, ComponentCtrl, Checkbox, Radio, LabelElement, LabelImageElement, XulElement

public class Radio
extends Checkbox
implements Radio

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
AbstractComponent.Children
 
Field Summary
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_height, _left, _top, _width, _zclass
 
Fields inherited from class org.zkoss.zk.ui.AbstractComponent
_visible
 
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(java.lang.String label)
           
Radio(java.lang.String label, java.lang.String image)
           
 
Method Summary
 java.lang.String getName()
          Returns the name of this radio button.
 Radiogroup getRadiogroup()
          Returns Radiogroup that this radio button belongs to.
 Radiogroup getRadiogroupApi()
          Returns Radiogroup that this radio button belongs to.
 java.lang.String getValue()
          Returns the value.
 java.lang.String getZclass()
          Returns the Style of radio label Default: "z-radio" Since 3.5.1
 boolean isSelected()
          Returns whether it is selected.
 void onCheck(Event event)
          Process the onCheck event sent when the radio is checked.
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 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
getTabindex, isChecked, isDisabled, setDisabled, setName, setTabindex
 
Methods inherited from class org.zkoss.zul.impl.LabelImageElement
getHoverImage, getImage, getImageContent, getSrc, isImageAssigned, newExtraCtrl, setHoverImage, setHoverImageContent, setHoverImageContent, setImage, setImageContent, setImageContent, setSrc
 
Methods inherited from class org.zkoss.zul.impl.LabelElement
getLabel, setLabel
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getDraggable, getDroppable, getHeight, getHflex, getLeft, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, setClass, setDraggable, setDroppable, setFocus, setHeight, setHflex, setLeft, setSclass, setStyle, setTooltiptext, setTop, setVflex, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, containsVariable, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getChildren, getClientEvents, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getExtraCtrl, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, newChildren, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setVariable, setVisible, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, unsetVariable, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zkoss.zul.api.Checkbox
getTabindex, isChecked, isDisabled, setDisabled, setName, setTabindex
 
Methods inherited from interface org.zkoss.zul.impl.api.LabelImageElement
getHoverImage, getImage, getImageContent, setHoverImage, setHoverImageContent, setHoverImageContent, setImage, setImageContent, setImageContent
 
Methods inherited from interface org.zkoss.zul.impl.api.LabelElement
getLabel, setLabel
 
Methods inherited from interface org.zkoss.zul.impl.api.XulElement
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, clone, containsVariable, detach, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getChildren, getDefinition, getDesktop, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setAuService, setId, setMold, setPage, setPageBefore, setVariable, setVisible, setWidgetListener, setWidgetOverride, unsetVariable
 
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
 

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.


getRadiogroupApi

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

Specified by:
getRadiogroupApi in interface Radio
Since:
3.5.2

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.

Specified by:
setChecked in interface Checkbox
Overrides:
setChecked in class Checkbox

getValue

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

Default: "".

Specified by:
getValue in interface Radio

setValue

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

Specified by:
setValue in interface Radio
Parameters:
value - the value; If null, it is considered as empty.

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

Specified by:
getName in interface Checkbox
Overrides:
getName in class Checkbox

getZclass

public java.lang.String getZclass()
Returns the Style of radio label

Default: "z-radio"

Since 3.5.1

Specified by:
getZclass in interface HtmlBasedComponent
Overrides:
getZclass in class Checkbox
See Also:
HtmlBasedComponent.getSclass()

onCheck

public void onCheck(Event event)
Process the onCheck event sent when the radio is checked.

Since:
3.6.0

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 back Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and/or Component.removeChild(org.zkoss.zk.ui.Component), while Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.removeChild(org.zkoss.zk.ui.Component) always calls back Component.setParent(org.zkoss.zk.ui.Component), if the parent is changed. Thus, you don't need to override both Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.setParent(org.zkoss.zk.ui.Component), if you want to customize the behavior.

Specified by:
setParent in interface Component
Overrides:
setParent in class AbstractComponent

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.

See also Render Special Properties

Overrides:
renderProperties in class Checkbox
Throws:
java.io.IOException

service

public void service(AuRequest request,
                    boolean everError)
Processes an AU request.

Specified by:
service in interface ComponentCtrl
Overrides:
service in class Checkbox
everError - whether any error ever occured before processing this request.
Since:
5.0.0
See Also:
AbstractComponent.setAuService(org.zkoss.zk.au.AuService)


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo