Interface DataGrid.Column<E>
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractDataGrid.ColumnImpl
-
Method Summary
Modifier and TypeMethodDescriptionvoidClears the expand ratio for this column.intgetId()doubledoublegetOwner()Returns the renderer instance used by this column.doublegetWidth()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.booleanReturns whether this column can be resized by the user.booleanReturns 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.default voidsetColumnGenerator(Function<DataGrid.ColumnGeneratorEvent<E>, ?> columnGenerator) INTERNALvoidsetDescriptionProvider(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.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.voidsetValueDescription(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.
-
Method Details
-
getId
String getId()- Returns:
- id of a column
-
getPropertyPath
- Returns:
- the instance of
MetaPropertyPathrepresenting a relative path to a property from certain MetaClass
-
getCaption
- Returns:
- the caption of the header
-
setCaption
Sets the caption of the header. This caption is also used as the hiding toggle caption, unless it is explicitly set viasetCollapsingToggleCaption(String).- Parameters:
caption- the text to show in the caption
-
getCollapsingToggleCaption
- Returns:
- the caption for the hiding toggle for this column
-
setCollapsingToggleCaption
@StudioProperty(type=LOCALIZED_STRING) void setCollapsingToggleCaption(@Nullable String collapsingToggleCaption) 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 captionis used. NOTE: setting this to empty string might cause the hiding toggle to not render correctly.- Parameters:
collapsingToggleCaption- the text to show in the column hiding toggle
-
getWidth
double getWidth()- Returns:
- the width in pixels of the column
-
setWidth
Sets the width (in pixels).This overrides any configuration set by any of
setExpandRatio(int),setMinimumWidth(double)orsetMaximumWidth(double).- Parameters:
width- the new pixel width of the column
-
isWidthAuto
boolean isWidthAuto()- Returns:
- whether the width is auto
-
setWidthAuto
void setWidthAuto()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. -
getExpandRatio
int getExpandRatio()- Returns:
- the column's expand ratio
- See Also:
-
setExpandRatio
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 (
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.- 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
void clearExpandRatio()Clears the expand ratio for this column.Equal to calling
setExpandRatio(-1) -
getMinimumWidth
double getMinimumWidth()- Returns:
- the minimum width for this column
- See Also:
-
setMinimumWidth
@StudioProperty(name="minimumWidth", defaultValue="0") @PositiveOrZero void setMinimumWidth(double pixels) Sets the minimum width for this column.This defines the minimum guaranteed pixel width of the column when it is set to expand.
- Parameters:
pixels- the new minimum pixel width of the column- See Also:
-
getMaximumWidth
double getMaximumWidth()- Returns:
- the maximum width for this column
- See Also:
-
setMaximumWidth
@StudioProperty(name="maximumWidth", defaultValue="0") @PositiveOrZero void setMaximumWidth(double pixels) Sets the maximum width for this column.This defines the maximum allowed pixel width of the column when it is set to expand.
- Parameters:
pixels- the new maximum pixel width of the column- See Also:
-
isVisible
boolean isVisible()- Returns:
falseif the column is currently hidden by security permissions,trueotherwise
-
setVisible
void setVisible(boolean visible) Hides or shows the column according to security permissions. Invisible column doesn't send any data to client side.- Parameters:
visible-falseto hide the column,trueto show
-
isCollapsed
boolean isCollapsed()- Returns:
trueif the column is currently hidden,falseotherwise
-
setCollapsed
Hides or shows the column. By default columns are visible before explicitly hiding them.- Parameters:
collapsed-trueto hide the column,falseto show
-
isCollapsible
boolean isCollapsible()Returns whether this column can be hidden by the user. Default istrue. Note: the column can be programmatically hidden usingsetCollapsed(boolean)regardless of the returned value.- Returns:
trueif the user can hide the column,falseif not- See Also:
-
setCollapsible
Sets whether this column can be hidden by the user. Hidable columns can be hidden and shown via the sidebar menu.- Parameters:
collapsible-trueif the column may be hidden by the user via UI interaction- See Also:
-
isSortable
boolean isSortable()Returns whether the user can sort the grid by this column.- Returns:
trueif the column is sortable by the user,falseotherwise
-
setSortable
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.- Parameters:
sortable-trueif the user should be able to sort the column,falseotherwise- See Also:
-
isResizable
boolean isResizable()Returns whether this column can be resized by the user. Default istrue. Note: the column can be programmatically resized usingsetWidth(double)andsetWidthAuto()regardless of the returned value.- Returns:
trueif this column is resizable,falseotherwise
-
setResizable
Sets whether this column can be resized by the user.- Parameters:
resizable-trueif this column should be resizable,falseotherwise
-
getRenderer
Returns the renderer instance used by this column.- Returns:
- the renderer
-
setRenderer
Sets the renderer for this column. If given renderer is null, then the default renderer will be used.- Parameters:
renderer- the renderer to use- See Also:
-
setRenderer
Sets 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.- Parameters:
renderer- the renderer to usepresentationProvider- the presentation provider to use- See Also:
-
getPresentationProvider
- Returns:
- a function to get presentations from the value of this column
-
isEditable
boolean isEditable()Returns whether the properties corresponding to this column should be editable when the item editor is active.- Returns:
trueif this column is editable,falseotherwise- See Also:
-
setEditable
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.
- Parameters:
editable-trueif this column should be editable,falseotherwise- See Also:
-
getEditFieldGenerator
- Returns:
- field generator that generates a component
for this column in
DataGrideditor
-
setEditFieldGenerator
void setEditFieldGenerator(@Nullable Function<DataGrid.EditorFieldGenerationContext<E>, Field<?>> generator) - Parameters:
generator- field generator that generates a component for this column inDataGrideditor.
-
getStyleProvider
- Returns:
- the style provider that is used for generating styles for cells
-
setStyleProvider
Sets the style provider for the DataGrid column.- Parameters:
styleProvider- a style provider to set
-
getDescriptionProvider
- Returns:
- the description provider that is used for generating descriptions for cells in this column
-
setDescriptionProvider
Sets the description provider that is used for generating descriptions for cells in this column.This method uses the
ContentMode.PREFORMATTEDcontent mode.- Parameters:
descriptionProvider- a description provider to set, ornullto remove a previously set generator
-
setDescriptionProvider
void setDescriptionProvider(Function<? super E, String> descriptionProvider, ContentMode contentMode) Sets the description provider that is used for generating descriptions for cells in this column.- Parameters:
descriptionProvider- a description provider to set, ornullto remove a previously set generatorcontentMode- a content mode for row tooltips
-
getOwner
- Returns:
- The DataGrid this column belongs to
-
setOwner
- Parameters:
owner- The DataGrid this column belongs to
-
setColumnGenerator
INTERNALIntended to install declarative
ColumnGeneratorinstance.- Parameters:
columnGenerator- column generator instance
-
getAggregation
- Returns:
- aggregation info
- See Also:
-
setAggregation
Sets an aggregation info in order to perform aggregation for this column.- Parameters:
info- aggregation info- See Also:
-
getValueDescription
- Returns:
- value description for aggregation row cells
- See Also:
-
setValueDescription
Sets value description for aggregated row cells.- Parameters:
valueDescription- value description- See Also:
-