Class GroupDataGrid<E>
- Type Parameters:
E- the entity type
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<Grid<E>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<Grid<E>>,com.vaadin.flow.component.FocusNotifier<Grid<E>>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.data.event.SortEvent.SortNotifier<Grid<E>,,GridSortOrder<E>> com.vaadin.flow.data.provider.HasDataGenerators<E>,com.vaadin.flow.data.provider.HasDataView<E,,Void, GridDataView<E>> com.vaadin.flow.data.provider.HasLazyDataView<E,,Void, GridLazyDataView<E>> com.vaadin.flow.data.provider.HasListDataView<E,,GridListDataView<E>> com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<E>,GroupListDataComponent<E>,ListDataComponent<E>,LookupComponent<E>,LookupComponent.MultiSelectLookupComponent<E>,SupportsEnterPress<GroupDataGrid<E>>,HasActions,HasSubParts,SelectionChangeNotifier<Grid<E>,,E> EnhancedGroupDataGrid<E>,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.groupgridflowui.kit.component.JmixGroupGrid
JmixGroupGrid.JmixDetailsManager, JmixGroupGrid.JmixGroupGridArrayUpdaterImpl, JmixGroupGrid.JmixGroupGridDataCommunicatorBuilder<E>, JmixGroupGrid.JmixGroupGridUpdateQueueNested classes/interfaces inherited from class io.jmix.groupgridflowui.kit.vaadin.grid.Grid
Grid.AbstractGridExtension<T>, Grid.Column<T>, Grid.DataCommunicatorBuilder<T,U extends com.vaadin.flow.data.provider.ArrayUpdater>, Grid.DetailsManager, Grid.MultiSortPriority, Grid.NestedNullBehavior, Grid.SelectionMode, Grid.SpringData, Grid.UpdateQueue Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface io.jmix.groupgridflowui.component.EnhancedGroupDataGrid
EnhancedGroupDataGrid.AggregationPositionNested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface io.jmix.flowui.component.groupgrid.GroupListDataComponent
GroupListDataComponent.CollapseEvent<E>, GroupListDataComponent.ExpandEvent<E>Nested classes/interfaces inherited from interface io.jmix.flowui.component.LookupComponent
LookupComponent.MultiSelectLookupComponent<T>Nested classes/interfaces inherited from interface io.jmix.flowui.component.SupportsEnterPress
SupportsEnterPress.EnterPressEvent<C extends com.vaadin.flow.component.Component> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected JmixGroupGridContextMenu<E>protected booleanprotected GroupDataGridDelegate<E,GroupDataGridItems<E>> static final Stringprotected GroupGridPropertiesprotected EventBusprotected MetadataToolsFields inherited from class io.jmix.groupgridflowui.kit.component.JmixGroupGrid
actionsSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAggregation(Grid.Column<E> column, AggregationInfo info) Add aggregation info to perform aggregation for column.com.vaadin.flow.shared.RegistrationAdds a listener to be notified when a group is collapsed.Adds a new text column to thisGridwith a renderer and default column factory.Adds a new text column to thisGridwith a value provider and default column factory.<V extends Comparable<? super V>>
DataGridColumn<E>Adds a new text column to thisGridwith a value provider and sorting properties.The value is converted to a JSON value by usingJsonSerializer.toJson(Object).addColumn(MetaPropertyPath metaPropertyPath) Adds a column by the meta-property path.Adds a new column for the given property name with the default column factory.addColumn(String key, MetaPropertyPath metaPropertyPath) Adds a column by the meta-property path and specified key.<V extends com.vaadin.flow.component.Component>
DataGridColumn<E>addComponentColumn(com.vaadin.flow.function.ValueProvider<E, V> componentProvider) Adds a new column that shows components.<C extends com.vaadin.flow.component.Component>
GroupDataGridColumn<E>addComponentGroupColumn(com.vaadin.flow.function.ValueProvider<GroupInfo, C> componentProvider) Adds a group column to the grid using a component provider.Adds a new context-menu for this grid.com.vaadin.flow.shared.RegistrationaddExpandListener(Consumer<GroupListDataComponent.ExpandEvent<E>> listener) Adds a listener to be notified when a group is expanded.Adds a group column to the grid using a default group renderer.addGroupColumn(GroupCellValueFormatter<E> valueFormatter) Adds a group column to the grid using value formatter.protected GroupDataGridColumn<E>addGroupColumnInternal(com.vaadin.flow.data.renderer.Renderer<E> renderer, GroupCellValueFormatter<E> valueFormatter) com.vaadin.flow.shared.RegistrationaddGroupingChangedListener(com.vaadin.flow.component.ComponentEventListener<GroupingChangedEvent<E>> listener) Adds grouping changed listener.com.vaadin.flow.shared.RegistrationaddGroupItemClickListener(com.vaadin.flow.component.ComponentEventListener<GroupItemClickEvent<E>> listener) Adds a group item click listener.com.vaadin.flow.shared.RegistrationaddGroupItemDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<GroupItemDoubleClickEvent<E>> listener) Adds a group item double-click listener.com.vaadin.flow.shared.RegistrationaddItemDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<ItemDoubleClickEvent<E>> listener) Adds an item double click listener to this component.com.vaadin.flow.shared.RegistrationaddSelectionListener(com.vaadin.flow.data.selection.SelectionListener<Grid<E>, E> listener) Adds a selection listener to the current selection model.protected List<Grid.Column<E>>addUngroupedColumns(List<Grid.Column<E>> ungroupedColumns, List<GroupDataGridColumn<E>> groupColumns) voidvoidCollapses the specified group.protected voidcollapse(Collection<E> items, boolean userOriginated) voidCollapses all root groups and their children recursively.voidcollapseByPath(E item) Collapses all groups that are on the path to the provided item.collectGroupItems(List<GroupInfo> groups) protected voidcollectGroupItemsRecursively(List<GroupInfo> groups, List<E> groupItems) protected JmixGroupGridActionsSupport<JmixGroupGrid<E>,E> protected <V extends com.vaadin.flow.component.Component>
com.vaadin.flow.data.renderer.Renderer<E>createComponentGroupRenderer(com.vaadin.flow.function.ValueProvider<GroupInfo, V> componentProvider) protected GroupDataGridDelegate<E,GroupDataGridItems<E>> protected GroupDataGridEditor<E>Creates a new Editor instance.protected com.vaadin.flow.data.renderer.Renderer<E>protected com.vaadin.flow.data.renderer.Renderer<E>createGroupRendererWrapper(com.vaadin.flow.data.renderer.Renderer<E> renderer) voidThis method is a shorthand that delegates to the currently set selection model.voidThis method is a shorthand that delegates to the currently set selection model.voidEnables multi-selection functionality for the component.voidExpands the specified group.protected voidexpand(Collection<E> items, boolean userOriginated) voidExpands all root groups and their children recursively.voidexpandByPath(E item) Expands all groups that are on the path to the provided item.protected voidfireCollapseEvent(Collection<E> collapsedItems, boolean userOriginated) protected voidfireExpandEvent(Collection<E> expandedItems, boolean userOriginated) protected voidfireGroupingChangedEvent(List<Grid.Column<E>> previousGroupingColumns, List<Grid.Column<E>> groupingColumns, boolean userOriginated) protected Stringprotected voidgeneratePartData(E item, elemental.json.JsonObject jsonObject) CAUTION! Copied fromio.jmix.groupgridflowui.kit.vaadin.grid.Grid#generatePartData(T, JsonObject).List<Grid.Column<E>>Gets an unmodifiable list of all currently addedGrid.Columns.getChildren(GroupInfo group) getColumnByKey(String columnKey) Gets aGrid.Columnof this grid by its key.getColumnByMetaPropertyPath(MetaPropertyPath metaPropertyPath) getColumnMetaPropertyPath(Grid.Column<E> column) List<Grid.Column<E>>Note: If column reordering is enabled withGrid.setColumnReorderingAllowed(boolean)and the user has reordered the columns, the order of the list returned by this method might be incorrect.protected BiFunction<com.vaadin.flow.data.renderer.Renderer<E>,String, Grid.Column<E>> Gives a reference to the column factory.Gets the editor.com.vaadin.flow.component.ComponentReturns the component that is displayed when the grid is empty.Returns the text that is displayed when the grid is empty.protected GroupInfogetGroupByItem(E item) protected List<GroupDataGridColumn<E>>List<Grid.Column<E>>Retrieves the list of columns that are used for grouping data in the grid.getItems()protected EventBusGets the function that is used for generating CSS part names for rows in this grid.This method is a shorthand that delegates to the currently set selection model.Returns an item corresponding to the selected row of this component.getSubPart(String name) Returns a sub part object by its name.protected voidfinal voidgroupByColumns(Grid.Column<E>... columns) Performs grouping by specified columns.voidgroupByColumnsList(List<Grid.Column<E>> columns) Performs grouping by specified columns.voidgroupByKeys(String... keys) Groups data by the specified column keys.voidgroupByKeysList(List<String> keys) Groups data by the specified column keys.booleanhasChildren(GroupInfo groupInfo) Indicates that the group has nested groupsbooleanIndicates that items have groupsprotected voidbooleanbooleanbooleanisExpanded(GroupInfo group) Determines if the specified group is expanded.protected booleanisGroupColumn(Grid.Column<E> column) booleanbooleanprotected voidprotected voidprotected voidCallback which is called if a new data provider is set or any change happen in the current data provider (anDataChangeEventevent is fired).protected StringonPartNameGenerator(E item) protected StringonTooltipGenerator(E item) protected List<Grid.Column<E>>reattachUngroupedColumns(List<Grid.Column<E>> columns) protected voidvoidremoveColumn(Grid.Column<E> column) Removes a column from the Grid.voidThis method is a shorthand that delegates to the currently set selection model.voidselect(Collection<E> items) Selects the rows of this component for a given collection of items.voidsetAggregatable(boolean aggregatable) Set to true if aggregation should be enabled.voidSets aggregation row position.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetColumnPosition(Grid.Column<E> column, int index) Moves column to the provided position in theGroupDataGrid.voidsetDataProvider(com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<E, ?> hierarchicalDataProvider) voidsetEmptyStateComponent(com.vaadin.flow.component.Component emptyStateComponent) Sets the component to be displayed when the grid is empty.voidsetEmptyStateText(String emptyStateText) Sets the text to be displayed when the grid is empty.voidSets code to execute when Enter key is pressed.voidsetGroupPartNameGenerator(com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupPartNameGenerator) Sets the function that is used for generating CSS part names for all the cells in the group rows in this grid.voidsetGroupTooltipGenerator(com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupTooltipGenerator) Sets the function that is used for generating tooltip text for all cells in the group rows in this grid.voidsetMultiSelect(boolean multiSelect) Sets whether the component allows multi-selection or not.voidsetPartNameGenerator(com.vaadin.flow.function.SerializableFunction<E, String> partNameGenerator) Sets the function that is used for generating CSS part names for all the cells in the rows in this grid.setSelectionMode(Grid.SelectionMode selectionMode) Sets the grid's selection mode.voidsetSortByGroupEnabled(boolean sortByGroupEnabled) Enables automatic sorting on grouping columns when a collection of grouping columns changes.voidsetTooltipGenerator(com.vaadin.flow.function.SerializableFunction<E, String> tooltipGenerator) Sets the function that is used for generating tooltip text for all cells in this grid.voidungroup()Resets any grouping applied in the grid.final voidungroupByColumns(Grid.Column<E>... columns) Ungroups the specified columns.voidungroupByColumnsList(List<Grid.Column<E>> columns) Ungroups the provided list of columns.voidungroupByKeys(String... keys) Ungroups the provided array of column keys.voidungroupByKeysList(List<String> keys) Ungroups the provided list of column keys.Methods inherited from class io.jmix.groupgridflowui.kit.component.JmixGroupGrid
addAction, addAction, addItemClickListener, createDefaultArrayUpdater, createDetailsManager, generateSelectableData, getAction, getActions, getActionsSupport, getDataCommunicator, getDataProvider, getDefaultHeaderRow, getGenericDataView, getLazyDataView, getListDataView, removeAction, scrollToEnd, scrollToIndex, scrollToIndex, scrollToItem, setDataProvider, setItems, setItems, setItems, setItems, setItemsMethods inherited from class io.jmix.groupgridflowui.kit.vaadin.grid.Grid
addCellFocusListener, addColumn, addColumn, addColumn, addColumnReorderListener, addColumnResizeListener, addColumns, addDataGenerator, addDragEndListener, addDragStartListener, addDropListener, addFirstHeaderRow, addSortListener, addThemeVariants, addValueProvider, appendFooterRow, appendHeaderRow, asMultiSelect, asSingleSelect, compareMaybeComparables, configureBeanType, createColumn, createColumnId, createSortingComparator, getAriaLabel, getArrayUpdater, getBeanType, getClassNameGenerator, getColumnByInternalId, getColumnLayers, getColumnRendering, getDragFilter, getDropFilter, getDropMode, getFooterRows, getHeaderRows, getNestedNullBehavior, getPageSize, getPropertySet, getSelectionMode, getSelectionModel, getSelectionPreservationMode, getSortOrder, getTooltipPosition, getUniqueKeyProperty, getUniqueKeyProvider, initConnector, insertColumnLayer, isAllRowsVisible, isColumnReorderingAllowed, isDetailsVisible, isDetailsVisibleOnClick, isMultiSort, isRowsDraggable, onAttach, onDetach, onEnabledStateChanged, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeAllFooterRows, removeAllHeaderRows, removeColumnByKey, removeColumnLayer, removeColumns, removeFooterRow, removeHeaderRow, removeThemeVariants, scrollToStart, setAllRowsVisible, setAriaLabel, setClassNameGenerator, setColumnKey, setColumnOrder, setColumnOrder, setColumnRendering, setColumnReorderingAllowed, setColumns, setDefaultMultiSortPriority, setDetailsVisible, setDetailsVisibleOnClick, setDragDataGenerator, setDragFilter, setDropFilter, setDropMode, setItemDetailsRenderer, setItems, setItems, setItemSelectableProvider, setItemsPageable, setItemsPageable, setMultiSort, setMultiSort, setMultiSort, setMultiSort, setNestedNullBehavior, setPageSize, setRowsDraggable, setSelectionDragDetails, setSelectionModel, setSelectionPreservationMode, setSortableColumns, setTooltipPosition, setUniqueKeyProperty, setUniqueKeyProvider, sort, updateSelectionModeOnClientMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface io.jmix.flowui.kit.component.HasActions
removeAction, removeAllActionsMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider
getTreeData, setItems, setItems, setTreeDataMethods inherited from interface com.vaadin.flow.data.provider.HasLazyDataView
setItemsMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Field Details
-
GROUP_ROW_CELL_PN
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
metadataTools
-
groupGridProperties
-
gridDelegate
-
contextMenu
-
partNameGenerator
-
groupPartNameGenerator
-
tooltipGenerator
-
groupTooltipGenerator
-
jmixEventBus
-
editorCreated
protected boolean editorCreated
-
-
Constructor Details
-
GroupDataGrid
public GroupDataGrid()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
initComponent
protected void initComponent() -
isSortByGroupEnabled
public boolean isSortByGroupEnabled()- Returns:
trueif sorting by grouping is enabled,falseotherwise
-
setSortByGroupEnabled
public void setSortByGroupEnabled(boolean sortByGroupEnabled) Enables automatic sorting on grouping columns when a collection of grouping columns changes. Sorting by grouping is also applied when sorting is performed on non-grouping columns.The default value is
true.- Parameters:
sortByGroupEnabled- whether sorting by grouping is enabled or not
-
setDataProvider
public void setDataProvider(com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<E, ?> hierarchicalDataProvider) - Specified by:
setDataProviderin interfacecom.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<E>- Overrides:
setDataProviderin classJmixGroupGrid<E>
-
getSingleSelectedItem
Description copied from interface:ListDataComponentReturns an item corresponding to the selected row of this component. If nothing is selected, the method returnsnull. If multiple selection mode is enabled, returns the first selected instance.- Specified by:
getSingleSelectedItemin interfaceListDataComponent<E>- Returns:
- an item corresponding to the selected row of this component
-
getSelectedItems
Description copied from class:GridThis method is a shorthand that delegates to the currently set selection model.- Specified by:
getSelectedItemsin interfaceListDataComponent<E>- Specified by:
getSelectedItemsin interfaceLookupComponent<E>- Overrides:
getSelectedItemsin classGrid<E>- Returns:
- a set with the selected items, never
null - See Also:
-
select
Description copied from class:GridThis method is a shorthand that delegates to the currently set selection model. -
select
Description copied from interface:ListDataComponentSelects the rows of this component for a given collection of items.- Specified by:
selectin interfaceListDataComponent<E>- Parameters:
items- collection of items to select rows
-
deselect
Description copied from class:GridThis method is a shorthand that delegates to the currently set selection model. -
deselectAll
public void deselectAll()Description copied from class:GridThis method is a shorthand that delegates to the currently set selection model.- Specified by:
deselectAllin interfaceListDataComponent<E>- Overrides:
deselectAllin classGrid<E>- See Also:
-
enableMultiSelect
public void enableMultiSelect()Description copied from interface:LookupComponent.MultiSelectLookupComponentEnables multi-selection functionality for the component.This method sets the component to allow the selection of multiple items simultaneously by internally invoking
setMultiSelect(true).- Specified by:
enableMultiSelectin interfaceLookupComponent.MultiSelectLookupComponent<E>
-
setSelectionMode
Description copied from class:GridSets the grid's selection mode.To use your custom selection model, you can use
Grid.setSelectionModel(GridSelectionModel, SelectionMode), see existing selection model implementations for example.- Overrides:
setSelectionModein classGrid<E>- Parameters:
selectionMode- the selection mode to switch to, notnull- Returns:
- the used selection model
- See Also:
-
addSelectionListener
public com.vaadin.flow.shared.Registration addSelectionListener(com.vaadin.flow.data.selection.SelectionListener<Grid<E>, E> listener) Description copied from class:GridAdds a selection listener to the current selection model.This is a shorthand for
grid.getSelectionModel().addSelectionListener(). To get more detailed selection events, useGrid.getSelectionModel()and eitherGridSingleSelectionModel.addSingleSelectionListener(SingleSelectionListener)orGridMultiSelectionModel.addMultiSelectionListener(MultiSelectionListener)depending on the used selection mode.- Specified by:
addSelectionListenerin interfaceSelectionChangeNotifier<Grid<E>,E> - Overrides:
addSelectionListenerin classGrid<E>- Parameters:
listener- the listener to add- Returns:
- a registration handle to remove the listener
-
addItemDoubleClickListener
public com.vaadin.flow.shared.Registration addItemDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<ItemDoubleClickEvent<E>> listener) Description copied from class:GridAdds an item double click listener to this component.Note that double click event happens along with a click event. It means there is no way to get a double click event only (double click without a click): a click listener added using
Grid.addItemClickListener(ComponentEventListener)(if any) will also be notified about a click event once a double click event is fired.Double click event type is not fully supported by the mobile browsers which means that double click event might not work (double click listeners won't be notified) for such browsers.
- Overrides:
addItemDoubleClickListenerin classJmixGroupGrid<E>- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
- See Also:
-
getItems
- Specified by:
getItemsin interfaceListDataComponent<E>- Returns:
- a data unit that holds component items
-
isMultiSelect
public boolean isMultiSelect()- Specified by:
isMultiSelectin interfaceListDataComponent<E>- Returns:
trueif multiple selection mode is enabled
-
setMultiSelect
public void setMultiSelect(boolean multiSelect) Description copied from interface:LookupComponent.MultiSelectLookupComponentSets whether the component allows multi-selection or not.- Specified by:
setMultiSelectin interfaceLookupComponent.MultiSelectLookupComponent<E>- Parameters:
multiSelect- iftrue, multi-selection is enabled; otherwise, multi-selection is disabled
-
setEnterPressHandler
public void setEnterPressHandler(@Nullable Consumer<SupportsEnterPress.EnterPressEvent<GroupDataGrid<E>>> handler) Sets code to execute when Enter key is pressed.If such code is not set, this component responds to Enter press by attempting to find and execute the following actions:
- Action assigned to Enter key by setting its
KeyCombination EditActionReadAction
If one of these actions is found and enabled, it is executed.
Note: if no explicit double click listeners are added, then the above rule is used to handle double clicks on this component.
- Specified by:
setEnterPressHandlerin interfaceSupportsEnterPress<E>- Parameters:
handler- code to execute when Enter key is pressed ornullto remove previously set.- See Also:
- Action assigned to Enter key by setting its
-
getPartNameGenerator
Description copied from class:GridGets the function that is used for generating CSS part names for rows in this grid.- Overrides:
getPartNameGeneratorin classGrid<E>- Returns:
- the part name generator
-
setPartNameGenerator
public void setPartNameGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<E, String> partNameGenerator) Description copied from class:GridSets the function that is used for generating CSS part names for all the cells in the rows in this grid. Returningnullfrom the generator results in no custom part name being set. Multiple part names can be returned from the generator as space-separated.If
Grid.Column.setPartNameGenerator(SerializableFunction)is used together with this method, resulting part names from both methods will be effective.- Overrides:
setPartNameGeneratorin classGrid<E>- Parameters:
partNameGenerator- the part name generator to set, notnull- See Also:
-
getGroupPartNameGenerator
@Nullable public com.vaadin.flow.function.SerializableFunction<GroupInfo,String> getGroupPartNameGenerator()- Returns:
- group part name generator or
nullif not set
-
setGroupPartNameGenerator
public void setGroupPartNameGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupPartNameGenerator) Sets the function that is used for generating CSS part names for all the cells in the group rows in this grid. Returningnullfrom the generator results in no custom part name being set. Multiple part names can be returned from the generator as space-separated.If
DataGridColumn.setGroupPartNameGenerator(SerializableFunction)is used together with this method, resulting part names from both methods will be effective.- Parameters:
groupPartNameGenerator- group part name generator
-
getTooltipGenerator
- Returns:
- a tooltip generator or
nullif not set
-
setTooltipGenerator
public void setTooltipGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<E, String> tooltipGenerator) Sets the function that is used for generating tooltip text for all cells in this grid. Tooltip generators set to individual columns have priority over the generator set with this method. Returningnullfrom the generator results in no tooltip being set.- Overrides:
setTooltipGeneratorin classGrid<E>- Parameters:
tooltipGenerator- tooltip generator
-
getGroupTooltipGenerator
@Nullable public com.vaadin.flow.function.SerializableFunction<GroupInfo,String> getGroupTooltipGenerator()- Returns:
- group tooltip generator or
nullif not set
-
setGroupTooltipGenerator
public void setGroupTooltipGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupTooltipGenerator) Sets the function that is used for generating tooltip text for all cells in the group rows in this grid. Group tooltip generators set to individual columns have priority over the generator set with this method. Returningnullfrom the generator results in no tooltip being set.- Parameters:
groupTooltipGenerator- group tooltip generator
-
getColumnMetaPropertyPath
- Specified by:
getColumnMetaPropertyPathin interfaceEnhancedGroupDataGrid<E>- Parameters:
column- column to get the meta-property path for- Returns:
MetaPropertyPaththat refers to the column ornullif the column is not bound to any property
-
getColumnByMetaPropertyPath
- Specified by:
getColumnByMetaPropertyPathin interfaceEnhancedGroupDataGrid<E>- Parameters:
metaPropertyPath-MetaPropertyPaththat refers to the column- Returns:
DataGridColumnthat is bound to the passedmetaPropertyPath
-
addColumn
Description copied from interface:EnhancedGroupDataGridAdds a column by the meta-property path.- Specified by:
addColumnin interfaceEnhancedGroupDataGrid<E>- Parameters:
metaPropertyPath- meta-property path to add a column- Returns:
- added column
-
addColumn
Description copied from interface:EnhancedGroupDataGridAdds a column by the meta-property path and specified key. The key is used to identify the column, seeGrid.getColumnByKey(String).- Specified by:
addColumnin interfaceEnhancedGroupDataGrid<E>- Parameters:
key- column keymetaPropertyPath- meta-property path to add a column- Returns:
- added column
-
addColumn
Description copied from class:GridAdds a new text column to thisGridwith a value provider and default column factory. The value is converted to String when sent to the client by usingString.valueOf(Object).NOTE: For displaying components, see
Grid.addComponentColumn(ValueProvider). For using build-in renderers, seeGrid.addColumn(Renderer).Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
Grid.removeColumn(Column)to avoid sending extra data.NOTE: This method is a shorthand for
Grid.addColumn(ValueProvider, BiFunction) -
addColumn
Description copied from class:GridAdds a new text column to thisGridwith a renderer and default column factory.See implementations of the
Rendererinterface for built-in renderer options with type safe APIs. For a renderer using template binding, useLitRenderer.of(String).NOTE: You can add component columns easily using the
Grid.addComponentColumn(ValueProvider), but usingComponentRendereris not as efficient as the built in renderers or usingLitRenderer.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
Grid.removeColumn(Column)to avoid sending extra data.NOTE: This method is a shorthand for
Grid.addColumn(Renderer, BiFunction) -
addComponentColumn
public <V extends com.vaadin.flow.component.Component> DataGridColumn<E> addComponentColumn(com.vaadin.flow.function.ValueProvider<E, V> componentProvider) Description copied from class:GridAdds a new column that shows components.This is a shorthand for
Grid.addColumn(Renderer)with aComponentRenderer.NOTE: Using
ComponentRendereris not as efficient as the built in renderers or usingLitRenderer.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
Grid.removeColumn(Column)to avoid sending extra data.- Overrides:
addComponentColumnin classGrid<E>- Type Parameters:
V- the component type- Parameters:
componentProvider- a value provider that will return a component for the given item- Returns:
- the new column
- See Also:
-
addColumn
public <V extends Comparable<? super V>> DataGridColumn<E> addColumn(com.vaadin.flow.function.ValueProvider<E, V> valueProvider, String... sortingProperties) Description copied from class:GridAdds a new text column to thisGridwith a value provider and sorting properties.The value is converted to a JSON value by usingJsonSerializer.toJson(Object). The sorting properties are used to configure backend sorting for this column. In-memory sorting is automatically configured using the return type of the givenValueProvider.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
Grid.removeColumn(Column)to avoid sending extra data. -
addColumn
Description copied from class:GridAdds a new column for the given property name with the default column factory. The property values are converted to Strings in the grid cells. The property's full name will be used as thecolumn keyand the property caption will be used as thecolumn header.You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"If the property is
Comparable, the created column is sortable by default. This can be changed with theGrid.Column.setSortable(boolean)method.Note: This method can only be used for a Grid created from a bean type with
Grid(Class).Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
Grid.removeColumn(Column)to avoid sending extra data.Note: This method is a shorthand for
Grid.addColumn(String, BiFunction) -
addGroupColumn
Adds a group column to the grid using a default group renderer.This method creates a column specifically designed for grouping data in the grid. The default group renderer generates a toggler that expands and collapses group items.
- Returns:
- the added
GroupDataGridColumninstance
-
addGroupColumn
Adds a group column to the grid using value formatter. The formatter is used to format a value of group cells. The formatter is also applied for group cell values while exporting grid to an Excel file.- Parameters:
valueFormatter- value formatter to be used for formatting group cell values- Returns:
- the added
GroupDataGridColumninstance
-
addComponentGroupColumn
public <C extends com.vaadin.flow.component.Component> GroupDataGridColumn<E> addComponentGroupColumn(com.vaadin.flow.function.ValueProvider<GroupInfo, C> componentProvider) Adds a group column to the grid using a component provider. The component provider is used to create a custom component for group cells.For instance:
customersDataGrid.addComponentGroupColumn(groupInfo -> { if (groupInfo.getProperty().is("grade")) { return new Span(groupInfo.getValue().toString()); } else if (groupInfo.getProperty().is("country")) { Div root = new Div(); root.add(new Span(metadataTools.getInstanceName(groupInfo.getValue()))); root.add(VaadinIcon.FLAG.create()); return root; } return null; });- Type Parameters:
C- the type of the component- Parameters:
componentProvider- component provider- Returns:
- the added
GroupDataGridColumninstance
-
groupByColumns
Performs grouping by specified columns.The previous grouping will be replaced by a new one.
- Parameters:
columns- columns to group by
-
groupByColumnsList
Performs grouping by specified columns.The previous grouping will be replaced by a new one.
- Parameters:
columns- columns to group by
-
groupByKeys
Groups data by the specified column keys.The previous grouping will be replaced by a new one.
- Specified by:
groupByKeysin interfaceGroupListDataComponent<E>- Parameters:
keys- the column keys to group by
-
groupByKeysList
Groups data by the specified column keys.The previous grouping will be replaced by a new one.
- Specified by:
groupByKeysListin interfaceGroupListDataComponent<E>- Parameters:
keys- the column keys to group by
-
ungroup
public void ungroup()Resets any grouping applied in the grid.- Specified by:
ungroupin interfaceGroupListDataComponent<E>
-
ungroupByColumns
Ungroups the specified columns.Grouping columns that are not in the provided array will still be applied.
- Parameters:
columns- an array of columns to ungroup
-
ungroupByColumnsList
Ungroups the provided list of columns.Grouping columns that are not in the provided list will still be applied.
- Parameters:
columns- the list of columns to be ungrouped
-
ungroupByKeys
Ungroups the provided array of column keys.Grouping columns that are not in the provided keys array will still be applied.
- Specified by:
ungroupByKeysin interfaceGroupListDataComponent<E>- Parameters:
keys- the array of column keys used to ungroup
-
ungroupByKeysList
Ungroups the provided list of column keys.Grouping columns that are not in the provided keys list will still be applied.
- Specified by:
ungroupByKeysListin interfaceGroupListDataComponent<E>- Parameters:
keys- a list of column keys used to ungroup;
-
expand
Expands the specified group.- Specified by:
expandin interfaceGroupListDataComponent<E>- Parameters:
group- the group to be expanded
-
expandByPath
Expands all groups that are on the path to the provided item.- Specified by:
expandByPathin interfaceGroupListDataComponent<E>- Parameters:
item- item to expand all groups
-
expandAll
public void expandAll()Expands all root groups and their children recursively.- Specified by:
expandAllin interfaceGroupListDataComponent<E>
-
collapse
Collapses the specified group.- Specified by:
collapsein interfaceGroupListDataComponent<E>- Parameters:
group- the group to be collapsed
-
collapseByPath
Collapses all groups that are on the path to the provided item.- Specified by:
collapseByPathin interfaceGroupListDataComponent<E>- Parameters:
item- item to collapse all groups
-
collapseAll
public void collapseAll()Collapses all root groups and their children recursively.- Specified by:
collapseAllin interfaceGroupListDataComponent<E>
-
isExpanded
Determines if the specified group is expanded.- Specified by:
isExpandedin interfaceGroupListDataComponent<E>- Parameters:
group- the group to check- Returns:
trueif the group is expanded, false otherwise
-
getRootGroups
- Specified by:
getRootGroupsin interfaceGroupListDataComponent<E>- Returns:
- the list of root groups
-
getChildren
- Specified by:
getChildrenin interfaceGroupListDataComponent<E>- Returns:
- the list of nested groups
-
hasChildren
Indicates that the group has nested groups- Specified by:
hasChildrenin interfaceGroupListDataComponent<E>- Parameters:
groupInfo- group info
-
hasGroups
public boolean hasGroups()Indicates that items have groups- Specified by:
hasGroupsin interfaceGroupListDataComponent<E>
-
addGroupItemClickListener
public com.vaadin.flow.shared.Registration addGroupItemClickListener(com.vaadin.flow.component.ComponentEventListener<GroupItemClickEvent<E>> listener) Adds a group item click listener.- Parameters:
listener- listener to be added- Returns:
- a registration object for removing the listener
-
addGroupItemDoubleClickListener
public com.vaadin.flow.shared.Registration addGroupItemDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<GroupItemDoubleClickEvent<E>> listener) Adds a group item double-click listener.- Parameters:
listener- listener to be added- Returns:
- a registration object for removing the listener
-
addGroupingChangedListener
public com.vaadin.flow.shared.Registration addGroupingChangedListener(com.vaadin.flow.component.ComponentEventListener<GroupingChangedEvent<E>> listener) Adds grouping changed listener.- Parameters:
listener- listener to be added- Returns:
- a registration object for removing the listener
-
addCollapseListener
public com.vaadin.flow.shared.Registration addCollapseListener(Consumer<GroupListDataComponent.CollapseEvent<E>> listener) Description copied from interface:GroupListDataComponentAdds a listener to be notified when a group is collapsed.- Specified by:
addCollapseListenerin interfaceGroupListDataComponent<E>- Parameters:
listener- the listener to add- Returns:
- a registration object for removing the listener
-
addExpandListener
public com.vaadin.flow.shared.Registration addExpandListener(Consumer<GroupListDataComponent.ExpandEvent<E>> listener) Description copied from interface:GroupListDataComponentAdds a listener to be notified when a group is expanded.- Specified by:
addExpandListenerin interfaceGroupListDataComponent<E>- Parameters:
listener- the listener to add- Returns:
- a registration object for removing the listener
-
isEditorCreated
public boolean isEditorCreated()- Specified by:
isEditorCreatedin interfaceEnhancedGroupDataGrid<E>- Returns:
trueif the editor is created
-
isAggregatable
public boolean isAggregatable()- Specified by:
isAggregatablein interfaceEnhancedGroupDataGrid<E>- Returns:
trueif DataGrid is aggregatable
-
setAggregatable
public void setAggregatable(boolean aggregatable) Description copied from interface:EnhancedGroupDataGridSet to true if aggregation should be enabled. The default value isfalse.- Specified by:
setAggregatablein interfaceEnhancedGroupDataGrid<E>- Parameters:
aggregatable- whether to aggregate DataGrid columns
-
getAggregationPosition
- Specified by:
getAggregationPositionin interfaceEnhancedGroupDataGrid<E>- Returns:
- return aggregation row position
-
setAggregationPosition
Description copied from interface:EnhancedGroupDataGridSets aggregation row position. Default value isEnhancedGroupDataGrid.AggregationPosition.BOTTOM.- Specified by:
setAggregationPositionin interfaceEnhancedGroupDataGrid<E>- Parameters:
position- position:EnhancedGroupDataGrid.AggregationPosition.TOPorEnhancedGroupDataGrid.AggregationPosition.BOTTOM
-
addAggregation
Description copied from interface:EnhancedGroupDataGridAdd aggregation info to perform aggregation for column.- Specified by:
addAggregationin interfaceEnhancedGroupDataGrid<E>- Parameters:
column- column for aggregationinfo- aggregation info- See Also:
-
getAggregationResults
- Specified by:
getAggregationResultsin interfaceEnhancedGroupDataGrid<E>- Returns:
- aggregated values for columns
-
setColumnPosition
Moves column to the provided position in theGroupDataGrid.- Parameters:
column- column to moveindex- new index of column ingetAllColumns()list
-
getColumns
Note: If column reordering is enabled withGrid.setColumnReorderingAllowed(boolean)and the user has reordered the columns, the order of the list returned by this method might be incorrect.The columns do not contain grouping columns. To get currently grouping columns, use
getGroupingColumns().- Overrides:
getColumnsin classGrid<E>- Returns:
- an unmodifiable list of
Grid.Columns that are not hidden by security
-
getAllColumns
Gets an unmodifiable list of all currently addedGrid.Columns.If column reordering is enabled with
Grid.setColumnReorderingAllowed(boolean)and the user has reordered the columns, the order of the returned list will be correct.The returned columns also contain grouping columns. Note that grouping columns are not attached to the grid.
- Returns:
- a copy of all currently added
Grid.Columns including hidden by security
-
getGroupingColumns
Retrieves the list of columns that are used for grouping data in the grid.Note that grouping columns are not attached to the grid. When the grouping column is ungrouped, the grid will add a copy of the ungrouped column. To work correctly with an ungrouped column, you should get it from the grid again.
- Returns:
- a list of grouping columns
-
getColumnByKey
Description copied from class:GridGets aGrid.Columnof this grid by its key.- Overrides:
getColumnByKeyin classGrid<E>- Parameters:
columnKey- the identifier key of the column to get- Returns:
- the column corresponding to the given column key, or
nullif no column has such key - See Also:
-
removeColumn
Description copied from class:GridRemoves a column from the Grid.- Overrides:
removeColumnin classGrid<E>- Parameters:
column- the column to be removed, notnull
-
getEditor
Description copied from class:GridGets the editor.The editor is created using
Grid.createEditor(). -
createEditor
Description copied from class:GridCreates a new Editor instance. Can be overridden to create a custom Editor. If the Editor is aGrid.AbstractGridExtension, it will be automatically added toDataCommunicator.- Overrides:
createEditorin classGrid<E>- Returns:
- editor
-
getDefaultColumnFactory
protected BiFunction<com.vaadin.flow.data.renderer.Renderer<E>,String, getDefaultColumnFactory()Grid.Column<E>> Description copied from class:GridGives a reference to the column factory.This method must not return
null.- Overrides:
getDefaultColumnFactoryin classGrid<E>- Returns:
- method for column creation
-
onDataProviderChange
protected void onDataProviderChange()Description copied from class:GridCallback which is called if a new data provider is set or any change happen in the current data provider (anDataChangeEventevent is fired). Default implementation closes the editor if it's opened.- Overrides:
onDataProviderChangein classGrid<E>- See Also:
-
DataChangeEventDataProviderListener
-
createActionsSupport
- Overrides:
createActionsSupportin classJmixGroupGrid<E>
-
getContextMenu
- Specified by:
getContextMenuin interfaceEnhancedGroupDataGrid<E>- Returns:
- context menu instance attached to the grid
-
addContextMenu
Description copied from class:GridAdds a new context-menu for this grid.- Overrides:
addContextMenuin classGrid<E>- Returns:
- the added context-menu
-
getSubPart
Description copied from interface:HasSubPartsReturns a sub part object by its name.- Specified by:
getSubPartin interfaceHasSubParts- Overrides:
getSubPartin classJmixGroupGrid<E>- Parameters:
name- sub part name, e.g. component id- Returns:
- a sub part object by its name, or
nullif not found
-
getEmptyStateText
Description copied from class:GridReturns the text that is displayed when the grid is empty.- Overrides:
getEmptyStateTextin classGrid<E>- Returns:
- the text that is displayed when the grid is empty or null if no empty state text is set
-
setEmptyStateText
Description copied from class:GridSets the text to be displayed when the grid is empty.Note: This will also override any empty state content set with
Grid.setEmptyStateComponent(Component).- Overrides:
setEmptyStateTextin classGrid<E>- Parameters:
emptyStateText- the text to be displayed when the grid is empty, or null to clear the empty state content
-
getEmptyStateComponent
@Nullable public com.vaadin.flow.component.Component getEmptyStateComponent()Description copied from class:GridReturns the component that is displayed when the grid is empty.- Overrides:
getEmptyStateComponentin classGrid<E>- Returns:
- the component that is displayed when the grid is empty or null if no empty state component is set
-
setEmptyStateComponent
public void setEmptyStateComponent(com.vaadin.flow.component.Component emptyStateComponent) Description copied from class:GridSets the component to be displayed when the grid is empty.Note: This will also override any empty state content set with
Grid.setEmptyStateText(String).- Overrides:
setEmptyStateComponentin classGrid<E>- Parameters:
emptyStateComponent- the component to be displayed when the grid is empty, or null to clear the empty state content
-
fireExpandEvent
- Overrides:
fireExpandEventin classJmixGroupGrid<E>
-
fireCollapseEvent
- Overrides:
fireCollapseEventin classJmixGroupGrid<E>
-
fireGroupingChangedEvent
protected void fireGroupingChangedEvent(List<Grid.Column<E>> previousGroupingColumns, List<Grid.Column<E>> groupingColumns, boolean userOriginated) -
addGroupColumnInternal
protected GroupDataGridColumn<E> addGroupColumnInternal(com.vaadin.flow.data.renderer.Renderer<E> renderer, @Nullable GroupCellValueFormatter<E> valueFormatter) -
createGroupRenderer
-
createComponentGroupRenderer
-
createGroupRendererWrapper
-
generateGroupRendererItemValue
-
getGroupByItem
-
createDelegate
-
onPartNameGenerator
-
onTooltipGenerator
-
onAfterApplyColumnSecurity
protected void onAfterApplyColumnSecurity(AbstractGroupGridDelegate.ColumnSecurityContext<E> context) -
onAfterColumnGrouping
-
addUngroupedColumns
protected List<Grid.Column<E>> addUngroupedColumns(List<Grid.Column<E>> ungroupedColumns, List<GroupDataGridColumn<E>> groupColumns) -
reattachUngroupedColumns
-
getGroupColumns
-
isGroupColumn
-
refreshGroupColumns
protected void refreshGroupColumns() -
collectGroupItems
-
collectGroupItemsRecursively
-
groupBy
-
expand
- Overrides:
expandin classJmixGroupGrid<E>
-
collapse
- Overrides:
collapsein classJmixGroupGrid<E>
-
getJmixEventBus
-
generatePartData
CAUTION! Copied fromio.jmix.groupgridflowui.kit.vaadin.grid.Grid#generatePartData(T, JsonObject).- Overrides:
generatePartDatain classGrid<E>- Parameters:
item- entity itemjsonObject- JSON to send to a client side
-