public interface Table<E extends Entity> extends ListComponent<E>, Component.Editable, Component.HasSettings, Component.HasButtonsPanel, Component.HasPresentations, Component.HasCaption, Component.HasIcon, Component.HasRowsCount, LookupComponent, Component.Focusable
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 interface |
Table.CellClickListener
Lightweight click listener for table cells.
|
static class |
Table.Column |
static class |
Table.ColumnAlignment |
static interface |
Table.ColumnCollapseListener |
static interface |
Table.ColumnGenerator<E extends Entity>
Allows rendering of an arbitrary
Component inside a table cell. |
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.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>
Component.ActionOwner, Component.ActionsHolder, Component.Alignment, Component.BelongToFrame, Component.Buffered, Component.ChildEditableController, Component.Collapsable, Component.Container, Component.ContextHelpIconClickEvent, Component.Disposable, Component.Editable, Component.EditableChangeEvent, Component.EditableChangeListener, Component.EditableChangeNotifier, Component.ExpandedStateChangeEvent, Component.ExpandedStateChangeListener, Component.Focusable, Component.HasBorder, Component.HasButtonsPanel, Component.HasCaption, Component.HasContextHelp, Component.HasFormatter, Component.HasIcon, Component.HasInputPrompt, Component.HasNamedComponents, Component.HasOptionsStyleProvider, Component.HasPresentations, Component.HasRowsCount, Component.HasSettings, Component.HasValue, Component.HasXmlDescriptor, Component.LayoutClickEvent, Component.LayoutClickListener, Component.LayoutClickNotifier, Component.Margin, Component.MouseEventDetails, Component.OptionsStyleProvider, Component.OrderedContainer, Component.OuterMargin, Component.SecuredActionsHolder, Component.ShortcutAction, Component.ShortcutNotifier, Component.ShortcutTriggeredEvent, Component.Spacing, Component.UiPermissionAware, Component.Validatable, Component.ValueChangeEvent, Component.ValueChangeListener, Component.Wrapper
LookupComponent.LookupSelectionChangeEvent, LookupComponent.LookupSelectionChangeListener, LookupComponent.LookupSelectionChangeNotifier
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
AUTO_SIZE, AUTO_SIZE_PX, UNITS_PERCENTAGE, UNITS_PIXELS
Modifier and Type | Method and Description |
---|---|
void |
addAggregationProperty(java.lang.String columnId,
AggregationInfo.Type type) |
void |
addAggregationProperty(Table.Column columnId,
AggregationInfo.Type type) |
void |
addColumn(Table.Column column) |
void |
addColumnCollapsedListener(Table.ColumnCollapseListener columnCollapsedListener) |
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. |
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. |
void |
addValidator(Field.Validator validator) |
void |
addValidator(Table.Column column,
Field.Validator validator) |
Table.AggregationDistributionProvider<E> |
getAggregationDistributionProvider() |
java.util.Map<java.lang.Object,java.lang.Object> |
getAggregationResults() |
Table.AggregationStyle |
getAggregationStyle() |
Table.Column |
getColumn(java.lang.String id) |
boolean |
getColumnControlVisible() |
boolean |
getColumnReorderingAllowed() |
java.util.List<Table.Column> |
getColumns() |
boolean |
getColumnSortable(java.lang.String columnId) |
boolean |
getColumnSortable(Table.Column column) |
Action |
getEnterPressAction() |
Action |
getItemClickAction() |
Datasource |
getItemDatasource(Entity item)
This method returns the datasource which contains the provided item.
|
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() |
boolean |
isAggregatable() |
boolean |
isAutoScrolling() |
boolean |
isColumnHeaderVisible() |
boolean |
isContextMenuEnabled() |
boolean |
isMultiLineCells() |
boolean |
isShowSelection() |
boolean |
isShowTotalAggregation() |
boolean |
isSortable() |
boolean |
isTextSelectionEnabled() |
void |
refresh()
Deprecated.
refresh datasource instead
|
void |
removeAggregationProperty(java.lang.String columnId) |
void |
removeClickListener(java.lang.String columnId)
Remove click listener.
|
void |
removeColumn(Table.Column column) |
void |
removeColumnCollapseListener(Table.ColumnCollapseListener columnCollapseListener) |
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 |
setClickListener(java.lang.String columnId,
Table.CellClickListener clickListener)
Add lightweight click handler for column cells.
Web specific: cell value will be wrapped in span with cuba-table-clickable-cell style name. You can use .cuba-table-clickable-cell for CSS rules to specify custom representation of cell value. |
void |
setColumnAlignment(java.lang.String columnId,
Table.ColumnAlignment alignment) |
void |
setColumnAlignment(Table.Column column,
Table.ColumnAlignment alignment) |
void |
setColumnCaption(java.lang.String columnId,
java.lang.String caption)
Assign caption for column in runtime.
|
void |
setColumnCaption(Table.Column column,
java.lang.String caption) |
void |
setColumnCollapsed(java.lang.String columnId,
boolean collapsed)
Show/hide column in runtime.
|
void |
setColumnCollapsed(Table.Column column,
boolean collapsed) |
void |
setColumnControlVisible(boolean columnCollapsingAllowed) |
void |
setColumnDescription(java.lang.String columnId,
java.lang.String description)
Assign description for column in runtime.
|
void |
setColumnDescription(Table.Column column,
java.lang.String description) |
void |
setColumnHeaderVisible(boolean columnHeaderVisible)
Set visibility for table header
|
void |
setColumnReorderingAllowed(boolean columnReorderingAllowed) |
void |
setColumnSortable(java.lang.String columnId,
boolean sortable) |
void |
setColumnSortable(Table.Column column,
boolean sortable) |
void |
setColumnWidth(java.lang.String columnId,
int width)
Set column width in runtime.
|
void |
setColumnWidth(Table.Column column,
int width) |
void |
setContextMenuEnabled(boolean contextMenuEnabled) |
void |
setDatasource(CollectionDatasource datasource) |
void |
setEnterPressAction(Action action)
Assign action to be executed on Enter key press.
|
void |
setIconProvider(ListComponent.IconProvider<? super E> 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 |
setMultiLineCells(boolean multiLineCells) |
void |
setMultiSelect(boolean multiselect) |
void |
setRequired(Table.Column 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 |
getDatasource, getSelected, getSingleSelected, isMultiSelect, setSelected, setSelected
getFrame, setFrame
addAction, addAction, getAction, getActionNN, getActions, removeAction, removeAction, removeAllActions
addStyleName, getAlignment, getDebugId, getHeight, getHeightUnits, getId, getParent, getStyleName, getWidth, getWidthUnits, isEnabled, isEnabledItself, isResponsive, isVisible, isVisibleItself, removeStyleName, requestFocus, setAlignment, setDebugId, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition
isEditable, isEditableWithParent, setEditable
getButtonsPanel, setButtonsPanel
applyPresentation, applyPresentationAsDefault, getDefaultPresentationId, getPresentations, isUsePresentations, loadPresentations, resetPresentation, usePresentations
applySettings, isSettingsEnabled, saveSettings, setSettingsEnabled
getCaption, getDescription, setCaption, setDescription
getIcon, setIcon, setIconFromSet
getRowsCount, setRowsCount
getLookupSelectedItems, setLookupSelectHandler
getTabIndex, isFocusable, setFocusable, setTabIndex
static final java.lang.String NAME
java.util.List<Table.Column> getColumns()
Table.Column getColumn(java.lang.String id)
void addColumn(Table.Column column)
void removeColumn(Table.Column column)
java.util.Map<java.lang.Object,java.lang.Object> getAggregationResults()
void setDatasource(CollectionDatasource datasource)
void setRequired(Table.Column column, boolean required, java.lang.String message)
void addValidator(Table.Column column, Field.Validator validator)
void addValidator(Field.Validator validator)
void setColumnCaption(java.lang.String columnId, java.lang.String caption)
void setColumnCaption(Table.Column column, java.lang.String caption)
void setTextSelectionEnabled(boolean value)
boolean isTextSelectionEnabled()
void setColumnDescription(java.lang.String columnId, java.lang.String description)
void setColumnDescription(Table.Column column, java.lang.String description)
void setColumnCollapsed(java.lang.String columnId, boolean collapsed)
void setColumnCollapsed(Table.Column column, boolean collapsed)
void setColumnWidth(java.lang.String columnId, int width)
void setColumnWidth(Table.Column column, int width)
void setColumnAlignment(java.lang.String columnId, Table.ColumnAlignment alignment)
void setColumnAlignment(Table.Column column, Table.ColumnAlignment alignment)
void addAggregationProperty(java.lang.String columnId, AggregationInfo.Type type)
void addAggregationProperty(Table.Column columnId, AggregationInfo.Type type)
void removeAggregationProperty(java.lang.String columnId)
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 setColumnSortable(java.lang.String columnId, boolean sortable)
boolean getColumnSortable(java.lang.String columnId)
void setColumnSortable(Table.Column column, boolean sortable)
boolean getColumnSortable(Table.Column column)
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)
IconProvider
is specified.width
- width of row header column in pxint getRowHeaderWidth()
void setMultiSelect(boolean multiselect)
@Deprecated void refresh()
void repaint()
void addColumnCollapsedListener(Table.ColumnCollapseListener columnCollapsedListener)
void removeColumnCollapseListener(Table.ColumnCollapseListener columnCollapseListener)
void 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(ListComponent.IconProvider<? super E> iconProvider)
setRowHeaderWidth(int)
Datasource getItemDatasource(Entity item)
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 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, 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 idvoid setClickListener(java.lang.String columnId, Table.CellClickListener clickListener)
columnId
- id of columnclickListener
- click listenervoid removeClickListener(java.lang.String columnId)
columnId
- 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()