Class Table
-
- All Implemented Interfaces:
Buffered,BufferedValidatable,Container,Container.ItemSetChangeListener,Container.ItemSetChangeNotifier,Container.Ordered,Container.PropertySetChangeListener,Container.PropertySetChangeNotifier,Container.Sortable,Container.Viewer,Property<Object>,Property.Editor,Property.ReadOnlyStatusChangeListener,Property.ReadOnlyStatusChangeNotifier,Property.ValueChangeListener,Property.ValueChangeNotifier,Property.Viewer,Validatable,Action.Container,Action.ShortcutNotifier,ConnectorEventListener,ContextClickEvent.ContextClickNotifier,DragSource,DropTarget,ItemClickEvent.ItemClickNotifier,MethodEventSource,ClientConnector,Sizeable,VariableOwner,Connector,Component,Component.Focusable,Field<Object>,HasChildMeasurementHint,HasComponents,LegacyComponent,Serializable,Iterable<Component>,EventListener
- Direct Known Subclasses:
TreeTable
public class Table extends AbstractSelect implements Action.Container, Container.Ordered, Container.Sortable, ItemClickEvent.ItemClickNotifier, DragSource, DropTarget, HasComponents, HasChildMeasurementHint
Tableis used for representing data or components in a pageable and selectable table.Scalability of the Table is largely dictated by the container. A table does not have a limit for the number of items and is just as fast with hundreds of thousands of items as with just a few. The current GWT implementation with scrolling however limits the number of rows to around 500000, depending on the browser and the pixel height of rows.
Components in a Table will not have their caption nor icon rendered.
- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTable.Alignstatic classTable.CacheUpdateExceptionException thrown when one or more exceptions occurred during updating of the Table cache.static interfaceTable.CellStyleGeneratorAllow to define specific style on cells (and rows) contents.static classTable.ColumnCollapseEventThis event is fired when the collapse state of a column changes.static interfaceTable.ColumnCollapseListenerInterface for listening to column collapse events.static interfaceTable.ColumnGeneratorUsed to create "generated columns"; columns that exist only in the Table, not in the underlying Container.static classTable.ColumnHeaderModestatic classTable.ColumnReorderEventThis event is fired when a columns are reordered by the end user user.static interfaceTable.ColumnReorderListenerInterface for listening to column reorder events.static classTable.ColumnResizeEventThis event is fired when a column is resized.static interfaceTable.ColumnResizeListenerInterface for listening to column resize events.static classTable.FooterClickEventClick event fired when clicking on the Table footers.static interfaceTable.FooterClickListenerInterface for the listener for column footer mouse click events.static classTable.GeneratedRowstatic classTable.HeaderClickEventClick event fired when clicking on the Table headers.static interfaceTable.HeaderClickListenerInterface for the listener for column header mouse click events.static interfaceTable.RowGeneratorRow generators can be used to replace certain items in a table with a generated string.static classTable.RowHeaderModestatic classTable.TableContextClickEventContextClickEvent for the Table Component.static classTable.TableDragModeModes that Table support as drag sourse.static classTable.TableDropCriterionLazy loading accept criterion for Table.classTable.TableTransferableConcrete implementation ofDataBoundTransferablefor data transferred from a table.-
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractSelect
AbstractSelect.AbstractSelectTargetDetails, AbstractSelect.AcceptItem, AbstractSelect.CaptionChangeListener, AbstractSelect.DefaultNewItemHandler, AbstractSelect.Filtering, AbstractSelect.ItemCaptionMode, AbstractSelect.ItemDescriptionGenerator, AbstractSelect.NewItemHandler, AbstractSelect.TargetItemIs, AbstractSelect.VerticalLocationIs
-
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
-
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered
Buffered.SourceException
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.data.Container
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeEvent, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Field
Field.ValueChangeEvent
-
Nested classes/interfaces inherited from interface com.vaadin.ui.HasChildMeasurementHint
HasChildMeasurementHint.ChildMeasurementHint
-
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.AbstractSelect
ITEM_CAPTION_MODE_EXPLICIT, ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID, ITEM_CAPTION_MODE_ICON_ONLY, ITEM_CAPTION_MODE_ID, ITEM_CAPTION_MODE_INDEX, ITEM_CAPTION_MODE_ITEM, ITEM_CAPTION_MODE_PROPERTY, itemIdMapper, items
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddActionHandler(Action.Handler actionHandler)Registers a new action handler for this containervoidaddColumnCollapseListener(Table.ColumnCollapseListener listener)Adds a column collapse listener to the Table.voidaddColumnReorderListener(Table.ColumnReorderListener listener)Adds a column reorder listener to the Table.voidaddColumnResizeListener(Table.ColumnResizeListener listener)Adds a column resize listener to the Table.booleanaddContainerProperty(Object propertyId, Class<?> type, Object defaultValue)Adds a new property to the table and show it as a visible column.booleanaddContainerProperty(Object propertyId, Class<?> type, Object defaultValue, String columnHeader, Resource columnIcon, Table.Align columnAlignment)Adds a new property to the table and show it as a visible column.voidaddFooterClickListener(Table.FooterClickListener listener)Adds a footer click listener which handles the click events when the user clicks on a column footer cell in the Table.voidaddGeneratedColumn(Object id, Table.ColumnGenerator generatedColumn)Adds a generated column to the Table.voidaddHeaderClickListener(Table.HeaderClickListener listener)Adds a header click listener which handles the click events when the user clicks on a column header cell in the Table.ObjectaddItem(Object[] cells, Object itemId)Adds the new row to table and fill the visible cells (except generated columns) with given values.ObjectaddItemAfter(Object previousItemId)Adds new item after the given item.ItemaddItemAfter(Object previousItemId, Object newItemId)Adds new item after the given item.voidaddItemClickListener(ItemClickEvent.ItemClickListener listener)Register a listener to handleItemClickEvents.voidaddListener(ItemClickEvent.ItemClickListener listener)Deprecated.As of 7.0, replaced byaddItemClickListener(ItemClickListener)voidaddListener(Table.ColumnReorderListener listener)Deprecated.As of 7.0, replaced byaddColumnReorderListener(ColumnReorderListener)voidaddListener(Table.ColumnResizeListener listener)Deprecated.As of 7.0, replaced byaddColumnResizeListener(ColumnResizeListener)voidaddListener(Table.FooterClickListener listener)Deprecated.As of 7.0, replaced byaddFooterClickListener(FooterClickListener)voidaddListener(Table.HeaderClickListener listener)Deprecated.As of 7.0, replaced byaddHeaderClickListener(HeaderClickListener)voidattach()Notifies the component that it is connected to an application.voidbeforeClientResponse(boolean initial)Called before the shared state and RPC invocations are sent to the client.protected voidbindPropertyToField(Object rowId, Object colId, Property property, Field field)Binds an item property to a field generated by TableFieldFactory.voidchangeVariables(Object source, Map<String,Object> variables)Invoked when the value of a variable has changed.voidcontainerItemSetChange(Container.ItemSetChangeEvent event)Container datasource item set change.voidcontainerPropertySetChange(Container.PropertySetChangeEvent event)Container datasource property set change.voiddetach()Notifies the component that it is detached from the applicationprotected booleandisableContentRefreshing()Go to mode where content updates are not done.protected voidenableContentRefreshing(boolean refreshContent)Go to mode where content content refreshing has effect.ObjectfirstItemId()Gets the ID of the first Item in the Container.protected StringformatPropertyValue(Object rowId, Object colId, Property<?> property)Formats table cell property values.protected intgetAddedRowCount()Subclass and override this to enable partial row additions, bypassing the normal caching mechanism.doublegetCacheRate()Table.CellStyleGeneratorgetCellStyleGenerator()Get the current cell style generator.HasChildMeasurementHint.ChildMeasurementHintgetChildMeasurementHint()Returns the current child size measurement hint.CollapseMenuContentgetCollapseMenuContent()Checks whether only collapsible columns are shown to the user in the column collapse menu.Table.AligngetColumnAlignment(Object propertyId)Gets the specified column's alignment.Table.Align[]getColumnAlignments()Gets the array of column alignments.floatgetColumnExpandRatio(Object propertyId)Gets the column expand ratio for a column.StringgetColumnFooter(Object propertyId)Gets the footer caption beneath the rowsTable.ColumnGeneratorgetColumnGenerator(Object columnId)Returns the ColumnGenerator used to generate the given column.StringgetColumnHeader(Object propertyId)Gets the header for the specified column.Table.ColumnHeaderModegetColumnHeaderMode()Getter for property columnHeaderMode.String[]getColumnHeaders()Gets the headers of the columns.ResourcegetColumnIcon(Object propertyId)Gets the icon Resource for the specified column.Resource[]getColumnIcons()Gets the icons of the columns.intgetColumnWidth(Object propertyId)Gets the pixel width of columnIterator<Component>getComponentIterator()Deprecated.As of 7.0, useiterator()instead.Converter<String,Object>getConverter(Object propertyId)Returns the converter used to format the given propertyId.ObjectgetCurrentPageFirstItemId()Getter for property currentPageFirstItem.intgetCurrentPageFirstItemIndex()Getter for property currentPageFirstItem.protected Collection<String>getCustomAttributes()Returns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)andAbstractComponent.writeDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)methods.Table.TableDragModegetDragMode()DropHandlergetDropHandler()protected intgetFirstAddedItemIndex()Subclass and override this to enable partial row additions, bypassing the normal caching mechanism.protected intgetFirstUpdatedItemIndex()Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism.protected ObjectgetIdByIndex(int index)Returns the item ID for the item represented by the index given.AbstractSelect.ItemDescriptionGeneratorgetItemDescriptionGenerator()Get the item description generator which generates tooltips for cells and rows in the Table.protected List<Object>getItemIds(int firstIndex, int rows)MultiSelectModegetMultiSelectMode()Returns the select mode in which multi-select is used.intgetPageLength()Gets the page length.protected ObjectgetPropertyValue(Object rowId, Object colId, Property property)Gets the value of property.Table.RowGeneratorgetRowGenerator()Table.RowHeaderModegetRowHeaderMode()Gets the row header mode.Collection<?>getSortableContainerPropertyIds()Gets the container property IDs, which can be used to sort the item.ObjectgetSortContainerPropertyId()Gets the currently sorted column property ID.protected TableStategetState()Returns the shared state bean with information to be sent from the server to the client.protected TableStategetState(boolean markAsDirty)Returns the shared state for this connector.TableFieldFactorygetTableFieldFactory()Gets the TableFieldFactory that is used to create editor for table cells.Table.TableTransferablegetTransferable(Map<String,Object> rawVariables)DragSource may convert data added by client side component to meaningful values for server side developer or add other data based on it.protected intgetUpdatedRowCount()Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism.Object[]getVisibleColumns()Gets the array of visible column id:s, including generated columns.Collection<?>getVisibleItemIds()Returns item identifiers of the items which are currently rendered on the client.protected booleanhasConverter(Object propertyId)Checks if there is a converter set explicitly for the given property id.protected intindexOfId(Object itemId)booleanisColumnCollapsed(Object propertyId)Checks if the specified column is collapsed.booleanisColumnCollapsible(Object propertyId)Checks if the given column is collapsible.booleanisColumnCollapsingAllowed()Checks if column collapsing is allowed.booleanisColumnReorderingAllowed()Checks if column reordering is allowed.booleanisEditable()Is table editable.booleanisFirstId(Object itemId)Tests if the Item corresponding to the given Item ID is the first Item in the Container.booleanisFooterVisible()Is the footer currently visible?booleanisLastId(Object itemId)Tests if the Item corresponding to the given Item ID is the last Item in the Container.booleanisMultiSelectTouchDetectionEnabled()Returns if touch screen detection is used to toggle multi select mode.protected booleanisPartialRowUpdate()Subclass and override this to enable partial row updates and additions, which bypass the normal caching mechanism.protected booleanisRowCacheInvalidated()booleanisSelectable()Returns whether table is selectable.booleanisSortAscending()Is the table currently sorted in ascending order.booleanisSortDisabled()Deprecated.As of 7.0, useisSortEnabled()insteadbooleanisSortEnabled()Checks if sorting is enabled.Iterator<Component>iterator()Gets an iterator to the collection of contained components.ObjectlastItemId()Gets the ID of the last Item in the Container.voidmarkAsDirty()Requests that the Table should be repainted as soon as possible.voidmarkAsDirtyRecursive()Causes this connector and all connectors below it to be marked as dirty.ObjectnextItemId(Object itemId)Gets the ID of the Item following the Item that corresponds to itemId.voidpaintContent(PaintTarget target)Paints the content of this component.protected voidpaintRowAttributes(PaintTarget target, Object itemId)A method where extended Table implementations may add their custom attributes for rows.protected voidpaintRowHeader(PaintTarget target, Object[][] cells, int indexInRowbuffer)protected voidpaintRowIcon(PaintTarget target, Object[][] cells, int indexInRowbuffer)ObjectprevItemId(Object itemId)Gets the ID of the Item preceding the Item that corresponds to the itemId.protected voidreadBody(org.jsoup.nodes.Element design, DesignContext context)voidreadDesign(org.jsoup.nodes.Element design, DesignContext context)Reads the component state from the given design.protected ObjectreadItem(org.jsoup.nodes.Element tr, Set<String> selected, DesignContext context)Reads an Item from a design and inserts it into the data source.protected voidreadItems(org.jsoup.nodes.Element design, DesignContext context)protected voidrefreshRenderedCells()Refreshes the rows in the internal cache.voidrefreshRowCache()Discards and recreates the internal row cache.protected voidregisterComponent(Component component)voidremoveActionHandler(Action.Handler actionHandler)Removes a previously registered action handler for the contents of this container.voidremoveAllActionHandlers()Removes all action handlersbooleanremoveAllItems()Removes all Items from the Container.voidremoveColumnCollapseListener(Table.ColumnCollapseListener listener)Removes a column reorder listener from the Table.voidremoveColumnReorderListener(Table.ColumnReorderListener listener)Removes a column reorder listener from the Table.voidremoveColumnResizeListener(Table.ColumnResizeListener listener)Removes a column resize listener from the Table.booleanremoveContainerProperty(Object propertyId)Removes a Property specified by the given Property ID from the Container.voidremoveFooterClickListener(Table.FooterClickListener listener)Removes a footer click listenerbooleanremoveGeneratedColumn(Object columnId)Removes a generated column previously added with addGeneratedColumn.voidremoveHeaderClickListener(Table.HeaderClickListener listener)Removes a header click listenerbooleanremoveItem(Object itemId)Removes the Item identified byItemIdfrom the Container.voidremoveItemClickListener(ItemClickEvent.ItemClickListener listener)Removes an ItemClickListener.voidremoveListener(ItemClickEvent.ItemClickListener listener)Deprecated.As of 7.0, replaced byremoveItemClickListener(ItemClickListener)voidremoveListener(Table.ColumnReorderListener listener)Deprecated.As of 7.0, replaced byremoveColumnReorderListener(ColumnReorderListener)voidremoveListener(Table.ColumnResizeListener listener)Deprecated.As of 7.0, replaced byremoveColumnResizeListener(ColumnResizeListener)voidremoveListener(Table.FooterClickListener listener)Deprecated.As of 7.0, replaced byremoveFooterClickListener(FooterClickListener)voidremoveListener(Table.HeaderClickListener listener)Deprecated.As of 7.0, replaced byremoveHeaderClickListener(HeaderClickListener)voidrequestRepaint()Deprecated.As of 7.0, usemarkAsDirty()insteadprotected voidresetPageBuffer()Clears the current page buffer.protected booleanrowHeadersAreEnabled()Checks whether row headers are visible.voidsetCacheRate(double cacheRate)This method adjusts a possible caching mechanism of table implementation.voidsetCellStyleGenerator(Table.CellStyleGenerator cellStyleGenerator)Set cell style generator for Table.voidsetChildMeasurementHint(HasChildMeasurementHint.ChildMeasurementHint hint)Sets desired child size measurement hint.voidsetCollapseMenuContent(CollapseMenuContent content)Sets whether only collapsible columns should be shown to the user in the column collapse menu.voidsetColumnAlignment(Object propertyId, Table.Align alignment)Sets the specified column's alignment.voidsetColumnAlignments(Table.Align... columnAlignments)Sets the column alignments.voidsetColumnCollapsed(Object propertyId, boolean collapsed)Sets whether the specified column is collapsed or not.voidsetColumnCollapsible(Object propertyId, boolean collapsible)Sets whether the given column is collapsible.voidsetColumnCollapsingAllowed(boolean collapsingAllowed)Sets whether column collapsing is allowed or not.voidsetColumnExpandRatio(Object propertyId, float expandRatio)Sets the column expand ratio for given column.voidsetColumnFooter(Object propertyId, String footer)Sets the column footer caption.voidsetColumnHeader(Object propertyId, String header)Sets the column header for the specified column;voidsetColumnHeaderMode(Table.ColumnHeaderMode columnHeaderMode)Setter for property columnHeaderMode.voidsetColumnHeaders(String... columnHeaders)Sets the headers of the columns.voidsetColumnIcon(Object propertyId, Resource icon)Sets the icon Resource for the specified column.voidsetColumnIcons(Resource... columnIcons)Sets the icons of the columns.voidsetColumnReorderingAllowed(boolean columnReorderingAllowed)Sets whether column reordering is allowed or not.voidsetColumnWidth(Object propertyId, int width)Sets columns width (in pixels).voidsetContainerDataSource(Container newDataSource)Sets the Container that serves as the data source of the viewer.voidsetContainerDataSource(Container newDataSource, Collection<?> visibleIds)Sets the container data source and the columns that will be visible.voidsetConverter(Object propertyId, Converter<String,?> converter)Sets a converter for a property id.voidsetCurrentPageFirstItemId(Object currentPageFirstItemId)Setter for property currentPageFirstItemId.voidsetCurrentPageFirstItemIndex(int newIndex)Setter for property currentPageFirstItem.voidsetDragMode(Table.TableDragMode newDragMode)Sets the drag start mode of the Table.voidsetDropHandler(DropHandler dropHandler)voidsetEditable(boolean editable)Sets the editable property.voidsetEnabled(boolean enabled)Enables or disables the component.voidsetFooterVisible(boolean visible)Sets the footer visible in the bottom of the table.voidsetItemDescriptionGenerator(AbstractSelect.ItemDescriptionGenerator generator)Set the item description generator which generates tooltips for cells and rows in the TablevoidsetMultiSelectMode(MultiSelectMode mode)Sets the behavior of how the multi-select mode should behave when the table is both selectable and in multi-select mode.voidsetMultiSelectTouchDetectionEnabled(boolean multiSelectTouchDetectionEnabled)Default behavior on touch-reporting devices is to switch from CTRL/SHIFT based multi-selection to simple mode, but you can use this method to explicitly disable the touch device detection.voidsetNewItemsAllowed(boolean allowNewOptions)Adding new items is not supported.voidsetPageLength(int pageLength)Sets the page length.voidsetRowGenerator(Table.RowGenerator generator)Assigns a row generator to the table.voidsetRowHeaderMode(Table.RowHeaderMode mode)Sets the row header mode.voidsetSelectable(boolean selectable)Setter for property selectable.voidsetSortAscending(boolean ascending)Sets the table in ascending order.voidsetSortContainerPropertyId(Object propertyId)Sets the currently sorted column property id.voidsetSortDisabled(boolean sortDisabled)Deprecated.As of 7.0, usesetSortEnabled(boolean)insteadvoidsetSortEnabled(boolean sortEnabled)Enables or disables sorting.voidsetTableFieldFactory(TableFieldFactory fieldFactory)Sets the TableFieldFactory that is used to create editor for table cells.voidsetVisible(boolean visible)Sets the visibility of the component.voidsetVisibleColumns(Object... visibleColumns)Sets the array of visible column property id:s.protected booleanshouldHideAddedRows()Subclass and override this to enable removing of rows, bypassing the normal caching and lazy loading mechanism.voidsort()Sorts the table by currently selected sorting column.voidsort(Object[] propertyId, boolean[] ascending)Sorts the table.AbstractSelect.AbstractSelectTargetDetailstranslateDropTargetDetails(Map<String,Object> clientVariables)Called before theDragAndDropEventis passed toDropHandler.protected voidunregisterComponent(Component component)This method cleans up a Component that has been generated when Table is in editable mode.voidvalueChange(Property.ValueChangeEvent event)Notifies this listener that the Property's value has changed.voidwriteDesign(org.jsoup.nodes.Element design, DesignContext context)Writes the component state to the given design.protected org.jsoup.nodes.ElementwriteItem(org.jsoup.nodes.Element tbody, Object itemId, DesignContext context)Writes a data source Item to a design.protected voidwriteItems(org.jsoup.nodes.Element design, DesignContext context)Writes the data source items to a design.-
Methods inherited from class com.vaadin.ui.AbstractSelect
addItem, addItem, addItems, addItems, addItemSetChangeListener, addListener, addListener, addPropertySetChangeListener, containsId, fireItemSetChange, firePropertySetChange, getCaptionChangeListener, getContainerDataSource, getContainerProperty, getContainerPropertyIds, getItem, getItemCaption, getItemCaptionMode, getItemCaptionPropertyId, getItemIcon, getItemIconPropertyId, getItemIds, getListeners, getNewItemHandler, getNullSelectionItemId, getType, getType, getValue, isEmpty, isMultiSelect, isNewItemsAllowed, isNullSelectionAllowed, isSelected, paintItem, removeItemSetChangeListener, removeListener, removeListener, removePropertySetChangeListener, sanitizeSelection, select, setItemCaption, setItemCaptionMode, setItemCaptionPropertyId, setItemIcon, setItemIconPropertyId, setMultiSelect, setNewItemHandler, setNullSelectionAllowed, setNullSelectionItemId, setValue, setValue, size, unselect
-
Methods inherited from class com.vaadin.ui.AbstractField
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, clear, commit, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, isBuffered, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, shouldHideErrors, toString, validate, validate
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setWidth, setWidth, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier
addShortcutListener, removeShortcutListener
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, removeAttachListener, removeDetachListener, removeExtension, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.data.Container
addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, size
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
-
Methods inherited from interface com.vaadin.server.VariableOwner
isEnabled, isImmediate
-
-
-
-
Field Detail
-
CELL_KEY
protected static final int CELL_KEY
- See Also:
- Constant Field Values
-
CELL_HEADER
protected static final int CELL_HEADER
- See Also:
- Constant Field Values
-
CELL_ICON
protected static final int CELL_ICON
- See Also:
- Constant Field Values
-
CELL_ITEMID
protected static final int CELL_ITEMID
- See Also:
- Constant Field Values
-
CELL_GENERATED_ROW
protected static final int CELL_GENERATED_ROW
- See Also:
- Constant Field Values
-
CELL_FIRSTCOL
protected static final int CELL_FIRSTCOL
- See Also:
- Constant Field Values
-
ALIGN_LEFT
@Deprecated public static final Table.Align ALIGN_LEFT
Deprecated.As of 7.0, useTable.Align.LEFTinstead
-
ALIGN_CENTER
@Deprecated public static final Table.Align ALIGN_CENTER
Deprecated.As of 7.0, useTable.Align.CENTERinstead
-
ALIGN_RIGHT
@Deprecated public static final Table.Align ALIGN_RIGHT
Deprecated.As of 7.0, useTable.Align.RIGHTinstead
-
COLUMN_HEADER_MODE_HIDDEN
@Deprecated public static final Table.ColumnHeaderMode COLUMN_HEADER_MODE_HIDDEN
Deprecated.As of 7.0, useTable.ColumnHeaderMode.HIDDENinstead
-
COLUMN_HEADER_MODE_ID
@Deprecated public static final Table.ColumnHeaderMode COLUMN_HEADER_MODE_ID
Deprecated.As of 7.0, useTable.ColumnHeaderMode.IDinstead
-
COLUMN_HEADER_MODE_EXPLICIT
@Deprecated public static final Table.ColumnHeaderMode COLUMN_HEADER_MODE_EXPLICIT
Deprecated.As of 7.0, useTable.ColumnHeaderMode.EXPLICITinstead
-
COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID
@Deprecated public static final Table.ColumnHeaderMode COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID
Deprecated.As of 7.0, useTable.ColumnHeaderMode.EXPLICIT_DEFAULTS_IDinstead
-
ROW_HEADER_MODE_HIDDEN
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_HIDDEN
Deprecated.As of 7.0, useTable.RowHeaderMode.HIDDENinstead
-
ROW_HEADER_MODE_ID
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_ID
Deprecated.As of 7.0, useTable.RowHeaderMode.IDinstead
-
ROW_HEADER_MODE_ITEM
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_ITEM
Deprecated.As of 7.0, useTable.RowHeaderMode.ITEMinstead
-
ROW_HEADER_MODE_INDEX
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_INDEX
Deprecated.As of 7.0, useTable.RowHeaderMode.INDEXinstead
-
ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID
Deprecated.As of 7.0, useTable.RowHeaderMode.EXPLICIT_DEFAULTS_IDinstead
-
ROW_HEADER_MODE_EXPLICIT
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_EXPLICIT
Deprecated.As of 7.0, useTable.RowHeaderMode.EXPLICITinstead
-
ROW_HEADER_MODE_ICON_ONLY
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_ICON_ONLY
Deprecated.As of 7.0, useTable.RowHeaderMode.ICON_ONLYinstead
-
ROW_HEADER_MODE_PROPERTY
@Deprecated public static final Table.RowHeaderMode ROW_HEADER_MODE_PROPERTY
Deprecated.As of 7.0, useTable.RowHeaderMode.PROPERTYinstead
-
alwaysRecalculateColumnWidths
protected boolean alwaysRecalculateColumnWidths
-
-
Constructor Detail
-
Table
public Table()
Creates a new empty table.
-
Table
public Table(String caption)
Creates a new empty table with caption.- Parameters:
caption-
-
-
Method Detail
-
getVisibleColumns
public Object[] getVisibleColumns()
Gets the array of visible column id:s, including generated columns.The columns are show in the order of their appearance in this array.
- Returns:
- an array of currently visible propertyIds and generated column ids.
-
setVisibleColumns
public void setVisibleColumns(Object... visibleColumns)
Sets the array of visible column property id:s.The columns are show in the order of their appearance in this array.
- Parameters:
visibleColumns- the Array of shown property id:s.
-
getColumnHeaders
public String[] getColumnHeaders()
Gets the headers of the columns.The headers match the property id:s given by the set visible column headers. The table must be set in either
COLUMN_HEADER_MODE_EXPLICITorCOLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_IDmode to show the headers. In the defaults mode any nulls in the headers array are replaced with id.toString().- Returns:
- the Array of column headers.
-
setColumnHeaders
public void setColumnHeaders(String... columnHeaders)
Sets the headers of the columns.The headers match the property id:s given by the set visible column headers. The table must be set in either
COLUMN_HEADER_MODE_EXPLICITorCOLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_IDmode to show the headers. In the defaults mode any nulls in the headers array are replaced with id.toString() outputs when rendering.- Parameters:
columnHeaders- the Array of column headers that match thegetVisibleColumns()method.
-
getColumnIcons
public Resource[] getColumnIcons()
Gets the icons of the columns.The icons in headers match the property id:s given by the set visible column headers. The table must be set in either
COLUMN_HEADER_MODE_EXPLICITorCOLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_IDmode to show the headers with icons.- Returns:
- the Array of icons that match the
getVisibleColumns().
-
setColumnIcons
public void setColumnIcons(Resource... columnIcons)
Sets the icons of the columns.The icons in headers match the property id:s given by the set visible column headers. The table must be set in either
COLUMN_HEADER_MODE_EXPLICITorCOLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_IDmode to show the headers with icons.- Parameters:
columnIcons- the Array of icons that match thegetVisibleColumns().
-
getColumnAlignments
public Table.Align[] getColumnAlignments()
Gets the array of column alignments.The items in the array must match the properties identified by
getVisibleColumns(). The possible values for the alignments include:Table.Align.LEFT: Left alignmentTable.Align.CENTER: CenteredTable.Align.RIGHT: Right alignment
Table.Align.LEFT: any null values are rendered as align lefts.- Returns:
- the Column alignments array.
-
setColumnAlignments
public void setColumnAlignments(Table.Align... columnAlignments)
Sets the column alignments.The amount of items in the array must match the amount of properties identified by
getVisibleColumns(). The possible values for the alignments include:Table.Align.LEFT: Left alignmentTable.Align.CENTER: CenteredTable.Align.RIGHT: Right alignment
Table.Align.LEFT- Parameters:
columnAlignments- the Column alignments array.
-
setColumnWidth
public void setColumnWidth(Object propertyId, int width)
Sets columns width (in pixels). Theme may not necessarily respect very small or very big values. Setting width to -1 (default) means that theme will make decision of width.Column can either have a fixed width or expand ratio. The latter one set is used. See @link
setColumnExpandRatio(Object, float).- Parameters:
propertyId- columns property idwidth- width to be reserved for columns content- Since:
- 4.0.3
-
setColumnExpandRatio
public void setColumnExpandRatio(Object propertyId, float expandRatio)
Sets the column expand ratio for given column.Expand ratios can be defined to customize the way how excess space is divided among columns. Table can have excess space if it has its width defined and there is horizontally more space than columns consume naturally. Excess space is the space that is not used by columns with explicit width (see
setColumnWidth(Object, int)) or with natural width (no width nor expand ratio).By default (without expand ratios) the excess space is divided proportionally to columns natural widths.
Only expand ratios of visible columns are used in final calculations.
Column can either have a fixed width or expand ratio. The latter one set is used.
A column with expand ratio is considered to be minimum width by default (if no excess space exists). The minimum width is defined by terminal implementation.
If terminal implementation supports re-sizable columns the column becomes fixed width column if users resizes the column.
- Parameters:
propertyId- columns property idexpandRatio- the expandRatio used to divide excess space for this column
-
getColumnExpandRatio
public float getColumnExpandRatio(Object propertyId)
Gets the column expand ratio for a column. SeesetColumnExpandRatio(Object, float)- Parameters:
propertyId- columns property id- Returns:
- the expandRatio used to divide excess space for this column
-
getColumnWidth
public int getColumnWidth(Object propertyId)
Gets the pixel width of column- Parameters:
propertyId-- Returns:
- width of column or -1 when value not set
-
getPageLength
public int getPageLength()
Gets the page length.Setting page length 0 disables paging.
- Returns:
- the Length of one page.
-
setPageLength
public void setPageLength(int pageLength)
Sets the page length.Setting page length 0 disables paging. The page length defaults to 15.
If Table has height set (
AbstractComponent.setHeight(float, Unit)) the client side may update the page length automatically the correct value.- Parameters:
pageLength- the length of one page.
-
setCacheRate
public void setCacheRate(double cacheRate)
This method adjusts a possible caching mechanism of table implementation.Table component may fetch and render some rows outside visible area. With complex tables (for example containing layouts and components), the client side may become unresponsive. Setting the value lower, UI will become more responsive. With higher values scrolling in client will hit server less frequently.
The amount of cached rows will be cacheRate multiplied with pageLength (
setPageLength(int)both below and above visible area..- Parameters:
cacheRate- a value over 0 (fastest rendering time). Higher value will cache more rows on server (smoother scrolling). Default value is 2.
-
getCacheRate
public double getCacheRate()
- Returns:
- the current cache rate value
- See Also:
setCacheRate(double)
-
getCurrentPageFirstItemId
public Object getCurrentPageFirstItemId()
Getter for property currentPageFirstItem.- Returns:
- the Value of property currentPageFirstItem.
-
getIdByIndex
protected Object getIdByIndex(int index)
Returns the item ID for the item represented by the index given. Assumes that the current container implementsContainer.Indexed. SeeContainer.Indexed.getIdByIndex(int)for more information about the exceptions that can be thrown.- Parameters:
index- the index for which the item ID should be fetched- Returns:
- the item ID for the given index
- Throws:
ClassCastException- if container does not implementContainer.IndexedIndexOutOfBoundsException- thrown byContainer.Indexed.getIdByIndex(int)if the index is invalid
-
setCurrentPageFirstItemId
public void setCurrentPageFirstItemId(Object currentPageFirstItemId)
Setter for property currentPageFirstItemId.- Parameters:
currentPageFirstItemId- the New value of property currentPageFirstItemId.
-
indexOfId
protected int indexOfId(Object itemId)
-
getColumnIcon
public Resource getColumnIcon(Object propertyId)
Gets the icon Resource for the specified column.- Parameters:
propertyId- the propertyId identifying the column.- Returns:
- the icon for the specified column; null if the column has no icon set, or if the column is not visible.
-
setColumnIcon
public void setColumnIcon(Object propertyId, Resource icon)
Sets the icon Resource for the specified column.Throws IllegalArgumentException if the specified column is not visible.
- Parameters:
propertyId- the propertyId identifying the column.icon- the icon Resource to set.
-
getColumnHeader
public String getColumnHeader(Object propertyId)
Gets the header for the specified column.- Parameters:
propertyId- the propertyId identifying the column.- Returns:
- the header for the specified column if it has one.
-
setColumnHeader
public void setColumnHeader(Object propertyId, String header)
Sets the column header for the specified column;- Parameters:
propertyId- the propertyId identifying the column.header- the header to set.
-
getColumnAlignment
public Table.Align getColumnAlignment(Object propertyId)
Gets the specified column's alignment.- Parameters:
propertyId- the propertyID identifying the column.- Returns:
- the specified column's alignment if it as one;
Table.Align.LEFTotherwise.
-
setColumnAlignment
public void setColumnAlignment(Object propertyId, Table.Align alignment)
Sets the specified column's alignment.Throws IllegalArgumentException if the alignment is not one of the following:
Table.Align.LEFT,Table.Align.CENTERorTable.Align.RIGHT- Parameters:
propertyId- the propertyID identifying the column.alignment- the desired alignment.
-
isColumnCollapsed
public boolean isColumnCollapsed(Object propertyId)
Checks if the specified column is collapsed.- Parameters:
propertyId- the propertyID identifying the column.- Returns:
- true if the column is collapsed; false otherwise;
-
setColumnCollapsed
public void setColumnCollapsed(Object propertyId, boolean collapsed) throws IllegalStateException
Sets whether the specified column is collapsed or not.- Parameters:
propertyId- the propertyID identifying the column.collapsed- the desired collapsedness.- Throws:
IllegalStateException- if column collapsing is not allowedIllegalArgumentException- if the property id does not exist
-
isColumnCollapsingAllowed
public boolean isColumnCollapsingAllowed()
Checks if column collapsing is allowed.- Returns:
- true if columns can be collapsed; false otherwise.
-
setColumnCollapsingAllowed
public void setColumnCollapsingAllowed(boolean collapsingAllowed)
Sets whether column collapsing is allowed or not.- Parameters:
collapsingAllowed- specifies whether column collapsing is allowed.
-
setColumnCollapsible
public void setColumnCollapsible(Object propertyId, boolean collapsible)
Sets whether the given column is collapsible. Note that collapsible columns can only be actually collapsed (via UI or withsetColumnCollapsed()) ifisColumnCollapsingAllowed()is true. By default all columns are collapsible.- Parameters:
propertyId- the propertyID identifying the column.collapsible- true if the column should be collapsible, false otherwise.
-
isColumnCollapsible
public boolean isColumnCollapsible(Object propertyId)
Checks if the given column is collapsible. Note that even if this method returnstrue, the column can only be actually collapsed (via UI or withsetColumnCollapsed()) ifisColumnCollapsingAllowed()is also true.- Returns:
- true if the column can be collapsed; false otherwise.
-
isColumnReorderingAllowed
public boolean isColumnReorderingAllowed()
Checks if column reordering is allowed.- Returns:
- true if columns can be reordered; false otherwise.
-
setColumnReorderingAllowed
public void setColumnReorderingAllowed(boolean columnReorderingAllowed)
Sets whether column reordering is allowed or not.- Parameters:
columnReorderingAllowed- specifies whether column reordering is allowed.
-
getCurrentPageFirstItemIndex
public int getCurrentPageFirstItemIndex()
Getter for property currentPageFirstItem.- Returns:
- the Value of property currentPageFirstItem.
-
setCurrentPageFirstItemIndex
public void setCurrentPageFirstItemIndex(int newIndex)
Setter for property currentPageFirstItem.- Parameters:
newIndex- the New value of property currentPageFirstItem.
-
isSelectable
public boolean isSelectable()
Returns whether table is selectable.The table is not selectable until it's explicitly set as selectable or at least one
Property.ValueChangeListeneris added.- Returns:
- whether table is selectable.
-
setSelectable
public void setSelectable(boolean selectable)
Setter for property selectable.The table is not selectable until it's explicitly set as selectable via this method or alternatively at least one
Property.ValueChangeListeneris added.- Parameters:
selectable- the New value of property selectable.
-
getColumnHeaderMode
public Table.ColumnHeaderMode getColumnHeaderMode()
Getter for property columnHeaderMode.- Returns:
- the Value of property columnHeaderMode.
-
setColumnHeaderMode
public void setColumnHeaderMode(Table.ColumnHeaderMode columnHeaderMode)
Setter for property columnHeaderMode.- Parameters:
columnHeaderMode- the New value of property columnHeaderMode.
-
refreshRenderedCells
protected void refreshRenderedCells()
Refreshes the rows in the internal cache. Only ifresetPageBuffer()is called before this then all values are guaranteed to be recreated.
-
requestRepaint
@Deprecated public void requestRepaint()
Deprecated.As of 7.0, usemarkAsDirty()insteadRequests that the Table should be repainted as soon as possible. Note that aTabledoes not necessarily repaint its contents when this method has been called. SeerefreshRowCache()for forcing an update of the contents.- Specified by:
requestRepaintin interfaceClientConnector- Overrides:
requestRepaintin classAbstractClientConnector
-
markAsDirty
public void markAsDirty()
Requests that the Table should be repainted as soon as possible. Note that aTabledoes not necessarily repaint its contents when this method has been called. SeerefreshRowCache()for forcing an update of the contents.- Specified by:
markAsDirtyin interfaceClientConnector- Specified by:
markAsDirtyin interfaceLegacyComponent- Overrides:
markAsDirtyin classAbstractClientConnector- See Also:
ClientConnector.markAsDirty()
-
markAsDirtyRecursive
public void markAsDirtyRecursive()
Description copied from interface:ClientConnectorCauses this connector and all connectors below it to be marked as dirty.This should only be used in special cases, e.g when the state of a descendant depends on the state of an ancestor.
- Specified by:
markAsDirtyRecursivein interfaceClientConnector- Overrides:
markAsDirtyRecursivein classAbstractClientConnector- See Also:
ClientConnector.markAsDirty()
-
registerComponent
protected void registerComponent(Component component)
-
unregisterComponent
protected void unregisterComponent(Component component)
This method cleans up a Component that has been generated when Table is in editable mode. The component needs to be detached from its parent and if it is a field, it needs to be detached from its property data source in order to allow garbage collection to take care of removing the unused component from memory. Override this method and getPropertyValue(Object, Object, Property) with custom logic if you need to deal with buffered fields.- Parameters:
component- component that should be unregistered.- See Also:
getPropertyValue(Object, Object, Property)
-
setRowHeaderMode
public void setRowHeaderMode(Table.RowHeaderMode mode)
Sets the row header mode.The mode can be one of the following ones:
ROW_HEADER_MODE_HIDDEN: The row captions are hidden.ROW_HEADER_MODE_ID: Items Id-objectstoString()is used as row caption.ROW_HEADER_MODE_ITEM: Item-objectstoString()is used as row caption.ROW_HEADER_MODE_PROPERTY: Property set withAbstractSelect.setItemCaptionPropertyId(Object)is used as row header.ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID: Items Id-objectstoString()is used as row header. If caption is explicitly specified, it overrides the id-caption.ROW_HEADER_MODE_EXPLICIT: The row headers must be explicitly specified.ROW_HEADER_MODE_INDEX: The index of the item is used as row caption. The index mode can only be used with the containers implementingContainer.Indexedinterface.
ROW_HEADER_MODE_HIDDEN- Parameters:
mode- the One of the modes listed above.
-
getRowHeaderMode
public Table.RowHeaderMode getRowHeaderMode()
Gets the row header mode.- Returns:
- the Row header mode.
- See Also:
setRowHeaderMode(com.vaadin.ui.Table.RowHeaderMode)
-
addItem
public Object addItem(Object[] cells, Object itemId) throws UnsupportedOperationException
Adds the new row to table and fill the visible cells (except generated columns) with given values.- Parameters:
cells- the Object array that is used for filling the visible cells new row. The types must be settable to visible column property types.itemId- the Id the new row. If null, a new id is automatically assigned. If given, the table cannot already have a item with given id.- Returns:
- Returns item id for the new row. Returns null if operation fails.
- Throws:
UnsupportedOperationException
-
refreshRowCache
public void refreshRowCache()
Discards and recreates the internal row cache. Call this if you make changes that affect the rows but the information about the changes are not automatically propagated to the Table.Do not call this e.g. if you have updated the data model through a Property. These types of changes are automatically propagated to the Table.
A typical case when this is needed is if you update a generator (e.g. CellStyleGenerator) and want to ensure that the rows are redrawn with new styles.
Note that calling this method is not cheap so avoid calling it unnecessarily.
- Since:
- 6.7.2
-
setContainerDataSource
public void setContainerDataSource(Container newDataSource)
Sets the Container that serves as the data source of the viewer. As a side-effect the table's selection value is set to null as the old selection might not exist in new Container.
All rows and columns are generated as visible using this method. If the new container contains properties that are not meant to be shown you should usesetContainerDataSource(Container, Collection)instead, especially if the table is editable.Keeps propertyValueConverters if the corresponding id exists in the new data source and is of a compatible type.
- Specified by:
setContainerDataSourcein interfaceContainer.Viewer- Overrides:
setContainerDataSourcein classAbstractSelect- Parameters:
newDataSource- the new data source.- See Also:
Container.Viewer.setContainerDataSource(Container)
-
setContainerDataSource
public void setContainerDataSource(Container newDataSource, Collection<?> visibleIds)
Sets the container data source and the columns that will be visible. Columns are shown in the collection's iteration order.Keeps propertyValueConverters if the corresponding id exists in the new data source and is of a compatible type.
- Parameters:
newDataSource- the new data source.visibleIds- IDs of the visible columns- See Also:
setContainerDataSource(Container),setVisibleColumns(Object[]),Table#setConverter(Object, Converter)
-
changeVariables
public void changeVariables(Object source, Map<String,Object> variables)
Invoked when the value of a variable has changed.- Specified by:
changeVariablesin interfaceVariableOwner- Overrides:
changeVariablesin classAbstractSelect- Parameters:
source- the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.variables- the Mapping from variable names to new variable values.- See Also:
ComboBox.changeVariables(java.lang.Object, java.util.Map)
-
disableContentRefreshing
protected boolean disableContentRefreshing()
Go to mode where content updates are not done. This is due we want to bypass expensive content for some reason (like when we know we may have other content changes on their way).- Returns:
- true if content refresh flag was enabled prior this call
-
enableContentRefreshing
protected void enableContentRefreshing(boolean refreshContent)
Go to mode where content content refreshing has effect.- Parameters:
refreshContent- true if content refresh needs to be done
-
beforeClientResponse
public void beforeClientResponse(boolean initial)
Description copied from interface:ClientConnectorCalled before the shared state and RPC invocations are sent to the client. Gives the connector an opportunity to set computed/dynamic state values or to invoke last minute RPC methods depending on other component features.- Specified by:
beforeClientResponsein interfaceClientConnector- Overrides:
beforeClientResponsein classAbstractField<Object>- Parameters:
initial-trueif the client-side connector will be created and initialized after this method has been invoked.falseif there is already an initialized client-side connector.
-
paintContent
public void paintContent(PaintTarget target) throws PaintException
Description copied from class:AbstractSelectPaints the content of this component.- Specified by:
paintContentin interfaceLegacyComponent- Overrides:
paintContentin classAbstractSelect- Parameters:
target- the Paint Event.- Throws:
PaintException- if the paint operation failed.
-
isRowCacheInvalidated
protected boolean isRowCacheInvalidated()
-
isPartialRowUpdate
protected boolean isPartialRowUpdate()
Subclass and override this to enable partial row updates and additions, which bypass the normal caching mechanism. This is useful for e.g. TreeTable.- Returns:
- true if this update is a partial row update, false if not. For plain Table it is always false.
-
getFirstAddedItemIndex
protected int getFirstAddedItemIndex()
Subclass and override this to enable partial row additions, bypassing the normal caching mechanism. This is useful for e.g. TreeTable, where expanding a node should only fetch and add the items inside of that node.- Returns:
- The index of the first added item. For plain Table it is always 0.
-
getAddedRowCount
protected int getAddedRowCount()
Subclass and override this to enable partial row additions, bypassing the normal caching mechanism. This is useful for e.g. TreeTable, where expanding a node should only fetch and add the items inside of that node.- Returns:
- the number of rows to be added, starting at the index returned by
getFirstAddedItemIndex(). For plain Table it is always 0.
-
shouldHideAddedRows
protected boolean shouldHideAddedRows()
Subclass and override this to enable removing of rows, bypassing the normal caching and lazy loading mechanism. This is useful for e.g. TreeTable, when you need to hide certain rows as a node is collapsed. This should return true if the rows pointed to bygetFirstAddedItemIndex()andgetAddedRowCount()should be hidden instead of added.- Returns:
- whether the rows to add (see
getFirstAddedItemIndex()andgetAddedRowCount()) should be added or hidden. For plain Table it is always false.
-
getFirstUpdatedItemIndex
protected int getFirstUpdatedItemIndex()
Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism. This is useful for updating the state of certain rows, e.g. in the TreeTable the collapsed state of a single node is updated using this mechanism.- Returns:
- the index of the first item to be updated. For plain Table it is always 0.
-
getUpdatedRowCount
protected int getUpdatedRowCount()
Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism. This is useful for updating the state of certain rows, e.g. in the TreeTable the collapsed state of a single node is updated using this mechanism.- Returns:
- the number of rows to update, starting at the index returned by
getFirstUpdatedItemIndex(). For plain table it is always 0.
-
rowHeadersAreEnabled
protected boolean rowHeadersAreEnabled()
Checks whether row headers are visible.- Returns:
falseif row headers are hidden,trueotherwise- Since:
- 7.3.9
-
paintRowHeader
protected void paintRowHeader(PaintTarget target, Object[][] cells, int indexInRowbuffer) throws PaintException
- Throws:
PaintException
-
paintRowIcon
protected void paintRowIcon(PaintTarget target, Object[][] cells, int indexInRowbuffer) throws PaintException
- Throws:
PaintException
-
paintRowAttributes
protected void paintRowAttributes(PaintTarget target, Object itemId) throws PaintException
A method where extended Table implementations may add their custom attributes for rows.- Parameters:
target-itemId-- Throws:
PaintException
-
getPropertyValue
protected Object getPropertyValue(Object rowId, Object colId, Property property)
Gets the value of property. By default if the table is editable the fieldFactory is used to create editors for table cells. Otherwise formatPropertyValue is used to format the value representation.- Parameters:
rowId- the Id of the row (same as item Id).colId- the Id of the column.property- the Property to be presented.- Returns:
- Object Either formatted value or Component for field.
- See Also:
setTableFieldFactory(TableFieldFactory)
-
bindPropertyToField
protected void bindPropertyToField(Object rowId, Object colId, Property property, Field field)
Binds an item property to a field generated by TableFieldFactory. The default behavior is to bind property straight to Field. If Property.Viewer type property (e.g. PropertyFormatter) is already set for field, the property is bound to that Property.Viewer.- Parameters:
rowId-colId-property-field-- Since:
- 6.7.3
-
formatPropertyValue
protected String formatPropertyValue(Object rowId, Object colId, Property<?> property)
Formats table cell property values. By default the property.toString() and return a empty string for null properties.- Parameters:
rowId- the Id of the row (same as item Id).colId- the Id of the column.property- the Property to be formatted.- Returns:
- the String representation of property and its value.
- Since:
- 3.1
-
addActionHandler
public void addActionHandler(Action.Handler actionHandler)
Registers a new action handler for this container- Specified by:
addActionHandlerin interfaceAction.Container- Parameters:
actionHandler- the new handler to be added.- See Also:
Action.Container.addActionHandler(Action.Handler)
-
removeActionHandler
public void removeActionHandler(Action.Handler actionHandler)
Removes a previously registered action handler for the contents of this container.- Specified by:
removeActionHandlerin interfaceAction.Container- Parameters:
actionHandler- the handler to be removed.- See Also:
Action.Container.removeActionHandler(Action.Handler)
-
removeAllActionHandlers
public void removeAllActionHandlers()
Removes all action handlers
-
valueChange
public void valueChange(Property.ValueChangeEvent event)
Notifies this listener that the Property's value has changed. Also listens changes in rendered items to refresh content area.- Specified by:
valueChangein interfaceProperty.ValueChangeListener- Overrides:
valueChangein classAbstractField<Object>- Parameters:
event- the value change event telling the data source contents have changed.- See Also:
Property.ValueChangeListener.valueChange(Property.ValueChangeEvent)
-
resetPageBuffer
protected void resetPageBuffer()
Clears the current page buffer. Call this beforerefreshRenderedCells()to ensure that all content is updated from the properties.
-
attach
public void attach()
Notifies the component that it is connected to an application.- Specified by:
attachin interfaceClientConnector- Specified by:
attachin interfaceComponent- Overrides:
attachin classAbstractSelect- See Also:
Component.attach()
-
detach
public void detach()
Notifies the component that it is detached from the application- Specified by:
detachin interfaceClientConnector- Overrides:
detachin classAbstractSelect- See Also:
ClientConnector.detach()
-
removeAllItems
public boolean removeAllItems()
Removes all Items from the Container.- Specified by:
removeAllItemsin interfaceContainer- Overrides:
removeAllItemsin classAbstractSelect- Returns:
- True if the operation succeeded.
- See Also:
Container.removeAllItems()
-
removeItem
public boolean removeItem(Object itemId)
Removes the Item identified byItemIdfrom the Container.- Specified by:
removeItemin interfaceContainer- Overrides:
removeItemin classAbstractSelect- Parameters:
itemId- ID of the Item to remove- Returns:
trueif the operation succeeded,falseif not- See Also:
Container.removeItem(Object)
-
removeContainerProperty
public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
Removes a Property specified by the given Property ID from the Container.- Specified by:
removeContainerPropertyin interfaceContainer- Overrides:
removeContainerPropertyin classAbstractSelect- Parameters:
propertyId- ID of the Property to remove- Returns:
- True if the operation succeeded.
- Throws:
UnsupportedOperationException- if the container does not support removing container properties- See Also:
Container.removeContainerProperty(Object)
-
addContainerProperty
public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
Adds a new property to the table and show it as a visible column.- Specified by:
addContainerPropertyin interfaceContainer- Overrides:
addContainerPropertyin classAbstractSelect- Parameters:
propertyId- the Id of the property.type- the class of the property.defaultValue- the default value given for all existing items.- Returns:
- True if the operation succeeded.
- Throws:
UnsupportedOperationException- if the container does not support explicitly adding container properties- See Also:
Container.addContainerProperty(Object, Class, Object)
-
addContainerProperty
public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue, String columnHeader, Resource columnIcon, Table.Align columnAlignment) throws UnsupportedOperationException
Adds a new property to the table and show it as a visible column.- Parameters:
propertyId- the Id of the propertytype- the class of the propertydefaultValue- the default value given for all existing itemscolumnHeader- the Explicit header of the column. If explicit header is not needed, this should be set null.columnIcon- the Icon of the column. If icon is not needed, this should be set null.columnAlignment- the Alignment of the column. Null implies align left.- Throws:
UnsupportedOperationException- if the operation is not supported.- See Also:
Container.addContainerProperty(Object, Class, Object)
-
addGeneratedColumn
public void addGeneratedColumn(Object id, Table.ColumnGenerator generatedColumn)
Adds a generated column to the Table.A generated column is a column that exists only in the Table, not as a property in the underlying Container. It shows up just as a regular column.
A generated column will override a property with the same id, so that the generated column is shown instead of the column representing the property. Note that getContainerProperty() will still get the real property.
Table will not listen to value change events from properties overridden by generated columns. If the content of your generated column depends on properties that are not directly visible in the table, attach value change listener to update the content on all depended properties. Otherwise your UI might not get updated as expected.
Also note that getVisibleColumns() will return the generated columns, while getContainerPropertyIds() will not.
- Parameters:
id- the id of the column to be addedgeneratedColumn- theTable.ColumnGeneratorto use for this column
-
getColumnGenerator
public Table.ColumnGenerator getColumnGenerator(Object columnId) throws IllegalArgumentException
Returns the ColumnGenerator used to generate the given column.- Parameters:
columnId- The id of the generated column- Returns:
- The ColumnGenerator used for the given columnId or null.
- Throws:
IllegalArgumentException
-
removeGeneratedColumn
public boolean removeGeneratedColumn(Object columnId)
Removes a generated column previously added with addGeneratedColumn.- Parameters:
columnId- id of the generated column to remove- Returns:
- true if the column could be removed (existed in the Table)
-
getVisibleItemIds
public Collection<?> getVisibleItemIds()
Returns item identifiers of the items which are currently rendered on the client.Note, that some due to historical reasons the name of the method is bit misleading. Some items may be partly or totally out of the viewport of the table's scrollable area. Actually detecting rows which can be actually seen by the end user may be problematic due to the client server architecture. Using
getCurrentPageFirstItemId()combined withgetPageLength()may produce good enough estimates in some situations.- Overrides:
getVisibleItemIdsin classAbstractSelect- See Also:
AbstractSelect.getVisibleItemIds()
-
containerItemSetChange
public void containerItemSetChange(Container.ItemSetChangeEvent event)
Container datasource item set change. Table must flush its buffers on change.- Specified by:
containerItemSetChangein interfaceContainer.ItemSetChangeListener- Overrides:
containerItemSetChangein classAbstractSelect- Parameters:
event- change event text- See Also:
Container.ItemSetChangeListener.containerItemSetChange(Container.ItemSetChangeEvent)
-
containerPropertySetChange
public void containerPropertySetChange(Container.PropertySetChangeEvent event)
Container datasource property set change. Table must flush its buffers on change.- Specified by:
containerPropertySetChangein interfaceContainer.PropertySetChangeListener- Overrides:
containerPropertySetChangein classAbstractSelect- Parameters:
event- Change event.- See Also:
Container.PropertySetChangeListener.containerPropertySetChange(Container.PropertySetChangeEvent)
-
setNewItemsAllowed
public void setNewItemsAllowed(boolean allowNewOptions) throws UnsupportedOperationExceptionAdding new items is not supported.- Overrides:
setNewItemsAllowedin classAbstractSelect- Parameters:
allowNewOptions- the New value of property allowNewOptions.- Throws:
UnsupportedOperationException- if set to true.- See Also:
AbstractSelect.setNewItemsAllowed(boolean)
-
nextItemId
public Object nextItemId(Object itemId)
Gets the ID of the Item following the Item that corresponds to itemId.- Specified by:
nextItemIdin interfaceContainer.Ordered- Parameters:
itemId- ID of a visible Item in the Container- Returns:
- ID of the next visible Item or
null - See Also:
Container.Ordered.nextItemId(java.lang.Object)
-
prevItemId
public Object prevItemId(Object itemId)
Gets the ID of the Item preceding the Item that corresponds to the itemId.- Specified by:
prevItemIdin interfaceContainer.Ordered- Parameters:
itemId- ID of a visible Item in the Container- Returns:
- ID of the previous visible Item or
null - See Also:
Container.Ordered.prevItemId(java.lang.Object)
-
firstItemId
public Object firstItemId()
Gets the ID of the first Item in the Container.- Specified by:
firstItemIdin interfaceContainer.Ordered- Returns:
- ID of the first visible Item in the Container
- See Also:
Container.Ordered.firstItemId()
-
lastItemId
public Object lastItemId()
Gets the ID of the last Item in the Container.- Specified by:
lastItemIdin interfaceContainer.Ordered- Returns:
- ID of the last visible Item in the Container
- See Also:
Container.Ordered.lastItemId()
-
isFirstId
public boolean isFirstId(Object itemId)
Tests if the Item corresponding to the given Item ID is the first Item in the Container.- Specified by:
isFirstIdin interfaceContainer.Ordered- Parameters:
itemId- ID of an Item in the Container- Returns:
trueif the Item is first visible item in the Container,falseif not- See Also:
Container.Ordered.isFirstId(java.lang.Object)
-
isLastId
public boolean isLastId(Object itemId)
Tests if the Item corresponding to the given Item ID is the last Item in the Container.- Specified by:
isLastIdin interfaceContainer.Ordered- Returns:
trueif the Item is last visible item in the Container,falseif not- See Also:
Container.Ordered.isLastId(java.lang.Object)
-
addItemAfter
public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException
Adds new item after the given item.- Specified by:
addItemAfterin interfaceContainer.Ordered- Parameters:
previousItemId- Id of the visible item in ordered container after which to insert the new item.- Returns:
- item id the the created new item or null if the operation fails.
- Throws:
UnsupportedOperationException- if the operation is not supported by the container- See Also:
Container.Ordered.addItemAfter(java.lang.Object)
-
addItemAfter
public Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException
Adds new item after the given item.- Specified by:
addItemAfterin interfaceContainer.Ordered- Parameters:
previousItemId- Id of the visible item in ordered container after which to insert the new item.newItemId- Id of the new item to be added.- Returns:
- new item or null if the operation fails.
- Throws:
UnsupportedOperationException- if the operation is not supported by the container- See Also:
Container.Ordered.addItemAfter(java.lang.Object, java.lang.Object)
-
setTableFieldFactory
public void setTableFieldFactory(TableFieldFactory fieldFactory)
Sets the TableFieldFactory that is used to create editor for table cells. The TableFieldFactory is only used if the Table is editable. By default the DefaultFieldFactory is used.- Parameters:
fieldFactory- the field factory to set.- See Also:
isEditable(),DefaultFieldFactory
-
getTableFieldFactory
public TableFieldFactory getTableFieldFactory()
Gets the TableFieldFactory that is used to create editor for table cells. The FieldFactory is only used if the Table is editable.- Returns:
- TableFieldFactory used to create the Field instances.
- See Also:
isEditable()
-
isEditable
public boolean isEditable()
Is table editable. If table is editable a editor of type Field is created for each table cell. The assigned FieldFactory is used to create the instances. To provide custom editors for table cells create a class implementing the FieldFactory interface, and assign it to table, and set the editable property to true.- Returns:
- true if table is editable, false otherwise.
- See Also:
Field,FieldFactory
-
setEditable
public void setEditable(boolean editable)
Sets the editable property. If table is editable a editor of type Field is created for each table cell. The assigned FieldFactory is used to create the instances. To provide custom editors for table cells create a class implementing the FieldFactory interface, and assign it to table, and set the editable property to true.- Parameters:
editable- true if table should be editable by user.- See Also:
Field,FieldFactory
-
sort
public void sort(Object[] propertyId, boolean[] ascending) throws UnsupportedOperationException
Sorts the table.- Specified by:
sortin interfaceContainer.Sortable- Parameters:
propertyId- Array of container property IDs, whose values are used to sort the items in container as primary, secondary, ... sorting criterion. All of the item IDs must be in the collection returned byContainer.Sortable.getSortableContainerPropertyIds()ascending- Array of sorting order flags corresponding to each property ID used in sorting. If this array is shorter than propertyId array, ascending order is assumed for items where the order is not specified. Usetrueto sort in ascending order,falseto use descending order.- Throws:
UnsupportedOperationException- if the container data source does not implement Container.Sortable- See Also:
Container.Sortable.sort(java.lang.Object[], boolean[])
-
sort
public void sort()
Sorts the table by currently selected sorting column.- Throws:
UnsupportedOperationException- if the container data source does not implement Container.Sortable
-
getSortableContainerPropertyIds
public Collection<?> getSortableContainerPropertyIds()
Gets the container property IDs, which can be used to sort the item.Note that the
isSortEnabled()state affects what this method returns. Disabling sorting causes this method to always return an empty collection.- Specified by:
getSortableContainerPropertyIdsin interfaceContainer.Sortable- Returns:
- the IDs of the properties that can be used for sorting the container
- See Also:
Container.Sortable.getSortableContainerPropertyIds()
-
getSortContainerPropertyId
public Object getSortContainerPropertyId()
Gets the currently sorted column property ID.- Returns:
- the Container property id of the currently sorted column.
-
setSortContainerPropertyId
public void setSortContainerPropertyId(Object propertyId)
Sets the currently sorted column property id.- Parameters:
propertyId- the Container property id of the currently sorted column.
-
isSortAscending
public boolean isSortAscending()
Is the table currently sorted in ascending order.- Returns:
trueif ascending,falseif descending.
-
setSortAscending
public void setSortAscending(boolean ascending)
Sets the table in ascending order.- Parameters:
ascending-trueif ascending,falseif descending.
-
isSortDisabled
@Deprecated public boolean isSortDisabled()
Deprecated.As of 7.0, useisSortEnabled()insteadIs sorting disabled altogether. True iff no sortable columns are given even in the case where data source would support this.- Returns:
- True iff sorting is disabled.
-
isSortEnabled
public boolean isSortEnabled()
Checks if sorting is enabled.- Returns:
- true if sorting by the user is allowed, false otherwise
-
setSortDisabled
@Deprecated public void setSortDisabled(boolean sortDisabled)
Deprecated.As of 7.0, usesetSortEnabled(boolean)insteadDisables the sorting by the user altogether.- Parameters:
sortDisabled- True iff sorting is disabled.
-
setSortEnabled
public void setSortEnabled(boolean sortEnabled)
Enables or disables sorting.Setting this to false disallows sorting by the user. It is still possible to call
sort().- Parameters:
sortEnabled- true to allow the user to sort the table, false to disallow it
-
setCellStyleGenerator
public void setCellStyleGenerator(Table.CellStyleGenerator cellStyleGenerator)
Set cell style generator for Table.- Parameters:
cellStyleGenerator- New cell style generator or null to remove generator.
-
getCellStyleGenerator
public Table.CellStyleGenerator getCellStyleGenerator()
Get the current cell style generator.
-
addItemClickListener
public void addItemClickListener(ItemClickEvent.ItemClickListener listener)
Description copied from interface:ItemClickEvent.ItemClickNotifierRegister a listener to handleItemClickEvents.- Specified by:
addItemClickListenerin interfaceItemClickEvent.ItemClickNotifier- Parameters:
listener- ItemClickListener to be registered
-
addListener
@Deprecated public void addListener(ItemClickEvent.ItemClickListener listener)
Deprecated.As of 7.0, replaced byaddItemClickListener(ItemClickListener)- Specified by:
addListenerin interfaceItemClickEvent.ItemClickNotifier
-
removeItemClickListener
public void removeItemClickListener(ItemClickEvent.ItemClickListener listener)
Description copied from interface:ItemClickEvent.ItemClickNotifierRemoves an ItemClickListener.- Specified by:
removeItemClickListenerin interfaceItemClickEvent.ItemClickNotifier- Parameters:
listener- ItemClickListener to be removed
-
removeListener
@Deprecated public void removeListener(ItemClickEvent.ItemClickListener listener)
Deprecated.As of 7.0, replaced byremoveItemClickListener(ItemClickListener)- Specified by:
removeListenerin interfaceItemClickEvent.ItemClickNotifier
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:ComponentEnables or disables the component. The user can not interact with disabled components, which are shown with a style that indicates the status, usually shaded in light gray color. Components are enabled by default.Button enabled = new Button("Enabled"); enabled.setEnabled(true); // The default layout.addComponent(enabled); Button disabled = new Button("Disabled"); disabled.setEnabled(false); layout.addComponent(disabled);This method will trigger a
RepaintRequestEventfor the component and, if it is aComponentContainer, for all its children recursively.- Specified by:
setEnabledin interfaceComponent- Overrides:
setEnabledin classAbstractComponent- Parameters:
enabled- a boolean value specifying if the component should be enabled or not
-
setDragMode
public void setDragMode(Table.TableDragMode newDragMode)
Sets the drag start mode of the Table. Drag start mode controls how Table behaves as a drag source.- Parameters:
newDragMode-
-
getDragMode
public Table.TableDragMode getDragMode()
- Returns:
- the current start mode of the Table. Drag start mode controls how Table behaves as a drag source.
-
getTransferable
public Table.TableTransferable getTransferable(Map<String,Object> rawVariables)
Description copied from interface:DragSourceDragSource may convert data added by client side component to meaningful values for server side developer or add other data based on it.For example Tree converts item identifiers to generated string keys for the client side. Vaadin developer don't and can't know anything about these generated keys, only about item identifiers. When tree node is dragged client puts that key to
Transferables client side counterpart. InTree.getTransferable(Map)the key is converted back to item identifier that the server side developer can use.- Specified by:
getTransferablein interfaceDragSource- Parameters:
rawVariables- the data that client side initially included inTransferables client side counterpart.- Returns:
- the
Transferableinstance that will be passed toDropHandler(and/orAcceptCriterion)
-
getDropHandler
public DropHandler getDropHandler()
- Specified by:
getDropHandlerin interfaceDropTarget- Returns:
- the drop hanler that will receive the dragged data or null if drops are not currently accepted
-
setDropHandler
public void setDropHandler(DropHandler dropHandler)
-
translateDropTargetDetails
public AbstractSelect.AbstractSelectTargetDetails translateDropTargetDetails(Map<String,Object> clientVariables)
Description copied from interface:DropTargetCalled before theDragAndDropEventis passed toDropHandler. Implementation may for example translate the drop target details provided by the client side (drop target) to meaningful server side values. If null is returned the terminal implementation will automatically create aTargetDetailswith raw client side data.- Specified by:
translateDropTargetDetailsin interfaceDropTarget- Parameters:
clientVariables- data passed from the DropTargets client side counterpart.- Returns:
- A DropTargetDetails object with the translated data or null to use a default implementation.
- See Also:
DragSource.getTransferable(Map)
-
setMultiSelectMode
public void setMultiSelectMode(MultiSelectMode mode)
Sets the behavior of how the multi-select mode should behave when the table is both selectable and in multi-select mode.Note, that on some clients the mode may not be respected. E.g. on touch based devices CTRL/SHIFT base selection method is invalid, so touch based browsers always use the
MultiSelectMode.SIMPLEunless touch multi select is explicitly disabled .- Parameters:
mode- The select mode of the table- See Also:
setMultiSelectTouchDetectionEnabled(boolean)
-
getMultiSelectMode
public MultiSelectMode getMultiSelectMode()
Returns the select mode in which multi-select is used.- Returns:
- The multi select mode
-
setMultiSelectTouchDetectionEnabled
public void setMultiSelectTouchDetectionEnabled(boolean multiSelectTouchDetectionEnabled)
Default behavior on touch-reporting devices is to switch from CTRL/SHIFT based multi-selection to simple mode, but you can use this method to explicitly disable the touch device detection. Thus you can keep using keyboard-based multi selection on hybrid devices that have both a touch screen and a keyboard.- Parameters:
multiSelectTouchDetectionEnabled- Whether to enable or disable touch screen detection
-
isMultiSelectTouchDetectionEnabled
public boolean isMultiSelectTouchDetectionEnabled()
Returns if touch screen detection is used to toggle multi select mode.- Returns:
- If touch screen detection for multi select is enabled
-
addHeaderClickListener
public void addHeaderClickListener(Table.HeaderClickListener listener)
Adds a header click listener which handles the click events when the user clicks on a column header cell in the Table.The listener will receive events which contain information about which column was clicked and some details about the mouse event.
- Parameters:
listener- The handler which should handle the header click events.
-
addListener
@Deprecated public void addListener(Table.HeaderClickListener listener)
Deprecated.As of 7.0, replaced byaddHeaderClickListener(HeaderClickListener)
-
removeHeaderClickListener
public void removeHeaderClickListener(Table.HeaderClickListener listener)
Removes a header click listener- Parameters:
listener- The listener to remove.
-
removeListener
@Deprecated public void removeListener(Table.HeaderClickListener listener)
Deprecated.As of 7.0, replaced byremoveHeaderClickListener(HeaderClickListener)
-
addFooterClickListener
public void addFooterClickListener(Table.FooterClickListener listener)
Adds a footer click listener which handles the click events when the user clicks on a column footer cell in the Table.The listener will receive events which contain information about which column was clicked and some details about the mouse event.
- Parameters:
listener- The handler which should handle the footer click events.
-
addListener
@Deprecated public void addListener(Table.FooterClickListener listener)
Deprecated.As of 7.0, replaced byaddFooterClickListener(FooterClickListener)
-
removeFooterClickListener
public void removeFooterClickListener(Table.FooterClickListener listener)
Removes a footer click listener- Parameters:
listener- The listener to remove.
-
removeListener
@Deprecated public void removeListener(Table.FooterClickListener listener)
Deprecated.As of 7.0, replaced byremoveFooterClickListener(FooterClickListener)
-
getColumnFooter
public String getColumnFooter(Object propertyId)
Gets the footer caption beneath the rows- Parameters:
propertyId- The propertyId of the column *- Returns:
- The caption of the footer or NULL if not set
-
setColumnFooter
public void setColumnFooter(Object propertyId, String footer)
Sets the column footer caption. The column footer caption is the text displayed beneath the column if footers have been set visible.- Parameters:
propertyId- The properyId of the columnfooter- The caption of the footer
-
setFooterVisible
public void setFooterVisible(boolean visible)
Sets the footer visible in the bottom of the table.The footer can be used to add column related data like sums to the bottom of the Table using setColumnFooter(Object propertyId, String footer).
- Parameters:
visible- Should the footer be visible
-
isFooterVisible
public boolean isFooterVisible()
Is the footer currently visible?- Returns:
- Returns true if visible else false
-
addColumnResizeListener
public void addColumnResizeListener(Table.ColumnResizeListener listener)
Adds a column resize listener to the Table. A column resize listener is called when a user resizes a columns width.- Parameters:
listener- The listener to attach to the Table
-
addListener
@Deprecated public void addListener(Table.ColumnResizeListener listener)
Deprecated.As of 7.0, replaced byaddColumnResizeListener(ColumnResizeListener)
-
removeColumnResizeListener
public void removeColumnResizeListener(Table.ColumnResizeListener listener)
Removes a column resize listener from the Table.- Parameters:
listener- The listener to remove
-
removeListener
@Deprecated public void removeListener(Table.ColumnResizeListener listener)
Deprecated.As of 7.0, replaced byremoveColumnResizeListener(ColumnResizeListener)
-
addColumnReorderListener
public void addColumnReorderListener(Table.ColumnReorderListener listener)
Adds a column reorder listener to the Table. A column reorder listener is called when a user reorders columns.- Parameters:
listener- The listener to attach to the Table
-
addListener
@Deprecated public void addListener(Table.ColumnReorderListener listener)
Deprecated.As of 7.0, replaced byaddColumnReorderListener(ColumnReorderListener)
-
removeColumnReorderListener
public void removeColumnReorderListener(Table.ColumnReorderListener listener)
Removes a column reorder listener from the Table.- Parameters:
listener- The listener to remove
-
removeListener
@Deprecated public void removeListener(Table.ColumnReorderListener listener)
Deprecated.As of 7.0, replaced byremoveColumnReorderListener(ColumnReorderListener)
-
addColumnCollapseListener
public void addColumnCollapseListener(Table.ColumnCollapseListener listener)
Adds a column collapse listener to the Table. A column collapse listener is called when the collapsed state of a column changes.- Parameters:
listener- The listener to attach- Since:
- 7.6
-
removeColumnCollapseListener
public void removeColumnCollapseListener(Table.ColumnCollapseListener listener)
Removes a column reorder listener from the Table.- Parameters:
listener- The listener to remove- Since:
- 7.6
-
setItemDescriptionGenerator
public void setItemDescriptionGenerator(AbstractSelect.ItemDescriptionGenerator generator)
Set the item description generator which generates tooltips for cells and rows in the Table- Parameters:
generator- The generator to use or null to disable
-
getItemDescriptionGenerator
public AbstractSelect.ItemDescriptionGenerator getItemDescriptionGenerator()
Get the item description generator which generates tooltips for cells and rows in the Table.
-
setRowGenerator
public void setRowGenerator(Table.RowGenerator generator)
Assigns a row generator to the table. The row generator will be able to replace rows in the table when it is rendered.- Parameters:
generator- the new row generator
-
getRowGenerator
public Table.RowGenerator getRowGenerator()
- Returns:
- the current row generator
-
setConverter
public void setConverter(Object propertyId, Converter<String,?> converter)
Sets a converter for a property id.The converter is used to format the the data for the given property id before displaying it in the table.
- Parameters:
propertyId- The propertyId to format using the converterconverter- The converter to use for the property id
-
hasConverter
protected boolean hasConverter(Object propertyId)
Checks if there is a converter set explicitly for the given property id.- Parameters:
propertyId- The propertyId to check- Returns:
- true if a converter has been set for the property id, false otherwise
-
getConverter
public Converter<String,Object> getConverter(Object propertyId)
Returns the converter used to format the given propertyId.- Parameters:
propertyId- The propertyId to check- Returns:
- The converter used to format the propertyId or null if no converter has been set
-
setVisible
public void setVisible(boolean visible)
Description copied from interface:ComponentSets the visibility of the component.Visible components are drawn in the user interface, while invisible ones are not. The effect is not merely a cosmetic CSS change - no information about an invisible component will be sent to the client. The effect is thus the same as removing the component from its parent.
TextField readonly = new TextField("Read-Only"); readonly.setValue("You can't see this!"); readonly.setVisible(false); layout.addComponent(readonly);A component is visible only if all of its parents are also visible. If a component is explicitly set to be invisible, changes in the visibility of its parents will not change the visibility of the component.
- Specified by:
setVisiblein interfaceComponent- Overrides:
setVisiblein classAbstractComponent- Parameters:
visible- the boolean value specifying if the component should be visible after the call or not.- See Also:
Component.isVisible()
-
iterator
public Iterator<Component> iterator()
Description copied from interface:HasComponentsGets an iterator to the collection of contained components. Using this iterator it is possible to step through all components contained in this container.- Specified by:
iteratorin interfaceHasComponents- Specified by:
iteratorin interfaceIterable<Component>- Returns:
- the component iterator.
-
getComponentIterator
@Deprecated public Iterator<Component> getComponentIterator()
Deprecated.As of 7.0, useiterator()instead.
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext context)Description copied from interface:ComponentReads the component state from the given design.The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
- Specified by:
readDesignin interfaceComponent- Overrides:
readDesignin classAbstractSelect- Parameters:
design- The element to obtain the state fromcontext- The DesignContext instance used for parsing the design
-
readItems
protected void readItems(org.jsoup.nodes.Element design, DesignContext context)- Overrides:
readItemsin classAbstractSelect
-
readBody
protected void readBody(org.jsoup.nodes.Element design, DesignContext context)
-
readItem
protected Object readItem(org.jsoup.nodes.Element tr, Set<String> selected, DesignContext context)
Description copied from class:AbstractSelectReads an Item from a design and inserts it into the data source. Hierarchical select components should override this method to recursively recursively read any child items as well.- Overrides:
readItemin classAbstractSelect- Parameters:
tr- a child element representing the itemselected- A set accumulating selected items. If the item that is read is marked as selected, its item id should be added to this set.context- the DesignContext instance used in parsing- Returns:
- the item id of the new item
-
writeDesign
public void writeDesign(org.jsoup.nodes.Element design, DesignContext context)Description copied from interface:ComponentWrites the component state to the given design.The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
- Specified by:
writeDesignin interfaceComponent- Overrides:
writeDesignin classAbstractSelect- Parameters:
design- The element to write the component state to. Any previous attributes or child nodes are not cleared.context- The DesignContext instance used for writing the design
-
writeItems
protected void writeItems(org.jsoup.nodes.Element design, DesignContext context)Description copied from class:AbstractSelectWrites the data source items to a design. Hierarchical select components should override this method to only write the root items.- Overrides:
writeItemsin classAbstractSelect- Parameters:
design- the element into which to insert the itemscontext- the DesignContext instance used in writing
-
writeItem
protected org.jsoup.nodes.Element writeItem(org.jsoup.nodes.Element tbody, Object itemId, DesignContext context)Description copied from class:AbstractSelectWrites a data source Item to a design. Hierarchical select components should override this method to recursively write any child items as well.- Overrides:
writeItemin classAbstractSelect- Parameters:
tbody- the element into which to insert the itemitemId- the id of the item to writecontext- the DesignContext instance used in writing- Returns:
-
getCustomAttributes
protected Collection<String> getCustomAttributes()
Description copied from class:AbstractComponentReturns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)andAbstractComponent.writeDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)methods. Typically these are handled in a custom way in the overridden versions of the above methods- Overrides:
getCustomAttributesin classAbstractField<Object>- Returns:
- the collection of attributes that are not handled by the basic implementation
-
getState
protected TableState getState()
Description copied from class:AbstractComponentReturns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().- Overrides:
getStatein classAbstractSelect- Returns:
- updated component shared state
-
getState
protected TableState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnectorReturns the shared state for this connector.- Overrides:
getStatein classAbstractField<Object>- Parameters:
markAsDirty- true if the connector should automatically be marked dirty, false otherwise- Returns:
- The shared state for this connector. Never null.
- See Also:
AbstractClientConnector.getState()
-
setChildMeasurementHint
public void setChildMeasurementHint(HasChildMeasurementHint.ChildMeasurementHint hint)
Description copied from interface:HasChildMeasurementHintSets desired child size measurement hint.- Specified by:
setChildMeasurementHintin interfaceHasChildMeasurementHint- Parameters:
hint- desired hint. A value of null will reset value back to the default (MEASURE_ALWAYS)
-
getChildMeasurementHint
public HasChildMeasurementHint.ChildMeasurementHint getChildMeasurementHint()
Description copied from interface:HasChildMeasurementHintReturns the current child size measurement hint.- Specified by:
getChildMeasurementHintin interfaceHasChildMeasurementHint- Returns:
- a child measurement hint value
-
setCollapseMenuContent
public void setCollapseMenuContent(CollapseMenuContent content)
Sets whether only collapsible columns should be shown to the user in the column collapse menu. The default isCollapseMenuContent.ALL_COLUMNS.- Parameters:
content- the desired collapsible menu content setting- Since:
- 7.6
-
getCollapseMenuContent
public CollapseMenuContent getCollapseMenuContent()
Checks whether only collapsible columns are shown to the user in the column collapse menu. The default isCollapseMenuContent.ALL_COLUMNS.- Returns:
- the current collapsible menu content setting
- Since:
- 7.6
-
-