public class SimpleCheckBox extends FocusWidget implements HasName, HasValue<Boolean>, IsEditor<LeafValueEditor<Boolean>>
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
DEBUG_ID_PREFIX
Modifier | Constructor and Description |
---|---|
|
SimpleCheckBox()
Creates a new simple checkbox.
|
protected |
SimpleCheckBox(Element element)
This constructor may be used by subclasses to explicitly use an existing
element.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<Boolean> handler)
Adds a
ValueChangeEvent handler. |
LeafValueEditor<Boolean> |
asEditor()
Returns the Editor encapsulated by the view object.
|
protected void |
ensureDomEventHandlers() |
String |
getFormValue()
Returns the value property of the input element that backs this widget.
|
String |
getName()
Gets the widget's name.
|
Boolean |
getValue()
Determines whether this check box is currently checked.
|
boolean |
isChecked()
Deprecated.
Use
getValue() instead |
protected void |
onUnload()
This method is called when a widget is detached from the browser's
document.
|
void |
setChecked(boolean checked)
Deprecated.
Use
setValue(Boolean) instead |
void |
setEnabled(boolean enabled)
Sets whether this widget is enabled.
|
void |
setFormValue(String value)
Set the value property on the input element that backs this widget.
|
void |
setName(String name)
Sets the widget's name.
|
void |
setValue(Boolean value)
Checks or unchecks the check box.
|
void |
setValue(Boolean value,
boolean fireEvents)
Checks or unchecks the check box, firing
ValueChangeEvent if
appropriate. |
static SimpleCheckBox |
wrap(Element element)
Creates a SimpleCheckBox widget that wraps an existing <input
type='checkbox'> element.
|
addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, getFocusImpl, getTabIndex, isEnabled, onAttach, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setFocus, setTabIndex
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
fireEvent
public SimpleCheckBox()
protected SimpleCheckBox(Element element)
element
- the element to be usedpublic static SimpleCheckBox wrap(Element element)
RootPanel.detachNow(Widget)
.element
- the element to be wrappedpublic HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler)
HasValueChangeHandlers
ValueChangeEvent
handler.addValueChangeHandler
in interface HasValueChangeHandlers<Boolean>
handler
- the handlerpublic LeafValueEditor<Boolean> asEditor()
IsEditor
asEditor
in interface IsEditor<LeafValueEditor<Boolean>>
Editor
of type Epublic String getFormValue()
FormPanel
that holds it is submitted
and the box is checked.
Don't confuse this with getValue()
, which returns true or false if
the widget is checked.
public Boolean getValue()
Note that this does not return the value property of the checkbox
input element wrapped by this widget. For access to that property, see
getFormValue()
getValue
in interface TakesValue<Boolean>
getValue
in interface HasValue<Boolean>
true
if the check box is checked, false otherwise.
Will not return nullTakesValue.setValue(V)
@Deprecated public boolean isChecked()
getValue()
insteadtrue
if the check box is checked@Deprecated public void setChecked(boolean checked)
setValue(Boolean)
insteadchecked
- true
to check the check boxpublic void setEnabled(boolean enabled)
FocusWidget
setEnabled
in interface HasEnabled
setEnabled
in class FocusWidget
enabled
- true
to enable the widget, false
to disable itpublic void setFormValue(String value)
FormPanel
that holds it is submitted and the box
is checked.
Don't confuse this with setValue(java.lang.Boolean)
, which actually checks and
unchecks the box.
value
- public void setName(String name)
HasName
public void setValue(Boolean value)
Note that this does not set the value property of the checkbox
input element wrapped by this widget. For access to that property, see
setFormValue(String)
setValue
in interface TakesValue<Boolean>
setValue
in interface HasValue<Boolean>
value
- true to check, false to uncheck; null value implies falseTakesValue.getValue()
public void setValue(Boolean value, boolean fireEvents)
ValueChangeEvent
if
appropriate.
Note that this does not set the value property of the checkbox
input element wrapped by this widget. For access to that property, see
setFormValue(String)
setValue
in interface HasValue<Boolean>
value
- true to check, false to uncheck; null value implies falsefireEvents
- If true, and value has changed, fire a
ValueChangeEvent
protected void ensureDomEventHandlers()
Copyright © 2018. All rights reserved.