Class AbstractDataGrid.ColumnImpl<E>
- All Implemented Interfaces:
Component.HasXmlDescriptor,DataGrid.Column<E>,Serializable
- Enclosing class:
- AbstractDataGrid<C extends com.vaadin.ui.Grid<E> & JmixEnhancedGrid<E>,
E>
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AggregationInfoprotected Stringprotected booleanprotected booleanprotected Stringprotected ContentModeprotected booleanprotected org.dom4j.Elementprotected intprotected booleanprotected Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> protected com.vaadin.ui.Grid.Column<E,?> protected final Stringprotected doubleprotected doubleprotected AbstractDataGrid<?,E> protected Functionprotected final MetaPropertyPathprotected AbstractDataGrid.AbstractRenderer<E,?> protected booleanprotected booleanprotected Stringprotected booleanprotected double -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedColumnImpl(String id, MetaPropertyPath propertyPath, AbstractDataGrid<?, E> owner) -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the expand ratio for this column.booleanintcom.vaadin.ui.Grid.Column<E,?> getId()doubleprotected MetaPropertydoublegetOwner()Returns the renderer instance used by this column.doublegetWidth()org.dom4j.ElementinthashCode()booleanbooleanReturns whether this column can be hidden by the user.booleanReturns whether the properties corresponding to this column should be editable when the item editor is active.protected booleanbooleanprotected booleanbooleanReturns whether this column can be resized by the user.booleanbooleanReturns whether the user can sort the grid by this column.booleanbooleanvoidSets an aggregation info in order to perform aggregation for this column.voidsetCaption(String caption) Sets the caption of the header.voidsetCollapsed(boolean collapsed) Hides or shows the column.voidsetCollapsible(boolean collapsible) Sets whether this column can be hidden by the user.voidsetCollapsingToggleCaption(String collapsingToggleCaption) Sets the caption of the hiding toggle for this column.voidsetDescriptionProvider(Function<? super E, String> descriptionProvider) Sets the description provider that is used for generating descriptions for cells in this column.voidsetDescriptionProvider(Function<? super E, String> descriptionProvider, ContentMode contentMode) Sets the description provider that is used for generating descriptions for cells in this column.voidsetEditable(boolean editable) Sets whether the properties corresponding to this column should be editable when the item editor is active.voidsetEditFieldGenerator(Function<DataGrid.EditorFieldGenerationContext<E>, Field<?>> generator) voidsetExpandRatio(int expandRatio) Sets the ratio with which the column expands.voidsetGenerated(boolean generated) voidsetGridColumn(com.vaadin.ui.Grid.Column<E, ?> gridColumn) voidsetMaximumWidth(double pixels) Sets the maximum width for this column.voidsetMinimumWidth(double pixels) Sets the minimum width for this column.voidvoidsetRenderer(DataGrid.Renderer renderer) Sets the renderer for this column.voidsetRenderer(DataGrid.Renderer renderer, Function presentationProvider) Sets the renderer for this column.voidsetResizable(boolean resizable) Sets whether this column can be resized by the user.voidsetSortable(boolean sortable) Sets whether this column is sortable by the user.voidsetStyleProvider(Function<? super E, String> styleProvider) Sets the style provider for the DataGrid column.protected voidvoidsetValueDescription(String valueDescription) Sets value description for aggregated row cells.voidsetVisible(boolean visible) Hides or shows the column according to security permissions.voidsetWidth(double width) Sets the width (in pixels).voidMarks the column width as auto.voidsetXmlDescriptor(org.dom4j.Element element) toString()voidprotected voidprotected voidvoidMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.jmix.ui.component.DataGrid.Column
setColumnGenerator
-
Field Details
-
id
-
propertyPath
-
caption
-
collapsingToggleCaption
-
width
protected double width -
minWidth
protected double minWidth -
maxWidth
protected double maxWidth -
expandRatio
protected int expandRatio -
collapsed
protected boolean collapsed -
visible
protected boolean visible -
collapsible
protected boolean collapsible -
sortable
protected boolean sortable -
resizable
protected boolean resizable -
editable
protected boolean editable -
generated
protected boolean generated -
aggregation
-
valueDescription
-
renderer
-
presentationProvider
-
styleProvider
-
descriptionProvider
-
descriptionContentMode
-
element
protected org.dom4j.Element element -
owner
-
gridColumn
-
generator
-
-
Constructor Details
-
ColumnImpl
protected ColumnImpl(String id, @Nullable MetaPropertyPath propertyPath, AbstractDataGrid<?, E> owner)
-
-
Method Details
-
setupDefaults
protected void setupDefaults() -
getId
- Specified by:
getIdin interfaceDataGrid.Column<E>- Returns:
- id of a column
-
getPropertyPath
- Specified by:
getPropertyPathin interfaceDataGrid.Column<E>- Returns:
- the instance of
MetaPropertyPathrepresenting a relative path to a property from certain MetaClass
-
getPropertyId
-
getCaption
- Specified by:
getCaptionin interfaceDataGrid.Column<E>- Returns:
- the caption of the header
-
setCaption
Description copied from interface:DataGrid.ColumnSets the caption of the header. This caption is also used as the hiding toggle caption, unless it is explicitly set viaDataGrid.Column.setCollapsingToggleCaption(String).- Specified by:
setCaptionin interfaceDataGrid.Column<E>- Parameters:
caption- the text to show in the caption
-
getCollapsingToggleCaption
- Specified by:
getCollapsingToggleCaptionin interfaceDataGrid.Column<E>- Returns:
- the caption for the hiding toggle for this column
-
setCollapsingToggleCaption
Description copied from interface:DataGrid.ColumnSets the caption of the hiding toggle for this column. Shown in the toggle for this column in the DataGrid's sidebar when the column ishidable.The default value is
null, and in that case the column'sheader captionis used. NOTE: setting this to empty string might cause the hiding toggle to not render correctly.- Specified by:
setCollapsingToggleCaptionin interfaceDataGrid.Column<E>- Parameters:
collapsingToggleCaption- the text to show in the column hiding toggle
-
getWidth
public double getWidth()- Specified by:
getWidthin interfaceDataGrid.Column<E>- Returns:
- the width in pixels of the column
-
setWidth
public void setWidth(double width) Description copied from interface:DataGrid.ColumnSets the width (in pixels).This overrides any configuration set by any of
DataGrid.Column.setExpandRatio(int),DataGrid.Column.setMinimumWidth(double)orDataGrid.Column.setMaximumWidth(double).- Specified by:
setWidthin interfaceDataGrid.Column<E>- Parameters:
width- the new pixel width of the column
-
isWidthAuto
public boolean isWidthAuto()- Specified by:
isWidthAutoin interfaceDataGrid.Column<E>- Returns:
- whether the width is auto
-
setWidthAuto
public void setWidthAuto()Description copied from interface:DataGrid.ColumnMarks the column width as auto. An auto width means the DataGrid is free to resize the column based on the cell contents and available space in the grid.- Specified by:
setWidthAutoin interfaceDataGrid.Column<E>
-
getExpandRatio
public int getExpandRatio()- Specified by:
getExpandRatioin interfaceDataGrid.Column<E>- Returns:
- the column's expand ratio
- See Also:
-
setExpandRatio
public void setExpandRatio(int expandRatio) Description copied from interface:DataGrid.ColumnSets the ratio with which the column expands.By default, all columns expand equally (treated as if all of them had an expand ratio of 1). Once at least one column gets a defined expand ratio, the implicit expand ratio is removed, and only the defined expand ratios are taken into account.
If a column has a defined width (
DataGrid.Column.setWidth(double)), it overrides this method's effects. Example: A DataGrid with three columns, with expand ratios 0, 1 and 2, respectively. The column with a ratio of 0 is exactly as wide as its contents requires. The column with a ratio of 1 is as wide as it needs, plus a third of any excess space, because we have 3 parts total, and this column reserves only one of those. The column with a ratio of 2, is as wide as it needs to be, plus two thirds of the excess width.- Specified by:
setExpandRatioin interfaceDataGrid.Column<E>- Parameters:
expandRatio- the expand ratio of this column.0to not have it expand at all. A negative number to clear the expand value.- See Also:
-
clearExpandRatio
public void clearExpandRatio()Description copied from interface:DataGrid.ColumnClears the expand ratio for this column.Equal to calling
setExpandRatio(-1)- Specified by:
clearExpandRatioin interfaceDataGrid.Column<E>
-
getMinimumWidth
public double getMinimumWidth()- Specified by:
getMinimumWidthin interfaceDataGrid.Column<E>- Returns:
- the minimum width for this column
- See Also:
-
setMinimumWidth
public void setMinimumWidth(double pixels) Description copied from interface:DataGrid.ColumnSets the minimum width for this column.This defines the minimum guaranteed pixel width of the column when it is set to expand.
- Specified by:
setMinimumWidthin interfaceDataGrid.Column<E>- Parameters:
pixels- the new minimum pixel width of the column- See Also:
-
getMaximumWidth
public double getMaximumWidth()- Specified by:
getMaximumWidthin interfaceDataGrid.Column<E>- Returns:
- the maximum width for this column
- See Also:
-
setMaximumWidth
public void setMaximumWidth(double pixels) Description copied from interface:DataGrid.ColumnSets the maximum width for this column.This defines the maximum allowed pixel width of the column when it is set to expand.
- Specified by:
setMaximumWidthin interfaceDataGrid.Column<E>- Parameters:
pixels- the new maximum pixel width of the column- See Also:
-
isVisible
public boolean isVisible()- Specified by:
isVisiblein interfaceDataGrid.Column<E>- Returns:
falseif the column is currently hidden by security permissions,trueotherwise
-
setVisible
public void setVisible(boolean visible) Description copied from interface:DataGrid.ColumnHides or shows the column according to security permissions. Invisible column doesn't send any data to client side.- Specified by:
setVisiblein interfaceDataGrid.Column<E>- Parameters:
visible-falseto hide the column,trueto show
-
isCollapsed
public boolean isCollapsed()- Specified by:
isCollapsedin interfaceDataGrid.Column<E>- Returns:
trueif the column is currently hidden,falseotherwise
-
setCollapsed
public void setCollapsed(boolean collapsed) Description copied from interface:DataGrid.ColumnHides or shows the column. By default columns are visible before explicitly hiding them.- Specified by:
setCollapsedin interfaceDataGrid.Column<E>- Parameters:
collapsed-trueto hide the column,falseto show
-
isCollapsible
public boolean isCollapsible()Description copied from interface:DataGrid.ColumnReturns whether this column can be hidden by the user. Default istrue. Note: the column can be programmatically hidden usingDataGrid.Column.setCollapsed(boolean)regardless of the returned value.- Specified by:
isCollapsiblein interfaceDataGrid.Column<E>- Returns:
trueif the user can hide the column,falseif not- See Also:
-
setCollapsible
public void setCollapsible(boolean collapsible) Description copied from interface:DataGrid.ColumnSets whether this column can be hidden by the user. Hidable columns can be hidden and shown via the sidebar menu.- Specified by:
setCollapsiblein interfaceDataGrid.Column<E>- Parameters:
collapsible-trueif the column may be hidden by the user via UI interaction- See Also:
-
updateCollapsible
public void updateCollapsible() -
isSortable
public boolean isSortable()Description copied from interface:DataGrid.ColumnReturns whether the user can sort the grid by this column.- Specified by:
isSortablein interfaceDataGrid.Column<E>- Returns:
trueif the column is sortable by the user,falseotherwise
-
setSortable
public void setSortable(boolean sortable) Description copied from interface:DataGrid.ColumnSets whether this column is sortable by the user. The DataGrid can be sorted by a sortable column by clicking or tapping the column's default header.- Specified by:
setSortablein interfaceDataGrid.Column<E>- Parameters:
sortable-trueif the user should be able to sort the column,falseotherwise- See Also:
-
updateSortable
public void updateSortable() -
isResizable
public boolean isResizable()Description copied from interface:DataGrid.ColumnReturns whether this column can be resized by the user. Default istrue. Note: the column can be programmatically resized usingDataGrid.Column.setWidth(double)andDataGrid.Column.setWidthAuto()regardless of the returned value.- Specified by:
isResizablein interfaceDataGrid.Column<E>- Returns:
trueif this column is resizable,falseotherwise
-
setResizable
public void setResizable(boolean resizable) Description copied from interface:DataGrid.ColumnSets whether this column can be resized by the user.- Specified by:
setResizablein interfaceDataGrid.Column<E>- Parameters:
resizable-trueif this column should be resizable,falseotherwise
-
getMetaProperty
-
getXmlDescriptor
@Nullable public org.dom4j.Element getXmlDescriptor()- Specified by:
getXmlDescriptorin interfaceComponent.HasXmlDescriptor
-
setXmlDescriptor
public void setXmlDescriptor(@Nullable org.dom4j.Element element) - Specified by:
setXmlDescriptorin interfaceComponent.HasXmlDescriptor
-
getRenderer
Description copied from interface:DataGrid.ColumnReturns the renderer instance used by this column.- Specified by:
getRendererin interfaceDataGrid.Column<E>- Returns:
- the renderer
-
setRenderer
Description copied from interface:DataGrid.ColumnSets the renderer for this column. If given renderer is null, then the default renderer will be used.- Specified by:
setRendererin interfaceDataGrid.Column<E>- Parameters:
renderer- the renderer to use- See Also:
-
setRenderer
public void setRenderer(@Nullable DataGrid.Renderer renderer, @Nullable Function presentationProvider) Description copied from interface:DataGrid.ColumnSets the renderer for this column. If given renderer is null, then the default renderer will be used.The presentation provider is a
Functionthat takes the value of this column on a single row, and converts that to a value that the renderer accepts.The presentation provider takes precedence over
formatter.- Specified by:
setRendererin interfaceDataGrid.Column<E>- Parameters:
renderer- the renderer to usepresentationProvider- the presentation provider to use- See Also:
-
updateRendererInternal
protected void updateRendererInternal() -
getPresentationProvider
- Specified by:
getPresentationProviderin interfaceDataGrid.Column<E>- Returns:
- a function to get presentations from the value of this column
-
isGenerated
public boolean isGenerated() -
setGenerated
public void setGenerated(boolean generated) -
isEditable
public boolean isEditable()Description copied from interface:DataGrid.ColumnReturns whether the properties corresponding to this column should be editable when the item editor is active.- Specified by:
isEditablein interfaceDataGrid.Column<E>- Returns:
trueif this column is editable,falseotherwise- See Also:
-
isShouldBeEditable
public boolean isShouldBeEditable() -
isRepresentsCollection
protected boolean isRepresentsCollection() -
isEditingPermitted
protected boolean isEditingPermitted() -
setEditable
public void setEditable(boolean editable) Description copied from interface:DataGrid.ColumnSets whether the properties corresponding to this column should be editable when the item editor is active. By default columns are editable.Values in non-editable columns are currently not displayed when the editor is active, but this will probably change in the future. They are not automatically assigned an editor field and, if one is manually assigned, it is not used. Columns that cannot (or should not) be edited even in principle should be set non-editable.
- Specified by:
setEditablein interfaceDataGrid.Column<E>- Parameters:
editable-trueif this column should be editable,falseotherwise- See Also:
-
updateEditable
protected void updateEditable() -
getEditFieldGenerator
@Nullable public Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> getEditFieldGenerator()- Specified by:
getEditFieldGeneratorin interfaceDataGrid.Column<E>- Returns:
- field generator that generates a component
for this column in
DataGrideditor
-
setEditFieldGenerator
public void setEditFieldGenerator(@Nullable Function<DataGrid.EditorFieldGenerationContext<E>, Field<?>> generator) - Specified by:
setEditFieldGeneratorin interfaceDataGrid.Column<E>- Parameters:
generator- field generator that generates a component for this column inDataGrideditor.
-
getStyleProvider
- Specified by:
getStyleProviderin interfaceDataGrid.Column<E>- Returns:
- the style provider that is used for generating styles for cells
-
setStyleProvider
Description copied from interface:DataGrid.ColumnSets the style provider for the DataGrid column.- Specified by:
setStyleProviderin interfaceDataGrid.Column<E>- Parameters:
styleProvider- a style provider to set
-
getDescriptionProvider
- Specified by:
getDescriptionProviderin interfaceDataGrid.Column<E>- Returns:
- the description provider that is used for generating descriptions for cells in this column
-
setDescriptionProvider
Description copied from interface:DataGrid.ColumnSets the description provider that is used for generating descriptions for cells in this column.This method uses the
ContentMode.PREFORMATTEDcontent mode.- Specified by:
setDescriptionProviderin interfaceDataGrid.Column<E>- Parameters:
descriptionProvider- a description provider to set, ornullto remove a previously set generator
-
setDescriptionProvider
public void setDescriptionProvider(@Nullable Function<? super E, String> descriptionProvider, ContentMode contentMode) Description copied from interface:DataGrid.ColumnSets the description provider that is used for generating descriptions for cells in this column.- Specified by:
setDescriptionProviderin interfaceDataGrid.Column<E>- Parameters:
descriptionProvider- a description provider to set, ornullto remove a previously set generatorcontentMode- a content mode for row tooltips
-
getDescriptionContentMode
-
getGridColumn
-
setGridColumn
-
getOwner
- Specified by:
getOwnerin interfaceDataGrid.Column<E>- Returns:
- The DataGrid this column belongs to
-
setOwner
- Specified by:
setOwnerin interfaceDataGrid.Column<E>- Parameters:
owner- The DataGrid this column belongs to
-
equals
-
hashCode
public int hashCode() -
toString
-
getAggregation
- Specified by:
getAggregationin interfaceDataGrid.Column<E>- Returns:
- aggregation info
- See Also:
-
setAggregation
Description copied from interface:DataGrid.ColumnSets an aggregation info in order to perform aggregation for this column.- Specified by:
setAggregationin interfaceDataGrid.Column<E>- Parameters:
info- aggregation info- See Also:
-
getValueDescription
- Specified by:
getValueDescriptionin interfaceDataGrid.Column<E>- Returns:
- value description for aggregation row cells
- See Also:
-
setValueDescription
Description copied from interface:DataGrid.ColumnSets value description for aggregated row cells.- Specified by:
setValueDescriptionin interfaceDataGrid.Column<E>- Parameters:
valueDescription- value description- See Also:
-