Package io.jmix.flowui.data.grid
Class ContainerDataGridItems<T>
java.lang.Object
com.vaadin.flow.data.provider.AbstractDataProvider<T,Void>
io.jmix.flowui.data.grid.ContainerDataGridItems<T>
- Type Parameters:
T- the type of entity contained in the associatedCollectionContainer
- All Implemented Interfaces:
com.vaadin.flow.data.provider.DataProvider<T,,Void> ContainerDataUnit<T>,DataUnit,EntityDataUnit,DataGridItems<T>,DataGridItems.Sortable<T>,EntityDataGridItems<T>,HasType<T>,Serializable
- Direct Known Subclasses:
ContainerGroupDataGridItems,ContainerTreeDataGridItems
public class ContainerDataGridItems<T>
extends com.vaadin.flow.data.provider.AbstractDataProvider<T,Void>
implements ContainerDataUnit<T>, EntityDataGridItems<T>, DataGridItems.Sortable<T>
Implementation of
DataProvider that connects a CollectionContainer
to a DataGrid. This class allows seamless synchronization
between the container and the grid, supporting selection, sorting, and event listeners.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.data.grid.DataGridItems
DataGridItems.ItemSetChangeEvent<T>, DataGridItems.SelectedItemChangeEvent<T>, DataGridItems.Sortable<T>, DataGridItems.ValueChangeEvent<T>Nested classes/interfaces inherited from interface io.jmix.flowui.data.DataUnit
DataUnit.StateChangeEvent -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationRegisters a new item set change listener.com.vaadin.flow.shared.RegistrationRegisters a new selected item change listener.com.vaadin.flow.shared.RegistrationRegisters a new state change listener.com.vaadin.flow.shared.RegistrationRegisters a new value change listener.protected voidprotected voidprotected voidbooleancontainsItem(T item) protected SortcreateSort(Object[] propertyId, boolean[] ascending) voidEnables the sorting functionality for the data grid items.Returns theCollectionContainerassociated with this data unit.protected EventBusgetItems()getItemValue(Object itemId, MetaPropertyPath propertyId) getState()getType()protected voidinitContainer(CollectionContainer<T> container) booleanvoidResets the sort order of the items to the default state or removes any applied sorting.voidsetSelectedItem(T item) Set current item in the source.intvoidSorts the items based on the specified property IDs and sort order.voidSuppresses the automatic sorting functionality for the data grid items.Methods inherited from class com.vaadin.flow.data.provider.AbstractDataProvider
addDataProviderListener, addListener, fireEvent, refreshAll, refreshItem, refreshItemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.data.provider.DataProvider
getId, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
-
Field Details
-
container
-
suppressSorting
protected boolean suppressSorting
-
-
Constructor Details
-
ContainerDataGridItems
-
-
Method Details
-
initContainer
-
containerItemChanged
-
containerCollectionChanged
-
containerItemPropertyChanged
-
getItems
- Specified by:
getItemsin interfaceDataGridItems<T>- Returns:
- unmodifiable collection of items
-
getSelectedItem
- Specified by:
getSelectedItemin interfaceDataGridItems<T>- Returns:
- the current item contained in the source
-
setSelectedItem
Description copied from interface:DataGridItemsSet current item in the source.- Specified by:
setSelectedItemin interfaceDataGridItems<T>- Parameters:
item- the item to set
-
containsItem
- Specified by:
containsItemin interfaceDataGridItems<T>- Parameters:
item- an item to check- Returns:
trueif the underlying collection contains an item,falseotherwise
-
sort
Description copied from interface:DataGridItems.SortableSorts the items based on the specified property IDs and sort order.- Specified by:
sortin interfaceDataGridItems.Sortable<T>- Parameters:
propertyId- an array of property IDs by which the items should be sortedascending- an array indicating the sort order for each property ID, where true represents ascending order and false represents descending order
-
createSort
-
resetSortOrder
public void resetSortOrder()Description copied from interface:DataGridItems.SortableResets the sort order of the items to the default state or removes any applied sorting.- Specified by:
resetSortOrderin interfaceDataGridItems.Sortable<T>
-
suppressSorting
public void suppressSorting()Description copied from interface:DataGridItems.SortableSuppresses the automatic sorting functionality for the data grid items.- Specified by:
suppressSortingin interfaceDataGridItems.Sortable<T>
-
enableSorting
public void enableSorting()Description copied from interface:DataGridItems.SortableEnables the sorting functionality for the data grid items.- Specified by:
enableSortingin interfaceDataGridItems.Sortable<T>
-
addValueChangeListener
public com.vaadin.flow.shared.Registration addValueChangeListener(Consumer<DataGridItems.ValueChangeEvent<T>> listener) Description copied from interface:DataGridItemsRegisters a new value change listener.- Specified by:
addValueChangeListenerin interfaceDataGridItems<T>- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addItemSetChangeListener
public com.vaadin.flow.shared.Registration addItemSetChangeListener(Consumer<DataGridItems.ItemSetChangeEvent<T>> listener) Description copied from interface:DataGridItemsRegisters a new item set change listener.- Specified by:
addItemSetChangeListenerin interfaceDataGridItems<T>- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addSelectedItemChangeListener
public com.vaadin.flow.shared.Registration addSelectedItemChangeListener(Consumer<DataGridItems.SelectedItemChangeEvent<T>> listener) Description copied from interface:DataGridItemsRegisters a new selected item change listener.- Specified by:
addSelectedItemChangeListenerin interfaceDataGridItems<T>- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
isInMemory
public boolean isInMemory() -
size
-
fetch
-
getItem
- Specified by:
getItemin interfaceDataGridItems<T>- Parameters:
entityId- the item id- Returns:
- the item by the given id
-
getItemValue
- Specified by:
getItemValuein interfaceDataGridItems<T>- Parameters:
itemId- the item idpropertyId- the property id- Returns:
- the item value
-
getContainer
Description copied from interface:ContainerDataUnitReturns theCollectionContainerassociated with this data unit.- Specified by:
getContainerin interfaceContainerDataUnit<T>- Returns:
- the container that holds a collection of entity instances
-
getState
-
getEntityMetaClass
- Specified by:
getEntityMetaClassin interfaceEntityDataUnit- Returns:
MetaClassof an entity contained in the source
-
addStateChangeListener
public com.vaadin.flow.shared.Registration addStateChangeListener(Consumer<DataUnit.StateChangeEvent> listener) Description copied from interface:DataUnitRegisters a new state change listener.- Specified by:
addStateChangeListenerin interfaceDataUnit- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
getType
-
getEventBus
-