Package io.jmix.ui.component
Interface Table.Column<E>
- Type Parameters:
E
- row item type
- All Superinterfaces:
Component.HasCaption
,Component.HasDescription
,Component.HasXmlDescriptor
,HasFormatter
,HasHtmlCaption
- All Known Subinterfaces:
GroupTable.GroupColumn<E>
- All Known Implementing Classes:
AbstractTable.ColumnImpl
,GroupTableImpl.GroupColumnImpl
public static interface Table.Column<E>
extends Component.HasXmlDescriptor, HasHtmlCaption, HasFormatter
Table column.
Use Table.addColumn(Object)
and Table.addColumn(Object, int)
methods to create
and add column to the Table.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
An event is fired when the user clicks inside the table cell that belongs to the current column. -
Method Summary
Modifier and TypeMethodDescriptionaddClickListener
(Consumer<Table.Column.ClickEvent<E>> listener) Adds a click listener for column.float
getId()
Returns a column identifier.getOwner()
Returns a column identifier as aString
.getWidth()
Returns default column width.boolean
When the aggregation is editable in conjunction with using theTable.setAggregationDistributionProvider(AggregationDistributionProvider)
method, this allows users to implement algorithms for distributing data between table rows.boolean
boolean
Returns whether editing is allowed for the corresponding column in the table.boolean
Returns whether the user can sort the data by this column.void
setAggregation
(AggregationInfo aggregation) Sets an aggregation info in order to perform aggregation for this column.void
setAlignment
(Table.ColumnAlignment alignment) Sets a text alignment of column cells.void
setCollapsed
(boolean collapsed) Hides or shows the column.default void
setColumnGenerator
(Function<E, Component> columnGenerator) Intended to install instance from screen controller.void
setEditable
(boolean editable) Sets whether editing is allowed for the corresponding column in the table.void
setExpandRatio
(float ratio) Sets the ratio with which the column expands.void
setMaxTextLength
(Integer maxTextLength) Limits the number of characters in a cell.void
void
setSortable
(boolean sortable) Sets whether this column is sortable by the user.void
setValueDescription
(String valueDescription) Defines a hint which is displayed in a popup when a user hovers the mouse cursor on the aggregated value.void
setValueProvider
(Function<E, Object> valueProvider) Sets value provider for the column.void
Sets default column width.Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasXmlDescriptor
getXmlDescriptor, setXmlDescriptor
Methods inherited from interface io.jmix.ui.component.HasFormatter
getFormatter, setFormatter
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
-
Method Details
-
getId
Object getId()Returns a column identifier. It could be aString
or an instance ofMetaPropertyPath
.- Returns:
- id of a column
-
getStringId
String getStringId()Returns a column identifier as aString
. If the id is an instance ofMetaPropertyPath
, then theMetaPropertyPath.toPathString()
will be returned.- Returns:
- a column identifier as a string
-
getMetaPropertyPath
- Returns:
- the instance of
MetaPropertyPath
representing a relative path to a property from certain MetaClass or null
-
getMetaPropertyPathNN
MetaPropertyPath getMetaPropertyPathNN()- Returns:
- the instance of
MetaPropertyPath
representing a relative path to a property from certain MetaClass
-
getOwner
- Returns:
- the Table this column belongs to
-
setOwner
- Parameters:
owner
- the Table this column belongs to
-
setColumnGenerator
Intended to install instance from screen controller. For instance:@Install(to = "filesTable.content", subject = "columnGenerator") private Object filesTableContentColumnGenerator(DataGrid.ColumnGeneratorEvent<File> event) { LinkButton linkButton = uiComponents.create(LinkButton.class); linkButton.setCaption("Open content screen"); linkButton.addClickListener(this::onLinkClickListener); return linkButton; }
- Parameters:
columnGenerator
- column generator instance
-
getValueProvider
- Returns:
- a value provider or null
-
setValueProvider
Sets value provider for the column. Value provider can be called 0 or more times depending on visibility of a cell and value type. Return type must be the same as type of the column.- Parameters:
valueProvider
- a callback interface for providing column values from a given source
-
getValueDescription
- Returns:
- a hint which is displayed in a popup when a user hovers the mouse cursor on the aggregated value
-
setValueDescription
Defines a hint which is displayed in a popup when a user hovers the mouse cursor on the aggregated value. For the operations listed above (SUM, AVG, COUNT, MIN, MAX), popup hints are already available by default.- Parameters:
valueDescription
- a hint- See Also:
-
isEditable
boolean isEditable()Returns whether editing is allowed for the corresponding column in the table.- Returns:
- whether editing is allowed for the corresponding column in the table
-
setEditable
Sets whether editing is allowed for the corresponding column in the table. NOTE: changing this property at runtime is not supported.- Parameters:
editable
- whether editing is allowed for the corresponding column in the table
-
getAlignment
- Returns:
- a text alignment of column cells
-
setAlignment
@StudioProperty(name="align", type=ENUMERATION, defaultValue="LEFT", options={"LEFT","CENTER","RIGHT"}) void setAlignment(@Nullable Table.ColumnAlignment alignment) Sets a text alignment of column cells. The default alignment isTable.ColumnAlignment.LEFT
.- Parameters:
alignment
- a text alignment of column cells
-
getWidth
Returns default column width. May contain only numeric values in pixels.- Returns:
- default column width
-
setWidth
Sets default column width. May contain only numeric values in pixels.- Parameters:
width
- default column width
-
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
-
isSortable
boolean isSortable()Returns whether the user can sort the data 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 Table 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:
-
getMaxTextLength
- Returns:
- the maximum number of characters in a cell
-
setMaxTextLength
Limits the number of characters in a cell. If the difference between the actual and the maximum allowed number of characters does not exceed the 10 character threshold, the extra characters remain unhidden. To see the entire record, users need to click on its visible part.- Parameters:
maxTextLength
- the maximum number of characters in a cell- See Also:
-
getAggregation
- Returns:
- an aggregation info
-
setAggregation
Sets an aggregation info in order to perform aggregation for this column.- Parameters:
aggregation
- aggregation info
-
isAggregationEditable
boolean isAggregationEditable()When the aggregation is editable in conjunction with using theTable.setAggregationDistributionProvider(AggregationDistributionProvider)
method, this allows users to implement algorithms for distributing data between table rows.- Returns:
- whether aggregation info is editable
-
setExpandRatio
Sets the ratio with which the column expands. The default value is -1.By default (without expand ratios) the excess space is divided proportionally to columns natural widths.
- Parameters:
ratio
- the expand ratio of this column.0
to not have it expand at all. A negative number to clear the expand value.
-
getExpandRatio
float getExpandRatio()- Returns:
- the ratio with which the column expands
-
addClickListener
Adds a click listener for column.- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-