Class TreeTable
-
- All Implemented Interfaces:
Buffered,BufferedValidatable,Container,Container.Hierarchical,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
public class TreeTable extends Table implements Container.Hierarchical
TreeTable extends theTablecomponent so that it can also visualize a hierarchy of its Items in a similar manner thatTreedoes. The tree hierarchy is always displayed in the first actual column of the TreeTable.The TreeTable supports the usual
Tablefeatures like lazy loading, so it should be no problem to display lots of items at once. Only required rows and some cache rows are sent to the client.TreeTable supports standard
Container.Hierarchicalcontainer interfaces, but also a more fine tuned version -Collapsible. A container implementing theCollapsibleinterface stores the collapsed/expanded state internally and can this way scale better on the server side than with standard Hierarchical implementations. Developer must however note thatCollapsiblecontainers can not be shared among several users as they share UI state in the container.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.ui.Table
Table.Align, Table.CacheUpdateException, Table.CellStyleGenerator, Table.ColumnCollapseEvent, Table.ColumnCollapseListener, Table.ColumnGenerator, Table.ColumnHeaderMode, Table.ColumnReorderEvent, Table.ColumnReorderListener, Table.ColumnResizeEvent, Table.ColumnResizeListener, Table.FooterClickEvent, Table.FooterClickListener, Table.GeneratedRow, Table.HeaderClickEvent, Table.HeaderClickListener, Table.RowGenerator, Table.RowHeaderMode, Table.TableContextClickEvent, Table.TableDragMode, Table.TableDropCriterion, Table.TableTransferable
-
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.Table
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, alwaysRecalculateColumnWidths, CELL_FIRSTCOL, CELL_GENERATED_ROW, CELL_HEADER, CELL_ICON, CELL_ITEMID, CELL_KEY, COLUMN_HEADER_MODE_EXPLICIT, COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID, COLUMN_HEADER_MODE_HIDDEN, COLUMN_HEADER_MODE_ID, ROW_HEADER_MODE_EXPLICIT, ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID, ROW_HEADER_MODE_HIDDEN, ROW_HEADER_MODE_ICON_ONLY, ROW_HEADER_MODE_ID, ROW_HEADER_MODE_INDEX, ROW_HEADER_MODE_ITEM, ROW_HEADER_MODE_PROPERTY
-
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
-
-
Constructor Summary
Constructors Constructor Description TreeTable()Creates an empty TreeTable with a default container.TreeTable(String caption)Creates an empty TreeTable with a default container.TreeTable(String caption, Container dataSource)Creates a TreeTable instance with given captions and data source.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddCollapseListener(Tree.CollapseListener listener)Adds a collapse listener.voidaddExpandListener(Tree.ExpandListener listener)Adds an expand listener.ObjectaddItem()Creates a new item into container with container managed id.ItemaddItem(Object itemId)Create a new item into container.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.voidaddItems(Object... itemId)Adds given items with given item ids to container.voidaddItems(Collection<?> itemIds)Adds given items with given item ids to container.voidaddListener(Tree.CollapseListener listener)Deprecated.As of 7.0, replaced byaddCollapseListener(CollapseListener)voidaddListener(Tree.ExpandListener listener)Deprecated.As of 7.0, replaced byaddExpandListener(ExpandListener)booleanareChildrenAllowed(Object itemId)Tests if the Item with given ID can have children.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.protected voidfireCollapseEvent(Object itemId)Emits a collapse event.protected voidfireExpandEvent(Object itemId)Emits an expand event.protected intgetAddedRowCount()Subclass and override this to enable partial row additions, bypassing the normal caching mechanism.Collection<?>getChildren(Object itemId)Gets the IDs of all Items that are children of the specified Item.Container.HierarchicalgetContainerDataSource()Gets the viewing data-source container.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.ObjectgetHierarchyColumnId()protected ObjectgetIdByIndex(int index)Returns the item ID for the item represented by the index given.Collection<?>getItemIds()Gets the item Id collection from the container.protected List<Object>getItemIds(int firstIndex, int rows)ObjectgetParent(Object itemId)Gets the ID of the parent Item of the specified Item.protected TreeTableStategetState()Returns the shared state bean with information to be sent from the server to the client.protected intgetUpdatedRowCount()Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism.booleanhasChildren(Object itemId)Tests if the Item specified withitemIdhas child Items or if it is a leaf.protected intindexOfId(Object itemId)booleanisAnimationsEnabled()booleanisCollapsed(Object itemId)Checks if Item with given identifier is collapsed in the UI.booleanisLastId(Object itemId)Tests if the Item corresponding to the given Item ID is the last Item in the Container.protected booleanisPartialRowUpdate()Subclass and override this to enable partial row updates and additions, which bypass the normal caching mechanism.booleanisRoot(Object itemId)Tests if the Item specified withitemIdis a root Item.ObjectlastItemId()Gets the ID of the last Item in the Container.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 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)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.voidremoveCollapseListener(Tree.CollapseListener listener)Removes a collapse listener.voidremoveExpandListener(Tree.ExpandListener listener)Removes an expand listener.voidremoveListener(Tree.CollapseListener listener)Deprecated.As of 7.0, replaced byremoveCollapseListener(CollapseListener)voidremoveListener(Tree.ExpandListener listener)Deprecated.As of 7.0, replaced byremoveExpandListener(ExpandListener)Collection<?>rootItemIds()Gets the IDs of all Items in the container that don't have a parent.protected booleanrowHeadersAreEnabled()Checks whether row headers are visible.voidsetAnimationsEnabled(boolean animationsEnabled)Animations can be enabled by passing true to this method.booleansetChildrenAllowed(Object itemId, boolean areChildrenAllowed)Sets the given Item's capability to have children.voidsetCollapsed(Object itemId, boolean collapsed)Sets the Item specified by given identifier as collapsed or expanded.voidsetContainerDataSource(Container newDataSource)Sets the Container that serves as the data source of the viewer.voidsetHierarchyColumn(Object hierarchyColumnId)Explicitly sets the column in which the TreeTable visualizes the hierarchy.booleansetParent(Object itemId, Object newParentId)Sets the parent of an Item.protected booleanshouldHideAddedRows()Subclass and override this to enable removing of rows, bypassing the normal caching and lazy loading mechanism.intsize()Gets the number of items in the container.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.protected voidwriteItems(org.jsoup.nodes.Element tbody, Collection<?> itemIds, int depth, DesignContext context)-
Methods inherited from class com.vaadin.ui.Table
addActionHandler, addColumnCollapseListener, addColumnReorderListener, addColumnResizeListener, addContainerProperty, addContainerProperty, addFooterClickListener, addGeneratedColumn, addHeaderClickListener, addItemClickListener, addListener, addListener, addListener, addListener, addListener, attach, beforeClientResponse, bindPropertyToField, containerPropertySetChange, detach, disableContentRefreshing, enableContentRefreshing, firstItemId, formatPropertyValue, getCacheRate, getCellStyleGenerator, getChildMeasurementHint, getCollapseMenuContent, getColumnAlignment, getColumnAlignments, getColumnExpandRatio, getColumnFooter, getColumnGenerator, getColumnHeader, getColumnHeaderMode, getColumnHeaders, getColumnIcon, getColumnIcons, getColumnWidth, getComponentIterator, getConverter, getCurrentPageFirstItemId, getCurrentPageFirstItemIndex, getCustomAttributes, getDragMode, getDropHandler, getItemDescriptionGenerator, getMultiSelectMode, getPageLength, getPropertyValue, getRowGenerator, getRowHeaderMode, getSortableContainerPropertyIds, getSortContainerPropertyId, getState, getTableFieldFactory, getTransferable, getVisibleColumns, getVisibleItemIds, hasConverter, isColumnCollapsed, isColumnCollapsible, isColumnCollapsingAllowed, isColumnReorderingAllowed, isEditable, isFirstId, isFooterVisible, isMultiSelectTouchDetectionEnabled, isRowCacheInvalidated, isSelectable, isSortAscending, isSortDisabled, isSortEnabled, iterator, markAsDirty, markAsDirtyRecursive, paintRowHeader, readDesign, readItems, refreshRenderedCells, refreshRowCache, registerComponent, removeActionHandler, removeAllActionHandlers, removeAllItems, removeColumnCollapseListener, removeColumnReorderListener, removeColumnResizeListener, removeContainerProperty, removeFooterClickListener, removeGeneratedColumn, removeHeaderClickListener, removeItem, removeItemClickListener, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, resetPageBuffer, setCacheRate, setCellStyleGenerator, setChildMeasurementHint, setCollapseMenuContent, setColumnAlignment, setColumnAlignments, setColumnCollapsed, setColumnCollapsible, setColumnCollapsingAllowed, setColumnExpandRatio, setColumnFooter, setColumnHeader, setColumnHeaderMode, setColumnHeaders, setColumnIcon, setColumnIcons, setColumnReorderingAllowed, setColumnWidth, setContainerDataSource, setConverter, setCurrentPageFirstItemId, setCurrentPageFirstItemIndex, setDragMode, setDropHandler, setEditable, setEnabled, setFooterVisible, setItemDescriptionGenerator, setMultiSelectMode, setMultiSelectTouchDetectionEnabled, setNewItemsAllowed, setPageLength, setRowGenerator, setRowHeaderMode, setSelectable, setSortAscending, setSortContainerPropertyId, setSortDisabled, setSortEnabled, setTableFieldFactory, setVisible, setVisibleColumns, sort, sort, translateDropTargetDetails, unregisterComponent, valueChange, writeDesign
-
Methods inherited from class com.vaadin.ui.AbstractSelect
addItemSetChangeListener, addListener, addListener, addPropertySetChangeListener, containsId, fireItemSetChange, firePropertySetChange, getCaptionChangeListener, getContainerProperty, getContainerPropertyIds, getItem, getItemCaption, getItemCaptionMode, getItemCaptionPropertyId, getItemIcon, getItemIconPropertyId, 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, 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
addContainerProperty, containsId, getContainerProperty, getContainerPropertyIds, getItem, getType, removeAllItems, removeContainerProperty
-
Methods inherited from interface com.vaadin.data.Container.Hierarchical
removeItem
-
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
-
-
-
-
Constructor Detail
-
TreeTable
public TreeTable()
Creates an empty TreeTable with a default container.
-
TreeTable
public TreeTable(String caption)
Creates an empty TreeTable with a default container.- Parameters:
caption- the caption for the TreeTable
-
-
Method Detail
-
paintRowAttributes
protected void paintRowAttributes(PaintTarget target, Object itemId) throws PaintException
Description copied from class:TableA method where extended Table implementations may add their custom attributes for rows.- Overrides:
paintRowAttributesin classTable- Throws:
PaintException
-
paintRowIcon
protected void paintRowIcon(PaintTarget target, Object[][] cells, int indexInRowbuffer) throws PaintException
- Overrides:
paintRowIconin classTable- Throws:
PaintException
-
rowHeadersAreEnabled
protected boolean rowHeadersAreEnabled()
Description copied from class:TableChecks whether row headers are visible.- Overrides:
rowHeadersAreEnabledin classTable- Returns:
falseif row headers are hidden,trueotherwise
-
changeVariables
public void changeVariables(Object source, Map<String,Object> variables)
Description copied from class:TableInvoked when the value of a variable has changed.- Specified by:
changeVariablesin interfaceVariableOwner- Overrides:
changeVariablesin classTable- 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)
-
paintContent
public void paintContent(PaintTarget target) throws PaintException
Description copied from class:AbstractSelectPaints the content of this component.- Specified by:
paintContentin interfaceLegacyComponent- Overrides:
paintContentin classTable- Parameters:
target- the Paint Event.- Throws:
PaintException- if the paint operation failed.
-
isPartialRowUpdate
protected boolean isPartialRowUpdate()
Description copied from class:TableSubclass and override this to enable partial row updates and additions, which bypass the normal caching mechanism. This is useful for e.g. TreeTable.- Overrides:
isPartialRowUpdatein classTable- Returns:
- true if this update is a partial row update, false if not. For plain Table it is always false.
-
getFirstAddedItemIndex
protected int getFirstAddedItemIndex()
Description copied from class:TableSubclass 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.- Overrides:
getFirstAddedItemIndexin classTable- Returns:
- The index of the first added item. For plain Table it is always 0.
-
getAddedRowCount
protected int getAddedRowCount()
Description copied from class:TableSubclass 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.- Overrides:
getAddedRowCountin classTable- Returns:
- the number of rows to be added, starting at the index returned by
Table.getFirstAddedItemIndex(). For plain Table it is always 0.
-
getFirstUpdatedItemIndex
protected int getFirstUpdatedItemIndex()
Description copied from class:TableSubclass 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.- Overrides:
getFirstUpdatedItemIndexin classTable- Returns:
- the index of the first item to be updated. For plain Table it is always 0.
-
getUpdatedRowCount
protected int getUpdatedRowCount()
Description copied from class:TableSubclass 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.- Overrides:
getUpdatedRowCountin classTable- Returns:
- the number of rows to update, starting at the index returned by
Table.getFirstUpdatedItemIndex(). For plain table it is always 0.
-
shouldHideAddedRows
protected boolean shouldHideAddedRows()
Description copied from class:TableSubclass 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 byTable.getFirstAddedItemIndex()andTable.getAddedRowCount()should be hidden instead of added.- Overrides:
shouldHideAddedRowsin classTable- Returns:
- whether the rows to add (see
Table.getFirstAddedItemIndex()andTable.getAddedRowCount()) should be added or hidden. For plain Table it is always false.
-
size
public int size()
Description copied from class:AbstractSelectGets the number of items in the container.- Specified by:
sizein interfaceContainer- Overrides:
sizein classAbstractSelect- Returns:
- the Number of items in the container.
- See Also:
Container.size()
-
getContainerDataSource
public Container.Hierarchical getContainerDataSource()
Description copied from class:AbstractSelectGets the viewing data-source container.- Specified by:
getContainerDataSourcein interfaceContainer.Viewer- Overrides:
getContainerDataSourcein classAbstractSelect- Returns:
- data source Container
- See Also:
Container.Viewer.getContainerDataSource()
-
setContainerDataSource
public void setContainerDataSource(Container newDataSource)
Description copied from class:TableSets 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 useTable.setContainerDataSource(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 classTable- Parameters:
newDataSource- the new data source.- See Also:
Container.Viewer.setContainerDataSource(Container)
-
containerItemSetChange
public void containerItemSetChange(Container.ItemSetChangeEvent event)
Description copied from class:TableContainer datasource item set change. Table must flush its buffers on change.- Specified by:
containerItemSetChangein interfaceContainer.ItemSetChangeListener- Overrides:
containerItemSetChangein classTable- Parameters:
event- change event text- See Also:
Container.ItemSetChangeListener.containerItemSetChange(Container.ItemSetChangeEvent)
-
getIdByIndex
protected Object getIdByIndex(int index)
Description copied from class:TableReturns 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.- Overrides:
getIdByIndexin classTable- Parameters:
index- the index for which the item ID should be fetched- Returns:
- the item ID for the given index
-
nextItemId
public Object nextItemId(Object itemId)
Description copied from class:TableGets the ID of the Item following the Item that corresponds to itemId.- Specified by:
nextItemIdin interfaceContainer.Ordered- Overrides:
nextItemIdin classTable- 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)
-
lastItemId
public Object lastItemId()
Description copied from class:TableGets the ID of the last Item in the Container.- Specified by:
lastItemIdin interfaceContainer.Ordered- Overrides:
lastItemIdin classTable- Returns:
- ID of the last visible Item in the Container
- See Also:
Container.Ordered.lastItemId()
-
prevItemId
public Object prevItemId(Object itemId)
Description copied from class:TableGets the ID of the Item preceding the Item that corresponds to the itemId.- Specified by:
prevItemIdin interfaceContainer.Ordered- Overrides:
prevItemIdin classTable- 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)
-
isLastId
public boolean isLastId(Object itemId)
Description copied from class:TableTests if the Item corresponding to the given Item ID is the last Item in the Container.- Specified by:
isLastIdin interfaceContainer.Ordered- Overrides:
isLastIdin classTable- Returns:
trueif the Item is last visible item in the Container,falseif not- See Also:
Container.Ordered.isLastId(java.lang.Object)
-
getItemIds
public Collection<?> getItemIds()
Description copied from class:AbstractSelectGets the item Id collection from the container.- Specified by:
getItemIdsin interfaceContainer- Overrides:
getItemIdsin classAbstractSelect- Returns:
- the Collection of item ids.
-
areChildrenAllowed
public boolean areChildrenAllowed(Object itemId)
Description copied from interface:Container.HierarchicalTests if the Item with given ID can have children.- Specified by:
areChildrenAllowedin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item in the container whose child capability is to be tested- Returns:
trueif the specified Item exists in the Container and it can have children,falseif it's not found from the container or it can't have children.
-
getChildren
public Collection<?> getChildren(Object itemId)
Description copied from interface:Container.HierarchicalGets the IDs of all Items that are children of the specified Item. The returned collection is unmodifiable.- Specified by:
getChildrenin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item whose children the caller is interested in- Returns:
- An unmodifiable
collectioncontaining the IDs of all other Items that are children in the container hierarchy;nullif item does not have any children.
-
getParent
public Object getParent(Object itemId)
Description copied from interface:Container.HierarchicalGets the ID of the parent Item of the specified Item.- Specified by:
getParentin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item whose parent the caller wishes to find out.- Returns:
- the ID of the parent Item. Will be
nullif the specified Item is a root element.
-
hasChildren
public boolean hasChildren(Object itemId)
Description copied from interface:Container.HierarchicalTests if the Item specified with
itemIdhas child Items or if it is a leaf. TheContainer.Hierarchical.getChildren(Object itemId)method always returnsnullfor leaf Items.Note that being a leaf does not imply whether or not an Item is allowed to have children.
- Specified by:
hasChildrenin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item to be tested- Returns:
trueif the specified Item has children,falseif not (is a leaf)
-
isRoot
public boolean isRoot(Object itemId)
Description copied from interface:Container.HierarchicalTests if the Item specified withitemIdis a root Item. The hierarchical container can have more than one root and must have at least one unless it is empty. TheContainer.Hierarchical.getParent(Object itemId)method always returnsnullfor root Items.- Specified by:
isRootin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item whose root status is to be tested- Returns:
trueif the specified Item is a root,falseif not
-
rootItemIds
public Collection<?> rootItemIds()
Description copied from interface:Container.HierarchicalGets the IDs of all Items in the container that don't have a parent. Such items are calledrootItems. The returned collection is unmodifiable.- Specified by:
rootItemIdsin interfaceContainer.Hierarchical- Returns:
- An unmodifiable
collectioncontaining IDs of all root elements of the container
-
setChildrenAllowed
public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) throws UnsupportedOperationException
Description copied from interface:Container.HierarchicalSets the given Item's capability to have children. If the Item identified with
itemIdalready has children andis false this method fails andContainer.Hierarchical.areChildrenAllowed(Object)falseis returned.The children must be first explicitly removed with
Container.Hierarchical.setParent(Object itemId, Object newParentId)orContainer.removeItem(Object itemId).This operation is optional. If it is not implemented, the method always returns
false.- Specified by:
setChildrenAllowedin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item in the container whose child capability is to be setareChildrenAllowed- boolean value specifying if the Item can have children or not- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException
-
setParent
public boolean setParent(Object itemId, Object newParentId) throws UnsupportedOperationException
Sets the parent of an Item. The new parent item must exist and be able to have children. (
). It is also possible to detach a node from the hierarchy (and thus make it root) by setting the parentContainer.Hierarchical.areChildrenAllowed(Object)== truenull.This operation is optional.
Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance.- Specified by:
setParentin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the item to be set as the child of the Item identified withnewParentIdnewParentId- ID of the Item that's to be the new parent of the Item identified withitemId- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException
-
addItem
public Object addItem() throws UnsupportedOperationException
Creates a new item into container with container managed id. The id of the created new item is returned. The item can be fetched with getItem() method. if the creation fails, null is returned.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- Specified by:
addItemin interfaceContainer- Overrides:
addItemin classAbstractSelect- Returns:
- the Id of the created item or null in case of failure.
- Throws:
UnsupportedOperationException- if adding an item without an explicit item ID is not supported by the container- See Also:
Container.addItem()
-
addItem
public Item addItem(Object itemId) throws UnsupportedOperationException
Create a new item into container. The created new item is returned and ready for setting property values. if the creation fails, null is returned. In case the container already contains the item, null is returned. This functionality is optional. If the function is unsupported, it always returns null.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- Specified by:
addItemin interfaceContainer- Overrides:
addItemin classAbstractSelect- Parameters:
itemId- the Identification of the item to be created.- Returns:
- the Created item with the given id, or null in case of failure.
- Throws:
UnsupportedOperationException- if adding an item with an explicit item ID is not supported by the container- See Also:
Container.addItem(java.lang.Object)
-
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.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- Overrides:
addItemin classTable- 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
-
addItemAfter
public Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException
Adds new item after the given item.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- Specified by:
addItemAfterin interfaceContainer.Ordered- Overrides:
addItemAfterin classTable- 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)
-
addItemAfter
public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException
Adds new item after the given item.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- Specified by:
addItemAfterin interfaceContainer.Ordered- Overrides:
addItemAfterin classTable- 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)
-
addItems
public void addItems(Collection<?> itemIds) throws UnsupportedOperationException
Adds given items with given item ids to container.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- Overrides:
addItemsin classAbstractSelect- Parameters:
itemIds- item identifiers to be added to underlying container- Throws:
UnsupportedOperationException- if the underlying container don't support adding items with identifiers
-
addItems
public void addItems(Object... itemId) throws UnsupportedOperationException
Adds given items with given item ids to container.Note: Constructing a big hierarchical data set using the methods in
TreeTablemay cause a decrease in performance. Instead aContainer.Hierarchicalcontainer should be populated before setting it to theTreeTable.- Overrides:
addItemsin classAbstractSelect- Parameters:
itemId- item identifiers to be added to underlying container- Throws:
UnsupportedOperationException- if the underlying container don't support adding items with identifiers
-
setCollapsed
public void setCollapsed(Object itemId, boolean collapsed)
Sets the Item specified by given identifier as collapsed or expanded. If the Item is collapsed, its children are not displayed to the user.- Parameters:
itemId- the identifier of the Itemcollapsed- true if the Item should be collapsed, false if expanded
-
isCollapsed
public boolean isCollapsed(Object itemId)
Checks if Item with given identifier is collapsed in the UI.- Parameters:
itemId- the identifier of the checked Item- Returns:
- true if the Item with given id is collapsed
- See Also:
Collapsible.isCollapsed(Object)
-
setHierarchyColumn
public void setHierarchyColumn(Object hierarchyColumnId)
Explicitly sets the column in which the TreeTable visualizes the hierarchy. If hierarchyColumnId is not set, the hierarchy is visualized in the first visible column.- Parameters:
hierarchyColumnId-
-
getHierarchyColumnId
public Object getHierarchyColumnId()
- Returns:
- the identifier of column into which the hierarchy will be visualized or null if the column is not explicitly defined.
-
addExpandListener
public void addExpandListener(Tree.ExpandListener listener)
Adds an expand listener.- Parameters:
listener- the Listener to be added.
-
addListener
@Deprecated public void addListener(Tree.ExpandListener listener)
Deprecated.As of 7.0, replaced byaddExpandListener(ExpandListener)
-
removeExpandListener
public void removeExpandListener(Tree.ExpandListener listener)
Removes an expand listener.- Parameters:
listener- the Listener to be removed.
-
removeListener
@Deprecated public void removeListener(Tree.ExpandListener listener)
Deprecated.As of 7.0, replaced byremoveExpandListener(ExpandListener)
-
fireExpandEvent
protected void fireExpandEvent(Object itemId)
Emits an expand event.- Parameters:
itemId- the item id.
-
addCollapseListener
public void addCollapseListener(Tree.CollapseListener listener)
Adds a collapse listener.- Parameters:
listener- the Listener to be added.
-
addListener
@Deprecated public void addListener(Tree.CollapseListener listener)
Deprecated.As of 7.0, replaced byaddCollapseListener(CollapseListener)
-
removeCollapseListener
public void removeCollapseListener(Tree.CollapseListener listener)
Removes a collapse listener.- Parameters:
listener- the Listener to be removed.
-
removeListener
@Deprecated public void removeListener(Tree.CollapseListener listener)
Deprecated.As of 7.0, replaced byremoveCollapseListener(CollapseListener)
-
fireCollapseEvent
protected void fireCollapseEvent(Object itemId)
Emits a collapse event.- Parameters:
itemId- the item id.
-
isAnimationsEnabled
public boolean isAnimationsEnabled()
- Returns:
- true if animations are enabled
-
setAnimationsEnabled
public void setAnimationsEnabled(boolean animationsEnabled)
Animations can be enabled by passing true to this method. Currently expanding rows slide in from the top and collapsing rows slide out the same way. NOTE! not supported in Internet Explorer 6 or 7.- Parameters:
animationsEnabled- true or false whether to enable animations or not.
-
getItemIds
protected List<Object> getItemIds(int firstIndex, int rows)
- Overrides:
getItemIdsin classTable
-
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 classTable- 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
-
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 classTable- Parameters:
design- the element into which to insert the itemscontext- the DesignContext instance used in writing
-
writeItems
protected void writeItems(org.jsoup.nodes.Element tbody, Collection<?> itemIds, int depth, DesignContext context)
-
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.
-
getState
protected TreeTableState 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().
-
-