public static interface DataGrid.Column extends Component.HasXmlDescriptor, Component.HasFormatter, java.io.Serializable
Modifier and Type | Method and Description |
---|---|
void |
clearExpandRatio()
Clears the expand ratio for this column.
|
java.lang.String |
getCaption() |
java.lang.String |
getCollapsingToggleCaption() |
DataGrid.Converter<?,?> |
getConverter()
Returns the converter instance used by this column.
|
DataGrid.ColumnEditorFieldGenerator |
getEditorFieldGenerator() |
int |
getExpandRatio() |
java.lang.String |
getId() |
double |
getMaximumWidth() |
double |
getMinimumWidth() |
DataGrid |
getOwner() |
MetaPropertyPath |
getPropertyPath() |
DataGrid.Renderer |
getRenderer()
Returns the renderer instance used by this column.
|
java.lang.Class |
getType() |
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 |
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.
|
void |
setConverter(DataGrid.Converter<?,?> converter)
Sets the converter used to convert from the property value type to
the renderer presentation type.
|
void |
setEditable(boolean editable)
Sets whether the properties corresponding to this column should be
editable when the item editor is active.
|
void |
setEditorFieldGenerator(DataGrid.ColumnEditorFieldGenerator fieldFactory) |
void |
setExpandRatio(int expandRatio)
Sets the ratio with which the column expands.
|
void |
setLastFrozenColumn()
Sets this column as the last frozen column in its grid.
|
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 owner) |
void |
setRenderer(DataGrid.Renderer renderer)
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 |
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.
|
getXmlDescriptor, setXmlDescriptor
getFormatter, setFormatter
java.lang.String getId()
@Nullable MetaPropertyPath getPropertyPath()
MetaPropertyPath
representing a relative path
to a property from certain MetaClassjava.lang.String getCaption()
void setCaption(java.lang.String caption)
setCollapsingToggleCaption(String)
.caption
- the text to show in the captionjava.lang.String getCollapsingToggleCaption()
void setCollapsingToggleCaption(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()
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)
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)
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)
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
otherwisevoid 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)
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
otherwisevoid 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
otherwisevoid setResizable(boolean resizable)
resizable
- true
if this column should be resizable, false
otherwisevoid setLastFrozenColumn()
DataGrid.setFrozenColumnCount(int)
DataGrid.Renderer getRenderer()
void setRenderer(DataGrid.Renderer renderer)
renderer
- the renderer to use#setConverter(Converter)
DataGrid.Converter<?,?> getConverter()
void setConverter(DataGrid.Converter<?,?> converter)
converter
- the converter to use, or null
to not use any
converters#setRenderer(Renderer)
@Nullable java.lang.Class getType()
boolean isEditable()
true
if this column is editable, false
otherwiseDataGrid.edit(Entity)
,
setEditable(boolean)
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(Entity)
,
DataGrid.isEditorActive()
DataGrid.ColumnEditorFieldGenerator getEditorFieldGenerator()
DataGrid
editor.void setEditorFieldGenerator(DataGrid.ColumnEditorFieldGenerator fieldFactory)
fieldFactory
- field generator that generates component
for this column in DataGrid
editor.DataGrid getOwner()
void setOwner(DataGrid owner)
owner
- The DataGrid this column belongs to