Class GroupDataGridAdapter<E>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.grid.Grid<T>
Type Parameters:
E - entity type
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.grid.Grid<E>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.grid.Grid<E>>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.grid.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<com.vaadin.flow.component.grid.Grid<E>,com.vaadin.flow.component.grid.GridSortOrder<E>>, com.vaadin.flow.data.provider.HasDataGenerators<E>, com.vaadin.flow.data.provider.HasDataView<E,Void,com.vaadin.flow.component.grid.dataview.GridDataView<E>>, com.vaadin.flow.data.provider.HasLazyDataView<E,Void,com.vaadin.flow.component.grid.dataview.GridLazyDataView<E>>, com.vaadin.flow.data.provider.HasListDataView<E,com.vaadin.flow.component.grid.dataview.GridListDataView<E>>, EnhancedDataGrid<E>, GroupListDataComponent<E>, ListDataComponent<E>, LookupComponent<E>, LookupComponent.MultiSelectLookupComponent<E>, SupportsEnterPress<DataGrid<E>>, HasActions, HasSubParts, SelectionChangeNotifier<com.vaadin.flow.component.grid.Grid<E>,E>, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class GroupDataGridAdapter<E> extends AbstractGroupDataGridAdapter<E>
Adapter for GroupDataGrid component. The adapter has highly limited functionality. Most methods are not overridden and changes will not be applied to the adaptee.

This class mostly adapts GroupDataGrid to be used in Excel exporting and in JmixGridColumnVisibility.

