Class GroupDataGrid<E>

java.lang.Object
com.vaadin.flow.component.Component
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

@CssImport("./src/vaadin-grid-tree-toggle/vaadin-grid-tree-toggle.css") @JsModule("@vaadin/grid/src/vaadin-grid-tree-toggle.js") public class GroupDataGrid<E> extends JmixGroupGrid<E> implements GroupListDataComponent<E>, LookupComponent.MultiSelectLookupComponent<E>, EnhancedGroupDataGrid<E>, SupportsEnterPress<GroupDataGrid<E>>, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
The data grid component that supports grouping of data.
See Also:
  • Field Details

    • GROUP_ROW_CELL_PN

      public static final String GROUP_ROW_CELL_PN
      See Also:
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • metadataTools

      protected MetadataTools metadataTools
    • groupGridProperties

      protected GroupGridProperties groupGridProperties
    • gridDelegate

      protected GroupDataGridDelegate<E,GroupDataGridItems<E>> gridDelegate
    • contextMenu

      protected JmixGroupGridContextMenu<E> contextMenu
    • partNameGenerator

      protected com.vaadin.flow.function.SerializableFunction<E,String> partNameGenerator
    • groupPartNameGenerator

      protected com.vaadin.flow.function.SerializableFunction<GroupInfo,String> groupPartNameGenerator
    • tooltipGenerator

      protected com.vaadin.flow.function.SerializableFunction<E,String> tooltipGenerator
    • groupTooltipGenerator

      protected com.vaadin.flow.function.SerializableFunction<GroupInfo,String> groupTooltipGenerator
    • jmixEventBus

      protected EventBus 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:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • initComponent

      protected void initComponent()
    • isSortByGroupEnabled

      public boolean isSortByGroupEnabled()
      Returns:
      true if sorting by grouping is enabled, false otherwise
    • 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:
      setDataProvider in interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<E>
      Overrides:
      setDataProvider in class JmixGroupGrid<E>
    • getSingleSelectedItem

      @Nullable public E getSingleSelectedItem()
      Description copied from interface: ListDataComponent
      Returns an item corresponding to the selected row of this component. If nothing is selected, the method returns null. If multiple selection mode is enabled, returns the first selected instance.
      Specified by:
      getSingleSelectedItem in interface ListDataComponent<E>
      Returns:
      an item corresponding to the selected row of this component
    • getSelectedItems

      public Set<E> getSelectedItems()
      Description copied from class: Grid
      This method is a shorthand that delegates to the currently set selection model.
      Specified by:
      getSelectedItems in interface ListDataComponent<E>
      Specified by:
      getSelectedItems in interface LookupComponent<E>
      Overrides:
      getSelectedItems in class Grid<E>
      Returns:
      a set with the selected items, never null
      See Also:
    • select

      public void select(E item)
      Description copied from class: Grid
      This method is a shorthand that delegates to the currently set selection model.
      Specified by:
      select in interface ListDataComponent<E>
      Overrides:
      select in class Grid<E>
      Parameters:
      item - the item to select, not null
      See Also:
    • select

      public void select(Collection<E> items)
      Description copied from interface: ListDataComponent
      Selects the rows of this component for a given collection of items.
      Specified by:
      select in interface ListDataComponent<E>
      Parameters:
      items - collection of items to select rows
    • deselect

      public void deselect(E item)
      Description copied from class: Grid
      This method is a shorthand that delegates to the currently set selection model.
      Specified by:
      deselect in interface ListDataComponent<E>
      Overrides:
      deselect in class Grid<E>
      Parameters:
      item - the item to deselect, not null
      See Also:
    • deselectAll

      public void deselectAll()
      Description copied from class: Grid
      This method is a shorthand that delegates to the currently set selection model.
      Specified by:
      deselectAll in interface ListDataComponent<E>
      Overrides:
      deselectAll in class Grid<E>
      See Also:
    • enableMultiSelect

      public void enableMultiSelect()
      Description copied from interface: LookupComponent.MultiSelectLookupComponent
      Enables 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:
      enableMultiSelect in interface LookupComponent.MultiSelectLookupComponent<E>
    • setSelectionMode

      public GridSelectionModel<E> setSelectionMode(Grid.SelectionMode selectionMode)
      Description copied from class: Grid
      Sets 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:
      setSelectionMode in class Grid<E>
      Parameters:
      selectionMode - the selection mode to switch to, not null
      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: Grid
      Adds a selection listener to the current selection model.

      This is a shorthand for grid.getSelectionModel().addSelectionListener(). To get more detailed selection events, use Grid.getSelectionModel() and either GridSingleSelectionModel.addSingleSelectionListener(SingleSelectionListener) or GridMultiSelectionModel.addMultiSelectionListener(MultiSelectionListener) depending on the used selection mode.

      Specified by:
      addSelectionListener in interface SelectionChangeNotifier<Grid<E>,E>
      Overrides:
      addSelectionListener in class Grid<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: Grid
      Adds 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:
      addItemDoubleClickListener in class JmixGroupGrid<E>
      Parameters:
      listener - the listener to add, not null
      Returns:
      a handle that can be used for removing the listener
      See Also:
    • getItems

      @Nullable public GroupDataGridItems<E> getItems()
      Specified by:
      getItems in interface ListDataComponent<E>
      Returns:
      a data unit that holds component items
    • isMultiSelect

      public boolean isMultiSelect()
      Specified by:
      isMultiSelect in interface ListDataComponent<E>
      Returns:
      true if multiple selection mode is enabled
    • setMultiSelect

      public void setMultiSelect(boolean multiSelect)
      Description copied from interface: LookupComponent.MultiSelectLookupComponent
      Sets whether the component allows multi-selection or not.
      Specified by:
      setMultiSelect in interface LookupComponent.MultiSelectLookupComponent<E>
      Parameters:
      multiSelect - if true, 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:

      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:
      setEnterPressHandler in interface SupportsEnterPress<E>
      Parameters:
      handler - code to execute when Enter key is pressed or null to remove previously set.
      See Also:
    • getPartNameGenerator

      @Nullable public com.vaadin.flow.function.SerializableFunction<E,String> getPartNameGenerator()
      Description copied from class: Grid
      Gets the function that is used for generating CSS part names for rows in this grid.
      Overrides:
      getPartNameGenerator in class Grid<E>
      Returns:
      the part name generator
    • setPartNameGenerator

      public void setPartNameGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<E,String> partNameGenerator)
      Description copied from class: Grid
      Sets the function that is used for generating CSS part names for all the cells in the rows in this grid. Returning null from 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:
      setPartNameGenerator in class Grid<E>
      Parameters:
      partNameGenerator - the part name generator to set, not null
      See Also:
    • getGroupPartNameGenerator

      @Nullable public com.vaadin.flow.function.SerializableFunction<GroupInfo,String> getGroupPartNameGenerator()
      Returns:
      group part name generator or null if 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. Returning null from 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

      @Nullable public com.vaadin.flow.function.SerializableFunction<E,String> getTooltipGenerator()
      Returns:
      a tooltip generator or null if 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. Returning null from the generator results in no tooltip being set.
      Overrides:
      setTooltipGenerator in class Grid<E>
      Parameters:
      tooltipGenerator - tooltip generator
    • getGroupTooltipGenerator

      @Nullable public com.vaadin.flow.function.SerializableFunction<GroupInfo,String> getGroupTooltipGenerator()
      Returns:
      group tooltip generator or null if 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. Returning null from the generator results in no tooltip being set.
      Parameters:
      groupTooltipGenerator - group tooltip generator
    • getColumnMetaPropertyPath

      @Nullable public MetaPropertyPath getColumnMetaPropertyPath(Grid.Column<E> column)
      Specified by:
      getColumnMetaPropertyPath in interface EnhancedGroupDataGrid<E>
      Parameters:
      column - column to get the meta-property path for
      Returns:
      MetaPropertyPath that refers to the column or null if the column is not bound to any property
    • getColumnByMetaPropertyPath

      @Nullable public DataGridColumn<E> getColumnByMetaPropertyPath(MetaPropertyPath metaPropertyPath)
      Specified by:
      getColumnByMetaPropertyPath in interface EnhancedGroupDataGrid<E>
      Parameters:
      metaPropertyPath - MetaPropertyPath that refers to the column
      Returns:
      DataGridColumn that is bound to the passed metaPropertyPath
    • addColumn

      public DataGridColumn<E> addColumn(MetaPropertyPath metaPropertyPath)
      Description copied from interface: EnhancedGroupDataGrid
      Adds a column by the meta-property path.
      Specified by:
      addColumn in interface EnhancedGroupDataGrid<E>
      Parameters:
      metaPropertyPath - meta-property path to add a column
      Returns:
      added column
    • addColumn

      public DataGridColumn<E> addColumn(String key, MetaPropertyPath metaPropertyPath)
      Description copied from interface: EnhancedGroupDataGrid
      Adds a column by the meta-property path and specified key. The key is used to identify the column, see Grid.getColumnByKey(String).
      Specified by:
      addColumn in interface EnhancedGroupDataGrid<E>
      Parameters:
      key - column key
      metaPropertyPath - meta-property path to add a column
      Returns:
      added column
    • addColumn

      public DataGridColumn<E> addColumn(com.vaadin.flow.function.ValueProvider<E,?> valueProvider)
      Description copied from class: Grid
      Adds a new text column to this Grid with a value provider and default column factory. The value is converted to String when sent to the client by using String.valueOf(Object).

      NOTE: For displaying components, see Grid.addComponentColumn(ValueProvider). For using build-in renderers, see Grid.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)

      Overrides:
      addColumn in class Grid<E>
      Parameters:
      valueProvider - the value provider
      Returns:
      the created column
      See Also:
    • addColumn

      public DataGridColumn<E> addColumn(com.vaadin.flow.data.renderer.Renderer<E> renderer)
      Description copied from class: Grid
      Adds a new text column to this Grid with a renderer and default column factory.

      See implementations of the Renderer interface for built-in renderer options with type safe APIs. For a renderer using template binding, use LitRenderer.of(String).

      NOTE: You can add component columns easily using the Grid.addComponentColumn(ValueProvider), but using ComponentRenderer is not as efficient as the built in renderers or using LitRenderer.

      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)

      Overrides:
      addColumn in class Grid<E>
      Parameters:
      renderer - the renderer used to create the grid cell structure
      Returns:
      the created column
      See Also:
    • addComponentColumn

      public <V extends com.vaadin.flow.component.Component> DataGridColumn<E> addComponentColumn(com.vaadin.flow.function.ValueProvider<E,V> componentProvider)
      Description copied from class: Grid
      Adds a new column that shows components.

      This is a shorthand for Grid.addColumn(Renderer) with a ComponentRenderer.

      NOTE: Using ComponentRenderer is not as efficient as the built in renderers or using LitRenderer.

      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:
      addComponentColumn in class Grid<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: Grid
      Adds a new text column to this Grid with a value provider and sorting properties.The value is converted to a JSON value by using JsonSerializer.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 given ValueProvider.

      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:
      addColumn in class Grid<E>
      Type Parameters:
      V - the type of the column
      Parameters:
      valueProvider - the value provider
      sortingProperties - the sorting properties to use with this column
      Returns:
      the created column
      See Also:
    • addColumn

      public DataGridColumn<E> addColumn(String propertyName)
      Description copied from class: Grid
      Adds 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 the column key and the property caption will be used as the column 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 the Grid.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)

      Overrides:
      addColumn in class Grid<E>
      Parameters:
      propertyName - the property name of the new column, not null
      Returns:
      the created column
      See Also:
    • addGroupColumn

      public GroupDataGridColumn<E> 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 GroupDataGridColumn instance
    • addGroupColumn

      public GroupDataGridColumn<E> addGroupColumn(GroupCellValueFormatter<E> valueFormatter)
      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 GroupDataGridColumn instance
    • 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 GroupDataGridColumn instance
    • groupByColumns

      @SafeVarargs public final void groupByColumns(Grid.Column<E>... columns)
      Performs grouping by specified columns.

      The previous grouping will be replaced by a new one.

      Parameters:
      columns - columns to group by
    • groupByColumnsList

      public void groupByColumnsList(List<Grid.Column<E>> columns)
      Performs grouping by specified columns.

      The previous grouping will be replaced by a new one.

      Parameters:
      columns - columns to group by
    • groupByKeys

      public void groupByKeys(String... keys)
      Groups data by the specified column keys.

      The previous grouping will be replaced by a new one.

      Specified by:
      groupByKeys in interface GroupListDataComponent<E>
      Parameters:
      keys - the column keys to group by
    • groupByKeysList

      public void groupByKeysList(List<String> keys)
      Groups data by the specified column keys.

      The previous grouping will be replaced by a new one.

      Specified by:
      groupByKeysList in interface GroupListDataComponent<E>
      Parameters:
      keys - the column keys to group by
    • ungroup

      public void ungroup()
      Resets any grouping applied in the grid.
      Specified by:
      ungroup in interface GroupListDataComponent<E>
    • ungroupByColumns

      @SafeVarargs public final void ungroupByColumns(Grid.Column<E>... columns)
      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

      public void ungroupByColumnsList(List<Grid.Column<E>> columns)
      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

      public void ungroupByKeys(String... keys)
      Ungroups the provided array of column keys.

      Grouping columns that are not in the provided keys array will still be applied.

      Specified by:
      ungroupByKeys in interface GroupListDataComponent<E>
      Parameters:
      keys - the array of column keys used to ungroup
    • ungroupByKeysList

      public void ungroupByKeysList(List<String> keys)
      Ungroups the provided list of column keys.

      Grouping columns that are not in the provided keys list will still be applied.

      Specified by:
      ungroupByKeysList in interface GroupListDataComponent<E>
      Parameters:
      keys - a list of column keys used to ungroup;
    • expand

      public void expand(GroupInfo group)
      Expands the specified group.
      Specified by:
      expand in interface GroupListDataComponent<E>
      Parameters:
      group - the group to be expanded
    • expandByPath

      public void expandByPath(E item)
      Expands all groups that are on the path to the provided item.
      Specified by:
      expandByPath in interface GroupListDataComponent<E>
      Parameters:
      item - item to expand all groups
    • expandAll

      public void expandAll()
      Expands all root groups and their children recursively.
      Specified by:
      expandAll in interface GroupListDataComponent<E>
    • collapse

      public void collapse(GroupInfo group)
      Collapses the specified group.
      Specified by:
      collapse in interface GroupListDataComponent<E>
      Parameters:
      group - the group to be collapsed
    • collapseByPath

      public void collapseByPath(E item)
      Collapses all groups that are on the path to the provided item.
      Specified by:
      collapseByPath in interface GroupListDataComponent<E>
      Parameters:
      item - item to collapse all groups
    • collapseAll

      public void collapseAll()
      Collapses all root groups and their children recursively.
      Specified by:
      collapseAll in interface GroupListDataComponent<E>
    • isExpanded

      public boolean isExpanded(GroupInfo group)
      Determines if the specified group is expanded.
      Specified by:
      isExpanded in interface GroupListDataComponent<E>
      Parameters:
      group - the group to check
      Returns:
      true if the group is expanded, false otherwise
    • getRootGroups

      public List<GroupInfo> getRootGroups()
      Specified by:
      getRootGroups in interface GroupListDataComponent<E>
      Returns:
      the list of root groups
    • getChildren

      public List<GroupInfo> getChildren(GroupInfo group)
      Specified by:
      getChildren in interface GroupListDataComponent<E>
      Returns:
      the list of nested groups
    • hasChildren

      public boolean hasChildren(GroupInfo groupInfo)
      Indicates that the group has nested groups
      Specified by:
      hasChildren in interface GroupListDataComponent<E>
      Parameters:
      groupInfo - group info
    • hasGroups

      public boolean hasGroups()
      Indicates that items have groups
      Specified by:
      hasGroups in interface GroupListDataComponent<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: GroupListDataComponent
      Adds a listener to be notified when a group is collapsed.
      Specified by:
      addCollapseListener in interface GroupListDataComponent<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: GroupListDataComponent
      Adds a listener to be notified when a group is expanded.
      Specified by:
      addExpandListener in interface GroupListDataComponent<E>
      Parameters:
      listener - the listener to add
      Returns:
      a registration object for removing the listener
    • isEditorCreated

      public boolean isEditorCreated()
      Specified by:
      isEditorCreated in interface EnhancedGroupDataGrid<E>
      Returns:
      true if the editor is created
    • isAggregatable

      public boolean isAggregatable()
      Specified by:
      isAggregatable in interface EnhancedGroupDataGrid<E>
      Returns:
      true if DataGrid is aggregatable
    • setAggregatable

      public void setAggregatable(boolean aggregatable)
      Description copied from interface: EnhancedGroupDataGrid
      Set to true if aggregation should be enabled. The default value is false.
      Specified by:
      setAggregatable in interface EnhancedGroupDataGrid<E>
      Parameters:
      aggregatable - whether to aggregate DataGrid columns
    • getAggregationPosition

      public EnhancedGroupDataGrid.AggregationPosition getAggregationPosition()
      Specified by:
      getAggregationPosition in interface EnhancedGroupDataGrid<E>
      Returns:
      return aggregation row position
    • setAggregationPosition

      public void setAggregationPosition(EnhancedGroupDataGrid.AggregationPosition position)
      Description copied from interface: EnhancedGroupDataGrid
      Sets aggregation row position. Default value is EnhancedGroupDataGrid.AggregationPosition.BOTTOM.
      Specified by:
      setAggregationPosition in interface EnhancedGroupDataGrid<E>
      Parameters:
      position - position: EnhancedGroupDataGrid.AggregationPosition.TOP or EnhancedGroupDataGrid.AggregationPosition.BOTTOM
    • addAggregation

      public void addAggregation(Grid.Column<E> column, AggregationInfo info)
      Description copied from interface: EnhancedGroupDataGrid
      Add aggregation info to perform aggregation for column.
      Specified by:
      addAggregation in interface EnhancedGroupDataGrid<E>
      Parameters:
      column - column for aggregation
      info - aggregation info
      See Also:
    • getAggregationResults

      public Map<Grid.Column<E>,Object> getAggregationResults()
      Specified by:
      getAggregationResults in interface EnhancedGroupDataGrid<E>
      Returns:
      aggregated values for columns
    • setColumnPosition

      public void setColumnPosition(Grid.Column<E> column, int index)
      Moves column to the provided position in the GroupDataGrid.
      Parameters:
      column - column to move
      index - new index of column in getAllColumns() list
    • getColumns

      public List<Grid.Column<E>> getColumns()
      Note: If column reordering is enabled with Grid.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:
      getColumns in class Grid<E>
      Returns:
      an unmodifiable list of Grid.Columns that are not hidden by security
    • getAllColumns

      public List<Grid.Column<E>> getAllColumns()
      Gets an unmodifiable list of all currently added Grid.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

      public List<Grid.Column<E>> 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

      @Nullable public DataGridColumn<E> getColumnByKey(String columnKey)
      Description copied from class: Grid
      Gets a Grid.Column of this grid by its key.
      Overrides:
      getColumnByKey in class Grid<E>
      Parameters:
      columnKey - the identifier key of the column to get
      Returns:
      the column corresponding to the given column key, or null if no column has such key
      See Also:
    • removeColumn

      public void removeColumn(Grid.Column<E> column)
      Description copied from class: Grid
      Removes a column from the Grid.
      Overrides:
      removeColumn in class Grid<E>
      Parameters:
      column - the column to be removed, not null
    • getEditor

      public GroupDataGridEditor<E> getEditor()
      Description copied from class: Grid
      Gets the editor.

      The editor is created using Grid.createEditor().

      Overrides:
      getEditor in class Grid<E>
      Returns:
      the editor instance
      See Also:
    • createEditor

      protected GroupDataGridEditor<E> createEditor()
      Description copied from class: Grid
      Creates a new Editor instance. Can be overridden to create a custom Editor. If the Editor is a Grid.AbstractGridExtension, it will be automatically added to DataCommunicator.
      Overrides:
      createEditor in class Grid<E>
      Returns:
      editor
    • getDefaultColumnFactory

      protected BiFunction<com.vaadin.flow.data.renderer.Renderer<E>,String,Grid.Column<E>> getDefaultColumnFactory()
      Description copied from class: Grid
      Gives a reference to the column factory.

      This method must not return null.

      Overrides:
      getDefaultColumnFactory in class Grid<E>
      Returns:
      method for column creation
    • onDataProviderChange

      protected void onDataProviderChange()
      Description copied from class: Grid
      Callback which is called if a new data provider is set or any change happen in the current data provider (an DataChangeEvent event is fired). Default implementation closes the editor if it's opened.
      Overrides:
      onDataProviderChange in class Grid<E>
      See Also:
      • DataChangeEvent
      • DataProviderListener
    • createActionsSupport

      protected JmixGroupGridActionsSupport<JmixGroupGrid<E>,E> createActionsSupport()
      Overrides:
      createActionsSupport in class JmixGroupGrid<E>
    • getContextMenu

      public JmixGroupGridContextMenu<E> getContextMenu()
      Specified by:
      getContextMenu in interface EnhancedGroupDataGrid<E>
      Returns:
      context menu instance attached to the grid
    • addContextMenu

      public GridContextMenu<E> addContextMenu()
      Description copied from class: Grid
      Adds a new context-menu for this grid.
      Overrides:
      addContextMenu in class Grid<E>
      Returns:
      the added context-menu
    • getSubPart

      @Nullable public Object getSubPart(String name)
      Description copied from interface: HasSubParts
      Returns a sub part object by its name.
      Specified by:
      getSubPart in interface HasSubParts
      Overrides:
      getSubPart in class JmixGroupGrid<E>
      Parameters:
      name - sub part name, e.g. component id
      Returns:
      a sub part object by its name, or null if not found
    • getEmptyStateText

      @Nullable public String getEmptyStateText()
      Description copied from class: Grid
      Returns the text that is displayed when the grid is empty.
      Overrides:
      getEmptyStateText in class Grid<E>
      Returns:
      the text that is displayed when the grid is empty or null if no empty state text is set
    • setEmptyStateText

      public void setEmptyStateText(String emptyStateText)
      Description copied from class: Grid
      Sets 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:
      setEmptyStateText in class Grid<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: Grid
      Returns the component that is displayed when the grid is empty.
      Overrides:
      getEmptyStateComponent in class Grid<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: Grid
      Sets 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:
      setEmptyStateComponent in class Grid<E>
      Parameters:
      emptyStateComponent - the component to be displayed when the grid is empty, or null to clear the empty state content
    • fireExpandEvent

      protected void fireExpandEvent(Collection<E> expandedItems, boolean userOriginated)
      Overrides:
      fireExpandEvent in class JmixGroupGrid<E>
    • fireCollapseEvent

      protected void fireCollapseEvent(Collection<E> collapsedItems, boolean userOriginated)
      Overrides:
      fireCollapseEvent in class JmixGroupGrid<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

      protected com.vaadin.flow.data.renderer.Renderer<E> createGroupRenderer()
    • createComponentGroupRenderer

      protected <V extends com.vaadin.flow.component.Component> com.vaadin.flow.data.renderer.Renderer<E> createComponentGroupRenderer(com.vaadin.flow.function.ValueProvider<GroupInfo,V> componentProvider)
    • createGroupRendererWrapper

      protected com.vaadin.flow.data.renderer.Renderer<E> createGroupRendererWrapper(com.vaadin.flow.data.renderer.Renderer<E> renderer)
    • generateGroupRendererItemValue

      protected String generateGroupRendererItemValue(@Nullable GroupInfo group)
    • getGroupByItem

      @Nullable protected GroupInfo getGroupByItem(E item)
    • createDelegate

      protected GroupDataGridDelegate<E,GroupDataGridItems<E>> createDelegate()
    • onPartNameGenerator

      @Nullable protected String onPartNameGenerator(E item)
    • onTooltipGenerator

      @Nullable protected String onTooltipGenerator(E item)
    • onAfterApplyColumnSecurity

      protected void onAfterApplyColumnSecurity(AbstractGroupGridDelegate.ColumnSecurityContext<E> context)
    • onAfterColumnGrouping

      protected void onAfterColumnGrouping(GroupDataGridDelegate.ColumnGroupingContext<E> context)
    • addUngroupedColumns

      protected List<Grid.Column<E>> addUngroupedColumns(List<Grid.Column<E>> ungroupedColumns, List<GroupDataGridColumn<E>> groupColumns)
    • reattachUngroupedColumns

      protected List<Grid.Column<E>> reattachUngroupedColumns(List<Grid.Column<E>> columns)
    • getGroupColumns

      protected List<GroupDataGridColumn<E>> getGroupColumns()
    • isGroupColumn

      protected boolean isGroupColumn(Grid.Column<E> column)
    • refreshGroupColumns

      protected void refreshGroupColumns()
    • collectGroupItems

      protected List<E> collectGroupItems(List<GroupInfo> groups)
    • collectGroupItemsRecursively

      protected void collectGroupItemsRecursively(List<GroupInfo> groups, List<E> groupItems)
    • groupBy

      protected void groupBy(List<String> groupingKeys, boolean userOriginated)
    • expand

      protected void expand(Collection<E> items, boolean userOriginated)
      Overrides:
      expand in class JmixGroupGrid<E>
    • collapse

      protected void collapse(Collection<E> items, boolean userOriginated)
      Overrides:
      collapse in class JmixGroupGrid<E>
    • getJmixEventBus

      protected EventBus getJmixEventBus()
    • generatePartData

      protected void generatePartData(E item, elemental.json.JsonObject jsonObject)
      CAUTION! Copied from io.jmix.groupgridflowui.kit.vaadin.grid.Grid#generatePartData(T, JsonObject).
      Overrides:
      generatePartData in class Grid<E>
      Parameters:
      item - entity item
      jsonObject - JSON to send to a client side