protected static class AbstractDataGrid.ColumnImpl<E> extends java.lang.Object implements DataGrid.Column<E>, Component.HasXmlDescriptor
Modifier and Type | Field and Description |
---|---|
protected AggregationInfo |
aggregation |
protected java.lang.String |
caption |
protected boolean |
collapsed |
protected boolean |
collapsible |
protected java.lang.String |
collapsingToggleCaption |
protected ContentMode |
descriptionContentMode |
protected java.util.function.Function<? super E,java.lang.String> |
descriptionProvider |
protected boolean |
editable |
protected org.dom4j.Element |
element |
protected int |
expandRatio |
protected boolean |
generated |
protected java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> |
generator |
protected com.vaadin.ui.Grid.Column<E,?> |
gridColumn |
protected java.lang.String |
id |
protected double |
maxWidth |
protected double |
minWidth |
protected AbstractDataGrid<?,E> |
owner |
protected java.util.function.Function |
presentationProvider |
protected io.jmix.core.metamodel.model.MetaPropertyPath |
propertyPath |
protected AbstractDataGrid.AbstractRenderer<E,?> |
renderer |
protected boolean |
resizable |
protected boolean |
sortable |
protected java.util.function.Function<? super E,java.lang.String> |
styleProvider |
protected java.lang.String |
valueDescription |
protected boolean |
visible |
protected double |
width |
Modifier | Constructor and Description |
---|---|
protected |
ColumnImpl(java.lang.String id,
io.jmix.core.metamodel.model.MetaPropertyPath propertyPath,
AbstractDataGrid<?,E> owner) |
Modifier and Type | Method and Description |
---|---|
void |
clearExpandRatio()
Clears the expand ratio for this column.
|
boolean |
equals(java.lang.Object o) |
AggregationInfo |
getAggregation() |
java.lang.String |
getCaption() |
java.lang.String |
getCollapsingToggleCaption() |
ContentMode |
getDescriptionContentMode() |
java.util.function.Function<E,java.lang.String> |
getDescriptionProvider() |
java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> |
getEditFieldGenerator() |
int |
getExpandRatio() |
com.vaadin.ui.Grid.Column<E,?> |
getGridColumn() |
java.lang.String |
getId() |
double |
getMaximumWidth() |
protected io.jmix.core.metamodel.model.MetaProperty |
getMetaProperty() |
double |
getMinimumWidth() |
DataGrid<E> |
getOwner() |
java.util.function.Function |
getPresentationProvider() |
java.lang.Object |
getPropertyId() |
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() |
org.dom4j.Element |
getXmlDescriptor() |
int |
hashCode() |
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.
|
protected boolean |
isEditingPermitted() |
boolean |
isGenerated() |
protected boolean |
isRepresentsCollection() |
boolean |
isResizable()
Returns whether this column can be resized by the user.
|
boolean |
isShouldBeEditable() |
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.
|
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 |
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 |
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.
|
protected void |
setupDefaults() |
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.
|
void |
setXmlDescriptor(org.dom4j.Element element) |
java.lang.String |
toString() |
void |
updateCollapsible() |
protected void |
updateEditable() |
protected void |
updateRendererInternal() |
void |
updateSortable() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
setColumnGenerator
protected final java.lang.String id
protected final io.jmix.core.metamodel.model.MetaPropertyPath propertyPath
protected java.lang.String caption
protected java.lang.String collapsingToggleCaption
protected double width
protected double minWidth
protected double maxWidth
protected int expandRatio
protected boolean collapsed
protected boolean visible
protected boolean collapsible
protected boolean sortable
protected boolean resizable
protected boolean editable
protected boolean generated
protected AggregationInfo aggregation
protected java.lang.String valueDescription
protected AbstractDataGrid.AbstractRenderer<E,?> renderer
protected java.util.function.Function presentationProvider
protected java.util.function.Function<? super E,java.lang.String> styleProvider
protected java.util.function.Function<? super E,java.lang.String> descriptionProvider
protected ContentMode descriptionContentMode
protected org.dom4j.Element element
protected AbstractDataGrid<?,E> owner
protected com.vaadin.ui.Grid.Column<E,?> gridColumn
protected java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> generator
protected ColumnImpl(java.lang.String id, @Nullable io.jmix.core.metamodel.model.MetaPropertyPath propertyPath, AbstractDataGrid<?,E> owner)
protected void setupDefaults()
public java.lang.String getId()
getId
in interface DataGrid.Column<E>
@Nullable public io.jmix.core.metamodel.model.MetaPropertyPath getPropertyPath()
getPropertyPath
in interface DataGrid.Column<E>
MetaPropertyPath
representing a relative path
to a property from certain MetaClasspublic java.lang.Object getPropertyId()
@Nullable public java.lang.String getCaption()
getCaption
in interface DataGrid.Column<E>
public void setCaption(java.lang.String caption)
DataGrid.Column
DataGrid.Column.setCollapsingToggleCaption(String)
.setCaption
in interface DataGrid.Column<E>
caption
- the text to show in the captionpublic java.lang.String getCollapsingToggleCaption()
getCollapsingToggleCaption
in interface DataGrid.Column<E>
public void setCollapsingToggleCaption(@Nullable java.lang.String collapsingToggleCaption)
DataGrid.Column
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.
setCollapsingToggleCaption
in interface DataGrid.Column<E>
collapsingToggleCaption
- the text to show in the column hiding togglepublic double getWidth()
getWidth
in interface DataGrid.Column<E>
public void setWidth(double width)
DataGrid.Column
This overrides any configuration set by any of
DataGrid.Column.setExpandRatio(int)
, DataGrid.Column.setMinimumWidth(double)
or
DataGrid.Column.setMaximumWidth(double)
.
setWidth
in interface DataGrid.Column<E>
width
- the new pixel width of the columnpublic boolean isWidthAuto()
isWidthAuto
in interface DataGrid.Column<E>
public void setWidthAuto()
DataGrid.Column
setWidthAuto
in interface DataGrid.Column<E>
public int getExpandRatio()
getExpandRatio
in interface DataGrid.Column<E>
DataGrid.Column.setExpandRatio(int)
public void setExpandRatio(int expandRatio)
DataGrid.Column
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.
setExpandRatio
in interface DataGrid.Column<E>
expandRatio
- the expand ratio of this column. 0
to not have it
expand at all. A negative number to clear the expand
value.DataGrid.Column.setWidth(double)
public void clearExpandRatio()
DataGrid.Column
Equal to calling setExpandRatio(-1)
clearExpandRatio
in interface DataGrid.Column<E>
public double getMinimumWidth()
getMinimumWidth
in interface DataGrid.Column<E>
DataGrid.Column.setMinimumWidth(double)
public void setMinimumWidth(double pixels)
DataGrid.Column
This defines the minimum guaranteed pixel width of the column when it is set to expand.
setMinimumWidth
in interface DataGrid.Column<E>
pixels
- the new minimum pixel width of the columnDataGrid.Column.setWidth(double)
,
DataGrid.Column.setExpandRatio(int)
public double getMaximumWidth()
getMaximumWidth
in interface DataGrid.Column<E>
DataGrid.Column.setMaximumWidth(double)
public void setMaximumWidth(double pixels)
DataGrid.Column
This defines the maximum allowed pixel width of the column when it is set to expand.
setMaximumWidth
in interface DataGrid.Column<E>
pixels
- the new maximum pixel width of the columnDataGrid.Column.setWidth(double)
,
DataGrid.Column.setExpandRatio(int)
public boolean isVisible()
isVisible
in interface DataGrid.Column<E>
false
if the column is currently hidden by security permissions,
true
otherwisepublic void setVisible(boolean visible)
DataGrid.Column
setVisible
in interface DataGrid.Column<E>
visible
- false
to hide the column, true
to showpublic boolean isCollapsed()
isCollapsed
in interface DataGrid.Column<E>
true
if the column is currently hidden, false
otherwisepublic void setCollapsed(boolean collapsed)
DataGrid.Column
setCollapsed
in interface DataGrid.Column<E>
collapsed
- true
to hide the column, false
to showpublic boolean isCollapsible()
DataGrid.Column
true
.
Note: the column can be programmatically hidden using
DataGrid.Column.setCollapsed(boolean)
regardless of the returned value.isCollapsible
in interface DataGrid.Column<E>
true
if the user can hide the column, false
if notDataGrid.isColumnsCollapsingAllowed()
,
DataGrid.setColumnsCollapsingAllowed(boolean)
public void setCollapsible(boolean collapsible)
DataGrid.Column
setCollapsible
in interface DataGrid.Column<E>
collapsible
- true
if the column may be hidden by the user via UI interactionDataGrid.isColumnsCollapsingAllowed()
,
DataGrid.setColumnsCollapsingAllowed(boolean)
public void updateCollapsible()
public boolean isSortable()
DataGrid.Column
isSortable
in interface DataGrid.Column<E>
true
if the column is sortable by the user, false
otherwisepublic void setSortable(boolean sortable)
DataGrid.Column
setSortable
in interface DataGrid.Column<E>
sortable
- true
if the user should be able to sort the
column, false
otherwiseDataGrid.setSortable(boolean)
public void updateSortable()
public boolean isResizable()
DataGrid.Column
true
.
Note: the column can be programmatically resized using
DataGrid.Column.setWidth(double)
and DataGrid.Column.setWidthAuto()
regardless
of the returned value.isResizable
in interface DataGrid.Column<E>
true
if this column is resizable, false
otherwisepublic void setResizable(boolean resizable)
DataGrid.Column
setResizable
in interface DataGrid.Column<E>
resizable
- true
if this column should be resizable, false
otherwise@Nullable protected io.jmix.core.metamodel.model.MetaProperty getMetaProperty()
@Nullable public org.dom4j.Element getXmlDescriptor()
getXmlDescriptor
in interface Component.HasXmlDescriptor
public void setXmlDescriptor(@Nullable org.dom4j.Element element)
setXmlDescriptor
in interface Component.HasXmlDescriptor
@Nullable public DataGrid.Renderer getRenderer()
DataGrid.Column
getRenderer
in interface DataGrid.Column<E>
public void setRenderer(@Nullable DataGrid.Renderer renderer)
DataGrid.Column
setRenderer
in interface DataGrid.Column<E>
renderer
- the renderer to use#setRenderer(Renderer, Function)
public void setRenderer(@Nullable DataGrid.Renderer renderer, @Nullable java.util.function.Function presentationProvider)
DataGrid.Column
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
.
setRenderer
in interface DataGrid.Column<E>
renderer
- the renderer to usepresentationProvider
- the presentation provider to use#setRenderer(Renderer)
protected void updateRendererInternal()
@Nullable public java.util.function.Function getPresentationProvider()
getPresentationProvider
in interface DataGrid.Column<E>
public boolean isGenerated()
public void setGenerated(boolean generated)
public boolean isEditable()
DataGrid.Column
isEditable
in interface DataGrid.Column<E>
true
if this column is editable, false
otherwiseDataGrid.edit(Object)
,
DataGrid.Column.setEditable(boolean)
public boolean isShouldBeEditable()
protected boolean isRepresentsCollection()
protected boolean isEditingPermitted()
public void setEditable(boolean editable)
DataGrid.Column
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.
setEditable
in interface DataGrid.Column<E>
editable
- true
if this column should be editable, false
otherwiseDataGrid.edit(Object)
,
DataGrid.isEditorActive()
protected void updateEditable()
@Nullable public java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> getEditFieldGenerator()
getEditFieldGenerator
in interface DataGrid.Column<E>
DataGrid
editorpublic void setEditFieldGenerator(@Nullable java.util.function.Function<DataGrid.EditorFieldGenerationContext<E>,Field<?>> generator)
setEditFieldGenerator
in interface DataGrid.Column<E>
generator
- field generator that generates a component
for this column in DataGrid
editor.@Nullable public java.util.function.Function<E,java.lang.String> getStyleProvider()
getStyleProvider
in interface DataGrid.Column<E>
public void setStyleProvider(@Nullable java.util.function.Function<? super E,java.lang.String> styleProvider)
DataGrid.Column
setStyleProvider
in interface DataGrid.Column<E>
styleProvider
- a style provider to set@Nullable public java.util.function.Function<E,java.lang.String> getDescriptionProvider()
getDescriptionProvider
in interface DataGrid.Column<E>
public void setDescriptionProvider(@Nullable java.util.function.Function<? super E,java.lang.String> descriptionProvider)
DataGrid.Column
This method uses the ContentMode.PREFORMATTED
content mode.
setDescriptionProvider
in interface DataGrid.Column<E>
descriptionProvider
- a description provider to set,
or null
to remove a previously set generatorpublic void setDescriptionProvider(@Nullable java.util.function.Function<? super E,java.lang.String> descriptionProvider, ContentMode contentMode)
DataGrid.Column
setDescriptionProvider
in interface DataGrid.Column<E>
descriptionProvider
- a description provider to set,
or null
to remove a previously set generatorcontentMode
- a content mode for row tooltipspublic ContentMode getDescriptionContentMode()
public com.vaadin.ui.Grid.Column<E,?> getGridColumn()
public void setGridColumn(@Nullable com.vaadin.ui.Grid.Column<E,?> gridColumn)
@Nullable public DataGrid<E> getOwner()
getOwner
in interface DataGrid.Column<E>
public void setOwner(@Nullable DataGrid<E> owner)
setOwner
in interface DataGrid.Column<E>
owner
- The DataGrid this column belongs topublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
@Nullable public AggregationInfo getAggregation()
getAggregation
in interface DataGrid.Column<E>
DataGrid.setAggregatable(boolean)
public void setAggregation(@Nullable AggregationInfo info)
DataGrid.Column
setAggregation
in interface DataGrid.Column<E>
info
- aggregation infoDataGrid.setAggregatable(boolean)
@Nullable public java.lang.String getValueDescription()
getValueDescription
in interface DataGrid.Column<E>
DataGrid.setAggregatable(boolean)
public void setValueDescription(@Nullable java.lang.String valueDescription)
DataGrid.Column
setValueDescription
in interface DataGrid.Column<E>
valueDescription
- value descriptionDataGrid.setAggregatable(boolean)