public class CheckBox extends AbstractField<Boolean>
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
Field.ValueChangeEvent
Buffered.SourceException
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
DESIGN_ATTR_PLAIN_TEXT
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
Constructor and Description |
---|
CheckBox()
Creates a new checkbox.
|
CheckBox(String caption)
Creates a new checkbox with a set caption.
|
CheckBox(String caption,
boolean initialState)
Creates a new checkbox with a caption and a set initial state.
|
CheckBox(String caption,
Property<?> dataSource)
Creates a new checkbox that is connected to a boolean property.
|
Modifier and Type | Method and Description |
---|---|
void |
addBlurListener(FieldEvents.BlurListener listener) |
void |
addFocusListener(FieldEvents.FocusListener listener) |
void |
addListener(FieldEvents.BlurListener listener)
Deprecated.
As of 7.0, replaced by
#addBlurListener(BlurListener) |
void |
addListener(FieldEvents.FocusListener listener)
Deprecated.
As of 7.0, replaced by
#addFocusListener(FocusListener) |
boolean |
booleanValue()
Deprecated.
As of 7.0, use
AbstractField.getValue() instead and, if needed,
handle null values. |
void |
clear()
Clears the value of the field.
|
protected Collection<String> |
getCustomAttributes()
Returns a collection of attributes that should not be handled by the
basic implementation of the
readDesign and writeDesign
methods. |
protected CheckBoxState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
Class<Boolean> |
getType()
Returns the type of the Field.
|
boolean |
isEmpty()
Is the field empty?
In general, "empty" state is same as null.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
void |
removeBlurListener(FieldEvents.BlurListener listener) |
void |
removeFocusListener(FieldEvents.FocusListener listener) |
void |
removeListener(FieldEvents.BlurListener listener)
Deprecated.
As of 7.0, replaced by
#removeBlurListener(BlurListener) |
void |
removeListener(FieldEvents.FocusListener listener)
Deprecated.
As of 7.0, replaced by
#removeFocusListener(FocusListener) |
protected void |
setInternalValue(Boolean newValue)
Sets the internal field value.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, attach, beforeClientResponse, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getTabIndex, getValidators, getValue, isBuffered, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, setValue, shouldHideErrors, toString, validate, validate, valueChange
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefined
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setVisible
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
addShortcutListener, removeShortcutListener
public CheckBox()
public CheckBox(String caption)
caption
- the Checkbox caption.public CheckBox(String caption, boolean initialState)
caption
- the caption of the checkboxinitialState
- the initial state of the checkboxpublic Class<Boolean> getType()
AbstractField
getValue
and
setValue
must be compatible with this type: one must be able
to safely cast the value returned from getValue
to the given
type and pass any variable assignable to this type as an argument to
setValue
.protected CheckBoxState getState()
AbstractComponent
getState
in class AbstractField<Boolean>
protected void setInternalValue(Boolean newValue)
AbstractField
AbstractField.getInternalValue()
if necessary.setInternalValue
in class AbstractField<Boolean>
newValue
- the new value to be set.public void addBlurListener(FieldEvents.BlurListener listener)
@Deprecated public void addListener(FieldEvents.BlurListener listener)
#addBlurListener(BlurListener)
public void removeBlurListener(FieldEvents.BlurListener listener)
@Deprecated public void removeListener(FieldEvents.BlurListener listener)
#removeBlurListener(BlurListener)
public void addFocusListener(FieldEvents.FocusListener listener)
@Deprecated public void addListener(FieldEvents.FocusListener listener)
#addFocusListener(FocusListener)
public void removeFocusListener(FieldEvents.FocusListener listener)
@Deprecated public void removeListener(FieldEvents.FocusListener listener)
#removeFocusListener(FocusListener)
@Deprecated public boolean booleanValue()
AbstractField.getValue()
instead and, if needed,
handle null values.public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign
in interface Component
readDesign
in class AbstractField<Boolean>
design
- The element to obtain the state fromdesignContext
- The DesignContext instance used for parsing the designprotected Collection<String> getCustomAttributes()
AbstractComponent
readDesign
and writeDesign
methods. Typically these are handled in a custom way in the overridden
versions of the above methodsgetCustomAttributes
in class AbstractField<Boolean>
public void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign
in interface Component
writeDesign
in class AbstractField<Boolean>
design
- The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext
- The DesignContext instance used for writing the designpublic void clear()
Field
The field value is typically reset to the initial value of the field.
Calling Field.isEmpty()
on a cleared field must always returns true.
public boolean isEmpty()
Field
Copyright © 2019 Vaadin Ltd. All rights reserved.