com.google.gwt.user.client.ui
Class RadioButton
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.FocusWidget
com.google.gwt.user.client.ui.ButtonBase
com.google.gwt.user.client.ui.CheckBox
com.google.gwt.user.client.ui.RadioButton
- All Implemented Interfaces:
- HasAllFocusHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasBlurHandlers, HasClickHandlers, HasFocusHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasValueChangeHandlers<java.lang.Boolean>, HasHandlers, EventListener, Focusable, HasFocus, HasHTML, HasName, HasText, HasValue<java.lang.Boolean>, HasWordWrap, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents, SourcesMouseEvents, TakesValue<java.lang.Boolean>
public class RadioButton
- extends CheckBox
A mutually-exclusive selection radio button widget. Fires
ClickEvents
when the radio button is clicked, and ValueChangeEvents when the
button becomes checked. Note, however, that browser limitations prevent
ValueChangeEvents from being sent when the radio button is cleared as a side
effect of another in the group being clicked.
CSS Style Rules
- .gwt-RadioButton
- the outer element
Example
|
Constructor Summary |
RadioButton(java.lang.String name)
Creates a new radio associated with a particular group name. |
RadioButton(java.lang.String name,
java.lang.String label)
Creates a new radio associated with a particular group, and initialized
with the given HTML label. |
RadioButton(java.lang.String name,
java.lang.String label,
boolean asHTML)
Creates a new radio button associated with a particular group, and
initialized with the given label (optionally treated as HTML). |
|
Method Summary |
void |
onBrowserEvent(Event event)
Overridden to send ValueChangeEvents only when appropriate. |
void |
setName(java.lang.String name)
Change the group name of this radio button. |
void |
sinkEvents(int eventBitsToAdd)
Overridden to defer the call to super.sinkEvents until the first time this
widget is attached to the dom, as a performance enhancement. |
| Methods inherited from class com.google.gwt.user.client.ui.CheckBox |
addValueChangeHandler, getFormValue, getHTML, getName, getTabIndex, getText, getValue, getWordWrap, isChecked, isEnabled, setAccessKey, setChecked, setEnabled, setFocus, setFormValue, setHTML, setTabIndex, setText, setValue, setValue, setWordWrap |
| Methods inherited from class com.google.gwt.user.client.ui.FocusWidget |
addBlurHandler, addClickHandler, addClickListener, addFocusHandler, addFocusListener, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RadioButton
@UiConstructor
public RadioButton(java.lang.String name)
- Creates a new radio associated with a particular group name. All radio
buttons associated with the same group name belong to a mutually-exclusive
set.
Radio buttons are grouped by their name attribute, so changing their name
using the setName() method will also change their associated group.
- Parameters:
name - the group name with which to associate the radio button
RadioButton
public RadioButton(java.lang.String name,
java.lang.String label)
- Creates a new radio associated with a particular group, and initialized
with the given HTML label. All radio buttons associated with the same group
name belong to a mutually-exclusive set.
Radio buttons are grouped by their name attribute, so changing their name
using the setName() method will also change their associated group.
- Parameters:
name - the group name with which to associate the radio buttonlabel - this radio button's label
RadioButton
public RadioButton(java.lang.String name,
java.lang.String label,
boolean asHTML)
- Creates a new radio button associated with a particular group, and
initialized with the given label (optionally treated as HTML). All radio
buttons associated with the same group name belong to a mutually-exclusive
set.
Radio buttons are grouped by their name attribute, so changing their name
using the setName() method will also change their associated group.
- Parameters:
name - name the group with which to associate the radio buttonlabel - this radio button's labelasHTML - true to treat the specified label as HTML
onBrowserEvent
public void onBrowserEvent(Event event)
- Overridden to send ValueChangeEvents only when appropriate.
- Specified by:
onBrowserEvent in interface EventListener- Overrides:
onBrowserEvent in class Widget
- Parameters:
event - the event received
setName
public void setName(java.lang.String name)
- Change the group name of this radio button.
Radio buttons are grouped by their name attribute, so changing their name
using the setName() method will also change their associated group.
If changing this group name results in a new radio group with multiple
radio buttons selected, this radio button will remain selected and the
other radio buttons will be unselected.
- Specified by:
setName in interface HasName- Overrides:
setName in class CheckBox
- Parameters:
name - name the group with which to associate the radio button
sinkEvents
public void sinkEvents(int eventBitsToAdd)
- Description copied from class:
Widget
- Overridden to defer the call to super.sinkEvents until the first time this
widget is attached to the dom, as a performance enhancement. Subclasses
wishing to customize sinkEvents can preserve this deferred sink behavior by
putting their implementation behind a check of
isOrWasAttached():
@Override
public void sinkEvents(int eventBitsToAdd) {
if (isOrWasAttached()) {
/* customized sink code goes here */
} else {
super.sinkEvents(eventBitsToAdd);
}
}
- Overrides:
sinkEvents in class CheckBox
- Parameters:
eventBitsToAdd - a bitfield representing the set of events to be added
to this element's event set- See Also:
Event