eu.webtoolkit.jwt
Class WRadioButton

java.lang.Object
  extended by eu.webtoolkit.jwt.WObject
      extended by eu.webtoolkit.jwt.WWidget
          extended by eu.webtoolkit.jwt.WWebWidget
              extended by eu.webtoolkit.jwt.WInteractWidget
                  extended by eu.webtoolkit.jwt.WFormWidget
                      extended by eu.webtoolkit.jwt.WAbstractToggleButton
                          extended by eu.webtoolkit.jwt.WRadioButton

public class WRadioButton
extends WAbstractToggleButton

A user control that represents a radio button.

Use a WButtonGroup to group together radio buttons that reflect options that are mutually exclusive.

Usage example:

 enum Vote { Republican, Democrate, NoVote };
 
  // use a group box as widget container for 3 radio buttons, with a title
  WGroupBox container = new WGroupBox("USA elections vote");
 		 
  // use a button group to logically group the 3 options
  WButtonGroup group = new WButtonGroup(this);
 		 
  WRadioButton button;
  button = new WRadioButton("I voted Republican", container);
  new WBreak(container);
  group.addButton(button, Vote.Republican.ordinal());
  button = new WRadioButton("I voted Democrat", container);
  new WBreak(container);
  group.addButton(button, Vote.Democrate.ordinal());
 
  button = new WRadioButton("I didn't vote", container);
  new WBreak(container);
  group.addButton(button, Vote.NoVote.ordinal());
 		 
  group.setCheckedButton(group.button(Vote.NoVote.ordinal()));	
 
 

WRadioButton is an inline widget.

CSS

This widget corresponds to the HTML <input type="radio"> tag. Depending on whether a text is included, it may be nested in a <span> tag which also includes a rendered WLabel. This widget does not provide styling, and can be styled using inline or external CSS as appropriate.

See Also:
WAbstractToggleButton, WButtonGroup

Constructor Summary
WRadioButton()
          Creates an unchecked radio button with empty label and optional parent.
WRadioButton(java.lang.CharSequence text)
          Creates an unchecked radio button with given text and optional parent.
WRadioButton(java.lang.CharSequence text, WContainerWidget parent)
          Creates an unchecked radio button with given text and optional parent.
WRadioButton(WContainerWidget parent)
          Creates an unchecked radio button with empty label and optional parent.
 
Method Summary
 WButtonGroup getGroup()
          Returns the button group.
 void remove()
          Destructor.
 
Methods inherited from class eu.webtoolkit.jwt.WAbstractToggleButton
checked, getText, getValueText, isChecked, setChecked, setChecked, setText, setUnChecked, setValueText, unChecked
 
Methods inherited from class eu.webtoolkit.jwt.WFormWidget
blurred, changed, enableAjax, focussed, getEmptyText, getLabel, getTabIndex, getValidator, hasFocus, isReadOnly, propagateSetEnabled, refresh, render, selected, setEmptyText, setEnabled, setFocus, setFocus, setHidden, setReadOnly, setTabIndex, setValidator, validate, validated
 
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted
 
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, callJavaScriptMember, childrenChanged, doJavaScript, domCanBeSaved, escapeText, escapeText, escapeText, escapeText, find, getAttributeValue, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getStyleClass, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isVisible, jsStringLiteral, jsStringLiteral, removeScript, removeStyleClass, resize, setAttributeValue, setClearSides, setDecorationStyle, setDisabled, setFloatSide, setHiddenKeepsGeometry, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPopup, setPositionScheme, setSelectable, setStyleClass, setToolTip, setVerticalAlignment, updateSignalConnection
 
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
 
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getObjectName, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WRadioButton

public WRadioButton(WContainerWidget parent)
Creates an unchecked radio button with empty label and optional parent.


WRadioButton

public WRadioButton()
Creates an unchecked radio button with empty label and optional parent.

Calls this((WContainerWidget)null)


WRadioButton

public WRadioButton(java.lang.CharSequence text,
                    WContainerWidget parent)
Creates an unchecked radio button with given text and optional parent.


WRadioButton

public WRadioButton(java.lang.CharSequence text)
Creates an unchecked radio button with given text and optional parent.

Calls this(text, (WContainerWidget)null)

Method Detail

remove

public void remove()
Destructor.

Overrides:
remove in class WAbstractToggleButton
See Also:
WContainerWidget.removeWidget(WWidget widget)

getGroup

public WButtonGroup getGroup()
Returns the button group.

Returns the button group to which this button belongs.

See Also:
WButtonGroup.addButton(WRadioButton button, int id)