THIS
- Self-referential generic THISITEM
- The item type in the listingpublic interface FluentHasItems<THIS extends FluentHasItems<THIS,ITEM>,ITEM> extends com.vaadin.data.HasItems<ITEM>, FluentComponent<THIS>
HasItems
HasItems
FluentComponent.FluentFocusable<C extends FluentComponent.FluentFocusable<C>>
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
Modifier and Type | Method and Description |
---|---|
default THIS |
withItems(Collection<ITEM> items)
Sets the data items of this component provided as a collection.
|
default THIS |
withItems(ITEM... items)
Sets the data items of this listing.
|
default THIS |
withItems(Stream<ITEM> streamOfItems)
Sets the data items of this listing provided as a stream.
|
getDataProvider, setItems, setItems, setItems
withCaption, withEnabled, withIcon, withId, withParent, withPrimaryStyleName, withStyleName, withStyleName, withVisible
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, setVisible, writeDesign
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
withFullHeight, withFullSize, withFullWidth, withHeight, withHeight, withSize, withUndefinedHeight, withUndefinedSize, withUndefinedWidth, withWidth, withWidth
default THIS withItems(Collection<ITEM> items)
The provided items are wrapped into a ListDataProvider
and this
instance is used as a data provider for the setDataProvider(DataProvider) method.
It means that the items collection can be accessed later on via
ListDataProvider.getItems()
:
HasDataProvider<String> listing = new CheckBoxGroup<>();
listing.setItems(Arrays.asList("a","b"));
...
Collection<String> collection = ((ListDataProvider<String>)listing.getDataProvider()).getItems();
The provided collection instance may be used as-is. Subsequent modification of the collection might cause inconsistent data to be shown in the component unless it is explicitly instructed to read the data again.
items
- the data items to display, not nullHasItems.setItems(Collection)
default THIS withItems(ITEM... items)
The provided items are wrapped into a ListDataProvider
and this
instance is used as a data provider for the
setDataProvider(DataProvider) method. It means that the items
collection can be accessed later on via
ListDataProvider.getItems()
:
HasDataProvider<String> listing = new CheckBoxGroup<>();
listing.setItems("a","b");
...
Collection<String> collection = ((ListDataProvider<String>)listing.getDataProvider()).getItems();
items
- the data items to displayHasItems.setItems(Object...)
default THIS withItems(Stream<ITEM> streamOfItems)
This is just a shorthand for HasItems.setItems(Collection)
, that
collects objects in the stream to a list. Thus, using this method,
instead of its array and Collection variations, doesn't save any memory.
If you have a large data set to bind, using a lazy data provider is
recommended. See BackEndDataProvider
for more info.
The provided items are wrapped into a ListDataProvider
and this
instance is used as a data provider for the
setDataProvider(DataProvider) method. It means that the items
collection can be accessed later on via
ListDataProvider.getItems()
:
HasDataProvider<String> listing = new CheckBoxGroup<>();
listing.setItems(Stream.of("a","b"));
...
Collection<String> collection = ((ListDataProvider<String>)listing.getDataProvider()).getItems();
streamOfItems
- the stream of data items to display, not null
HasItems.setItems(Stream)
Copyright © 2017 Jean-Christophe Fortier. All rights reserved.