Package io.jmix.groupgridflowui.data
Class ContainerGroupDataGridItems<T>
java.lang.Object
com.vaadin.flow.data.provider.AbstractDataProvider<T,Void>
io.jmix.flowui.data.grid.ContainerDataGridItems<T>
io.jmix.groupgridflowui.data.ContainerGroupDataGridItems<T>
- All Implemented Interfaces:
com.vaadin.flow.data.provider.DataProvider<T,,Void> com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T,,Void> GroupDataGridItems<T>,ContainerDataUnit<T>,DataUnit,EntityDataUnit,DataGridItems<T>,DataGridItems.Sortable<T>,EntityDataGridItems<T>,HasType<T>,Serializable,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class ContainerGroupDataGridItems<T>
extends ContainerDataGridItems<T>
implements GroupDataGridItems<T>, org.springframework.context.ApplicationContextAware
- 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.StateChangeEventNested classes/interfaces inherited from interface io.jmix.flowui.component.groupgrid.data.GroupDataGridItems
GroupDataGridItems.GroupPropertyDescriptorsChangedEvent<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected List<GroupProperty>protected Map<Object,GroupPropertyDescriptor<T>> protected Metadataprotected boolean[]protected Object[]Fields inherited from class io.jmix.flowui.data.grid.ContainerDataGridItems
container, suppressSorting -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGroupPropertyDescriptor(GroupPropertyDescriptor<T> groupPropertyDescriptor) Adds a group property descriptor for a custom grouping property.com.vaadin.flow.shared.RegistrationaddGroupPropertyDescriptorsChangedListener(Consumer<GroupDataGridItems.GroupPropertyDescriptorsChangedEvent<T>> listener) Adds a listener to be notified when the group property descriptors are changed.protected voidprotected voidcheckForUnsupportedProperties(List<GroupProperty> properties) protected voidcollectGroupRowsRecursively(GroupInfo group, com.google.common.collect.BiMap<T, GroupInfo> childGroupRows) collectOwnChildren(T parent) protected voidbooleancontainsGroup(GroupInfo group) Indicates that a group is contained in the group treeprotected GroupInfocreateGroupInfo(GroupInfo parent, org.apache.commons.collections4.map.LinkedMap<GroupProperty, Object> groupValues) protected Tprotected voiddoGroup()fetchChildren(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, Void> query) intgetChildCount(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, Void> query) getChildItems(GroupInfo group) getChildren(GroupInfo group) getChildrenInternal(GroupInfo group) getGroupByItem(T groupItem) ReturnsGroupInfoby a group item.getGroupItems(GroupInfo group) intgetGroupItemsCount(GroupInfo group) getGroupPath(T item) getGroupPropertyDescriptor(GroupProperty property) getItemByGroup(GroupInfo group) Returns a group item that corresponds to the providedGroupInfo.getOwnChildItems(GroupInfo group) protected ObjectgetValueByProperty(T item, GroupProperty property) voidgroupBy(List<GroupProperty> properties) Perform grouping by the list of properties.protected GroupInfogroupItems(int propertyIndex, GroupInfo parent, Collection<GroupInfo> children, T item, org.apache.commons.collections4.map.LinkedMap<GroupProperty, Object> groupValues) booleanhasChildren(GroupInfo groupInfo) Indicates that the group has nested groupsbooleanhasChildren(T item) booleanIndicates that items have groupsbooleanisGroupRow(T item) protected voidvoidRemoves all group property descriptors previously added for grouping.voidremoveGroupPropertyDescriptor(GroupProperty property) Removes a group property descriptor for a custom property that was previously added for grouping.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidSorts the items based on the specified property IDs and sort order.protected voidMethods inherited from class io.jmix.flowui.data.grid.ContainerDataGridItems
addItemSetChangeListener, addSelectedItemChangeListener, addStateChangeListener, addValueChangeListener, containerItemChanged, containerItemPropertyChanged, containsItem, createSort, enableSorting, fetch, getContainer, getEntityMetaClass, getEventBus, getItem, getItems, getItemValue, getSelectedItem, getState, getType, initContainer, isInMemory, resetSortOrder, setSelectedItem, size, suppressSortingMethods 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 io.jmix.flowui.data.grid.DataGridItems
addItemSetChangeListener, addSelectedItemChangeListener, addValueChangeListener, containsItem, getItem, getItems, getItemValue, getSelectedItem, setSelectedItemMethods inherited from interface com.vaadin.flow.data.provider.DataProvider
addDataProviderListener, getId, isInMemory, refreshAll, refreshItem, refreshItemMethods inherited from interface io.jmix.flowui.data.DataUnit
addStateChangeListener, getStateMethods inherited from interface com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider
fetch, size, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
metadata
-
groupProperties
-
parents
-
children
-
groupPropertyDescriptors
-
childGroupRows
-
rootGroupRows
-
roots
-
groupItems
-
itemGroups
-
sortProperties
-
sortAscending
protected boolean[] sortAscending
-
-
Constructor Details
-
ContainerGroupDataGridItems
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
containerCollectionChanged
- Overrides:
containerCollectionChangedin classContainerDataGridItems<T>
-
sort
Description copied from interface:DataGridItems.SortableSorts the items based on the specified property IDs and sort order.- Specified by:
sortin interfaceDataGridItems.Sortable<T>- Overrides:
sortin classContainerDataGridItems<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
-
groupBy
Description copied from interface:GroupDataGridItemsPerform grouping by the list of properties. The available values for properties are:- MetaPropertyPath can be a property of current or a reference entity.
- Column key (String) of a generated value.
- Specified by:
groupByin interfaceGroupDataGridItems<T>
-
doGroup
protected void doGroup() -
groupItems
@Nullable protected GroupInfo groupItems(int propertyIndex, @Nullable GroupInfo parent, Collection<GroupInfo> children, T item, org.apache.commons.collections4.map.LinkedMap<GroupProperty, Object> groupValues) -
getValueByProperty
-
getRootGroups
- Specified by:
getRootGroupsin interfaceGroupDataGridItems<T>- Returns:
- the list of root groups
-
hasChildren
Description copied from interface:GroupDataGridItemsIndicates that the group has nested groups- Specified by:
hasChildrenin interfaceGroupDataGridItems<T>- Parameters:
groupInfo- group info
-
hasChildren
-
getChildren
- Specified by:
getChildrenin interfaceGroupDataGridItems<T>- Returns:
- the list of own nested groups
-
getOwnChildItems
- Specified by:
getOwnChildItemsin interfaceGroupDataGridItems<T>- Returns:
- the list of nested items
-
getChildItems
- Specified by:
getChildItemsin interfaceGroupDataGridItems<T>- Returns:
- the list of items from all nested group levels
-
getChildrenInternal
-
getGroup
- Specified by:
getGroupin interfaceGroupDataGridItems<T>- Returns:
- a group that the passed item belongs to
-
getGroupPath
- Specified by:
getGroupPathin interfaceGroupDataGridItems<T>- Parameters:
item- item (leaf) to get all parent groups for- Returns:
- the path through all parent groups
-
getGroupItems
- Specified by:
getGroupItemsin interfaceGroupDataGridItems<T>- Returns:
- items that are contained in the selected group
-
getGroupItemsCount
- Specified by:
getGroupItemsCountin interfaceGroupDataGridItems<T>- Returns:
- a count of items that are contained in the selected group
-
hasGroups
public boolean hasGroups()Description copied from interface:GroupDataGridItemsIndicates that items have groups- Specified by:
hasGroupsin interfaceGroupDataGridItems<T>
-
getGroupProperties
- Specified by:
getGroupPropertiesin interfaceGroupDataGridItems<T>- Returns:
- group properties
-
containsGroup
Description copied from interface:GroupDataGridItemsIndicates that a group is contained in the group tree- Specified by:
containsGroupin interfaceGroupDataGridItems<T>
-
addGroupPropertyDescriptor
Description copied from interface:GroupDataGridItemsAdds a group property descriptor for a custom grouping property. This method enables defining custom logic for computing property values during data grouping.For instance:
customersDataGrid.getItems().addGroupPropertyDescriptor( new BaseGroupPropertyDescriptor<Customer>("fullName", context -> { Customer item = context.getItem(); return item.getFirstName() + " " + item.getLastName(); }).withSortProperties(List.of("firstName", "lastName")));- Specified by:
addGroupPropertyDescriptorin interfaceGroupDataGridItems<T>- Parameters:
groupPropertyDescriptor- implementation ofGroupPropertyDescriptor
-
removeGroupPropertyDescriptor
Description copied from interface:GroupDataGridItemsRemoves a group property descriptor for a custom property that was previously added for grouping.- Specified by:
removeGroupPropertyDescriptorin interfaceGroupDataGridItems<T>- Parameters:
property- the custom property
-
getGroupPropertyDescriptor
- Specified by:
getGroupPropertyDescriptorin interfaceGroupDataGridItems<T>- Parameters:
property- the custom property- Returns:
- a group property descriptor for a custom property
-
removeAllGroupPropertyProviders
public void removeAllGroupPropertyProviders()Description copied from interface:GroupDataGridItemsRemoves all group property descriptors previously added for grouping.- Specified by:
removeAllGroupPropertyProvidersin interfaceGroupDataGridItems<T>
-
getGroupByItem
Description copied from interface:GroupDataGridItemsReturnsGroupInfoby a group item.Group item is an empty entity object that represents a grouping row in a
GroupListDataComponent. It does not exist in the data container.- Specified by:
getGroupByItemin interfaceGroupDataGridItems<T>- Parameters:
groupItem- a group item- Returns:
- group info or
nullif there is no group info for the given item
-
getItemByGroup
Description copied from interface:GroupDataGridItemsReturns a group item that corresponds to the providedGroupInfo.Group item is an empty entity object that represents a grouping row in a
GroupListDataComponent. It does not exist in the data container.- Specified by:
getItemByGroupin interfaceGroupDataGridItems<T>- Parameters:
group- group info- Returns:
- group item or
nullif there is no item for the given group info
-
getChildCount
-
fetchChildren
-
addGroupPropertyDescriptorsChangedListener
public com.vaadin.flow.shared.Registration addGroupPropertyDescriptorsChangedListener(Consumer<GroupDataGridItems.GroupPropertyDescriptorsChangedEvent<T>> listener) Description copied from interface:GroupDataGridItemsAdds a listener to be notified when the group property descriptors are changed.- Specified by:
addGroupPropertyDescriptorsChangedListenerin interfaceGroupDataGridItems<T>- Parameters:
listener- the listener to add- Returns:
- a registration object for removing the listener
-
isGroupRow
-
updateGroupRows
protected void updateGroupRows() -
collectOwnChildren
-
collectGroupRowsRecursively
-
createGroupItem
-
refreshGroups
protected void refreshGroups() -
afterGroupBy
protected void afterGroupBy() -
checkForUnsupportedProperties
-
createGroupInfo
protected GroupInfo createGroupInfo(@Nullable GroupInfo parent, org.apache.commons.collections4.map.LinkedMap<GroupProperty, Object> groupValues)
-