Class AbstractGridPro<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>> Serializable
- Direct Known Subclasses:
TreeGridPro
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent fired when the user starts to edit an existing item.static classServer-side component for the<vaadin-grid-edit-column>element.static classEvent fired when the user has edited an existing item.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
ConstructorsModifierConstructorDescriptionCreates a new instance, with page size of 50.AbstractGridPro(int pageSize) Creates a new instance, with the specified page size.AbstractGridPro(int pageSize, TreeGridPro.TreeDataCommunicatorBuilder<E> dataCommunicatorBuilder) Creates a new instance, with the specified page size and data communicator.AbstractGridPro(Class<E> beanType) Instantiates a new CrudGrid for the supplied bean type.protectedAbstractGridPro(Class<E> beanType, TreeGridPro.TreeDataCommunicatorBuilder<E> dataCommunicatorBuilder) Creates a new grid with an initial set of columns for each of the bean's properties.protectedAbstractGridPro(Class<E> beanType, TreeGridPro.TreeDataCommunicatorBuilder<E> dataCommunicatorBuilder, boolean autoCreateColumns) Creates a new grid with an initial set of columns for each of the bean's properties. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddCellEditStartedListener(com.vaadin.flow.component.ComponentEventListener<AbstractGridPro.CellEditStartedEvent<E>> listener) Registers a listener to be notified when the user starts to edit an existing item.addEditColumn(com.vaadin.flow.function.ValueProvider<E, ?> valueProvider) Adds a new edit column to thisGridProwith a value provider.addEditColumn(com.vaadin.flow.function.ValueProvider<E, ?> valueProvider, com.vaadin.flow.data.renderer.Renderer<E> renderer) Adds a new edit column to thisGridProwith a value provider and renderer which is used to display the content when the cell is not in the edit mode.<V extends Comparable<? super V>>
EditColumnConfigurer<E> addEditColumn(com.vaadin.flow.function.ValueProvider<E, V> valueProvider, String... sortingProperties) Adds a new edit column to thisGridProwith a value provider and sorting properties.addEditColumn(String propertyName) Adds a new edit column for the given property name.com.vaadin.flow.shared.RegistrationaddItemPropertyChangedListener(com.vaadin.flow.component.ComponentEventListener<AbstractGridPro.ItemPropertyChangedEvent<E>> listener) Registers a listener to be notified when the user has edited an existing item.voidaddThemeVariants(com.vaadin.flow.component.gridpro.GridProVariant... variants) Adds theme variants to the component.protected AbstractGridPro.EditColumn<E> createEditColumn(com.vaadin.flow.data.renderer.Renderer<E> renderer, String columnId) Creates a new edit column instance for thisGridProinstance.booleanGets the value of the webcomponent's property editOnClick.booleanGets the value of the webcomponent's property enterNextRow.booleanGets the value of the webcomponent's property singleCellEdit.voidonEnabledStateChanged(boolean enabled) voidremoveThemeVariants(com.vaadin.flow.component.gridpro.GridProVariant... variants) Removes theme variants from the component.voidsetEditOnClick(boolean editOnClick) Sets the value of the webcomponent's property editOnClick.voidsetEnterNextRow(boolean enterNextRow) Sets the value of the webcomponent's property enterNextRow.voidsetSingleCellEdit(boolean singleCellEdit) Sets the value of the webcomponent's property singleCellEdit.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, 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, onAttach, onDataProviderChange, onDetach, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeAllFooterRows, removeAllHeaderRows, removeColumn, removeColumnByKey, removeColumnLayer, removeColumns, removeFooterRow, removeHeaderRow, removeThemeVariants, scrollToEnd, scrollToIndex, scrollToItem, scrollToStart, select, setAllRowsVisible, setAriaLabel, 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, setSelectionModel, setSelectionPreservationMode, setSortableColumns, setTooltipGenerator, setTooltipMarkdownEnabled, setTooltipPosition, setUniqueKeyProperty, setUniqueKeyProvider, sort, updateSelectionModeOnClientMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.provider.HasLazyDataView
setItems, setItemsMethods inherited from interface com.vaadin.flow.data.provider.HasListDataView
setItems, setItemsMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Constructor Details
-
AbstractGridPro
Instantiates a new CrudGrid for the supplied bean type.- Parameters:
beanType- the beanType for the item
-
AbstractGridPro
public AbstractGridPro()Creates a new instance, with page size of 50. -
AbstractGridPro
public AbstractGridPro(int pageSize) Creates a new instance, with the specified page size.The page size influences the
Query.getLimit()sent by the client, but it's up to the webcomponent to determine the actual query limit, based on the height of the component and scroll position. Usually the limit is 3 times the page size (e.g. 150 items with a page size of 50).- Parameters:
pageSize- the page size. Must be greater than zero.
-
AbstractGridPro
public AbstractGridPro(int pageSize, TreeGridPro.TreeDataCommunicatorBuilder<E> dataCommunicatorBuilder) Creates a new instance, with the specified page size and data communicator.The page size influences the
Query.getLimit()sent by the client, but it's up to the webcomponent to determine the actual query limit, based on the height of the component and scroll position. Usually the limit is 3 times the page size (e.g. 150 items with a page size of 50).- Type Parameters:
U- the GridArrayUpdater typeB- the data communicator builder type- Parameters:
pageSize- the page size. Must be greater than zero.dataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.
-
AbstractGridPro
protected AbstractGridPro(Class<E> beanType, TreeGridPro.TreeDataCommunicatorBuilder<E> dataCommunicatorBuilder) Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers.You can add columns for nested properties of the bean with
Grid.addColumn(String).- Type Parameters:
U- the GridArrayUpdater typeB- the data communicator builder type- Parameters:
beanType- the bean type to use, notnulldataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.
-
AbstractGridPro
protected AbstractGridPro(Class<E> beanType, TreeGridPro.TreeDataCommunicatorBuilder<E> dataCommunicatorBuilder, boolean autoCreateColumns) Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers.When autoCreateColumns is
true, only the direct properties of the bean are included and they will be in alphabetical order. UseGrid.setColumns(String...)to define which properties to include and in which order. You can also add a column for an individual property withGrid.addColumn(String). Both of these methods support also sub-properties with dot-notation, eg."property.nestedProperty".- Type Parameters:
U- the GridArrayUpdater typeB- the data communicator builder type- Parameters:
beanType- the bean type to use, notnulldataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.autoCreateColumns- whentrue, columns are created automatically for the properties of the beanType
-
-
Method Details
-
onEnabledStateChanged
public void onEnabledStateChanged(boolean enabled) - Overrides:
onEnabledStateChangedin classcom.vaadin.flow.component.grid.Grid<E>
-
addEditColumn
public EditColumnConfigurer<E> addEditColumn(com.vaadin.flow.function.ValueProvider<E, ?> valueProvider) Adds a new edit column to thisGridProwith a value provider.- Parameters:
valueProvider- the value provider- Returns:
- an edit column configurer for configuring the column editor
- See Also:
-
addEditColumn
public EditColumnConfigurer<E> addEditColumn(com.vaadin.flow.function.ValueProvider<E, ?> valueProvider, com.vaadin.flow.data.renderer.Renderer<E> renderer) Adds a new edit column to thisGridProwith a value provider and renderer which is used to display the content when the cell is not in the edit mode.- Parameters:
valueProvider- the value providerrenderer- the renderer- Returns:
- an edit column configurer for configuring the column editor
- See Also:
-
addEditColumn
public <V extends Comparable<? super V>> EditColumnConfigurer<E> addEditColumn(com.vaadin.flow.function.ValueProvider<E, V> valueProvider, String... sortingProperties) Adds a new edit column to thisGridProwith a value provider and sorting properties.- Parameters:
valueProvider- the value providersortingProperties- the sorting properties to use for this column- Returns:
- an edit column configurer for configuring the column editor
- See Also:
-
addEditColumn
Adds a new edit column for the given property name.Note: This method can only be used for a Grid created from a bean type with
.invalid reference
#GridPro(Class)- Parameters:
propertyName- the property name of the new column, notnull- Returns:
- and edit column configurer for configuring the column editor
- See Also:
-
setEnterNextRow
public void setEnterNextRow(boolean enterNextRow) Sets the value of the webcomponent's property enterNextRow. Default values is false. When true, pressing Enter while in cell edit mode will move focus to the editable cell in the next row (Shift + Enter - same, but for previous row).- Parameters:
enterNextRow- whentrue, pressing Enter while in cell edit mode will move focus to the editable cell in the next row (Shift + Enter - same, but for previous row)
-
getEnterNextRow
@Synchronize("enter-next-row-changed") public boolean getEnterNextRow()Gets the value of the webcomponent's property enterNextRow. Default values is false. When true, pressing Enter while in cell edit mode will move focus to the editable cell in the next row (Shift + Enter - same, but for previous row).- Returns:
- enterNextRow value
-
setSingleCellEdit
public void setSingleCellEdit(boolean singleCellEdit) Sets the value of the webcomponent's property singleCellEdit. Default values is false. When true, after moving to next or previous editable cell using Tab / Shift+Tab, it will be focused without edit mode.- Parameters:
singleCellEdit- whentrue, after moving to next or previous editable cell using Tab / Shift+Tab, it will be focused without edit mode
-
getSingleCellEdit
@Synchronize("single-cell-edit-changed") public boolean getSingleCellEdit()Gets the value of the webcomponent's property singleCellEdit. Default values is false. When true, after moving to next or previous editable cell using Tab / Shift+Tab, it will be focused without edit mode.- Returns:
- singleCellEdit value
-
setEditOnClick
public void setEditOnClick(boolean editOnClick) Sets the value of the webcomponent's property editOnClick. Default values is false. When true, cell edit mode gets activated on a single click instead of the default double click.- Parameters:
editOnClick- whentrue, cell edit mode gets activated on a single click instead of the default double click
-
getEditOnClick
@Synchronize("edit-on-click-changed") public boolean getEditOnClick()Gets the value of the webcomponent's property editOnClick. Default values is false. When true, cell edit mode gets activated on a single click instead of the default double click.- Returns:
- editOnClick value
-
createEditColumn
protected AbstractGridPro.EditColumn<E> createEditColumn(com.vaadin.flow.data.renderer.Renderer<E> renderer, String columnId) Creates a new edit column instance for thisGridProinstance.This method must not return
null.- Parameters:
renderer- the renderer used to create the grid cell structurecolumnId- internal column id- Returns:
- edit column instance
- See Also:
-
addCellEditStartedListener
public com.vaadin.flow.shared.Registration addCellEditStartedListener(com.vaadin.flow.component.ComponentEventListener<AbstractGridPro.CellEditStartedEvent<E>> listener) Registers a listener to be notified when the user starts to edit an existing item.- Parameters:
listener- a listener to be notified- Returns:
- a handle that can be used to unregister the listener
-
addItemPropertyChangedListener
public com.vaadin.flow.shared.Registration addItemPropertyChangedListener(com.vaadin.flow.component.ComponentEventListener<AbstractGridPro.ItemPropertyChangedEvent<E>> listener) Registers a listener to be notified when the user has edited an existing item.- Parameters:
listener- a listener to be notified- Returns:
- a handle that can be used to unregister the listener
-
addThemeVariants
public void addThemeVariants(com.vaadin.flow.component.gridpro.GridProVariant... variants) Adds theme variants to the component.- Parameters:
variants- theme variants to add
-
removeThemeVariants
public void removeThemeVariants(com.vaadin.flow.component.gridpro.GridProVariant... variants) Removes theme variants from the component.- Parameters:
variants- theme variants to remove
-