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
Modifier and TypeFieldDescriptionprotected AggregationInfo
protected String
protected boolean
protected boolean
protected String
protected ContentMode
protected boolean
protected org.dom4j.Element
protected int
protected boolean
protected Function<DataGrid.EditorFieldGenerationContext<E>,
Field<?>> protected com.vaadin.ui.Grid.Column<E,
?> protected final String
protected double
protected double
protected AbstractDataGrid<?,
E> protected Function
protected final MetaPropertyPath
protected AbstractDataGrid.AbstractRenderer<E,
?> protected boolean
protected boolean
protected String
protected boolean
protected double
-
Constructor Summary
ModifierConstructorDescriptionprotected
ColumnImpl
(String id, MetaPropertyPath propertyPath, AbstractDataGrid<?, E> owner) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the expand ratio for this column.boolean
int
com.vaadin.ui.Grid.Column<E,
?> getId()
double
protected MetaProperty
double
getOwner()
Returns the renderer instance used by this column.double
getWidth()
org.dom4j.Element
int
hashCode()
boolean
boolean
Returns whether this column can be hidden by the user.boolean
Returns whether the properties corresponding to this column should be editable when the item editor is active.protected boolean
boolean
protected boolean
boolean
Returns whether this column can be resized by the user.boolean
boolean
Returns whether the user can sort the grid by this column.boolean
boolean
void
Sets an aggregation info in order to perform aggregation for this column.void
setCaption
(String caption) Sets the caption of the header.void
setCollapsed
(boolean collapsed) Hides or shows the column.void
setCollapsible
(boolean collapsible) Sets whether this column can be hidden by the user.void
setCollapsingToggleCaption
(String collapsingToggleCaption) Sets the caption of the hiding toggle for this column.void
setDescriptionProvider
(Function<? super E, String> descriptionProvider) Sets the description provider that is used for generating descriptions for cells in this column.void
setDescriptionProvider
(Function<? super E, String> descriptionProvider, ContentMode contentMode) Sets the description provider that is used for generating descriptions for cells in this column.void
setEditable
(boolean editable) Sets whether the properties corresponding to this column should be editable when the item editor is active.void
setEditFieldGenerator
(Function<DataGrid.EditorFieldGenerationContext<E>, Field<?>> generator) void
setExpandRatio
(int expandRatio) Sets the ratio with which the column expands.void
setGenerated
(boolean generated) void
setGridColumn
(com.vaadin.ui.Grid.Column<E, ?> gridColumn) void
setMaximumWidth
(double pixels) Sets the maximum width for this column.void
setMinimumWidth
(double pixels) Sets the minimum width for this column.void
void
setRenderer
(DataGrid.Renderer renderer) Sets the renderer for this column.void
setRenderer
(DataGrid.Renderer renderer, Function presentationProvider) Sets the renderer for this column.void
setResizable
(boolean resizable) Sets whether this column can be resized by the user.void
setSortable
(boolean sortable) Sets whether this column is sortable by the user.void
setStyleProvider
(Function<? super E, String> styleProvider) Sets the style provider for the DataGrid column.protected void
void
setValueDescription
(String valueDescription) Sets value description for aggregated row cells.void
setVisible
(boolean visible) Hides or shows the column according to security permissions.void
setWidth
(double width) Sets the width (in pixels).void
Marks the column width as auto.void
setXmlDescriptor
(org.dom4j.Element element) toString()
void
protected void
protected void
void
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.DataGrid.Column
setColumnGenerator
-
Field Details
-
id
-
propertyPath
-
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:
getId
in interfaceDataGrid.Column<E>
- Returns:
- id of a column
-
getPropertyPath
- Specified by:
getPropertyPath
in interfaceDataGrid.Column<E>
- Returns:
- the instance of
MetaPropertyPath
representing a relative path to a property from certain MetaClass
-
getPropertyId
-
getCaption
- Specified by:
getCaption
in interfaceDataGrid.Column<E>
- Returns:
- the caption of the header
-
setCaption
Description copied from interface:DataGrid.Column
Sets 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:
setCaption
in interfaceDataGrid.Column<E>
- Parameters:
caption
- the text to show in the caption
-
getCollapsingToggleCaption
- Specified by:
getCollapsingToggleCaption
in interfaceDataGrid.Column<E>
- Returns:
- the caption for the hiding toggle for this column
-
setCollapsingToggleCaption
Description copied from interface:DataGrid.Column
Sets 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 caption
is used. NOTE: setting this to empty string might cause the hiding toggle to not render correctly.- Specified by:
setCollapsingToggleCaption
in interfaceDataGrid.Column<E>
- Parameters:
collapsingToggleCaption
- the text to show in the column hiding toggle
-
getWidth
public double getWidth()- Specified by:
getWidth
in interfaceDataGrid.Column<E>
- Returns:
- the width in pixels of the column
-
setWidth
public void setWidth(double width) Description copied from interface:DataGrid.Column
Sets 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:
setWidth
in interfaceDataGrid.Column<E>
- Parameters:
width
- the new pixel width of the column
-
isWidthAuto
public boolean isWidthAuto()- Specified by:
isWidthAuto
in interfaceDataGrid.Column<E>
- Returns:
- whether the width is auto
-
setWidthAuto
public void setWidthAuto()Description copied from interface:DataGrid.Column
Marks 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:
setWidthAuto
in interfaceDataGrid.Column<E>
-
getExpandRatio
public int getExpandRatio()- Specified by:
getExpandRatio
in interfaceDataGrid.Column<E>
- Returns:
- the column's expand ratio
- See Also:
-
setExpandRatio
public void setExpandRatio(int expandRatio) Description copied from interface:DataGrid.Column
Sets 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:
setExpandRatio
in interfaceDataGrid.Column<E>
- Parameters:
expandRatio
- the expand ratio of this column.0
to 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.Column
Clears the expand ratio for this column.Equal to calling
setExpandRatio(-1)
- Specified by:
clearExpandRatio
in interfaceDataGrid.Column<E>
-
getMinimumWidth
public double getMinimumWidth()- Specified by:
getMinimumWidth
in interfaceDataGrid.Column<E>
- Returns:
- the minimum width for this column
- See Also:
-
setMinimumWidth
public void setMinimumWidth(double pixels) Description copied from interface:DataGrid.Column
Sets the minimum width for this column.This defines the minimum guaranteed pixel width of the column when it is set to expand.
- Specified by:
setMinimumWidth
in interfaceDataGrid.Column<E>
- Parameters:
pixels
- the new minimum pixel width of the column- See Also:
-
getMaximumWidth
public double getMaximumWidth()- Specified by:
getMaximumWidth
in interfaceDataGrid.Column<E>
- Returns:
- the maximum width for this column
- See Also:
-
setMaximumWidth
public void setMaximumWidth(double pixels) Description copied from interface:DataGrid.Column
Sets the maximum width for this column.This defines the maximum allowed pixel width of the column when it is set to expand.
- Specified by:
setMaximumWidth
in interfaceDataGrid.Column<E>
- Parameters:
pixels
- the new maximum pixel width of the column- See Also:
-
isVisible
public boolean isVisible()- Specified by:
isVisible
in interfaceDataGrid.Column<E>
- Returns:
false
if the column is currently hidden by security permissions,true
otherwise
-
setVisible
public void setVisible(boolean visible) Description copied from interface:DataGrid.Column
Hides or shows the column according to security permissions. Invisible column doesn't send any data to client side.- Specified by:
setVisible
in interfaceDataGrid.Column<E>
- Parameters:
visible
-false
to hide the column,true
to show
-
isCollapsed
public boolean isCollapsed()- Specified by:
isCollapsed
in interfaceDataGrid.Column<E>
- Returns:
true
if the column is currently hidden,false
otherwise
-
setCollapsed
public void setCollapsed(boolean collapsed) Description copied from interface:DataGrid.Column
Hides or shows the column. By default columns are visible before explicitly hiding them.- Specified by:
setCollapsed
in interfaceDataGrid.Column<E>
- Parameters:
collapsed
-true
to hide the column,false
to show
-
isCollapsible
public boolean isCollapsible()Description copied from interface:DataGrid.Column
Returns 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:
isCollapsible
in interfaceDataGrid.Column<E>
- Returns:
true
if the user can hide the column,false
if not- See Also:
-
setCollapsible
public void setCollapsible(boolean collapsible) Description copied from interface:DataGrid.Column
Sets whether this column can be hidden by the user. Hidable columns can be hidden and shown via the sidebar menu.- Specified by:
setCollapsible
in interfaceDataGrid.Column<E>
- Parameters:
collapsible
-true
if 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.Column
Returns whether the user can sort the grid by this column.- Specified by:
isSortable
in interfaceDataGrid.Column<E>
- Returns:
true
if the column is sortable by the user,false
otherwise
-
setSortable
public void setSortable(boolean sortable) Description copied from interface:DataGrid.Column
Sets 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:
setSortable
in interfaceDataGrid.Column<E>
- Parameters:
sortable
-true
if the user should be able to sort the column,false
otherwise- See Also:
-
updateSortable
public void updateSortable() -
isResizable
public boolean isResizable()Description copied from interface:DataGrid.Column
Returns 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:
isResizable
in interfaceDataGrid.Column<E>
- Returns:
true
if this column is resizable,false
otherwise
-
setResizable
public void setResizable(boolean resizable) Description copied from interface:DataGrid.Column
Sets whether this column can be resized by the user.- Specified by:
setResizable
in interfaceDataGrid.Column<E>
- Parameters:
resizable
-true
if this column should be resizable,false
otherwise
-
getMetaProperty
-
getXmlDescriptor
@Nullable public org.dom4j.Element getXmlDescriptor()- Specified by:
getXmlDescriptor
in interfaceComponent.HasXmlDescriptor
-
setXmlDescriptor
public void setXmlDescriptor(@Nullable org.dom4j.Element element) - Specified by:
setXmlDescriptor
in interfaceComponent.HasXmlDescriptor
-
getRenderer
Description copied from interface:DataGrid.Column
Returns the renderer instance used by this column.- Specified by:
getRenderer
in interfaceDataGrid.Column<E>
- Returns:
- the renderer
-
setRenderer
Description copied from interface:DataGrid.Column
Sets the renderer for this column. If given renderer is null, then the default renderer will be used.- Specified by:
setRenderer
in 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.Column
Sets the renderer for this column. If given renderer is null, then the default renderer will be used.The presentation provider is a
Function
that 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:
setRenderer
in interfaceDataGrid.Column<E>
- Parameters:
renderer
- the renderer to usepresentationProvider
- the presentation provider to use- See Also:
-
updateRendererInternal
protected void updateRendererInternal() -
getPresentationProvider
- Specified by:
getPresentationProvider
in 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.Column
Returns whether the properties corresponding to this column should be editable when the item editor is active.- Specified by:
isEditable
in interfaceDataGrid.Column<E>
- Returns:
true
if this column is editable,false
otherwise- 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.Column
Sets 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:
setEditable
in interfaceDataGrid.Column<E>
- Parameters:
editable
-true
if this column should be editable,false
otherwise- See Also:
-
updateEditable
protected void updateEditable() -
getEditFieldGenerator
@Nullable public Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> getEditFieldGenerator()- Specified by:
getEditFieldGenerator
in interfaceDataGrid.Column<E>
- Returns:
- field generator that generates a component
for this column in
DataGrid
editor
-
setEditFieldGenerator
public void setEditFieldGenerator(@Nullable Function<DataGrid.EditorFieldGenerationContext<E>, Field<?>> generator) - Specified by:
setEditFieldGenerator
in interfaceDataGrid.Column<E>
- Parameters:
generator
- field generator that generates a component for this column inDataGrid
editor.
-
getStyleProvider
- Specified by:
getStyleProvider
in interfaceDataGrid.Column<E>
- Returns:
- the style provider that is used for generating styles for cells
-
setStyleProvider
Description copied from interface:DataGrid.Column
Sets the style provider for the DataGrid column.- Specified by:
setStyleProvider
in interfaceDataGrid.Column<E>
- Parameters:
styleProvider
- a style provider to set
-
getDescriptionProvider
- Specified by:
getDescriptionProvider
in interfaceDataGrid.Column<E>
- Returns:
- the description provider that is used for generating descriptions for cells in this column
-
setDescriptionProvider
Description copied from interface:DataGrid.Column
Sets the description provider that is used for generating descriptions for cells in this column.This method uses the
ContentMode.PREFORMATTED
content mode.- Specified by:
setDescriptionProvider
in interfaceDataGrid.Column<E>
- Parameters:
descriptionProvider
- a description provider to set, ornull
to remove a previously set generator
-
setDescriptionProvider
public void setDescriptionProvider(@Nullable Function<? super E, String> descriptionProvider, ContentMode contentMode) Description copied from interface:DataGrid.Column
Sets the description provider that is used for generating descriptions for cells in this column.- Specified by:
setDescriptionProvider
in interfaceDataGrid.Column<E>
- Parameters:
descriptionProvider
- a description provider to set, ornull
to remove a previously set generatorcontentMode
- a content mode for row tooltips
-
getDescriptionContentMode
-
getGridColumn
-
setGridColumn
-
getOwner
- Specified by:
getOwner
in interfaceDataGrid.Column<E>
- Returns:
- The DataGrid this column belongs to
-
setOwner
- Specified by:
setOwner
in interfaceDataGrid.Column<E>
- Parameters:
owner
- The DataGrid this column belongs to
-
equals
-
hashCode
public int hashCode() -
toString
-
getAggregation
- Specified by:
getAggregation
in interfaceDataGrid.Column<E>
- Returns:
- aggregation info
- See Also:
-
setAggregation
Description copied from interface:DataGrid.Column
Sets an aggregation info in order to perform aggregation for this column.- Specified by:
setAggregation
in interfaceDataGrid.Column<E>
- Parameters:
info
- aggregation info- See Also:
-
getValueDescription
- Specified by:
getValueDescription
in interfaceDataGrid.Column<E>
- Returns:
- value description for aggregation row cells
- See Also:
-
setValueDescription
Description copied from interface:DataGrid.Column
Sets value description for aggregated row cells.- Specified by:
setValueDescription
in interfaceDataGrid.Column<E>
- Parameters:
valueDescription
- value description- See Also:
-