E
- row item typepublic interface Table<E extends Entity> extends ListComponent<E>, Component.Editable, HasSettings, HasDataLoadingSettings, HasButtonsPanel, HasPresentations, Component.HasCaption, HasContextHelp, Component.HasIcon, HasRowsCount, LookupComponent<E>, Component.Focusable, RowsCount.RowsCountTarget, HasSubParts, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, HasMinSize
Modifier and Type | Interface and Description |
---|---|
static class |
Table.AggregationDistributionContext<E>
Object that contains information about aggregation distribution.
|
static interface |
Table.AggregationDistributionProvider<E>
Allows to handle a group or total aggregation value changes.
|
static class |
Table.AggregationStyle |
static class |
Table.CellClickEvent<T extends Entity> |
static interface |
Table.CellClickListener<T extends Entity>
Deprecated.
Use
Table.Column.addClickListener(Consumer) instead. |
static class |
Table.Column<T extends Entity> |
static class |
Table.ColumnAlignment |
static class |
Table.ColumnCollapseEvent<E extends Entity>
Event sent every time column collapse state changes.
|
static interface |
Table.ColumnCollapseListener
Deprecated.
Use
addColumnCollapseListener(Consumer) instead |
static interface |
Table.ColumnGenerator<E extends Entity>
Allows rendering of an arbitrary
Component inside a table cell. |
static class |
Table.EmptyStateClickEvent<E extends Entity>
Describes empty state link click event.
|
static class |
Table.PlainTextCell
Special component for generated columns which will be rendered as simple text cell.
|
static interface |
Table.Printable<E extends Entity,P>
Allows set Printable representation for column in Excel export.
|
static interface |
Table.PrintableColumnGenerator<E extends Entity,P>
Column generator, which supports print to Excel.
|
static class |
Table.RowHeaderMode |
static class |
Table.SelectionEvent<E extends Entity>
Event sent when the selection changes.
|
static class |
Table.SortDirection
Describes sorting direction.
|
static class |
Table.SortInfo |
static interface |
Table.StyleProvider<E extends Entity>
Allows to define different styles for table cells.
|
ListComponent.IconProvider<E extends Entity>
HasContextHelp.ContextHelpIconClickEvent
LookupComponent.LookupSelectionChangeEvent<T extends Entity>, LookupComponent.LookupSelectionChangeNotifier<T extends Entity>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Table.Column<E> column)
Adds the given column to Table.
|
void |
addColumn(Table.Column<E> column,
int index)
Adds the given column at the specified index to Table.
|
default void |
addColumnCollapsedListener(Table.ColumnCollapseListener columnCollapsedListener)
Deprecated.
Use
addColumnCollapseListener(Consumer) instead |
Subscription |
addColumnCollapseListener(java.util.function.Consumer<Table.ColumnCollapseEvent> listener)
Adds a listener for column collapse events.
|
void |
addGeneratedColumn(java.lang.String columnId,
int index,
Table.ColumnGenerator<? super E> generator)
Adds a generated column at the specified index to Table.
|
void |
addGeneratedColumn(java.lang.String columnId,
Table.ColumnGenerator<? super E> generator)
Add a generated column to the table.
|
void |
addGeneratedColumn(java.lang.String columnId,
Table.ColumnGenerator<? super E> generator,
java.lang.Class<? extends Component> componentClass)
Add a generated column to the table.
|
void |
addPrintable(java.lang.String columnId,
Table.Printable<? super E,?> printable)
Adds
Table.Printable representation for column. |
Subscription |
addSelectionListener(java.util.function.Consumer<Table.SelectionEvent<E>> listener)
Registers a new selection listener
|
void |
addStyleProvider(Table.StyleProvider<? super E> styleProvider)
Add style provider for the table.
Table can use several providers to obtain many style names for cells and rows. |
default void |
addValidator(java.util.function.Consumer<?> validator)
Deprecated.
automatic validation of Table is not supported
|
default void |
addValidator(Table.Column column,
java.util.function.Consumer<?> validator)
Deprecated.
automatic validation of Table is not supported
|
Table.AggregationDistributionProvider<E> |
getAggregationDistributionProvider() |
java.util.Map<java.lang.Object,java.lang.Object> |
getAggregationResults()
Returns a map with aggregation results, where keys are table column ids and values are aggregation values.
|
Table.AggregationStyle |
getAggregationStyle() |
Table.Column<E> |
getColumn(java.lang.String id) |
boolean |
getColumnControlVisible() |
boolean |
getColumnReorderingAllowed() |
java.util.List<Table.Column<E>> |
getColumns() |
default CollectionDatasource |
getDatasource()
Deprecated.
Use
getItems() instead |
java.util.function.Consumer<Table.EmptyStateClickEvent<E>> |
getEmptyStateLinkClickHandler() |
java.lang.String |
getEmptyStateLinkMessage() |
java.lang.String |
getEmptyStateMessage() |
Action |
getEnterPressAction() |
InstanceContainer<E> |
getInstanceContainer(E item)
This method returns the InstanceContainer which contains the provided item.
|
Action |
getItemClickAction() |
Datasource |
getItemDatasource(Entity item)
Deprecated.
Use
getInstanceContainer(Entity) instead. |
java.util.function.BiFunction<? super E,java.lang.String,java.lang.String> |
getItemDescriptionProvider()
Gets the item description provider.
|
TableItems<E> |
getItems() |
java.lang.Float |
getMinHeight() |
SizeUnit |
getMinHeightSizeUnit() |
java.lang.Float |
getMinWidth() |
SizeUnit |
getMinWidthSizeUnit() |
java.util.List<Table.Column> |
getNotCollapsedColumns() |
Table.Printable |
getPrintable(java.lang.String columnId)
Get
Table.Printable representation for column. |
Table.Printable |
getPrintable(Table.Column column)
Get
Table.Printable representation for column. |
int |
getRowHeaderWidth() |
Table.SortInfo |
getSortInfo() |
default java.lang.Object |
getSubPart(java.lang.String name) |
boolean |
isAggregatable() |
boolean |
isAutoScrolling() |
boolean |
isColumnHeaderVisible() |
boolean |
isContextMenuEnabled() |
boolean |
isMultiLineCells() |
boolean |
isShowSelection() |
boolean |
isShowTotalAggregation() |
boolean |
isSortable() |
boolean |
isTextSelectionEnabled() |
static <T extends Entity> |
of(java.lang.Class<T> itemClass) |
void |
refresh()
Deprecated.
refresh datasource instead
|
void |
removeClickListener(java.lang.String columnId)
Deprecated.
Use
Subscription instead |
void |
removeColumn(Table.Column<E> column)
Removes the given column from Table or do nothing if column is
null . |
void |
removeColumnCollapseListener(java.util.function.Consumer<Table.ColumnCollapseEvent> listener)
Deprecated.
Use
Subscription instead |
default void |
removeColumnCollapseListener(Table.ColumnCollapseListener columnCollapseListener)
Deprecated.
Use
addColumnCollapseListener(Consumer) instead |
void |
removeGeneratedColumn(java.lang.String columnId) |
void |
removePrintable(java.lang.String columnId)
Removes
Table.Printable representation of column. |
void |
removeStyleProvider(Table.StyleProvider<? super E> styleProvider)
Remove style provider for the table.
|
void |
repaint()
Repaint UI representation of the table (columns, generated columns) without refreshing the table data
|
void |
requestFocus(E entity,
java.lang.String columnId)
Set focus on inner field of editable/generated column.
|
void |
scrollTo(E entity)
Scroll table to specified row.
|
void |
selectAll() |
void |
setAggregatable(boolean aggregatable) |
void |
setAggregationDistributionProvider(Table.AggregationDistributionProvider<E> distributionProvider)
Set aggregation distribution provider to handle distribution of data on rows.
|
void |
setAggregationStyle(Table.AggregationStyle aggregationStyle) |
void |
setAutoScrolling(boolean autoScroll)
Enables or disables automatic scroll to a selected row after table update.
|
void |
setCellClickListener(java.lang.String columnId,
java.util.function.Consumer<Table.CellClickEvent<E>> clickListener)
Deprecated.
Use
Table.Column.addClickListener(Consumer) instead |
default void |
setClickListener(java.lang.String columnId,
Table.CellClickListener<? super E> clickListener)
Deprecated.
Use
Table.Column.addClickListener(Consumer) instead |
void |
setColumnControlVisible(boolean columnCollapsingAllowed) |
void |
setColumnHeaderVisible(boolean columnHeaderVisible)
Set visibility for table header
|
void |
setColumnReorderingAllowed(boolean columnReorderingAllowed) |
void |
setContextMenuEnabled(boolean contextMenuEnabled) |
default void |
setDatasource(CollectionDatasource datasource)
Deprecated.
Use
setItems(TableItems) instead |
void |
setEmptyStateLinkClickHandler(java.util.function.Consumer<Table.EmptyStateClickEvent<E>> handler)
Sets click handler for link message.
|
void |
setEmptyStateLinkMessage(java.lang.String linkMessage)
Sets a link message to the middle of Table body that should be appeared when Table is empty.
|
void |
setEmptyStateMessage(java.lang.String message)
Sets a message to the middle of Table body that should be appeared when Table is empty.
|
void |
setEnterPressAction(Action action)
Assign action to be executed on Enter key press.
|
void |
setIconProvider(java.util.function.Function<? super E,java.lang.String> iconProvider)
Set the row icon provider for the table.
|
void |
setItemClickAction(Action action)
Assign action to be executed on double click inside a table row.
|
void |
setItemDescriptionProvider(java.util.function.BiFunction<? super E,java.lang.String,java.lang.String> provider)
Sets the item description provider that is used for generating tooltip descriptions for items.
|
void |
setItems(TableItems<E> tableItems) |
void |
setMinHeight(java.lang.String minHeight)
Sets
minHeight CSS property value to the Table (not a composition). |
void |
setMinWidth(java.lang.String minWidth)
Sets
minWidth CSS property value to the Table (not a composition). |
void |
setMultiLineCells(boolean multiLineCells) |
void |
setMultiSelect(boolean multiselect) |
void |
setRequired(Table.Column<E> column,
boolean required,
java.lang.String message) |
void |
setRowHeaderMode(Table.RowHeaderMode mode) |
void |
setRowHeaderWidth(int width)
Set width of row header column.
|
void |
setShowSelection(boolean showSelection)
Hide or show selection
|
void |
setShowTotalAggregation(boolean showAggregation) |
void |
setSortable(boolean sortable) |
void |
setStyleProvider(Table.StyleProvider<? super E> styleProvider)
Set the cell style provider for the table.
All style providers added before this call will be removed. |
void |
setTextSelectionEnabled(boolean value)
Enable or disable text selection in Table cells.
|
void |
showCustomPopup(Component popupComponent)
Show popup inside of Table, relative to last cell click event.
Call this method from Table.CellClickListener implementation. |
void |
showCustomPopupActions(java.util.List<Action> actions)
Show autocloseable popup view with actions, relative to last cell click event.
Call this method from Table.CellClickListener implementation.Autocloseable means that after any click on action popup will be closed. |
void |
sort(java.lang.String columnId,
Table.SortDirection direction)
Sorts the Table data for passed column id in the chosen sort direction.
|
void |
sortBy(java.lang.Object propertyId,
boolean ascending)
Deprecated.
Use
sort(String, SortDirection) method |
getSelected, getSingleSelected, isMultiSelect, setSelected, setSelected
addAction, addAction, getAction, getActionNN, getActions, removeAction, removeAction, removeAllActions
isEditable, isEditableWithParent, setEditable
applyDataLoadingSettings
getButtonsPanel, setButtonsPanel
applyPresentation, applyPresentationAsDefault, getDefaultPresentationId, getPresentations, isUsePresentations, loadPresentations, resetPresentation, usePresentations
applySettings, isSettingsEnabled, saveSettings, setSettingsEnabled
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
getIcon, setIcon, setIconFromSet
getRowsCount, setRowsCount, setRowsCountTotalCountDelegate
getLookupSelectedItems, setLookupSelectHandler
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
getFrame, setFrame
isCaptionAsHtml, setCaptionAsHtml
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
static final java.lang.String NAME
static <T extends Entity> com.google.common.reflect.TypeToken<Table<T>> of(java.lang.Class<T> itemClass)
java.util.List<Table.Column<E>> getColumns()
Table.Column<E> getColumn(java.lang.String id)
void addColumn(Table.Column<E> column)
Note that column id should be an instance of MetaPropertyPath
.
column
- the column to addaddColumn(Column, int)
void addColumn(Table.Column<E> column, int index)
Note that column id should be an instance of MetaPropertyPath
.
column
- the column to addindex
- index of a new columnaddColumn(Column)
void removeColumn(Table.Column<E> column)
null
.column
- the column to removejava.util.Map<java.lang.Object,java.lang.Object> getAggregationResults()
void setItems(TableItems<E> tableItems)
@Nullable TableItems<E> getItems()
getItems
in interface ListComponent<E extends Entity>
@Deprecated default void setDatasource(CollectionDatasource datasource)
setItems(TableItems)
insteaddatasource
- datasource@Deprecated default CollectionDatasource getDatasource()
getItems()
insteadgetDatasource
in interface ListComponent<E extends Entity>
void setRequired(Table.Column<E> column, boolean required, java.lang.String message)
@Deprecated default void addValidator(Table.Column column, java.util.function.Consumer<?> validator)
@Deprecated default void addValidator(java.util.function.Consumer<?> validator)
void setTextSelectionEnabled(boolean value)
boolean isTextSelectionEnabled()
void setItemClickAction(Action action)
If such action is not set, the table responds to double click by trying to find and execute the following actions:
shortcut
propertyAction getItemClickAction()
void setEnterPressAction(Action action)
If such action is not set, the table responds to pressing Enter by trying to find and execute the following actions:
setItemClickAction(Action)
shortcut
propertyAction getEnterPressAction()
java.util.List<Table.Column> getNotCollapsedColumns()
void setSortable(boolean sortable)
boolean isSortable()
void setAutoScrolling(boolean autoScroll)
boolean isAutoScrolling()
void setAggregatable(boolean aggregatable)
boolean isAggregatable()
void setShowTotalAggregation(boolean showAggregation)
boolean isShowTotalAggregation()
void setColumnReorderingAllowed(boolean columnReorderingAllowed)
boolean getColumnReorderingAllowed()
void setColumnControlVisible(boolean columnCollapsingAllowed)
boolean getColumnControlVisible()
void requestFocus(E entity, java.lang.String columnId)
entity
- entitycolumnId
- column idvoid scrollTo(E entity)
entity
- entity@Deprecated void sortBy(java.lang.Object propertyId, boolean ascending)
sort(String, SortDirection)
methodtable.sortBy(table.getDatasource().getMetaClass().getPropertyPath("name"), ascending);
propertyId
- column indicated by a corresponding MetaPropertyPath
objectascending
- sort directionvoid sort(java.lang.String columnId, Table.SortDirection direction)
columnId
- id of the column to sortdirection
- sort direction@Nullable Table.SortInfo getSortInfo()
void selectAll()
boolean isMultiLineCells()
void setMultiLineCells(boolean multiLineCells)
boolean isContextMenuEnabled()
void setContextMenuEnabled(boolean contextMenuEnabled)
void setRowHeaderWidth(int width)
width
- width of row header column in pxint getRowHeaderWidth()
void setMultiSelect(boolean multiselect)
@Deprecated void refresh()
void repaint()
@Nullable default java.lang.Object getSubPart(java.lang.String name)
getSubPart
in interface ActionsHolder
getSubPart
in interface HasSubParts
void setEmptyStateMessage(java.lang.String message)
message
- message that appears when Table is emptyjava.lang.String getEmptyStateMessage()
void setEmptyStateLinkMessage(java.lang.String linkMessage)
linkMessage
- message that appears when Table is emptysetEmptyStateLinkClickHandler(Consumer)
java.lang.String getEmptyStateLinkMessage()
void setEmptyStateLinkClickHandler(java.util.function.Consumer<Table.EmptyStateClickEvent<E>> handler)
handler
- handler to setsetEmptyStateLinkMessage(String)
java.util.function.Consumer<Table.EmptyStateClickEvent<E>> getEmptyStateLinkClickHandler()
@Nullable java.lang.Float getMinHeight()
getMinHeight
in interface HasMinSize
min-height
CSS property value of the Table (not a composition) or null
if not set@Nullable SizeUnit getMinHeightSizeUnit()
getMinHeightSizeUnit
in interface HasMinSize
min-height
CSS property value of the Table (not a composition)void setMinHeight(@Nullable java.lang.String minHeight)
minHeight
CSS property value to the Table (not a composition). To set CSS properties to the
composition use css
attribute in the XML descriptor or
HtmlAttributes.applyCss(Component, String)
.setMinHeight
in interface HasMinSize
minHeight
- property value@Nullable java.lang.Float getMinWidth()
getMinWidth
in interface HasMinSize
min-width
CSS property value of the Table (not a composition) or null
if not set@Nullable SizeUnit getMinWidthSizeUnit()
getMinWidthSizeUnit
in interface HasMinSize
min-width
CSS property value of the Table (not a composition)void setMinWidth(@Nullable java.lang.String minWidth)
minWidth
CSS property value to the Table (not a composition). To set CSS properties to the
composition use css
attribute in the XML descriptor or
HtmlAttributes.applyCss(Component, String)
.setMinWidth
in interface HasMinSize
minWidth
- property value@Deprecated default void addColumnCollapsedListener(Table.ColumnCollapseListener columnCollapsedListener)
addColumnCollapseListener(Consumer)
insteadcolumnCollapsedListener
- a listener to add@Deprecated default void removeColumnCollapseListener(Table.ColumnCollapseListener columnCollapseListener)
addColumnCollapseListener(Consumer)
insteadcolumnCollapseListener
- a listener to removeSubscription addColumnCollapseListener(java.util.function.Consumer<Table.ColumnCollapseEvent> listener)
listener
- a listener to addSubscription
object@Deprecated void removeColumnCollapseListener(java.util.function.Consumer<Table.ColumnCollapseEvent> listener)
Subscription
insteadlistener
- a listener to removevoid setRowHeaderMode(Table.RowHeaderMode mode)
void setAggregationStyle(Table.AggregationStyle aggregationStyle)
Table.AggregationStyle getAggregationStyle()
void setStyleProvider(@Nullable Table.StyleProvider<? super E> styleProvider)
void addStyleProvider(Table.StyleProvider<? super E> styleProvider)
void removeStyleProvider(Table.StyleProvider<? super E> styleProvider)
void setIconProvider(java.util.function.Function<? super E,java.lang.String> iconProvider)
setRowHeaderWidth(int)
void setItemDescriptionProvider(@Nullable java.util.function.BiFunction<? super E,java.lang.String,java.lang.String> provider)
All unhandled exceptions from ItemDescriptionProvider in Web components by default are logged with ERROR level and not shown to users.
provider
- the item description provider to use or null
to remove a
previously set provider if any@Nullable java.util.function.BiFunction<? super E,java.lang.String,java.lang.String> getItemDescriptionProvider()
@Deprecated Datasource getItemDatasource(Entity item)
getInstanceContainer(Entity)
instead.
modelsTable.addGeneratedColumn(
"numberOfSeats",
new Table.ColumnGenerator<Model>() {
public Component generateCell(Model entity) {
LookupField lookupField = componentsFactory.createComponent(LookupField.NAME);
lookupField.setDatasource(modelsTable.getItemDatasource(entity), "numberOfSeats");
lookupField.setOptionsList(Arrays.asList(2, 4, 5));
lookupField.setWidth("100px");
return lookupField;
}
}
);
item
- entity itemInstanceContainer<E> getInstanceContainer(E item)
carsTable.addGeneratedColumn("name", car -> {
TextField<String> textField = uiComponents.create(TextField.NAME);
textField.setValueSource(new ContainerValueSource<>(carsTable.getInstanceContainer(car),"name"));
textField.setValue(car.getName());
return textField;
});
item
- entity itemvoid addGeneratedColumn(java.lang.String columnId, Table.ColumnGenerator<? super E> generator)
columnId
- column identifier as defined in XML descriptor. May or may not correspond to an entity property.generator
- column generator instancevoid addGeneratedColumn(java.lang.String columnId, int index, Table.ColumnGenerator<? super E> generator)
columnId
- column identifier as defined in XML descriptor. May correspond to an entity propertyindex
- index of a new columngenerator
- column generator instancevoid addGeneratedColumn(java.lang.String columnId, Table.ColumnGenerator<? super E> generator, java.lang.Class<? extends Component> componentClass)
columnId
- column identifier as defined in XML descriptor. May or may not correspond to an entity property.generator
- column generator instancecomponentClass
- class of components that generator will providevoid removeGeneratedColumn(java.lang.String columnId)
void addPrintable(java.lang.String columnId, Table.Printable<? super E,?> printable)
Table.Printable
representation for column. columnId
- column idprintable
- printable representationvoid removePrintable(java.lang.String columnId)
Table.Printable
representation of column. columnId
- column id@Nullable Table.Printable getPrintable(Table.Column column)
Table.Printable
representation for column.column
- table column@Nullable Table.Printable getPrintable(java.lang.String columnId)
Table.Printable
representation for column.columnId
- column id@Deprecated default void setClickListener(java.lang.String columnId, Table.CellClickListener<? super E> clickListener)
Table.Column.addClickListener(Consumer)
insteadcolumnId
- id of columnclickListener
- click listener@Deprecated void setCellClickListener(java.lang.String columnId, java.util.function.Consumer<Table.CellClickEvent<E>> clickListener)
Table.Column.addClickListener(Consumer)
insteadYou cannot use cellClickListener for column with maxTextLength attribute, since cellClickListener is already defined to display abbreviated cell text.
columnId
- id of columnclickListener
- cell text click listener@Deprecated void removeClickListener(java.lang.String columnId)
Subscription
insteadcolumnId
- id of columnvoid setAggregationDistributionProvider(Table.AggregationDistributionProvider<E> distributionProvider)
distributionProvider
- distribution providerTable.AggregationDistributionProvider<E> getAggregationDistributionProvider()
void showCustomPopup(Component popupComponent)
Table.CellClickListener
implementation.popupComponent
- popup contentvoid showCustomPopupActions(java.util.List<Action> actions)
Table.CellClickListener
implementation.actions
- actionsvoid setColumnHeaderVisible(boolean columnHeaderVisible)
boolean isColumnHeaderVisible()
void setShowSelection(boolean showSelection)
boolean isShowSelection()
Subscription addSelectionListener(java.util.function.Consumer<Table.SelectionEvent<E>> listener)
listener
- the listener to register