Interface DataGrid.Column<E>
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractDataGrid.ColumnImpl
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the expand ratio for this column.int
getId()
double
double
getOwner()
Returns the renderer instance used by this column.double
getWidth()
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.boolean
Returns whether this column can be resized by the user.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.default void
setColumnGenerator
(Function<DataGrid.ColumnGeneratorEvent<E>, ?> columnGenerator) INTERNALvoid
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
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.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.
-
Method Details
-
getId
String getId()- Returns:
- id of a column
-
getPropertyPath
- Returns:
- the instance of
MetaPropertyPath
representing 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 caption
is 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.0
to 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:
false
if the column is currently hidden by security permissions,true
otherwise
-
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
-false
to hide the column,true
to show
-
isCollapsed
boolean isCollapsed()- Returns:
true
if the column is currently hidden,false
otherwise
-
setCollapsed
Hides or shows the column. By default columns are visible before explicitly hiding them.- Parameters:
collapsed
-true
to hide the column,false
to 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:
true
if the user can hide the column,false
if 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
-true
if 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:
true
if the column is sortable by the user,false
otherwise
-
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
-true
if the user should be able to sort the column,false
otherwise- 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:
true
if this column is resizable,false
otherwise
-
setResizable
Sets whether this column can be resized by the user.- Parameters:
resizable
-true
if this column should be resizable,false
otherwise
-
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
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
.- 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:
true
if this column is editable,false
otherwise- 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
-true
if this column should be editable,false
otherwise- See Also:
-
getEditFieldGenerator
- Returns:
- field generator that generates a component
for this column in
DataGrid
editor
-
setEditFieldGenerator
void setEditFieldGenerator(@Nullable Function<DataGrid.EditorFieldGenerationContext<E>, Field<?>> generator) - Parameters:
generator
- field generator that generates a component for this column inDataGrid
editor.
-
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.PREFORMATTED
content mode.- Parameters:
descriptionProvider
- a description provider to set, ornull
to 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, ornull
to 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
ColumnGenerator
instance.- 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:
-