|
GWT 2.4.0-rc1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
public class RadioButton
A mutually-exclusive selection radio button widget. Fires
ClickEvent
s
when the radio button is clicked, and ValueChangeEvent
s 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.
CheckBox.setDirectionEstimator(boolean)
or
passing a DirectionEstimator parameter to the constructor, and is off by
default.
public class RadioButtonExample implements EntryPoint { public void onModuleLoad() { // Make some radio buttons, all in one group. RadioButton rb0 = new RadioButton("myRadioGroup", "foo"); RadioButton rb1 = new RadioButton("myRadioGroup", "bar"); RadioButton rb2 = new RadioButton("myRadioGroup", "baz"); // Check 'baz' by default. rb2.setChecked(true); // Add them to the root panel. FlowPanel panel = new FlowPanel(); panel.add(rb0); panel.add(rb1); panel.add(rb2); RootPanel.get().add(panel); } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
Field Summary | |
---|---|
static DirectionEstimator |
DEFAULT_DIRECTION_ESTIMATOR
|
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
RadioButton(java.lang.String name)
Creates a new radio associated with a particular group name. |
|
RadioButton(java.lang.String name,
SafeHtml label)
Creates a new radio associated with a particular group, and initialized with the given HTML label. |
|
RadioButton(java.lang.String name,
SafeHtml label,
DirectionEstimator directionEstimator)
|
|
RadioButton(java.lang.String name,
SafeHtml label,
HasDirection.Direction dir)
|
|
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). |
|
RadioButton(java.lang.String name,
java.lang.String label,
DirectionEstimator directionEstimator)
|
|
RadioButton(java.lang.String name,
java.lang.String label,
HasDirection.Direction dir)
|
Method Summary | |
---|---|
protected void |
ensureDomEventHandlers()
No-op. |
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, asEditor, getDirectionEstimator, getFormValue, getHTML, getName, getTabIndex, getText, getTextDirection, getValue, getWordWrap, isChecked, isEnabled, onEnsureDebugId, onLoad, onUnload, replaceInputElement, setAccessKey, setChecked, setDirectionEstimator, setDirectionEstimator, setEnabled, setFocus, setFormValue, setHTML, setHTML, setTabIndex, setText, setText, setValue, setValue, setWordWrap |
Methods inherited from class com.google.gwt.user.client.ui.ButtonBase |
---|
setHTML |
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, isAttached, isOrWasAttached, onDetach, removeFromParent, setLayoutData |
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, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents |
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 |
Methods inherited from interface com.google.gwt.safehtml.client.HasSafeHtml |
---|
setHTML |
Field Detail |
---|
public static final DirectionEstimator DEFAULT_DIRECTION_ESTIMATOR
Constructor Detail |
---|
@UiConstructor public RadioButton(java.lang.String name)
name
- the group name with which to associate the radio buttonpublic RadioButton(java.lang.String name, SafeHtml label)
name
- the group name with which to associate the radio buttonlabel
- this radio button's html labelpublic RadioButton(java.lang.String name, SafeHtml label, HasDirection.Direction dir)
name
- the group name with which to associate the radio buttonlabel
- this radio button's html labeldir
- the text's direction. Note that DEFAULT
means direction
should be inherited from the widget's parent element.RadioButton(String, SafeHtml)
public RadioButton(java.lang.String name, SafeHtml label, DirectionEstimator directionEstimator)
name
- the group name with which to associate the radio buttonlabel
- this radio button's html labeldirectionEstimator
- A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR
can be used.RadioButton(String, SafeHtml)
public RadioButton(java.lang.String name, java.lang.String label)
name
- the group name with which to associate the radio buttonlabel
- this radio button's labelpublic RadioButton(java.lang.String name, java.lang.String label, HasDirection.Direction dir)
name
- the group name with which to associate the radio buttonlabel
- this radio button's labeldir
- the text's direction. Note that DEFAULT
means direction
should be inherited from the widget's parent element.RadioButton(String, SafeHtml)
public RadioButton(java.lang.String name, java.lang.String label, DirectionEstimator directionEstimator)
name
- the group name with which to associate the radio buttonlabel
- this radio button's labeldirectionEstimator
- A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR
can be used.RadioButton(String, SafeHtml)
public RadioButton(java.lang.String name, java.lang.String label, boolean asHTML)
name
- name the group with which to associate the radio buttonlabel
- this radio button's labelasHTML
- true
to treat the specified label as HTMLMethod Detail |
---|
public void onBrowserEvent(Event event)
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
event
- the event receivedpublic void setName(java.lang.String name)
setName
in interface HasName
setName
in class CheckBox
name
- name the group with which to associate the radio buttonpublic void sinkEvents(int eventBitsToAdd)
Widget
isOrWasAttached()
:
@Override public void sinkEvents(int eventBitsToAdd) { if (isOrWasAttached()) { /* customized sink code goes here */ } else { super.sinkEvents(eventBitsToAdd); } }
sinkEvents
in class CheckBox
eventBitsToAdd
- a bitfield representing the set of events to be added
to this element's event setEvent
protected void ensureDomEventHandlers()
onBrowserEvent(com.google.gwt.user.client.Event)
ensureDomEventHandlers
in class CheckBox
|
GWT 2.4.0-rc1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |