Package io.jmix.flowui.component.grid
Class DataGrid<E>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.grid.Grid<T>
io.jmix.flowui.kit.component.grid.JmixGrid<E>
io.jmix.flowui.component.grid.DataGrid<E>
- 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>
,ListDataComponent<E>
,LookupComponent<E>
,LookupComponent.MultiSelectLookupComponent<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 DataGrid<E>
extends JmixGrid<E>
implements ListDataComponent<E>, LookupComponent.MultiSelectLookupComponent<E>, EnhancedDataGrid<E>, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
- 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 extends Object>, com.vaadin.flow.component.grid.Grid.Column<T extends Object>, com.vaadin.flow.component.grid.Grid.DataCommunicatorBuilder<T extends Object,
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.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.flowui.component.grid.EnhancedDataGrid
EnhancedDataGrid.AggregationPosition
Nested 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.LookupComponent
LookupComponent.MultiSelectLookupComponent<T>
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected boolean
protected GridDelegate<E,
DataGridItems<E>> Fields inherited from class io.jmix.flowui.kit.component.grid.JmixGrid
actionsSupport
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAggregation
(com.vaadin.flow.component.grid.Grid.Column<E> column, AggregationInfo info) Add an aggregation info in order to perform aggregation for column.com.vaadin.flow.component.grid.Grid.Column<E>
com.vaadin.flow.component.grid.Grid.Column<E>
com.vaadin.flow.component.grid.Grid.Column<E>
addColumn
(MetaPropertyPath metaPropertyPath) Adds column by the meta property path.com.vaadin.flow.component.grid.Grid.Column<E>
addColumn
(String key, MetaPropertyPath metaPropertyPath) Adds column by the meta property path and specified key.com.vaadin.flow.shared.Registration
addSelectionListener
(com.vaadin.flow.data.selection.SelectionListener<com.vaadin.flow.component.grid.Grid<E>, E> listener) void
protected GridActionsSupport<JmixGrid<E>,
E> protected GridDelegate<E,
DataGridItems<E>> protected DataGridEditor<E>
void
void
Deselects all selected rows.void
Gets an unmodifiable list of all currently addedGrid.Column
s.com.vaadin.flow.component.grid.Grid.Column<E>
getColumnByKey
(String columnKey) getColumnMetaPropertyPath
(com.vaadin.flow.component.grid.Grid.Column<E> column) 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.getItems()
Returns a set of items corresponding to the selected rows of this component.Returns an item corresponding to the selected row of this component.protected void
boolean
boolean
boolean
protected void
protected void
void
removeColumn
(com.vaadin.flow.component.grid.Grid.Column<E> column) void
Selects a row of this component for a given item.void
select
(Collection<E> items) Selects the rows of this component for a given collection of items.void
setAggregatable
(boolean aggregatable) Set to true if aggregation should be enabled.void
setAggregationPosition
(EnhancedDataGrid.AggregationPosition aggregationPosition) Sets aggregation row position.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setColumnPosition
(com.vaadin.flow.component.grid.Grid.Column<E> column, int index) Moves column to the provided position in theDataGrid
.com.vaadin.flow.component.grid.dataview.GridDataView<E>
void
setMultiSelect
(boolean multiSelect) com.vaadin.flow.component.grid.GridSelectionModel<E>
setSelectionMode
(com.vaadin.flow.component.grid.Grid.SelectionMode selectionMode) Methods inherited from class io.jmix.flowui.kit.component.grid.JmixGrid
addAction, addAction, getAction, getActions, getActionsSupport, getSubPart, removeAction
Methods inherited from class com.vaadin.flow.component.grid.Grid
addCellFocusListener, addColumn, addColumn, addColumn, addColumn, addColumn, addColumnReorderListener, addColumnResizeListener, addColumns, addComponentColumn, addContextMenu, addDataGenerator, addDragEndListener, addDragStartListener, addDropListener, addFirstHeaderRow, addItemClickListener, addItemDoubleClickListener, addSortListener, addThemeVariants, addValueProvider, appendFooterRow, appendHeaderRow, asMultiSelect, asSingleSelect, compareMaybeComparables, configureBeanType, createColumn, createColumnId, createDefaultArrayUpdater, createSortingComparator, getArrayUpdater, getBeanType, getClassNameGenerator, getColumnLayers, getColumnRendering, getDataCommunicator, getDataProvider, getDefaultColumnFactory, getDefaultHeaderRow, getDragFilter, getDropFilter, getDropMode, getFooterRows, getGenericDataView, getHeaderRows, getLazyDataView, getListDataView, getNestedNullBehavior, getPageSize, getPartNameGenerator, getPropertySet, getSelectionModel, getSortOrder, getUniqueKeyProperty, getUniqueKeyProvider, initConnector, insertColumnLayer, isAllRowsVisible, isColumnReorderingAllowed, isDetailsVisible, isDetailsVisibleOnClick, isMultiSort, isRowsDraggable, onAttach, onDetach, onEnabledStateChanged, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeColumnByKey, removeColumnLayer, removeColumns, removeThemeVariants, scrollToEnd, scrollToIndex, scrollToStart, setAllRowsVisible, setClassNameGenerator, setColumnKey, setColumnOrder, setColumnOrder, setColumnRendering, setColumnReorderingAllowed, setColumns, setDataProvider, setDefaultMultiSortPriority, setDetailsVisible, setDetailsVisibleOnClick, setDragDataGenerator, setDragFilter, setDropFilter, setDropMode, setItemDetailsRenderer, setItems, setItems, setItems, setMultiSort, setMultiSort, setMultiSort, setMultiSort, setNestedNullBehavior, setPageSize, setPartNameGenerator, setRowsDraggable, setSelectionDragDetails, setSelectionModel, setSortableColumns, setTooltipGenerator, 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 io.jmix.flowui.kit.component.HasActions
removeAction, removeAllActions
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
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
gridDelegate
-
editorCreated
protected boolean editorCreated
-
-
Constructor Details
-
DataGrid
public DataGrid()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
initComponent
protected void initComponent() -
createDelegate
-
setItems
-
getSingleSelectedItem
Description copied from interface:ListDataComponent
Returns 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:
getSingleSelectedItem
in interfaceListDataComponent<E>
- Returns:
- an item corresponding to the selected row of this component
-
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 aCollections.emptySet()
.- Specified by:
getSelectedItems
in interfaceListDataComponent<E>
- Specified by:
getSelectedItems
in interfaceLookupComponent<E>
- Overrides:
getSelectedItems
in classcom.vaadin.flow.component.grid.Grid<E>
- Returns:
- a set of item instances corresponding to the selected rows of
this component, never
null
-
select
Description copied from interface:ListDataComponent
Selects a row of this component for a given item.- Specified by:
select
in interfaceListDataComponent<E>
- Overrides:
select
in classcom.vaadin.flow.component.grid.Grid<E>
- Parameters:
item
- item instance to select the row
-
select
Description copied from interface:ListDataComponent
Selects the rows of this component for a given collection of items.- Specified by:
select
in interfaceListDataComponent<E>
- Parameters:
items
- collection of items to select rows
-
deselect
- Specified by:
deselect
in interfaceListDataComponent<E>
- Overrides:
deselect
in classcom.vaadin.flow.component.grid.Grid<E>
-
deselectAll
public void deselectAll()Description copied from interface:ListDataComponent
Deselects all selected rows.- Specified by:
deselectAll
in interfaceListDataComponent<E>
- Overrides:
deselectAll
in classcom.vaadin.flow.component.grid.Grid<E>
-
getItems
- Specified by:
getItems
in interfaceListDataComponent<E>
- Returns:
- a data unit that holds component items
-
isMultiSelect
public boolean isMultiSelect()- Specified by:
isMultiSelect
in interfaceListDataComponent<E>
- Returns:
true
if multiple selection mode is enabled
-
addSelectionListener
public com.vaadin.flow.shared.Registration addSelectionListener(com.vaadin.flow.data.selection.SelectionListener<com.vaadin.flow.component.grid.Grid<E>, E> listener) - Specified by:
addSelectionListener
in interfaceSelectionChangeNotifier<com.vaadin.flow.component.grid.Grid<E>,
E> - Overrides:
addSelectionListener
in classcom.vaadin.flow.component.grid.Grid<E>
-
enableMultiSelect
public void enableMultiSelect()- Specified by:
enableMultiSelect
in interfaceLookupComponent.MultiSelectLookupComponent<E>
-
setMultiSelect
public void setMultiSelect(boolean multiSelect) - Specified by:
setMultiSelect
in interfaceLookupComponent.MultiSelectLookupComponent<E>
-
setSelectionMode
public com.vaadin.flow.component.grid.GridSelectionModel<E> setSelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode selectionMode) - Overrides:
setSelectionMode
in classcom.vaadin.flow.component.grid.Grid<E>
-
getColumnMetaPropertyPath
@Nullable public MetaPropertyPath getColumnMetaPropertyPath(com.vaadin.flow.component.grid.Grid.Column<E> column) - Specified by:
getColumnMetaPropertyPath
in interfaceEnhancedDataGrid<E>
-
addColumn
Adds column by the meta property path.- Specified by:
addColumn
in interfaceEnhancedDataGrid<E>
- Parameters:
metaPropertyPath
- meta property path to add column- Returns:
- added column
-
addColumn
public com.vaadin.flow.component.grid.Grid.Column<E> addColumn(String key, MetaPropertyPath metaPropertyPath) Adds column by the meta property path and specified key. The key is used to identify the column, seegetColumnByKey(String)
.- Specified by:
addColumn
in interfaceEnhancedDataGrid<E>
- Parameters:
key
- column keymetaPropertyPath
- meta property path to add column- Returns:
- added column
-
addColumn
public com.vaadin.flow.component.grid.Grid.Column<E> addColumn(com.vaadin.flow.function.ValueProvider<E, ?> valueProvider) - Overrides:
addColumn
in classcom.vaadin.flow.component.grid.Grid<E>
-
addColumn
public com.vaadin.flow.component.grid.Grid.Column<E> addColumn(com.vaadin.flow.data.renderer.Renderer<E> renderer) - Overrides:
addColumn
in classcom.vaadin.flow.component.grid.Grid<E>
-
isAggregatable
public boolean isAggregatable()- Specified by:
isAggregatable
in interfaceEnhancedDataGrid<E>
- Returns:
- true if DataGrid is aggregatable
-
setAggregatable
public void setAggregatable(boolean aggregatable) Description copied from interface:EnhancedDataGrid
Set to true if aggregation should be enabled. Default value is false.- Specified by:
setAggregatable
in interfaceEnhancedDataGrid<E>
- Parameters:
aggregatable
- whether to aggregate DataGrid columns
-
getAggregationPosition
- Specified by:
getAggregationPosition
in interfaceEnhancedDataGrid<E>
- Returns:
- return aggregation row position
-
setAggregationPosition
Description copied from interface:EnhancedDataGrid
Sets aggregation row position. Default value isEnhancedDataGrid.AggregationPosition.BOTTOM
.- Specified by:
setAggregationPosition
in interfaceEnhancedDataGrid<E>
- Parameters:
aggregationPosition
- position:EnhancedDataGrid.AggregationPosition.TOP
orEnhancedDataGrid.AggregationPosition.BOTTOM
-
addAggregation
public void addAggregation(com.vaadin.flow.component.grid.Grid.Column<E> column, AggregationInfo info) Description copied from interface:EnhancedDataGrid
Add an aggregation info in order to perform aggregation for column.- Specified by:
addAggregation
in interfaceEnhancedDataGrid<E>
- Parameters:
column
- column for aggregationinfo
- aggregation info- See Also:
-
getAggregationResults
- Specified by:
getAggregationResults
in interfaceEnhancedDataGrid<E>
- Returns:
- aggregated values for columns
-
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.- Overrides:
getColumns
in classcom.vaadin.flow.component.grid.Grid<E>
- Returns:
- an unmodifiable list of
Grid.Column
s that are not hidden by security
-
getAllColumns
Gets an unmodifiable list of all currently addedGrid.Column
s.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.- Returns:
- a copy of all currently added
Grid.Column
s including hidden by security
-
getColumnByKey
- Overrides:
getColumnByKey
in classcom.vaadin.flow.component.grid.Grid<E>
-
removeColumn
- Overrides:
removeColumn
in classcom.vaadin.flow.component.grid.Grid<E>
-
setColumnPosition
Moves column to the provided position in theDataGrid
.- Parameters:
column
- column to moveindex
- new index of column ingetAllColumns()
list
-
isEditorCreated
public boolean isEditorCreated()- Specified by:
isEditorCreated
in interfaceEnhancedDataGrid<E>
-
onDataProviderChange
protected void onDataProviderChange()- Overrides:
onDataProviderChange
in classcom.vaadin.flow.component.grid.Grid<E>
-
getEditor
- Overrides:
getEditor
in classcom.vaadin.flow.component.grid.Grid<E>
-
createEditor
- Overrides:
createEditor
in classcom.vaadin.flow.component.grid.Grid<E>
-
createActionsSupport
- Overrides:
createActionsSupport
in classJmixGrid<E>
-
onAfterApplyColumnSecurity
-