Package org.opencms.gwt.client.ui.input
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
-
-
Field Summary
Fields Modifier and Type Field Description protected CmsToggleButton
m_button
The wigdet used to implement the actual radio button.protected CmsRadioButtonGroup
m_group
The radio button group.
-
Constructor Summary
Constructors Constructor Description CmsRadioButton()
Creates a new radio button without setting the name and label text.CmsRadioButton(java.lang.String name, java.lang.String labelText)
Creates a new radio button.
-
Method Summary
All Methods Instance Methods Concrete Methods 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
getHorizontalAlignment()
This is the alignment of the text in reference to the checkbox, possible values are left or right.java.lang.String
getName()
Returns the value associated with this radio button.CmsToggleButton
getRadioButton()
Returns the radio button.boolean
isChecked()
Returns true if the radio button is checked.boolean
isEnabled()
Returnstrue
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
setGroup(CmsRadioButtonGroup group)
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
setName(java.lang.String name)
Sets the name of this radio button.void
setText(java.lang.String text)
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
-
-
-
-
Field Detail
-
m_button
protected CmsToggleButton m_button
The wigdet used to implement the actual radio button.
-
m_group
protected CmsRadioButtonGroup m_group
The radio button group.
-
-
Constructor Detail
-
CmsRadioButton
public CmsRadioButton()
Creates a new radio button without setting the name and label text.
-
CmsRadioButton
public CmsRadioButton(java.lang.String name, java.lang.String labelText)
Creates a new radio button.- Parameters:
name
- the value associated with this radio buttonlabelText
- the label text of the radio button
-
-
Method Detail
-
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 interfacecom.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 interfacecom.google.gwt.user.client.ui.HasHorizontalAlignment
- See Also:
HasHorizontalAlignment.getHorizontalAlignment()
-
getName
public java.lang.String getName()
Returns the value associated with this radio button.- Returns:
- the value associated with this radio button
-
getRadioButton
public CmsToggleButton 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()
Returnstrue
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 interfacecom.google.gwt.user.client.ui.HasHorizontalAlignment
- See Also:
HasHorizontalAlignment.setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant)
-
setName
public void setName(java.lang.String name)
Sets the name of this radio button.- Parameters:
name
- the new name
-
setText
public void setText(java.lang.String text)
Sets the text which is displayed next to the radio button.- Parameters:
text
- the new text
-
-