|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WWidget
eu.webtoolkit.jwt.WWebWidget
eu.webtoolkit.jwt.WInteractWidget
eu.webtoolkit.jwt.WFormWidget
eu.webtoolkit.jwt.WAbstractToggleButton
eu.webtoolkit.jwt.WCheckBox
public class WCheckBox
A user control that represents a check box.
By default, a checkbox can have two states: CheckState.Checked or
CheckState.Unchecked, which can be inspected using
WAbstractToggleButton#isChecked(),
and set using WAbstractToggleButton#setChecked().
A checkbox may also provide a third state,
CheckState.PartiallyChecked, which is useful to indicate that it is
neither checked or unchecked. JWt will use native browser support for this
HTML5 extension when available (Safari and MS IE), and use an image-based
workaround otherwise. You may enable support for the third state using
setTristate(), and use
setCheckState() and
getCheckState() to read all three states.
A label is added as a sibling of the checkbox to the same parent.
Usage example:
{
@code
WGroupBox box = new WGroupBox("In-flight options");
WCheckBox w1 = new WCheckBox("Vegetarian diet", box);
box.addWidget(new WBreak());
WCheckBox w2 = new WCheckBox("WIFI access", box);
box.addWidget(new WBreak());
WCheckBox w3 = new WCheckBox("AC plug", box);
w1.setChecked(false);
w2.setChecked(true);
w3.setChecked(true);
}
WCheckBox is an inline widget.
This widget corresponds to the HTML
<input type="checkbox"> 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.
WAbstractToggleButton| Constructor Summary | |
|---|---|
WCheckBox()
Creates a checkbox with empty label. |
|
WCheckBox(java.lang.CharSequence text)
Creates a checkbox with given label. |
|
WCheckBox(java.lang.CharSequence text,
WContainerWidget parent)
Creates a checkbox with given label. |
|
WCheckBox(WContainerWidget parent)
Creates a checkbox with empty label. |
|
| Method Summary | |
|---|---|
CheckState |
getCheckState()
Returns the check state. |
boolean |
isTristate()
Returns whether the checkbox is tristate. |
void |
setCheckState(CheckState state)
Sets the check state. |
void |
setTristate()
Makes a tristate checkbox. |
void |
setTristate(boolean tristate)
Makes a tristate checkbox. |
| Methods inherited from class eu.webtoolkit.jwt.WAbstractToggleButton |
|---|
checked, getText, getValueText, isChecked, remove, 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.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 |
|---|
public WCheckBox(WContainerWidget parent)
public WCheckBox()
Calls this((WContainerWidget)null)
public WCheckBox(java.lang.CharSequence text,
WContainerWidget parent)
public WCheckBox(java.lang.CharSequence text)
Calls this(text, (WContainerWidget)null)
| Method Detail |
|---|
public void setTristate(boolean tristate)
Note: You should enable tristate functionality right after construction and this cannot be modified later.
public final void setTristate()
Calls setTristate(true)
public boolean isTristate()
setTristate(boolean tristate)public void setCheckState(CheckState state)
Unless it is a tri-state checkbox, only CheckState.Checked and
CheckState.Unchecked are valid states.
public CheckState getCheckState()
setCheckState(CheckState state),
WAbstractToggleButton.isChecked()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||