Class DataGridColumn<E>
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
GroupDataGridColumn
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classThe data generator that wraps another one to manage generation data for group items. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected GroupDataGridHeaderFilterprotected final Grid<?>protected booleanprotected com.vaadin.flow.component.Componentprotected String -
Constructor Summary
ConstructorsConstructorDescriptionDataGridColumn(GroupDataGrid<E> grid, String columnId, com.vaadin.flow.data.renderer.Renderer<E> renderer) Constructs a new DataGridColumn for use inside aGroupDataGrid. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.function.SerializableComparator<E>protected com.vaadin.flow.function.SerializableFunction<E,? extends com.vaadin.flow.component.Component> protected SortOrderProvidercom.vaadin.flow.shared.RegistrationaddColumnVisibilityChangedListener(com.vaadin.flow.component.ComponentEventListener<GroupDataGridColumnVisibilityChangedEvent<E>> listener) Add listener for event of column visibility changeprotected com.vaadin.flow.shared.RegistrationaddDataGenerator(com.vaadin.flow.data.provider.DataGenerator<E> dataGenerator) protected List<Grid.Column<?>>Gets recursively the child components of this component that are instances of Column.com.vaadin.flow.component.ComponentReturns the footer component of the column.default StringGets the custom part name of the footer cell.Returns the footer text of the column.getGrid()Gets the owner of this column.com.vaadin.flow.component.ComponentReturns the header component of the column.default StringGets the custom part name of the header cell.Returns the header text of the column.protected StringGets the function that is used for generating CSS part names for cells in this column.protected com.vaadin.flow.component.ComponentReturns a header component that was directly set to the column.protected StringReturns a header text that was directly set to the column.default ColumnTextAlignGets the column text align.protected GroupDataGrid<E>protected booleanbooleandefault booleanisFrozen()Gets the this column's frozen state.default booleanGets the this column's frozen state.booleandefault booleanGets whether this column is user-resizable.protected voidmoveFooterContent(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.protected voidmoveHeaderContent(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.protected StringonPartNameGenerator(E item) protected StringonTooltipGenerator(E item) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) setClassNameGenerator(com.vaadin.flow.function.SerializableFunction<E, String> classNameGenerator) Sets the function that is used for generating CSS class names for cells in this column.voidsetFilterable(boolean filterable) Sets the filtering for a column.protected voidsetFooterComponent(com.vaadin.flow.component.Component component) default Grid.Column<E>setFooterPartName(String footerPartName) Sets a custom part name for the footer cell.protected voidsetFooterText(String text) default Grid.Column<E>setFrozen(boolean frozen) Sets this column's frozen state.default Grid.Column<E>setFrozenToEnd(boolean frozenToEnd) Sets this column's frozen state.voidsetGroupAllowed(boolean groupAllowed) Sets whether the column can be used in grouping.setGroupPartNameGenerator(com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupPartNameGenerator) Sets the part name generator for group item cell.setGroupTooltipGenerator(com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupTooltipGenerator) Sets the tooltip generator for group item cell.setHeader(com.vaadin.flow.component.Component headerComponent) Sets a header component to the column.Sets a header text to the column.protected voidsetHeaderComponent(com.vaadin.flow.component.Component component) default Grid.Column<E>setHeaderPartName(String headerPartName) Sets a custom part name for the header cell.protected voidsetHeaderText(String text) setPartNameGenerator(com.vaadin.flow.function.SerializableFunction<E, String> partNameGenerator) Sets the function that is used for generating CSS part names for cells in this column.default Grid.Column<E>setResizable(boolean resizable) When set totrue, the column is user-resizable.protected voidsetSortingIndicators(boolean sortingIndicators) Sets this component to show sorting indicators or not.default Grid.Column<E>setTextAlign(ColumnTextAlign textAlign) Sets the column text align.setTooltipGenerator(com.vaadin.flow.function.SerializableFunction<E, String> tooltipGenerator) Sets the tooltip generator for this column.voidsetVisible(boolean visible) protected voidupdateSortingIndicators(boolean sortable) Updates this component to either have sorting indicators according to the sortable state of the underlying column, or removes the sorting indicators.Methods inherited from class io.jmix.groupgridflowui.kit.vaadin.grid.Grid.Column
destroyDataGenerators, getBottomLevelColumn, getClassNameGenerator, getComparator, getEditorComponent, getElement, getFlexGrow, getKey, getRenderer, getSortOrder, getWidth, isAutoWidth, isRowHeader, isSortable, setAutoWidth, setComparator, setComparator, setEditorComponent, setEditorComponent, setFlexGrow, setFooter, setFooter, setKey, setRenderer, setRowHeader, setSortable, setSortOrderProvider, setSortProperty, setWidthMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setIdMethods 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.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
dataGridFilter
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
partNameGenerator
-
groupPartNameGenerator
-
tooltipGenerator
-
groupTooltipGenerator
-
storedHeaderText
-
storedHeaderComponent
protected com.vaadin.flow.component.Component storedHeaderComponent -
isGroupAllowed
protected boolean isGroupAllowed -
grid
-
-
Constructor Details
-
DataGridColumn
public DataGridColumn(GroupDataGrid<E> grid, String columnId, com.vaadin.flow.data.renderer.Renderer<E> renderer) Constructs a new DataGridColumn for use inside aGroupDataGrid.- Parameters:
grid- the grid this column is attached tocolumnId- unique identifier of this columnrenderer- the renderer to use in this column, must not benull
-
-
Method Details
-
getGrid
Gets the owner of this column.- Returns:
- the grid which owns this column
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
setClassNameGenerator
public Grid.Column<E> setClassNameGenerator(com.vaadin.flow.function.SerializableFunction<E, String> classNameGenerator) Description copied from class:Grid.ColumnSets the function that is used for generating CSS class names for cells in this column. Returningnullfrom the generator results in no custom class name being set. Multiple class names can be returned from the generator as space-separated.If
Grid.setClassNameGenerator(SerializableFunction)is used together with this method, resulting class names from both methods will be effective. Class names generated by grid are applied to the cells before the class names generated by column. This means that if the classes contain conflicting style properties, column's classes will win.- Overrides:
setClassNameGeneratorin classGrid.Column<E>- Parameters:
classNameGenerator- the class name generator to set, notnull- Returns:
- this column
- See Also:
-
setFilterable
public void setFilterable(boolean filterable) 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.- Parameters:
filterable- whether to add a filter to the header
-
isFilterable
public boolean isFilterable()- Returns:
trueif the filter is added to the column header,falseotherwise
-
isGroupAllowed
public boolean isGroupAllowed()- Returns:
trueif the column can be used in grouping
-
setGroupAllowed
public void setGroupAllowed(boolean groupAllowed) Sets whether the column can be used in grouping.This method enables/disables grouping by this column in UI. The column can still be grouped programmatically using
GroupDataGrid.groupByColumns(Grid.Column[])and other methods.The default value is
true.}- Parameters:
groupAllowed- whether the column can be used in grouping
-
setHeader
Description copied from class:Grid.ColumnSets 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:
setHeaderin classGrid.Column<E>- Parameters:
labelText- the text to be shown at the column header- Returns:
- this column, for method chaining
-
setHeader
Description copied from class:Grid.ColumnSets 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:
setHeaderin classGrid.Column<E>- Parameters:
headerComponent- the component to be used in the header of the column- Returns:
- this column, for method chaining
-
getPartNameGenerator
Description copied from class:Grid.ColumnGets the function that is used for generating CSS part names for cells in this column.- Overrides:
getPartNameGeneratorin classGrid.Column<E>- Returns:
- the part name generator
-
setPartNameGenerator
public Grid.Column<E> setPartNameGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<E, String> partNameGenerator) Description copied from class:Grid.ColumnSets the function that is used for generating CSS part names for cells in this column. Returningnullfrom the generator results in no custom part name being set. Multiple part names can be returned from the generator as space-separated.If
Grid.setPartNameGenerator(SerializableFunction)is used together with this method, resulting part names from both methods will be effective.- Overrides:
setPartNameGeneratorin classGrid.Column<E>- Parameters:
partNameGenerator- the part name generator to set, notnull- Returns:
- this column
- See Also:
-
getGroupPartNameGenerator
@Nullable public com.vaadin.flow.function.SerializableFunction<GroupInfo,String> getGroupPartNameGenerator()- Returns:
- group part name generator or
nullif not set
-
setGroupPartNameGenerator
public DataGridColumn<E> setGroupPartNameGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupPartNameGenerator) Sets the part name generator for group item cell.- Parameters:
groupPartNameGenerator- the generator to set- Returns:
- column instance
-
getTooltipGenerator
- Overrides:
getTooltipGeneratorin classGrid.Column<E>- Returns:
- the tooltip generator for this column or
nullif not set
-
setTooltipGenerator
public Grid.Column<E> setTooltipGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<E, String> tooltipGenerator) Sets the tooltip generator for this column.- Overrides:
setTooltipGeneratorin classGrid.Column<E>- Parameters:
tooltipGenerator- the tooltip generator to set- Returns:
- column instance
-
getGroupTooltipGenerator
@Nullable public com.vaadin.flow.function.SerializableFunction<GroupInfo,String> getGroupTooltipGenerator()- Returns:
- the tooltip generator for group item cell or
nullif not set
-
setGroupTooltipGenerator
public Grid.Column<E> setGroupTooltipGenerator(@Nullable com.vaadin.flow.function.SerializableFunction<GroupInfo, String> groupTooltipGenerator) Sets the tooltip generator for group item cell.- Parameters:
groupTooltipGenerator- the tooltip generator to set- Returns:
- column instance
-
setVisible
public void setVisible(boolean visible) Note that column related data is sent to the client side even if the column is invisible. Use
Grid.removeColumn(Column)to remove column (or don't add the column all) and avoid sending extra data.- See Also:
-
addColumnVisibilityChangedListener
public com.vaadin.flow.shared.Registration addColumnVisibilityChangedListener(com.vaadin.flow.component.ComponentEventListener<GroupDataGridColumnVisibilityChangedEvent<E>> listener) Add listener for event of column visibility change- Parameters:
listener- the listener to add- Returns:
- a registration handle to remove the listener
-
addDataGenerator
protected com.vaadin.flow.shared.Registration addDataGenerator(com.vaadin.flow.data.provider.DataGenerator<E> dataGenerator) - Overrides:
addDataGeneratorin classGrid.Column<E>
-
_getSortOrderProvider
- Overrides:
_getSortOrderProviderin classGrid.Column<E>
-
_getEditorComponentCallback
@Nullable protected com.vaadin.flow.function.SerializableFunction<E,? extends com.vaadin.flow.component.Component> _getEditorComponentCallback()- Overrides:
_getEditorComponentCallbackin classGrid.Column<E>
-
_getComparator
- Overrides:
_getComparatorin classGrid.Column<E>
-
getInternalId
- Overrides:
getInternalIdin classGrid.Column<E>
-
onPartNameGenerator
-
onTooltipGenerator
-
groupDataGrid
-
getStoredHeaderText
Returns a header text that was directly set to the column. When a grid contains few header rows, the header component/text is removed and a value must be got from the cell of the header row. In some cases of group data grid the stored header component/text is required to be returned.- Returns:
- the stored header text or
null
-
getStoredHeaderComponent
@Nullable protected com.vaadin.flow.component.Component getStoredHeaderComponent()Returns a header component that was directly set to the column. When a grid contains few header rows, the header component/text is removed and a value must be got from the cell of the header row. In some cases of group data grid the stored header component/text is required to be returned.- Returns:
- the stored component or
null
-
getHeaderText
Returns the header text of the column.- Returns:
- the header text
-
setHeaderText
-
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) -
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
-
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-trueto have sorting indicators if the column is sortable,falseto not have sorting indicators
-
setSortingIndicators
protected void setSortingIndicators(boolean sortingIndicators) Sets this component to show sorting indicators or not.- Parameters:
sortingIndicators-trueto show sorting indicators,falseto remove them
-
hasSortingIndicators
protected boolean hasSortingIndicators() -
getBottomChildColumns
Gets recursively the child components of this component that are instances of Column.- Returns:
- the Column children of this component
-
setResizable
When set totrue, the column is user-resizable. By default this is set tofalse.- 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
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
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
Sets the column text align.- Parameters:
textAlign- the text alignment of the column. Setting it tonullresets the alignment to the default valueColumnTextAlign.START.- Returns:
- this column, for method chaining
-
getTextAlign
Gets the column text align. The default isColumnTextAlign.START.- Returns:
- the column text align, not
null
-
setHeaderPartName
Sets a custom part name for the header cell.- Parameters:
headerPartName- the part name to set- Returns:
- this column, for method chaining
-
getHeaderPartName
Gets the custom part name of the header cell.- Returns:
- the part name
-