Class SelectionGrid<T>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.grid.Grid<T>
com.vaadin.componentfactory.selectiongrid.SelectionGrid<T>
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.grid.Grid<T>>, 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<T>,com.vaadin.flow.component.grid.GridSortOrder<T>>, com.vaadin.flow.data.provider.HasDataGenerators<T>, com.vaadin.flow.data.provider.HasDataView<T,Void,com.vaadin.flow.component.grid.dataview.GridDataView<T>>, com.vaadin.flow.data.provider.HasLazyDataView<T,Void,com.vaadin.flow.component.grid.dataview.GridLazyDataView<T>>, com.vaadin.flow.data.provider.HasListDataView<T,com.vaadin.flow.component.grid.dataview.GridListDataView<T>>, Serializable

@Tag("vaadin-selection-grid") @CssImport(value="./styles/grid.css", themeFor="vaadin-selection-grid") @JsModule("./src/vcf-selection-grid.js") @JsModule("./src/selection-grid.js") public class SelectionGrid<T> extends com.vaadin.flow.component.grid.Grid<T>
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.vaadin.flow.component.grid.Grid

    com.vaadin.flow.component.grid.Grid.AbstractGridExtension<T>, com.vaadin.flow.component.grid.Grid.Column<T>, com.vaadin.flow.component.grid.Grid.DataCommunicatorBuilder<T,U extends com.vaadin.flow.data.provider.ArrayUpdater>, com.vaadin.flow.component.grid.Grid.MultiSortPriority, com.vaadin.flow.component.grid.Grid.NestedNullBehavior, com.vaadin.flow.component.grid.Grid.SelectionMode, com.vaadin.flow.component.grid.Grid.SpringData, com.vaadin.flow.component.grid.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 com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    SelectionGrid(int pageSize)
     
    SelectionGrid(Class<T> beanType)
     
    SelectionGrid(Class<T> beanType, boolean autoCreateColumns)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds theme variants to the component.
    void
    focusOnCell(T item)
    Focus on the first cell on the row
    void
    focusOnCell(T item, com.vaadin.flow.component.grid.Grid.Column<T> column)
    Focus on the specific column on the row
    protected void
    Runs a JavaScript snippet to hide the multi selection / checkbox column on the client side.
    boolean
    Returns true if the multi selection column is visible, false otherwise.
    boolean
    Returns true if the checkbox selection is persistent, false otherwise.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
    Runs the super.onAttach and hides the multi selection column afterwards (if necessary).
    void
    Removes theme variants from the component.
    void
    scrollToIndex(int rowIndex)
     
    void
    setMultiSelectionColumnVisible(boolean multiSelectionColumnVisible)
    Sets the visibility of the multi selection column.
    void
    setPersistentCheckboxSelection(boolean persistentCheckboxSelection)
    Sets the checkbox selection to be persistent or not.
    protected void
    setSelectionModel(com.vaadin.flow.component.grid.GridSelectionModel<T> model, com.vaadin.flow.component.grid.Grid.SelectionMode selectionMode)
     

    Methods inherited from class com.vaadin.flow.component.grid.Grid

    addCellFocusListener, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumnReorderListener, addColumnResizeListener, addColumns, addComponentColumn, addContextMenu, addDataGenerator, addDragEndListener, addDragStartListener, addDropListener, addFirstHeaderRow, addItemClickListener, addItemDoubleClickListener, addSelectionListener, addSortListener, addThemeVariants, addValueProvider, appendFooterRow, appendHeaderRow, asMultiSelect, asSingleSelect, compareMaybeComparables, configureBeanType, createColumn, createColumnId, createDefaultArrayUpdater, createEditor, createSortingComparator, deselect, deselectAll, getAriaLabel, getArrayUpdater, getBeanType, getClassNameGenerator, getColumnByInternalId, getColumnByKey, getColumnLayers, getColumnRendering, getColumns, getDataCommunicator, getDataProvider, getDefaultColumnFactory, getDefaultHeaderRow, getDragFilter, getDropFilter, getDropMode, getEditor, getEmptyStateComponent, getEmptyStateText, getFooterRows, getGenericDataView, getHeaderRows, getLazyDataView, getListDataView, getNestedNullBehavior, getPageSize, getPartNameGenerator, getPropertySet, getSelectedItems, getSelectionMode, getSelectionModel, getSelectionPreservationMode, getSortOrder, getTooltipPosition, getUniqueKeyProperty, getUniqueKeyProvider, initConnector, insertColumnLayer, isAllRowsVisible, isColumnReorderingAllowed, isDetailsVisible, isDetailsVisibleOnClick, isMultiSort, isRowsDraggable, isTooltipMarkdownEnabled, onDataProviderChange, onDetach, onEnabledStateChanged, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeAllFooterRows, removeAllHeaderRows, removeColumn, removeColumnByKey, removeColumnLayer, removeColumns, removeFooterRow, removeHeaderRow, removeThemeVariants, scrollToEnd, scrollToItem, scrollToStart, select, setAllRowsVisible, setAriaLabel, setClassNameGenerator, setColumnKey, setColumnOrder, setColumnOrder, setColumnRendering, setColumnReorderingAllowed, setColumns, setDataProvider, setDefaultMultiSortPriority, setDetailsVisible, setDetailsVisibleOnClick, setDragDataGenerator, setDragFilter, setDropFilter, setDropMode, setEmptyStateComponent, setEmptyStateText, setItemDetailsRenderer, setItems, setItems, setItems, setItems, setItemSelectableProvider, setItemsPageable, setItemsPageable, setMultiSort, setMultiSort, setMultiSort, setMultiSort, setNestedNullBehavior, setPageSize, setPartNameGenerator, setRowsDraggable, setSelectionDragDetails, setSelectionMode, setSelectionPreservationMode, setSortableColumns, setTooltipGenerator, setTooltipMarkdownEnabled, setTooltipPosition, setUniqueKeyProperty, setUniqueKeyProvider, sort, updateSelectionModeOnClient

    Methods 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, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.data.provider.HasLazyDataView

    setItems, setItems

    Methods inherited from interface com.vaadin.flow.data.provider.HasListDataView

    setItems, setItems

    Methods 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, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasTheme

    addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
  • Constructor Details

    • SelectionGrid

      public SelectionGrid()
      See Also:
      • Grid()
    • SelectionGrid

      public SelectionGrid(int pageSize)
      Parameters:
      pageSize - - the page size. Must be greater than zero.
      See Also:
      • Grid(int)
    • SelectionGrid

      public SelectionGrid(Class<T> beanType, boolean autoCreateColumns)
      Parameters:
      beanType - - the bean type to use, not null
      autoCreateColumns - – when true, columns are created automatically for the properties of the beanType
      See Also:
      • Grid(Class, boolean)
    • SelectionGrid

      public SelectionGrid(Class<T> beanType)
      Parameters:
      beanType - - the bean type to use, not null
      See Also:
      • Grid(Class)
  • Method Details

    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Runs the super.onAttach and hides the multi selection column afterwards (if necessary).
      Overrides:
      onAttach in class com.vaadin.flow.component.grid.Grid<T>
      Parameters:
      attachEvent - event
    • scrollToIndex

      public void scrollToIndex(int rowIndex)
      Overrides:
      scrollToIndex in class com.vaadin.flow.component.grid.Grid<T>
    • focusOnCell

      public void focusOnCell(T item)
      Focus on the first cell on the row
      Parameters:
      item - item to scroll and focus
    • focusOnCell

      public void focusOnCell(T item, com.vaadin.flow.component.grid.Grid.Column<T> column)
      Focus on the specific column on the row
      Parameters:
      item - item to scroll and focus
      column - column to focus
    • setSelectionModel

      protected void setSelectionModel(com.vaadin.flow.component.grid.GridSelectionModel<T> model, com.vaadin.flow.component.grid.Grid.SelectionMode selectionMode)
      Overrides:
      setSelectionModel in class com.vaadin.flow.component.grid.Grid<T>
    • hideMultiSelectionColumn

      protected void hideMultiSelectionColumn()
      Runs a JavaScript snippet to hide the multi selection / checkbox column on the client side. The column is not removed, but set to "hidden" explicitly.
    • addThemeVariants

      public void addThemeVariants(SelectionGridVariant... variants)
      Adds theme variants to the component.
      Parameters:
      variants - theme variants to add
    • removeThemeVariants

      public void removeThemeVariants(SelectionGridVariant... variants)
      Removes theme variants from the component.
      Parameters:
      variants - theme variants to remove
    • isMultiSelectionColumnVisible

      public boolean isMultiSelectionColumnVisible()
      Returns true if the multi selection column is visible, false otherwise.
      Returns:
    • setMultiSelectionColumnVisible

      public void setMultiSelectionColumnVisible(boolean multiSelectionColumnVisible)
      Sets the visibility of the multi selection column.
      Parameters:
      multiSelectionColumnVisible - - true to show the multi selection column, false to hide it
    • isPersistentCheckboxSelection

      public boolean isPersistentCheckboxSelection()
      Returns true if the checkbox selection is persistent, false otherwise.
      Returns:
    • setPersistentCheckboxSelection

      public void setPersistentCheckboxSelection(boolean persistentCheckboxSelection)
      Sets the checkbox selection to be persistent or not.
      Parameters:
      persistentCheckboxSelection - - true to make the checkbox selection persistent, false otherwise