Package org.zkoss.zul

Class Radio

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
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:
  • 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

    org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.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_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
    Constructor
    Description
     
    Radio(String label)
     
    Radio(String label, String image)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Returns the name of this radio button.
    Returns Radiogroup that this radio button belongs to.
    Returns the Style of radio label
    boolean
    Returns whether it is selected.
    void
    onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage)
     
    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(String radiogroupId)
    Associates the radiogroup to this radio component by giving ID.
    void
    Associates the radiogroup to this radio component.
    void
    setSelected(boolean selected)
    Sets whether it is selected.

    Methods inherited from class org.zkoss.zul.impl.LabelElement

    getLabel, renderCrawlable, setLabel

    Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent

    addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, 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, setSkeleton, 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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Radio

      public Radio()
    • Radio

      public Radio(String label)
    • Radio

      public Radio(String label, String image)
  • Method Details

    • 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
    • onPageAttached

      public void onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage)
      Specified by:
      onPageAttached in interface org.zkoss.zk.ui.sys.ComponentCtrl
      Overrides:
      onPageAttached in class org.zkoss.zk.ui.AbstractComponent
    • clone

      public Object clone()
      Specified by:
      clone in interface org.zkoss.zk.ui.Component
      Overrides:
      clone in class LabelImageElement