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
-
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
Modifier and TypeFieldDescriptionprotected CmsToggleButton
The wigdet used to implement the actual radio button.protected CmsRadioButtonGroup
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
ConstructorDescriptionCreates 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 TypeMethodDescriptioncom.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.getName()
Returns the value associated with this radio button.Returns the radio button.boolean
Returns true if the radio button is checked.boolean
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
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
-
m_button
The wigdet used to implement the actual radio button. -
m_group
The radio button group.
-
-
Constructor Details
-
CmsRadioButton
public CmsRadioButton()Creates a new radio button without setting the name and label text. -
CmsRadioButton
Creates a new radio button.- Parameters:
name
- the value associated with this radio buttonlabelText
- 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 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
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
Returns true if the radio button is checked.- Returns:
- true if the radio button is checked
-
isEnabled
Returnstrue
if this widget is enabled.- Returns:
true
if this widget is enabled
-
setChecked
Sets the 'checked' status of the radio button.- Parameters:
checked
- if true, check the radio button, else uncheck it
-
setEnabled
Enables or disables the radio button.- Parameters:
enabled
- if true, the radio button is enabled, else disabled
-
setGroup
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
Sets the name of this radio button.- Parameters:
name
- the new name
-
setText
Sets the text which is displayed next to the radio button.- Parameters:
text
- the new text
-