eu.webtoolkit.jwt
Class WAbstractToggleButton

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
Direct Known Subclasses:
WCheckBox, WRadioButton

public abstract class WAbstractToggleButton
extends WFormWidget

An abstract base class for radio buttons and check boxes.

A toggle button provides a button with a boolean state (checked or unchecked), and a text label.

To act on a change of the state, either connect a slot to the WFormWidget#changed() signal, or connect a slot to the checked() or unChecked() signals.

The current state (checked or unchecked) may be inspected using the isChecked() method.


Constructor Summary
protected WAbstractToggleButton()
          Creates an unchecked toggle button without label.
protected WAbstractToggleButton(java.lang.CharSequence text)
          Creates an unchecked toggle button with given text label.
protected WAbstractToggleButton(java.lang.CharSequence text, WContainerWidget parent)
          Creates an unchecked toggle button with given text label.
protected WAbstractToggleButton(WContainerWidget parent)
          Creates an unchecked toggle button without label.
 
Method Summary
 EventSignal checked()
          Signal emitted when the button gets checked.
 WString getText()
          Returns the label text.
 java.lang.String getValueText()
          Returns the current value.
 boolean isChecked()
          Returns the button state.
 void remove()
          Destructor.
 void setChecked()
          Checks the button.
 void setChecked(boolean how)
          Sets the button state.
 void setText(java.lang.CharSequence text)
          Sets the label text.
 void setUnChecked()
          Unchecks the button.
 void setValueText(java.lang.String text)
          Sets the current value.
 EventSignal unChecked()
          Signal emitted when the button gets 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

WAbstractToggleButton

protected WAbstractToggleButton(WContainerWidget parent)
Creates an unchecked toggle button without label.


WAbstractToggleButton

protected WAbstractToggleButton()
Creates an unchecked toggle button without label.

Calls this((WContainerWidget)null)


WAbstractToggleButton

protected WAbstractToggleButton(java.lang.CharSequence text,
                                WContainerWidget parent)
Creates an unchecked toggle button with given text label.

The text label is rendered to the right side of the button.


WAbstractToggleButton

protected WAbstractToggleButton(java.lang.CharSequence text)
Creates an unchecked toggle button with given text label.

Calls this(text, (WContainerWidget)null)

Method Detail

remove

public void remove()
Destructor.

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

setText

public void setText(java.lang.CharSequence text)
Sets the label text.

The label is rendered to the right fo the button.


getText

public WString getText()
Returns the label text.

See Also:
setText(CharSequence text)

isChecked

public boolean isChecked()
Returns the button state.

See Also:
setChecked()

setChecked

public void setChecked(boolean how)
Sets the button state.

This method does not emit one of the checked() or unChecked() signals.

See Also:
setChecked(), setUnChecked()

setChecked

public void setChecked()
Checks the button.

Does not emit the checked() signal.

See Also:
setChecked(boolean how)

setUnChecked

public void setUnChecked()
Unchecks the button.

Does not emit the unChecked() signal.

See Also:
setChecked(boolean how)

getValueText

public java.lang.String getValueText()
Returns the current value.

Returns "yes" when checked, "maybe" when partially checked, and "no" when unchecked.

Specified by:
getValueText in class WFormWidget

setValueText

public void setValueText(java.lang.String text)
Sets the current value.

This interprets text values of "yes", "maybe" or "no".

Specified by:
setValueText in class WFormWidget

checked

public EventSignal checked()
Signal emitted when the button gets checked.

This signal is emitted when the user checks the button.

You can use the WFormWidget#changed() signal to react to any change of the button state.


unChecked

public EventSignal unChecked()
Signal emitted when the button gets unChecked.

This signal is emitted when the user unchecks the button.

You can use the WFormWidget#changed() signal to react to any change of the button state.