public static interface DataGrid.Column<E>
extends java.io.Serializable
Modifier and Type | Method and Description |
---|---|
void |
clearExpandRatio()
Clears the expand ratio for this column.
|
AggregationInfo |
getAggregation() |
java.lang.String |
getCaption() |
java.lang.String |
getCollapsingToggleCaption() |
java.util.function.Function<E,java.lang.String> |
getDescriptionProvider() |
java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> |
getEditFieldGenerator() |
int |
getExpandRatio() |
java.lang.String |
getId() |
double |
getMaximumWidth() |
double |
getMinimumWidth() |
DataGrid<E> |
getOwner() |
java.util.function.Function |
getPresentationProvider() |
io.jmix.core.metamodel.model.MetaPropertyPath |
getPropertyPath() |
DataGrid.Renderer |
getRenderer()
Returns the renderer instance used by this column.
|
java.util.function.Function<E,java.lang.String> |
getStyleProvider() |
java.lang.String |
getValueDescription() |
double |
getWidth() |
boolean |
isCollapsed() |
boolean |
isCollapsible()
Returns whether this column can be hidden by the user.
|
boolean |
isEditable()
Returns whether the properties corresponding to this column should be
editable when the item editor is active.
|
boolean |
isResizable()
Returns whether this column can be resized by the user.
|
boolean |
isSortable()
Returns whether the user can sort the grid by this column.
|
boolean |
isVisible() |
boolean |
isWidthAuto() |
void |
setAggregation(AggregationInfo info)
Sets an aggregation info in order to perform aggregation for this column.
|
void |
setCaption(java.lang.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(java.lang.String collapsingToggleCaption)
Sets the caption of the hiding toggle for this column.
|
default void |
setColumnGenerator(java.util.function.Function<DataGrid.ColumnGeneratorEvent<E>,?> columnGenerator)
INTERNAL
|
void |
setDescriptionProvider(java.util.function.Function<? super E,java.lang.String> descriptionProvider)
Sets the description provider that is used for generating
descriptions for cells in this column.
|
void |
setDescriptionProvider(java.util.function.Function<? super E,java.lang.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(java.util.function.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 |
setOwner(DataGrid<E> owner) |
void |
setRenderer(DataGrid.Renderer renderer)
Sets the renderer for this column.
|
void |
setRenderer(DataGrid.Renderer renderer,
java.util.function.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(java.util.function.Function<? super E,java.lang.String> styleProvider)
Sets the style provider for the DataGrid column.
|
void |
setValueDescription(java.lang.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 |
setWidthAuto()
Marks the column width as auto.
|
java.lang.String getId()
@Nullable io.jmix.core.metamodel.model.MetaPropertyPath getPropertyPath()
MetaPropertyPath
representing a relative path
to a property from certain MetaClass@Nullable java.lang.String getCaption()
@StudioProperty(type=LOCALIZED_STRING) void setCaption(java.lang.String caption)
setCollapsingToggleCaption(String)
.caption
- the text to show in the caption@Nullable java.lang.String getCollapsingToggleCaption()
@StudioProperty(type=LOCALIZED_STRING) void setCollapsingToggleCaption(@Nullable java.lang.String collapsingToggleCaption)
hidable
.
The default value is null
, and in that case the column's
header caption
is used.
NOTE: setting this to empty string might cause the hiding
toggle to not render correctly.
collapsingToggleCaption
- the text to show in the column hiding toggledouble getWidth()
@StudioProperty(defaultValue="0") @PositiveOrZero void setWidth(double width)
This overrides any configuration set by any of
setExpandRatio(int)
, setMinimumWidth(double)
or
setMaximumWidth(double)
.
width
- the new pixel width of the columnboolean isWidthAuto()
void setWidthAuto()
int getExpandRatio()
setExpandRatio(int)
@StudioProperty(name="expandRatio", defaultValue="0") void setExpandRatio(int expandRatio)
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.
expandRatio
- the expand ratio of this column. 0
to not have it
expand at all. A negative number to clear the expand
value.setWidth(double)
void clearExpandRatio()
Equal to calling setExpandRatio(-1)
double getMinimumWidth()
setMinimumWidth(double)
@StudioProperty(name="minimumWidth", defaultValue="0") @PositiveOrZero void setMinimumWidth(double pixels)
This defines the minimum guaranteed pixel width of the column when it is set to expand.
pixels
- the new minimum pixel width of the columnsetWidth(double)
,
setExpandRatio(int)
double getMaximumWidth()
setMaximumWidth(double)
@StudioProperty(name="maximumWidth", defaultValue="0") @PositiveOrZero void setMaximumWidth(double pixels)
This defines the maximum allowed pixel width of the column when it is set to expand.
pixels
- the new maximum pixel width of the columnsetWidth(double)
,
setExpandRatio(int)
boolean isVisible()
false
if the column is currently hidden by security permissions,
true
otherwisevoid setVisible(boolean visible)
visible
- false
to hide the column, true
to showboolean isCollapsed()
true
if the column is currently hidden, false
otherwise@StudioProperty(defaultValue="false") void setCollapsed(boolean collapsed)
collapsed
- true
to hide the column, false
to showboolean isCollapsible()
true
.
Note: the column can be programmatically hidden using
setCollapsed(boolean)
regardless of the returned value.true
if the user can hide the column, false
if notDataGrid.isColumnsCollapsingAllowed()
,
DataGrid.setColumnsCollapsingAllowed(boolean)
@StudioProperty(defaultValue="true") void setCollapsible(boolean collapsible)
collapsible
- true
if the column may be hidden by the user via UI interactionDataGrid.isColumnsCollapsingAllowed()
,
DataGrid.setColumnsCollapsingAllowed(boolean)
boolean isSortable()
true
if the column is sortable by the user, false
otherwise@StudioProperty(defaultValue="true") void setSortable(boolean sortable)
sortable
- true
if the user should be able to sort the
column, false
otherwiseDataGrid.setSortable(boolean)
boolean isResizable()
true
.
Note: the column can be programmatically resized using
setWidth(double)
and setWidthAuto()
regardless
of the returned value.true
if this column is resizable, false
otherwise@StudioProperty(defaultValue="true") void setResizable(boolean resizable)
resizable
- true
if this column should be resizable, false
otherwise@Nullable DataGrid.Renderer getRenderer()
void setRenderer(@Nullable DataGrid.Renderer renderer)
renderer
- the renderer to use#setRenderer(Renderer, Function)
void setRenderer(@Nullable DataGrid.Renderer renderer, @Nullable java.util.function.Function presentationProvider)
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
.
renderer
- the renderer to usepresentationProvider
- the presentation provider to use#setRenderer(Renderer)
@Nullable java.util.function.Function getPresentationProvider()
boolean isEditable()
true
if this column is editable, false
otherwiseDataGrid.edit(Object)
,
setEditable(boolean)
@StudioProperty(defaultValue="true") void setEditable(boolean 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.
editable
- true
if this column should be editable, false
otherwiseDataGrid.edit(Object)
,
DataGrid.isEditorActive()
@Nullable java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> getEditFieldGenerator()
DataGrid
editorvoid setEditFieldGenerator(@Nullable java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> generator)
generator
- field generator that generates a component
for this column in DataGrid
editor.@Nullable java.util.function.Function<E,java.lang.String> getStyleProvider()
void setStyleProvider(@Nullable java.util.function.Function<? super E,java.lang.String> styleProvider)
styleProvider
- a style provider to set@Nullable java.util.function.Function<E,java.lang.String> getDescriptionProvider()
void setDescriptionProvider(@Nullable java.util.function.Function<? super E,java.lang.String> descriptionProvider)
This method uses the ContentMode.PREFORMATTED
content mode.
descriptionProvider
- a description provider to set,
or null
to remove a previously set generatorvoid setDescriptionProvider(java.util.function.Function<? super E,java.lang.String> descriptionProvider, ContentMode contentMode)
descriptionProvider
- a description provider to set,
or null
to remove a previously set generatorcontentMode
- a content mode for row tooltipsvoid setOwner(@Nullable DataGrid<E> owner)
owner
- The DataGrid this column belongs todefault void setColumnGenerator(java.util.function.Function<DataGrid.ColumnGeneratorEvent<E>,?> columnGenerator)
Intended to install declarative ColumnGenerator
instance.
columnGenerator
- column generator instance@Nullable AggregationInfo getAggregation()
DataGrid.setAggregatable(boolean)
void setAggregation(@Nullable AggregationInfo info)
info
- aggregation infoDataGrid.setAggregatable(boolean)
@Nullable java.lang.String getValueDescription()
DataGrid.setAggregatable(boolean)
void setValueDescription(@Nullable java.lang.String valueDescription)
valueDescription
- value descriptionDataGrid.setAggregatable(boolean)