T - Item typeP - Item property typepublic interface ItemListing<T,P> extends ItemSet, Selectable<T>, HasComponent
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ItemListing.EditorComponentGroup<P,T>
A
BoundComponentGroup which represents the listing item editor Inputs and their property
bindings. |
static interface |
ItemListing.ItemListingCell
An
ItemListing section row cell handler. |
static interface |
ItemListing.ItemListingRow<P>
An
ItemListing section row handler. |
static interface |
ItemListing.ItemListingSection<P,R extends ItemListing.ItemListingRow<P>>
ItemListing section handler for header and footer configuration. |
Selectable.SelectionEvent<T>, Selectable.SelectionListener<T>, Selectable.SelectionMode| Modifier and Type | Method and Description |
|---|---|
void |
addAdditionalItem(T item)
Add an additional item to the listing.
|
void |
cancelEditing()
If the listing
isEditable(), closes the editor discarding any unsaved changes. |
void |
editItem(T item)
If the listing
isEditable(), opens the editor interface for the provided item. |
List<T> |
getAdditionalItems()
Get the current additional items, if any.
|
Optional<String> |
getColumnHeader(P property)
Get the header text of the column identified by given property id, if available.
|
List<com.vaadin.flow.data.provider.QuerySortOrder> |
getColumnSorts()
Get the current column sorts, if any.
|
com.vaadin.flow.data.provider.DataProvider<T,?> |
getDataProvider()
Get the
DataProvider used by this item listing as data source. |
Optional<ItemListing.ItemListingSection<P,? extends ItemListing.ItemListingRow<P>>> |
getFooter()
Get the item listing footer section rows handler, if available.
|
Optional<ItemListing.ItemListingSection<P,? extends ItemListing.ItemListingRow<P>>> |
getHeader()
Get the item listing header section rows handler, if available.
|
List<P> |
getVisibleColumns()
Gets the listing visible columns, in the order thay are displayed.
|
boolean |
isEditable()
Gets whether this listing is editable.
|
Optional<T> |
isEditing()
Checks whether the listing is in edit mode.
|
boolean |
isFrozen()
Get whether the listing is frozen.
|
boolean |
isItemDetailsVisible(T item)
Gets whether the row details component for given
item is visible. |
void |
refreshEditingItem()
If the listing
isEditable(), refreshes the editor components for the current item being edited, if any. |
void |
refreshItem(T item)
Refresh given item in data source
|
boolean |
removeAdditionalItem(T item)
Remove an additional item from the listing.
|
void |
removeAdditionalItems()
Remove all the additional items from the listing.
|
boolean |
saveEditingItem()
If the listing
isEditable(), saves the item which is currently in editing, if any. |
void |
setColumnVisible(P property,
boolean visible)
Show or hide the column which corresponds to given
property id. |
void |
setFrozen(boolean frozen)
Set whether the listing is frozen.
|
void |
setItemDetailsVisible(T item,
boolean visible)
Set whether to show the row details component for given
item. |
void |
setSelectionMode(Selectable.SelectionMode selectionMode)
Set the listing selection mode
|
default void |
sort(ItemSort<P>... sorts)
Sort the listing using given
ItemSort directives. |
void |
sort(List<ItemSort<P>> sorts)
Sort the listing using given
ItemSort directives. |
addSelectionListener, deselect, deselectAll, getFirstSelectedItem, getSelectedItems, getSelectionMode, isSelected, selectcreate, getComponent, getElement, hasEnabled, hasLabel, hasSize, hasStyle, hasValidation, isVisible, setVisibleList<P> getVisibleColumns()
void setColumnVisible(P property, boolean visible)
property id.property - The property which represents the column (not null)visible - true to show the column, false to hide itIllegalArgumentException - If the specified property is not bound to any columnOptional<String> getColumnHeader(P property)
property - The column property id (not null)boolean isItemDetailsVisible(T item)
item is visible.item - Item to check whether the row details component is visible (not null)true if row details component is visible for given item, false otherwisevoid setItemDetailsVisible(T item, boolean visible)
item.item - Item for which to show or hide the row details (not null)visible - true to show the row details component, false to hide itdefault void sort(ItemSort<P>... sorts)
ItemSort directives.sorts - The item sorts to applyvoid sort(List<ItemSort<P>> sorts)
ItemSort directives.sorts - The item sorts to applyvoid setSelectionMode(Selectable.SelectionMode selectionMode)
selectionMode - The selection mode to set (not null)void refreshItem(T item)
item - Item to refresh (not null)Optional<ItemListing.ItemListingSection<P,? extends ItemListing.ItemListingRow<P>>> getHeader()
Optional<ItemListing.ItemListingSection<P,? extends ItemListing.ItemListingRow<P>>> getFooter()
boolean isEditable()
When a listing is editable, the editItem(Object) and cancelEditing() methods can be used to
control item editing.
Optional<T> isEditing()
void editItem(T item)
isEditable(), opens the editor interface for the provided item.item - the item to edit (not null) if already editing a different item in buffered modeIllegalArgumentException - if the item is not in the backing data providerIllegalStateException - If the listing is not editablevoid cancelEditing()
isEditable(), closes the editor discarding any unsaved changes.IllegalStateException - If the listing is not editableboolean saveEditingItem()
isEditable(), saves the item which is currently in editing, if any.
When the listing editor is in buffered mode, this method will validate the item and will save any changes made to the editor fields to the edited item if all validators pass. If the write fails then there will be no events and the editor will stay open.
A successful write will fire an editor save event and close the editor that will fire an editor
close event .
NOTE: When the listing editor is not in buffered mode, calling save will have no effect and always return
false.
true if save succeeded, false otherwiseIllegalStateException - If the listing is not editablevoid refreshEditingItem()
isEditable(), refreshes the editor components for the current item being edited, if any.
This is useful when the state of the item is changed while the editor is open.
IllegalStateException - If the listing is not editablecom.vaadin.flow.data.provider.DataProvider<T,?> getDataProvider()
DataProvider used by this item listing as data source.DataProvider used as data sourceList<com.vaadin.flow.data.provider.QuerySortOrder> getColumnSorts()
boolean isFrozen()
When the listing is frozen, it never shows any item and no fetch is performed from the data provider.
void setFrozen(boolean frozen)
When the listing is frozen, it never shows any item and no fetch is performed from the data provider.
When the ItemSet.refresh() method is called, the frozen state is automatically set to false.
frozen - Whether the listing is frozenList<T> getAdditionalItems()
Additional items are provided in addition to the ones returned by the concrete data provider, for example from a backend service. They are always provided before any other item, and do not take part in filters and sorts.
addAdditionalItem(Object)void addAdditionalItem(T item)
Additional items are provided in addition to the ones returned by the concrete data provider, for example from a backend service. They are always provided before any other item, and do not take part in filters and sorts.
The additional items should be used, for example, to edit item values before saving into the backend. Then they should be removed from the listing.
NOTE: Additional items are identified in the same way than any other item, using the
DataProvider.getId(Object) method. So the id providing logic should be consistent with any other item.
item - The item to add (not null)removeAdditionalItem(Object)boolean removeAdditionalItem(T item)
item - The item to remove (not null)true if given item was an additional item and it's been removed, false
otherwiseaddAdditionalItem(Object),
removeAdditionalItems()void removeAdditionalItems()
addAdditionalItem(Object)Copyright © 2019 The Holon Platform. All rights reserved.