T
- item typepublic class CheckBoxGroup<T> extends AbstractMultiSelect<T> implements FieldEvents.FocusNotifier, FieldEvents.BlurNotifier, HasDataProvider<T>
DataProvider
. Checkboxes may have captions and icons.AbstractListing.AbstractListingExtension<T>
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<V>
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 |
---|
CheckBoxGroup()
Constructs a new CheckBoxGroup.
|
CheckBoxGroup(String caption)
Constructs a new CheckBoxGroup with caption.
|
CheckBoxGroup(String caption,
Collection<T> items)
Constructs a new CheckBoxGroup with caption and DataProvider containing
given items.
|
CheckBoxGroup(String caption,
DataProvider<T,?> dataProvider)
Constructs a new CheckBoxGroup with caption and DataProvider.
|
Modifier and Type | Method and Description |
---|---|
Registration |
addBlurListener(FieldEvents.BlurListener listener)
Adds a
BlurListener to the Component which gets fired
when a Field loses keyboard focus. |
Registration |
addFocusListener(FieldEvents.FocusListener listener)
Adds a
FocusListener to the Component which gets fired
when a Field receives keyboard focus. |
DataProvider<T,?> |
getDataProvider()
Returns the source of data items used by this listing.
|
DescriptionGenerator<T> |
getItemDescriptionGenerator()
Gets the item description generator.
|
SerializablePredicate<T> |
getItemEnabledProvider()
Returns the item enabled provider for this multiselect.
|
IconGenerator<T> |
getItemIconGenerator()
Gets the currently used item icon generator.
|
protected CheckBoxGroupState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
protected CheckBoxGroupState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
boolean |
isHtmlContentAllowed()
Checks whether captions are interpreted as html or plain text.
|
protected T |
readItem(org.jsoup.nodes.Element child,
Set<T> selected,
DesignContext context)
Reads an Item from a design and inserts it into the data source.
|
protected void |
readItems(org.jsoup.nodes.Element design,
DesignContext context)
Reads the data source items from the
design . |
void |
setDataProvider(DataProvider<T,?> dataProvider)
Sets the data provider for this listing.
|
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Sets whether html is allowed in the item captions.
|
void |
setItemDescriptionGenerator(DescriptionGenerator<T> descriptionGenerator)
Sets the description generator that is used for generating descriptions
for items.
|
void |
setItemEnabledProvider(SerializablePredicate<T> itemEnabledProvider)
Sets the item enabled predicate for this multiselect.
|
void |
setItemIconGenerator(IconGenerator<T> itemIconGenerator)
Sets the item icon generator that is used to produce custom icons for
shown items.
|
protected org.jsoup.nodes.Element |
writeItem(org.jsoup.nodes.Element design,
T item,
DesignContext context)
Writes a data source Item to a design.
|
addSelectionListener, addValueChangeListener, deselect, deselect, deselectAll, getCustomAttributes, getItemCaptionGenerator, getSelectedItems, getValue, isReadOnly, isRequiredIndicatorVisible, isSelected, select, setItemCaptionGenerator, setReadOnly, setRequiredIndicatorVisible, setValue, updateSelection, updateSelection
addDataGenerator, deserializeDeclarativeRepresentation, doReadDesign, doWriteDesign, focus, getDataCommunicator, getTabIndex, internalGetDataProvider, internalSetDataProvider, internalSetDataProvider, readDesign, readItem, removeDataGenerator, serializeDeclarativeRepresentation, setTabIndex, writeDesign, writeItems
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, 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, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, 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, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
setItems
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesign
addAttachListener, addDetachListener, beforeClientResponse, detach, 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
deselect, getEmptyValue, select
clear, getDefaultValidator, getOptionalValue, isEmpty
public CheckBoxGroup(String caption)
caption
- caption textpublic CheckBoxGroup(String caption, DataProvider<T,?> dataProvider)
caption
- the caption textdataProvider
- the data provider, not nullHasDataProvider.setDataProvider(DataProvider)
public CheckBoxGroup(String caption, Collection<T> items)
caption
- the caption textitems
- the data items to use, not nullHasItems.setItems(Collection)
public CheckBoxGroup()
public void setHtmlContentAllowed(boolean htmlContentAllowed)
htmlContentAllowed
- true if the captions are used as html, false if used as plain
textpublic boolean isHtmlContentAllowed()
setHtmlContentAllowed(boolean)
protected CheckBoxGroupState getState()
AbstractComponent
getState
in class AbstractMultiSelect<T>
protected CheckBoxGroupState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class AbstractMultiSelect<T>
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
public IconGenerator<T> getItemIconGenerator()
AbstractListing
Implementations that support item icons make this method public.
getItemIconGenerator
in class AbstractListing<T>
IconGenerator
,
AbstractListing.setItemIconGenerator(IconGenerator)
public void setItemIconGenerator(IconGenerator<T> itemIconGenerator)
AbstractListing
Implementations that support item icons make this method public.
setItemIconGenerator
in class AbstractListing<T>
itemIconGenerator
- the item icon generator to set, not nullIconGenerator
public SerializablePredicate<T> getItemEnabledProvider()
AbstractMultiSelect
Implementation note: Override this method and
AbstractMultiSelect.setItemEnabledProvider(SerializablePredicate)
as public
and invoke super
methods to support this feature in the
multiselect component.
getItemEnabledProvider
in class AbstractMultiSelect<T>
null
AbstractMultiSelect.setItemEnabledProvider(SerializablePredicate)
public void setItemEnabledProvider(SerializablePredicate<T> itemEnabledProvider)
AbstractMultiSelect
true
) or disabled (false
). Disabled items are displayed
as grayed out and the user cannot select them. The default predicate
always returns true
(all the items are enabled).
Implementation note: Override this method and
AbstractMultiSelect.getItemEnabledProvider()
as public
and invoke
super
methods to support this feature in the multiselect
component.
setItemEnabledProvider
in class AbstractMultiSelect<T>
itemEnabledProvider
- the item enabled provider to set, not null
public Registration addFocusListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifier
FocusListener
to the Component which gets fired
when a Field
receives keyboard focus.addFocusListener
in interface FieldEvents.FocusNotifier
listener
- the focus listener to add, not nullFieldEvents.FocusListener
,
Registration
public Registration addBlurListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifier
BlurListener
to the Component which gets fired
when a Field
loses keyboard focus.addBlurListener
in interface FieldEvents.BlurNotifier
listener
- the blur listener to add, not nullFieldEvents.BlurListener
,
Registration
public void setItemDescriptionGenerator(DescriptionGenerator<T> descriptionGenerator)
null
, no tooltip
is shown.descriptionGenerator
- the item description generator to set, not null
public DescriptionGenerator<T> getItemDescriptionGenerator()
protected void readItems(org.jsoup.nodes.Element design, DesignContext context)
AbstractListing
design
.readItems
in class AbstractMultiSelect<T>
design
- The element to obtain the state fromcontext
- The DesignContext instance used for parsing the designprotected T readItem(org.jsoup.nodes.Element child, Set<T> selected, DesignContext context)
AbstractMultiSelect
readItem
in class AbstractMultiSelect<T>
child
- a child element representing the itemselected
- A set accumulating selected items. If the item that is read is
marked as selected, its item id should be added to this set.context
- the DesignContext instance used in parsingprotected org.jsoup.nodes.Element writeItem(org.jsoup.nodes.Element design, T item, DesignContext context)
AbstractListing
writeItem
in class AbstractMultiSelect<T>
design
- the element into which to insert the itemitem
- the item to writecontext
- the DesignContext instance used in writingitem
public DataProvider<T,?> getDataProvider()
HasItems
getDataProvider
in interface HasItems<T>
public void setDataProvider(DataProvider<T,?> dataProvider)
HasDataProvider
setDataProvider
in interface HasDataProvider<T>
dataProvider
- the data provider, not nullCopyright © 2018 Vaadin Ltd. All rights reserved.