Package com.google.gwt.user.client.ui
Class SimpleCheckBox
- java.lang.Object
-
- com.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.SimpleCheckBox
-
- All Implemented Interfaces:
IsEditor<LeafValueEditor<java.lang.Boolean>>,HasAllDragAndDropHandlers,HasAllFocusHandlers,HasAllGestureHandlers,HasAllKeyHandlers,HasAllMouseHandlers,HasAllTouchHandlers,HasBlurHandlers,HasClickHandlers,HasDoubleClickHandlers,HasDragEndHandlers,HasDragEnterHandlers,HasDragHandlers,HasDragLeaveHandlers,HasDragOverHandlers,HasDragStartHandlers,HasDropHandlers,HasFocusHandlers,HasGestureChangeHandlers,HasGestureEndHandlers,HasGestureStartHandlers,HasKeyDownHandlers,HasKeyPressHandlers,HasKeyUpHandlers,HasMouseDownHandlers,HasMouseMoveHandlers,HasMouseOutHandlers,HasMouseOverHandlers,HasMouseUpHandlers,HasMouseWheelHandlers,HasTouchCancelHandlers,HasTouchEndHandlers,HasTouchMoveHandlers,HasTouchStartHandlers,HasAttachHandlers,HasValueChangeHandlers<java.lang.Boolean>,HasHandlers,EventListener,TakesValue<java.lang.Boolean>,Focusable,HasEnabled,HasFocus,HasName,HasValue<java.lang.Boolean>,HasVisibility,IsWidget,SourcesClickEvents,SourcesFocusEvents,SourcesKeyboardEvents,SourcesMouseEvents
- Direct Known Subclasses:
SimpleRadioButton
public class SimpleCheckBox extends FocusWidget implements HasName, HasValue<java.lang.Boolean>, IsEditor<LeafValueEditor<java.lang.Boolean>>
A simple checkbox widget, with no label.CSS Style Rules
- .gwt-SimpleCheckBox { }
- .gwt-SimpleCheckBox-disabled { Applied when checkbox is disabled }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
-
-
Field Summary
-
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
-
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
-
Constructor Summary
Constructors Modifier Constructor Description SimpleCheckBox()Creates a new simple checkbox.protectedSimpleCheckBox(Element element)This constructor may be used by subclasses to explicitly use an existing element.(package private)SimpleCheckBox(Element element, java.lang.String styleName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description HandlerRegistrationaddValueChangeHandler(ValueChangeHandler<java.lang.Boolean> handler)Adds aValueChangeEventhandler.LeafValueEditor<java.lang.Boolean>asEditor()Returns the Editor encapsulated by the view object.protected voidensureDomEventHandlers()java.lang.StringgetFormValue()Returns the value property of the input element that backs this widget.java.lang.StringgetName()Gets the widget's name.java.lang.BooleangetValue()Determines whether this check box is currently checked.booleanisChecked()Deprecated.UsegetValue()insteadprotected voidonUnload()This method is called when a widget is detached from the browser's document.voidsetChecked(boolean checked)Deprecated.UsesetValue(Boolean)insteadvoidsetEnabled(boolean enabled)Sets whether this widget is enabled.voidsetFormValue(java.lang.String value)Set the value property on the input element that backs this widget.voidsetName(java.lang.String name)Sets the widget's name.voidsetValue(java.lang.Boolean value)Checks or unchecks the check box.voidsetValue(java.lang.Boolean value, boolean fireEvents)Checks or unchecks the check box, firingValueChangeEventif appropriate.static SimpleCheckBoxwrap(Element element)Creates a SimpleCheckBox widget that wraps an existing <input type='checkbox'> element.-
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
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
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
-
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, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
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
-
-
-
-
Constructor Detail
-
SimpleCheckBox
public SimpleCheckBox()
Creates a new simple checkbox.
-
SimpleCheckBox
protected SimpleCheckBox(Element element)
This constructor may be used by subclasses to explicitly use an existing element. This element must be an <input> element whose type is either 'checkbox'.- Parameters:
element- the element to be used
-
SimpleCheckBox
SimpleCheckBox(Element element, java.lang.String styleName)
-
-
Method Detail
-
wrap
public static SimpleCheckBox wrap(Element element)
Creates a SimpleCheckBox widget that wraps an existing <input type='checkbox'> element. This element must already be attached to the document. If the element is removed from the document, you must callRootPanel.detachNow(Widget).- Parameters:
element- the element to be wrapped
-
addValueChangeHandler
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.lang.Boolean> handler)
Description copied from interface:HasValueChangeHandlersAdds aValueChangeEventhandler.- Specified by:
addValueChangeHandlerin interfaceHasValueChangeHandlers<java.lang.Boolean>- Parameters:
handler- the handler- Returns:
- the registration for the event
-
asEditor
public LeafValueEditor<java.lang.Boolean> asEditor()
Description copied from interface:IsEditorReturns the Editor encapsulated by the view object.- Specified by:
asEditorin interfaceIsEditor<LeafValueEditor<java.lang.Boolean>>- Returns:
- an
Editorof type E
-
getFormValue
public java.lang.String getFormValue()
Returns the value property of the input element that backs this widget. This is the value that will be associated with the check box name and submitted to the server if aFormPanelthat 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.
-
getName
public java.lang.String getName()
Description copied from interface:HasNameGets the widget's name.
-
getValue
public java.lang.Boolean getValue()
Determines whether this check box is currently checked.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()- Specified by:
getValuein interfaceHasValue<java.lang.Boolean>- Specified by:
getValuein interfaceTakesValue<java.lang.Boolean>- Returns:
trueif the check box is checked, false otherwise. Will not return null- See Also:
TakesValue.setValue(V)
-
isChecked
@Deprecated public boolean isChecked()
Deprecated.UsegetValue()insteadDetermines whether this check box is currently checked.- Returns:
trueif the check box is checked
-
setChecked
@Deprecated public void setChecked(boolean checked)
Deprecated.UsesetValue(Boolean)insteadChecks or unchecks this check box.- Parameters:
checked-trueto check the check box
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from class:FocusWidgetSets whether this widget is enabled.- Specified by:
setEnabledin interfaceHasEnabled- Overrides:
setEnabledin classFocusWidget- Parameters:
enabled-trueto enable the widget,falseto disable it
-
setFormValue
public void setFormValue(java.lang.String value)
Set the value property on the input element that backs this widget. This is the value that will be associated with the check box's name and submitted to the server if aFormPanelthat 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.- Parameters:
value-
-
setName
public void setName(java.lang.String name)
Description copied from interface:HasNameSets the widget's name.
-
setValue
public void setValue(java.lang.Boolean value)
Checks or unchecks the check box.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)- Specified by:
setValuein interfaceHasValue<java.lang.Boolean>- Specified by:
setValuein interfaceTakesValue<java.lang.Boolean>- Parameters:
value- true to check, false to uncheck; null value implies false- See Also:
TakesValue.getValue()
-
setValue
public void setValue(java.lang.Boolean value, boolean fireEvents)Checks or unchecks the check box, firingValueChangeEventif 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)- Specified by:
setValuein interfaceHasValue<java.lang.Boolean>- Parameters:
value- true to check, false to uncheck; null value implies falsefireEvents- If true, and value has changed, fire aValueChangeEvent
-
ensureDomEventHandlers
protected void ensureDomEventHandlers()
-
-