com.alkacon.geranium.client.ui.input
public class CheckBox extends com.google.gwt.user.client.ui.Composite implements com.google.gwt.event.dom.client.HasClickHandlers, I_FormWidget, I_HasInit, com.google.gwt.user.client.ui.HasHorizontalAlignment, com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.Boolean>
It can be checked/unchecked and enabled/disabled, which means 4 combinations in total. So you need to supply 4 images, one for each of the combinations.
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabledI_FormWidget.FieldType| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
WIDGET_TYPE
Type string for this widget.
|
| Constructor and Description |
|---|
CheckBox()
Default constructor which creates a checkbox without a label.
|
CheckBox(java.lang.String labelText)
Public constructor for a checkbox.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
Adds a click handler to the checkbox.
|
com.google.gwt.event.shared.HandlerRegistration |
addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.lang.Boolean> handler) |
void |
disable(java.lang.String disabledReason)
Disables the checkbox and changes the checkbox title attribute to the disabled reason.
|
void |
enable()
Enables the checkbox, switching the checkbox title attribute from the disabled reason to the original title.
|
protected void |
fireValueChangedEvent()
Helper method for firing a 'value changed' event.
|
java.lang.String |
getApparentValue()
Returns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.
|
I_FormWidget.FieldType |
getFieldType()
Returns the type of data this widget produces.
|
java.lang.Boolean |
getFormValue()
Gets the selected/entered value from the widget.
|
java.lang.String |
getFormValueAsString()
Gets the current value of the widget as a string.
|
com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant |
getHorizontalAlignment()
This is the alignment of the text in reference to the checkbox, possible values are left or right.
|
boolean |
isChecked()
Returns true if the checkbox is checked.
|
boolean |
isEnabled()
Returns true if the checkbox is enabled.
|
void |
reset()
Resets the widget to its default state.
|
void |
setAutoHideParent(I_AutoHider autoHideParent)
Call this when auto hiding parents are shown.
|
void |
setChecked(boolean checked)
Checks or unchecks the checkbox.
|
void |
setEnabled(boolean enabled)
Enables or disables the checkbox.
|
void |
setErrorMessage(java.lang.String errorMessage)
Sets the error message for this widget.
|
void |
setFormValue(java.lang.Object value)
Sets the value of the widget.
|
void |
setFormValueAsString(java.lang.String value)
Sets the current value of the widget as a string.
|
void |
setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant align)
This is the alignment of the text in reference to the checkbox, possible values are left or right.
|
void |
setText(java.lang.String text)
Sets the text.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEventspublic static final java.lang.String WIDGET_TYPE
public CheckBox()
public CheckBox(java.lang.String labelText)
The label text passed will be displayed to the right of the checkbox. If it is null, no label is displayed.
labelText - the label textpublic com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
addClickHandler in interface com.google.gwt.event.dom.client.HasClickHandlersHasClickHandlers.addClickHandler(com.google.gwt.event.dom.client.ClickHandler)public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.lang.Boolean> handler)
addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.Boolean>HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)public void disable(java.lang.String disabledReason)
disabledReason - the disabled reasonpublic void enable()
public java.lang.String getApparentValue()
I_FormWidgetgetApparentValue in interface I_FormWidgetI_FormWidget.getApparentValue()public I_FormWidget.FieldType getFieldType()
I_FormWidgetgetFieldType in interface I_FormWidgetI_FormWidget.getFieldType()public java.lang.Boolean getFormValue()
I_FormWidgetgetFormValue in interface I_FormWidgetI_FormWidget.getFormValue()public java.lang.String getFormValueAsString()
I_FormWidgetgetFormValueAsString in interface I_FormWidgetI_FormWidget.getFormValueAsString()public com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
getHorizontalAlignment in interface com.google.gwt.user.client.ui.HasHorizontalAlignmentHasHorizontalAlignment.getHorizontalAlignment()public boolean isChecked()
public boolean isEnabled()
isEnabled in interface I_FormWidgetpublic void reset()
I_FormWidgetreset in interface I_FormWidgetI_FormWidget.reset()public void setAutoHideParent(I_AutoHider autoHideParent)
I_FormWidgetsetAutoHideParent in interface I_FormWidgetautoHideParent - the auto hide parentI_FormWidget.setAutoHideParent(com.alkacon.geranium.client.ui.I_AutoHider)public void setChecked(boolean checked)
checked - if true, check the checkbox else uncheck itpublic void setEnabled(boolean enabled)
setEnabled in interface I_FormWidgetenabled - if true, enable the checkbox, else disable itpublic void setErrorMessage(java.lang.String errorMessage)
I_FormWidgetIf the error message is null, no error message will be displayed.
setErrorMessage in interface I_FormWidgeterrorMessage - an error message or nullI_FormWidget.setErrorMessage(java.lang.String)public void setFormValue(java.lang.Object value)
value - the new valuepublic void setFormValueAsString(java.lang.String value)
I_FormWidgetsetFormValueAsString in interface I_FormWidgetvalue - the new value of the widgetI_FormWidget.setFormValueAsString(java.lang.String)public void setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant align)
setHorizontalAlignment in interface com.google.gwt.user.client.ui.HasHorizontalAlignmentHasHorizontalAlignment.setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant)public void setText(java.lang.String text)
text - the text to setprotected void fireValueChangedEvent()