Class GroupDataGridColumn<E>

java.lang.Object
com.vaadin.flow.component.Component
Type Parameters:
E - item type
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, GroupColumn<E>, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class GroupDataGridColumn<E> extends DataGridColumn<E> implements GroupColumn<E>, org.springframework.beans.factory.InitializingBean
Represents a column that renderers grouping data by properties.
See Also:
  • Field Details

    • uiComponents

      protected UiComponents uiComponents
    • groupCellValueFormatter

      protected GroupCellValueFormatter<E> groupCellValueFormatter
    • headerGrouper

      protected GroupDataGridHeaderGrouper headerGrouper
    • autoHidden

      protected boolean autoHidden
    • displayItemsCount

      protected boolean displayItemsCount
    • groupIconVisible

      protected boolean groupIconVisible
    • grid

      protected final Grid<?> grid
  • Constructor Details

    • GroupDataGridColumn

      public GroupDataGridColumn(GroupDataGrid<E> grid, String columnId, com.vaadin.flow.data.renderer.Renderer<E> renderer)
  • 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
      Overrides:
      setApplicationContext in class DataGridColumn<E>
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • isAutoHidden

      public boolean isAutoHidden()
      Specified by:
      isAutoHidden in interface GroupColumn<E>
      Returns:
      true if the column is automatically hidden when there are no grouping columns
    • setAutoHidden

      public void setAutoHidden(boolean autoHidden)
      Description copied from interface: GroupColumn
      Sets whether the column is automatically hidden when there are no grouping columns.

      The default value is false.

      Specified by:
      setAutoHidden in interface GroupColumn<E>
      Parameters:
      autoHidden - autoHidden option
    • isDisplayItemsCount

      public boolean isDisplayItemsCount()
      Specified by:
      isDisplayItemsCount in interface GroupColumn<E>
      Returns:
      true if the column displays the number of items in each group
    • setDisplayItemsCount

      public void setDisplayItemsCount(boolean displayItemsCount)
      Description copied from interface: GroupColumn
      Sets whether the column displays the number of items in each group.

      The default value is true.

      Specified by:
      setDisplayItemsCount in interface GroupColumn<E>
      Parameters:
      displayItemsCount - displayItemsCount option
    • isDisplayColumnsGrouperOnIconClick

      public boolean isDisplayColumnsGrouperOnIconClick()
      Specified by:
      isDisplayColumnsGrouperOnIconClick in interface GroupColumn<E>
      Returns:
      true if the column displays a button that opens a popup that manages columns grouping
    • setDisplayColumnsGrouperOnIconClick

      public void setDisplayColumnsGrouperOnIconClick(boolean displayOnIcon)
      Description copied from interface: GroupColumn
      Sets whether the column displays a button that opens a popup that manages columns grouping.

      The default value is true.

      Specified by:
      setDisplayColumnsGrouperOnIconClick in interface GroupColumn<E>
      Parameters:
      displayOnIcon - displayColumnsGrouper option
    • getGroupIcon

      @Nullable public com.vaadin.flow.component.icon.Icon getGroupIcon()
      Specified by:
      getGroupIcon in interface GroupColumn<E>
      Returns:
      the icon for the Columns Grouper button or null if the default icon is used
    • setGroupIcon

      public void setGroupIcon(@Nullable com.vaadin.flow.component.icon.Icon icon)
      Description copied from interface: GroupColumn
      Sets the icon for the Columns Grouper button.
      Specified by:
      setGroupIcon in interface GroupColumn<E>
      Parameters:
      icon - the icon to set, or null to set the default icon
    • isGroupIconVisible

      public boolean isGroupIconVisible()
      Specified by:
      isGroupIconVisible in interface GroupColumn<E>
      Returns:
      true if the icon for the Columns Grouper button is visible
    • setGroupIconVisible

      public void setGroupIconVisible(boolean visible)
      Description copied from interface: GroupColumn
      Sets whether the icon for the Columns Grouper button is visible.

      The default value is true.

      Specified by:
      setGroupIconVisible in interface GroupColumn<E>
      Parameters:
      visible - visible option
    • setHeader

      public Grid.Column<E> setHeader(String labelText)
      Description copied from class: Grid.Column
      Sets a header text to the column.

      If there are no header rows when calling this method, the first header row will be created. If there are header rows, the header will be set on the first created header row and it will override any existing header.

      Overrides:
      setHeader in class DataGridColumn<E>
      Parameters:
      labelText - the text to be shown at the column header
      Returns:
      this column, for method chaining
    • setHeader

      public Grid.Column<E> setHeader(@Nullable com.vaadin.flow.component.Component headerComponent)
      Description copied from class: Grid.Column
      Sets a header component to the column.

      If there are no header rows when calling this method, the first header row will be created. If there are header rows, the header will be set on the first created header row and it will override any existing header.

      Overrides:
      setHeader in class DataGridColumn<E>
      Parameters:
      headerComponent - the component to be used in the header of the column
      Returns:
      this column, for method chaining
    • setFilterable

      public void setFilterable(boolean filterable)
      Description copied from class: DataGridColumn
      Sets the filtering for a column. If the filtering is enabled, a filter button will be added to the column header. The filtering is disabled by default.
      Overrides:
      setFilterable in class DataGridColumn<E>
      Parameters:
      filterable - whether to add a filter to the header
    • getGroupCellValueFormatter

      @Nullable public GroupCellValueFormatter<E> getGroupCellValueFormatter()
      Specified by:
      getGroupCellValueFormatter in interface GroupColumn<E>
      Returns:
      a formatter for group cell values or null if no formatter is set.
    • setGroupCellValueFormatter

      public void setGroupCellValueFormatter(@Nullable GroupCellValueFormatter<E> groupCellValueFormatter)
      Description copied from interface: GroupColumn
      Sets a formatter for group cell values.
      Specified by:
      setGroupCellValueFormatter in interface GroupColumn<E>
      Parameters:
      groupCellValueFormatter - a formatter to set, or null to remove the formatter
    • refreshHeader

      public void refreshHeader()
      Refreshes the GroupDataGridHeaderGrouper in the column.
    • getRenderer

      public com.vaadin.flow.data.renderer.Renderer<E> getRenderer()
      Description copied from class: Grid.Column
      Get the renderer used for this column.

      Note: Mutating the renderer after the Grid has been rendered on the client will not change the column, and can lead to undefined behavior.

      Overrides:
      getRenderer in class Grid.Column<E>
      Returns:
      the renderer used for this column, should never be null
    • setRenderer

      public Grid.Column<E> setRenderer(com.vaadin.flow.data.renderer.Renderer<E> renderer)
      Description copied from class: Grid.Column
      Set the renderer for this column.
      Overrides:
      setRenderer in class Grid.Column<E>
      Parameters:
      renderer - the new renderer to be used for this column, must not be null
    • isHeaderGrouperAdded

      protected boolean isHeaderGrouperAdded()
    • isHeaderRowAppended

      protected boolean isHeaderRowAppended()
    • updateHeaderGrouper

      protected void updateHeaderGrouper()
    • createHeaderGrouper

      protected GroupDataGridHeaderGrouper createHeaderGrouper()
    • attachRenderer

      protected void attachRenderer(com.vaadin.flow.data.renderer.Renderer<E> renderer)
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • getHeaderText

      public String getHeaderText()
      Returns the header text of the column.
      Returns:
      the header text
    • setHeaderText

      protected void setHeaderText(String text)
    • getFooterText

      public String getFooterText()
      Returns the footer text of the column.
      Returns:
      the footer text
    • setFooterText

      protected void setFooterText(String text)
    • getHeaderComponent

      public com.vaadin.flow.component.Component getHeaderComponent()
      Returns the header component of the column.
      Returns:
      the header component
    • setHeaderComponent

      protected void setHeaderComponent(com.vaadin.flow.component.Component component)
    • getFooterComponent

      public com.vaadin.flow.component.Component getFooterComponent()
      Returns the footer component of the column.
      Returns:
      the footer component
    • setFooterComponent

      protected void setFooterComponent(com.vaadin.flow.component.Component component)
    • moveHeaderContent

      protected void moveHeaderContent(io.jmix.groupgridflowui.kit.vaadin.grid.AbstractColumn<?> otherColumn)
      Moves the current header content, either a text or a component, to a different column or column group. Also clears the content of this column.
      Parameters:
      otherColumn - the column or group to move the content to
    • moveFooterContent

      protected void moveFooterContent(io.jmix.groupgridflowui.kit.vaadin.grid.AbstractColumn<?> otherColumn)
      Moves the current footer content, either a text or a component, to a different column or column group. Also clears the content of this column.
      Parameters:
      otherColumn - the column or group to move the content to
    • updateSortingIndicators

      protected void updateSortingIndicators(boolean sortable)
      Updates this component to either have sorting indicators according to the sortable state of the underlying column, or removes the sorting indicators.
      Parameters:
      sortable - true to have sorting indicators if the column is sortable, false to not have sorting indicators
    • setSortingIndicators

      protected void setSortingIndicators(boolean sortingIndicators)
      Sets this component to show sorting indicators or not.
      Parameters:
      sortingIndicators - true to show sorting indicators, false to remove them
    • hasSortingIndicators

      protected boolean hasSortingIndicators()
    • getBottomChildColumns

      protected List<Grid.Column<?>> getBottomChildColumns()
      Gets recursively the child components of this component that are instances of Column.
      Returns:
      the Column children of this component
    • setResizable

      default Grid.Column<E> setResizable(boolean resizable)
      When set to true, the column is user-resizable. By default this is set to false.
      Parameters:
      resizable - whether to allow user resizing of this column
      Returns:
      this column, for method chaining
    • isResizable

      @Synchronize("resizable-changed") default boolean isResizable()
      Gets whether this column is user-resizable.
      Returns:
      whether this column is user-resizable
    • setFrozen

      default Grid.Column<E> setFrozen(boolean frozen)
      Sets this column's frozen state.

      Note: Columns are frozen in-place, freeze columns from left to right for a consistent outcome.

      Parameters:
      frozen - whether to freeze or unfreeze this column
      Returns:
      this column, for method chaining
    • isFrozen

      @Synchronize("frozen-changed") default boolean isFrozen()
      Gets the this column's frozen state.
      Returns:
      whether this column is frozen
    • setFrozenToEnd

      default Grid.Column<E> setFrozenToEnd(boolean frozenToEnd)
      Sets this column's frozen state.

      Note: Columns are frozen in-place, freeze columns from right to left for a consistent outcome.

      Parameters:
      frozenToEnd - whether to freeze or unfreeze this column
      Returns:
      this column, for method chaining
      Since:
      23.1
    • isFrozenToEnd

      @Synchronize("frozen-to-end-changed") default boolean isFrozenToEnd()
      Gets the this column's frozen state.
      Returns:
      whether this column is frozen to end
      Since:
      23.1
    • setTextAlign

      default Grid.Column<E> setTextAlign(ColumnTextAlign textAlign)
      Sets the column text align.
      Parameters:
      textAlign - the text alignment of the column. Setting it to null resets the alignment to the default value ColumnTextAlign.START.
      Returns:
      this column, for method chaining
    • getTextAlign

      @Synchronize("text-align-changed") default ColumnTextAlign getTextAlign()
      Gets the column text align. The default is ColumnTextAlign.START.
      Returns:
      the column text align, not null
    • setHeaderPartName

      default Grid.Column<E> setHeaderPartName(String headerPartName)
      Sets a custom part name for the header cell.
      Parameters:
      headerPartName - the part name to set
      Returns:
      this column, for method chaining
    • getHeaderPartName

      default String getHeaderPartName()
      Gets the custom part name of the header cell.
      Returns:
      the part name
    • setFooterPartName

      default Grid.Column<E> setFooterPartName(String footerPartName)
      Sets a custom part name for the footer cell.
      Parameters:
      footerPartName - the part name to set
      Returns:
      this column, for method chaining
    • getFooterPartName

      default String getFooterPartName()
      Gets the custom part name of the footer cell.
      Returns:
      the part name