See Also:
  • Field Details

    • selectionEnabled

      protected boolean selectionEnabled
    • groupingColumns

      protected List<com.vaadin.flow.component.grid.Grid.Column<E>> groupingColumns
  • Constructor Details

    • GroupDataGridAdapter

      public GroupDataGridAdapter(GroupDataGrid<E> groupGrid)
  • Method Details

    • initComponent

      protected void initComponent()
      Overrides:
      initComponent in class DataGrid<E>
    • getAdaptee

      public GroupDataGrid<E> getAdaptee()
      Overrides:
      getAdaptee in class AbstractGroupDataGridAdapter<E>
      Returns:
      the underlying GroupListDataComponent instance that is adapted
    • getGroupingColumns

      public Collection<com.vaadin.flow.component.grid.Grid.Column<E>> getGroupingColumns()
      Specified by:
      getGroupingColumns in class AbstractGroupDataGridAdapter<E>
      Returns:
      the collection of columns that are used for grouping data in the grid
    • isGroupColumn

      public boolean isGroupColumn(com.vaadin.flow.component.grid.Grid.Column<E> column)
      Description copied from class: AbstractGroupDataGridAdapter
      Checks whether the given column is an implementation of GroupColumn.
      Specified by:
      isGroupColumn in class AbstractGroupDataGridAdapter<E>
      Parameters:
      column - the column to check
      Returns:
      true if the column is a group column
    • 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>
      Overrides:
      getSingleSelectedItem in class DataGrid<E>
      Returns:
      an item corresponding to the selected row of this component
    • getSelectedItems

      public Set<E> getSelectedItems()
      Description copied from interface: ListDataComponent
      Returns a set of items corresponding to the selected rows of this component. If nothing is selected, the method returns a Collections.emptySet().
      Specified by:
      getSelectedItems in interface ListDataComponent<E>
      Specified by:
      getSelectedItems in interface LookupComponent<E>
      Overrides:
      getSelectedItems in class DataGrid<E>
      Returns:
      a set of item instances corresponding to the selected rows of this component, never null
    • getColumnMetaPropertyPath

      @Nullable public MetaPropertyPath getColumnMetaPropertyPath(com.vaadin.flow.component.grid.Grid.Column<E> column)
      Specified by:
      getColumnMetaPropertyPath in interface EnhancedDataGrid<E>
      Overrides:
      getColumnMetaPropertyPath in class DataGrid<E>
    • getColumnByMetaPropertyPath

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

      public List<com.vaadin.flow.component.grid.Grid.Column<E>> getColumns()
      Description copied from class: DataGrid
      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.
      Overrides:
      getColumns in class DataGrid<E>
      Returns:
      an unmodifiable list of Grid.Columns that are not hidden by security
    • getAllColumns

      public List<com.vaadin.flow.component.grid.Grid.Column<E>> getAllColumns()
      Description copied from class: DataGrid
      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.

      Overrides:
      getAllColumns in class DataGrid<E>
      Returns:
      a copy of all currently added Grid.Columns including hidden by security
    • setItems

      public com.vaadin.flow.component.grid.dataview.GridDataView<E> setItems(com.vaadin.flow.data.provider.DataProvider<E,Void> dataProvider)
      Specified by:
      setItems in interface com.vaadin.flow.data.provider.HasDataView<E,Void,com.vaadin.flow.component.grid.dataview.GridDataView<E>>
      Overrides:
      setItems in class DataGrid<E>
    • select

      public void select(E item)
      Description copied from interface: ListDataComponent
      Selects a row of this component for a given item.
      Specified by:
      select in interface ListDataComponent<E>
      Overrides:
      select in class DataGrid<E>
      Parameters:
      item - item instance to select the row
    • deselect

      public void deselect(E item)
      Description copied from interface: ListDataComponent
      Deselects the row corresponding to the given item in this component.
      Specified by:
      deselect in interface ListDataComponent<E>
      Overrides:
      deselect in class DataGrid<E>
      Parameters:
      item - the item instance whose corresponding row should be deselected
    • deselectAll

      public void deselectAll()
      Description copied from interface: ListDataComponent
      Deselects all selected rows.
      Specified by:
      deselectAll in interface ListDataComponent<E>
      Overrides:
      deselectAll in class DataGrid<E>
    • isMultiSelect

      public boolean isMultiSelect()
      Specified by:
      isMultiSelect in interface ListDataComponent<E>
      Overrides:
      isMultiSelect in class DataGrid<E>
      Returns:
      true if multiple selection mode is enabled
    • 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>
      Overrides:
      enableMultiSelect in class DataGrid<E>
    • 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>
      Overrides:
      setMultiSelect in class DataGrid<E>
      Parameters:
      multiSelect - if true, multi-selection is enabled; otherwise, multi-selection is disabled
    • getDefaultHeaderRow

      public com.vaadin.flow.component.grid.HeaderRow getDefaultHeaderRow()
      Overrides:
      getDefaultHeaderRow in class JmixGrid<E>
      Returns:
      a default header row
    • appendHeaderRow

      public com.vaadin.flow.component.grid.HeaderRow appendHeaderRow()
      Overrides:
      appendHeaderRow in class com.vaadin.flow.component.grid.Grid<E>
    • prependFooterRow

      public com.vaadin.flow.component.grid.FooterRow prependFooterRow()
      Overrides:
      prependFooterRow in class com.vaadin.flow.component.grid.Grid<E>
    • getHeaderRows

      public List<com.vaadin.flow.component.grid.HeaderRow> getHeaderRows()
      Overrides:
      getHeaderRows in class com.vaadin.flow.component.grid.Grid<E>
    • getFooterRows

      public List<com.vaadin.flow.component.grid.FooterRow> getFooterRows()
      Overrides:
      getFooterRows in class com.vaadin.flow.component.grid.Grid<E>
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.data.provider.DataProvider<E,?> dataProvider)
      Overrides:
      setDataProvider in class com.vaadin.flow.component.grid.Grid<E>
    • getDataProvider

      public com.vaadin.flow.data.provider.DataProvider<E,?> getDataProvider()
      Overrides:
      getDataProvider in class com.vaadin.flow.component.grid.Grid<E>
    • getDataCommunicator

      public com.vaadin.flow.data.provider.DataCommunicator<E> getDataCommunicator()
      Overrides:
      getDataCommunicator in class com.vaadin.flow.component.grid.Grid<E>
    • recalculateColumnWidths

      public void recalculateColumnWidths()
      Overrides:
      recalculateColumnWidths in class com.vaadin.flow.component.grid.Grid<E>
    • getDefaultColumnFactoryInternal

      protected BiFunction<com.vaadin.flow.data.renderer.Renderer<E>,String,AbstractGroupDataGridColumnAdapter<E>> getDefaultColumnFactoryInternal()
      Specified by:
      getDefaultColumnFactoryInternal in class AbstractGroupDataGridAdapter<E>
    • getUI

      public Optional<com.vaadin.flow.component.UI> getUI()
      Overrides:
      getUI in class com.vaadin.flow.component.Component
    • getId

      public Optional<String> getId()
      Overrides:
      getId in class com.vaadin.flow.component.Component
    • isAttached

      public boolean isAttached()
      Overrides:
      isAttached in class com.vaadin.flow.component.Component
    • setVisible

      public void setVisible(boolean visible)
      Overrides:
      setVisible in class com.vaadin.flow.component.Component
    • isVisible

      public boolean isVisible()
      Overrides:
      isVisible in class com.vaadin.flow.component.Component
    • removeFromParent

      public void removeFromParent()
      Overrides:
      removeFromParent in class com.vaadin.flow.component.Component
    • groupDataGrid

      protected GroupDataGrid<E> groupDataGrid()
    • toNativeColumns

      protected List<com.vaadin.flow.component.grid.Grid.Column<E>> toNativeColumns(Collection<Grid.Column<E>> groupColumns)
    • createColumnAdapter

      protected DataGridColumnAdapter<E> createColumnAdapter(DataGridColumn<E> column)
    • createColumnAdapter

      protected DataGridColumnAdapter<E> createColumnAdapter(DataGridColumn<E> column, com.vaadin.flow.data.renderer.Renderer<E> renderer, String columnId)
    • addColumnInternal

      protected void addColumnInternal(Grid.Column<E> column)
    • createStubAggregationInfo

      protected AggregationInfo createStubAggregationInfo()
    • enableSelection

      protected void enableSelection()
    • disableSelection

      protected void disableSelection()
    • toNativeAggregationPosition

    • getItemsInternal

      @Nullable protected GroupDataGridItems<E> getItemsInternal()
      Specified by:
      getItemsInternal in class AbstractGroupDataGridAdapter<E>