Class CmsRadioButton

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.opencms.gwt.client.ui.input.CmsRadioButton
All Implemented Interfaces:
com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasHorizontalAlignment, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget

public class CmsRadioButton extends com.google.gwt.user.client.ui.Composite implements com.google.gwt.user.client.ui.HasHorizontalAlignment, com.google.gwt.event.dom.client.HasClickHandlers
Class representing a single radio button.

In most cases, you will need to set the group of a radio button, which is a Java object, not just a string as in HTML radio buttons. Clicking on a radio button in a group will result in the radio button being selected, and none of the other buttons in the group being selected.

Since:
8.0.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

    com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled

    Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment

    com.google.gwt.user.client.ui.HasHorizontalAlignment.AutoHorizontalAlignmentConstant, com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected CmsToggleButton
    The wigdet used to implement the actual radio button.
    The radio button group.

    Fields inherited from class com.google.gwt.user.client.ui.UIObject

    DEBUG_ID_PREFIX

    Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment

    ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new radio button without setting the name and label text.
    CmsRadioButton(String name, String labelText)
    Creates a new radio button.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.gwt.event.shared.HandlerRegistration
    addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
    Adds a click handler to the radio button.
    com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant
    This is the alignment of the text in reference to the checkbox, possible values are left or right.
    Returns the value associated with this radio button.
    Returns the radio button.
    boolean
    Returns true if the radio button is checked.
    boolean
    Returns true if this widget is enabled.
    void
    setChecked(boolean checked)
    Sets the 'checked' status of the radio button.
    void
    setEnabled(boolean enabled)
    Enables or disables the radio button.
    void
    Sets the group for this radio button.
    void
    setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant align)
    This is the alignment of the text in reference to the checkbox, possible values are left or right.
    void
    Sets the name of this radio button.
    void
    Sets the text which is displayed next to the radio button.

    Methods inherited from class com.google.gwt.user.client.ui.Composite

    claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget

    Methods inherited from class com.google.gwt.user.client.ui.Widget

    addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents

    Methods inherited from class com.google.gwt.user.client.ui.UIObject

    addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.gwt.event.shared.HasHandlers

    fireEvent
  • Field Details

  • Constructor Details

    • CmsRadioButton

      public CmsRadioButton()
      Creates a new radio button without setting the name and label text.

    • CmsRadioButton

      public CmsRadioButton(String name, String labelText)
      Creates a new radio button.

      Parameters:
      name - the value associated with this radio button
      labelText - the label text of the radio button
  • Method Details

    • addClickHandler

      public com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
      Adds a click handler to the radio button.

      Specified by:
      addClickHandler in interface com.google.gwt.event.dom.client.HasClickHandlers
      See Also:
      • HasClickHandlers.addClickHandler(com.google.gwt.event.dom.client.ClickHandler)
    • getHorizontalAlignment

      public com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
      This is the alignment of the text in reference to the checkbox, possible values are left or right.

      Specified by:
      getHorizontalAlignment in interface com.google.gwt.user.client.ui.HasHorizontalAlignment
      See Also:
      • HasHorizontalAlignment.getHorizontalAlignment()
    • getName

      public String getName()
      Returns the value associated with this radio button.

      Returns:
      the value associated with this radio button
    • getRadioButton

      Returns the radio button.

      Returns:
      the radio button
    • isChecked

      public boolean isChecked()
      Returns true if the radio button is checked.

      Returns:
      true if the radio button is checked
    • isEnabled

      public boolean isEnabled()
      Returns true if this widget is enabled.

      Returns:
      true if this widget is enabled
    • setChecked

      public void setChecked(boolean checked)
      Sets the 'checked' status of the radio button.

      Parameters:
      checked - if true, check the radio button, else uncheck it
    • setEnabled

      public void setEnabled(boolean enabled)
      Enables or disables the radio button.

      Parameters:
      enabled - if true, the radio button is enabled, else disabled
    • setGroup

      public void setGroup(CmsRadioButtonGroup group)
      Sets the group for this radio button.

      Parameters:
      group - the radio button group
    • setHorizontalAlignment

      public void setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant align)
      This is the alignment of the text in reference to the checkbox, possible values are left or right.

      Specified by:
      setHorizontalAlignment in interface com.google.gwt.user.client.ui.HasHorizontalAlignment
      See Also:
      • HasHorizontalAlignment.setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant)
    • setName

      public void setName(String name)
      Sets the name of this radio button.

      Parameters:
      name - the new name
    • setText

      public void setText(String text)
      Sets the text which is displayed next to the radio button.

      Parameters:
      text - the new text