public class

SimpleCheckBox

extends FocusWidget
implements IsEditor<E extends Editor<?>> TakesValue<V> HasName
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
Known Direct Subclasses

Class Overview

A simple checkbox widget, with no label.

CSS Style Rules

  • .gwt-SimpleCheckBox { }
  • .gwt-SimpleCheckBox-disabled { Applied when checkbox is disabled }

Summary

[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
Public Constructors
SimpleCheckBox()
Creates a new simple checkbox.
Protected Constructors
SimpleCheckBox(Element element)
This constructor may be used by subclasses to explicitly use an existing element.
Public Methods
LeafValueEditor<Boolean> asEditor()
Returns the Editor encapsulated by the view object.
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()
This method is deprecated. Use getValue() instead
void setChecked(boolean checked)
This method is 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.
static SimpleCheckBox wrap(Element element)
Creates a SimpleCheckBox widget that wraps an existing <input type='checkbox'> element.
Protected Methods
void onUnload()
This method is called when a widget is detached from the browser's document.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.FocusWidget
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.editor.client.IsEditor
From interface com.google.gwt.event.dom.client.HasBlurHandlers
From interface com.google.gwt.event.dom.client.HasClickHandlers
From interface com.google.gwt.event.dom.client.HasDoubleClickHandlers
From interface com.google.gwt.event.dom.client.HasFocusHandlers
From interface com.google.gwt.event.dom.client.HasGestureChangeHandlers
From interface com.google.gwt.event.dom.client.HasGestureEndHandlers
From interface com.google.gwt.event.dom.client.HasGestureStartHandlers
From interface com.google.gwt.event.dom.client.HasKeyDownHandlers
From interface com.google.gwt.event.dom.client.HasKeyPressHandlers
From interface com.google.gwt.event.dom.client.HasKeyUpHandlers
From interface com.google.gwt.event.dom.client.HasMouseDownHandlers
From interface com.google.gwt.event.dom.client.HasMouseMoveHandlers
From interface com.google.gwt.event.dom.client.HasMouseOutHandlers
From interface com.google.gwt.event.dom.client.HasMouseOverHandlers
From interface com.google.gwt.event.dom.client.HasMouseUpHandlers
From interface com.google.gwt.event.dom.client.HasMouseWheelHandlers
From interface com.google.gwt.event.dom.client.HasTouchCancelHandlers
From interface com.google.gwt.event.dom.client.HasTouchEndHandlers
From interface com.google.gwt.event.dom.client.HasTouchMoveHandlers
From interface com.google.gwt.event.dom.client.HasTouchStartHandlers
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.TakesValue
From interface com.google.gwt.user.client.ui.Focusable
From interface com.google.gwt.user.client.ui.HasEnabled
From interface com.google.gwt.user.client.ui.HasName
From interface com.google.gwt.user.client.ui.IsWidget
From interface com.google.gwt.user.client.ui.SourcesClickEvents
From interface com.google.gwt.user.client.ui.SourcesFocusEvents
From interface com.google.gwt.user.client.ui.SourcesKeyboardEvents
From interface com.google.gwt.user.client.ui.SourcesMouseEvents

Public Constructors

public SimpleCheckBox ()

Creates a new simple checkbox.

Protected Constructors

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

Public Methods

public LeafValueEditor<Boolean> asEditor ()

Returns the Editor encapsulated by the view object.

Returns

public 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 a 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 String getName ()

Gets the widget's name.

Returns
  • the widget's name

public 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()

Returns
  • true if the check box is checked, false otherwise. Will not return null

public boolean isChecked ()

This method is deprecated.
Use getValue() instead

Determines whether this check box is currently checked.

Returns
  • true if the check box is checked

public void setChecked (boolean checked)

This method is deprecated.
Use setValue(Boolean) instead

Checks or unchecks this check box.

Parameters
checked true to check the check box

public void setEnabled (boolean enabled)

Sets whether this widget is enabled.

Parameters
enabled true to enable the widget, false to disable it

public void setFormValue (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 a FormPanel that holds it is submitted and the box is checked.

Don't confuse this with setValue(V), which actually checks and unchecks the box.

public void setName (String name)

Sets the widget's name.

Parameters
name the widget's new name

public void setValue (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)

Parameters
value true to check, false to uncheck; null value implies false

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 call detachNow(Widget).

Parameters
element the element to be wrapped

Protected Methods

protected void onUnload ()

This method is called when a widget is detached from the browser's document. Overridden because of IE bug that throws away checked state.