com.vaadin.ui
Class TreeTable

java.lang.Object
  extended by com.vaadin.terminal.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractField<Object>
              extended by com.vaadin.ui.AbstractSelect
                  extended by com.vaadin.ui.Table
                      extended by com.vaadin.ui.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, DragSource, DropTarget, ItemClickEvent.ItemClickNotifier, MethodEventSource, Connector, ClientConnector, RpcTarget, Sizeable, Vaadin6Component, VariableOwner, Component, Component.Focusable, Field<Object>, HasComponents, Serializable, Iterable<Component>, EventListener

public class TreeTable
extends Table
implements Container.Hierarchical

TreeTable extends the Table component so that it can also visualize a hierarchy of its Items in a similar manner that Tree does. The tree hierarchy is always displayed in the first actual column of the TreeTable.

The TreeTable supports the usual Table features 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.Hierarchical container interfaces, but also a more fine tuned version - Collapsible. A container implementing the Collapsible interface 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 that Collapsible containers can not be shared among several users as they share UI state in the container.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.ui.Table
Table.Align, Table.CellStyleGenerator, 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.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.MultiSelectMode, 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 class com.vaadin.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
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.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.Sizeable
Sizeable.Unit
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.VariableOwner
VariableOwner.ErrorEvent
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Field
Field.ValueChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered
Buffered.SourceException
 
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
 
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 interface com.vaadin.terminal.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
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
 void addListener(Tree.CollapseListener listener)
          Adds a collapse listener.
 void addListener(Tree.ExpandListener listener)
          Adds an expand listener.
 boolean areChildrenAllowed(Object itemId)
          Tests if the Item with given ID can have children.
 void changeVariables(Object source, Map<String,Object> variables)
          Invoked when the value of a variable has changed.
 void containerItemSetChange(Container.ItemSetChangeEvent event)
          Container datasource item set change.
protected  void fireCollapseEvent(Object itemId)
          Emits a collapse event.
protected  void fireExpandEvent(Object itemId)
          Emits an expand event.
protected  int getAddedRowCount()
          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.Hierarchical getContainerDataSource()
          Gets the viewing data-source container.
protected  int getFirstAddedItemIndex()
          Subclass and override this to enable partial row additions, bypassing the normal caching mechanism.
protected  int getFirstUpdatedItemIndex()
          Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism.
 Object getHierarchyColumnId()
           
protected  Object getIdByIndex(int index)
           
 Collection<?> getItemIds()
          Gets the item Id collection from the container.
 Object getParent(Object itemId)
          Gets the ID of the parent Item of the specified Item.
protected  int getUpdatedRowCount()
          Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism.
 boolean hasChildren(Object itemId)
           Tests if the Item specified with itemId has child Items or if it is a leaf.
protected  int indexOfId(Object itemId)
           
 boolean isAnimationsEnabled()
           
 boolean isCollapsed(Object itemId)
          Checks if Item with given identifier is collapsed in the UI.
 boolean isLastId(Object itemId)
          Tests if the Item corresponding to the given Item ID is the last Item in the Container.
protected  boolean isPartialRowUpdate()
          Subclass and override this to enable partial row updates and additions, which bypass the normal caching mechanism.
 boolean isRoot(Object itemId)
          Tests if the Item specified with itemId is a root Item.
 Object lastItemId()
          Gets the ID of the last Item in the Container.
 Object nextItemId(Object itemId)
          Gets the ID of the Item following the Item that corresponds to itemId.
 void paintContent(PaintTarget target)
          Paints the content of this component.
protected  void paintRowAttributes(PaintTarget target, Object itemId)
          A method where extended Table implementations may add their custom attributes for rows.
protected  void paintRowIcon(PaintTarget target, Object[][] cells, int indexInRowbuffer)
           
 Object prevItemId(Object itemId)
          Gets the ID of the Item preceding the Item that corresponds to the itemId.
 void removeListener(Tree.CollapseListener listener)
          Removes a collapse listener.
 void removeListener(Tree.ExpandListener listener)
          Removes an expand listener.
 Collection<?> rootItemIds()
          Gets the IDs of all Items in the container that don't have a parent.
 void setAnimationsEnabled(boolean animationsEnabled)
          Animations can be enabled by passing true to this method.
 boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed)
           Sets the given Item's capability to have children.
 void setCollapsed(Object itemId, boolean collapsed)
          Sets the Item specified by given identifier as collapsed or expanded.
 void setContainerDataSource(Container newDataSource)
          Sets the Container that serves as the data source of the viewer.
 void setHierarchyColumn(Object hierarchyColumnId)
          Explicitly sets the column in which the TreeTable visualizes the hierarchy.
 boolean setParent(Object itemId, Object newParentId)
           Sets the parent of an Item.
protected  boolean shouldHideAddedRows()
          Subclass and override this to enable removing of rows, bypassing the normal caching and lazy loading mechanism.
 int size()
          Gets the number of visible Items in the Container.
 
Methods inherited from class com.vaadin.ui.Table
addActionHandler, addContainerProperty, addContainerProperty, addGeneratedColumn, addItem, addItemAfter, addItemAfter, addListener, addListener, addListener, addListener, addListener, attach, bindPropertyToField, containerPropertySetChange, detach, disableContentRefreshing, enableContentRefreshing, firstItemId, formatPropertyValue, getCacheRate, getCellStyleGenerator, getColumnAlignment, getColumnAlignments, getColumnExpandRatio, getColumnFooter, getColumnGenerator, getColumnHeader, getColumnHeaderMode, getColumnHeaders, getColumnIcon, getColumnIcons, getColumnWidth, getComponentIterator, getConverter, getCurrentPageFirstItemId, getCurrentPageFirstItemIndex, getDragMode, getDropHandler, getItemDescriptionGenerator, getMultiSelectMode, getPageLength, getPropertyValue, getRowGenerator, getRowHeaderMode, getSortableContainerPropertyIds, getSortContainerPropertyId, getTableFieldFactory, getTransferable, getVisibleColumns, getVisibleItemIds, hasConverter, isColumnCollapsed, isColumnCollapsible, isColumnCollapsingAllowed, isColumnReorderingAllowed, isComponentVisible, isEditable, isFirstId, isFooterVisible, isPageBufferingEnabled, isRowCacheInvalidated, isSelectable, isSortAscending, isSortDisabled, isSortEnabled, iterator, paintRowHeader, refreshCurrentPage, refreshRenderedCells, refreshRowCache, registerComponent, removeActionHandler, removeAllActionHandlers, removeAllItems, removeContainerProperty, removeGeneratedColumn, removeItem, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, resetPageBuffer, setCacheRate, setCellStyleGenerator, setColumnAlignment, setColumnAlignments, setColumnCollapsed, setColumnCollapsible, setColumnCollapsingAllowed, setColumnExpandRatio, setColumnFooter, setColumnHeader, setColumnHeaderMode, setColumnHeaders, setColumnIcon, setColumnIcons, setColumnReorderingAllowed, setColumnWidth, setConverter, setCurrentPageFirstItemId, setCurrentPageFirstItemIndex, setDragMode, setDropHandler, setEditable, setEnabled, setFooterVisible, setItemDescriptionGenerator, setMultiSelectMode, setNewItemsAllowed, setPageBufferingEnabled, setPageLength, setRowGenerator, setRowHeaderMode, setSelectable, setSortAscending, setSortContainerPropertyId, setSortDisabled, setSortEnabled, setTableFieldFactory, setVisible, setVisibleColumns, sort, sort, translateDropTargetDetails, unregisterComponent, valueChange
 
Methods inherited from class com.vaadin.ui.AbstractSelect
addItem, addItem, addListener, addListener, containsId, fireItemSetChange, firePropertySetChange, getCaptionChangeListener, getContainerProperty, getContainerPropertyIds, getItem, getItemCaption, getItemCaptionMode, getItemCaptionPropertyId, getItemIcon, getItemIconPropertyId, getListeners, getNewItemHandler, getNullSelectionItemId, getType, getType, getValue, isEmpty, isMultiSelect, isNewItemsAllowed, isNullSelectionAllowed, isSelected, paintItem, removeListener, removeListener, select, setItemCaption, setItemCaptionMode, setItemCaptionPropertyId, setItemIcon, setItemIconPropertyId, setMultiSelect, setNewItemHandler, setNullSelectionAllowed, setNullSelectionItemId, setValue, setValue, unselect
 
Methods inherited from class com.vaadin.ui.AbstractField
addListener, addListener, addValidator, commit, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getPropertyDataSource, getRequiredError, getState, getTabIndex, getValidators, isBuffered, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isReadThrough, isRequired, isValid, isValidationVisible, isWriteThrough, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeValidator, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setReadOnly, setReadThrough, setRequired, setRequiredError, setTabIndex, setValidationVisible, setWriteThrough, shouldHideErrors, toString, updateState, validate, validate
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireEvent, getActionManager, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getHeight, getHeightUnits, getIcon, getLocale, getParent, getRoot, getStyle, getStyleName, getWidth, getWidthUnits, handleError, hasListeners, isConnectorEnabled, isEnabled, isImmediate, isVisible, removeListener, removeListener, removeListener, removeListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeight, setHeight, setIcon, setImmediate, setLocale, setParent, setSizeFull, setSizeUndefined, setStyle, setStyleName, setWidth, setWidth
 
Methods inherited from class com.vaadin.terminal.AbstractClientConnector
addExtension, addMethodInvocationToQueue, createState, getAllChildrenIterable, getConnectorId, getExtensions, getRpcManager, getRpcProxy, getStateType, registerRpc, registerRpc, removeExtension, retrievePendingRpcCalls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vaadin.data.Container.Hierarchical
removeItem
 
Methods inherited from interface com.vaadin.data.Container
addContainerProperty, addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getType, removeAllItems, removeContainerProperty
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, getApplication, getCaption, getDebugId, getIcon, getLocale, getParent, getRoot, getState, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setDebugId, setIcon, setReadOnly, setStyleName, updateState
 
Methods inherited from interface com.vaadin.terminal.gwt.server.ClientConnector
getExtensions, getStateType, isConnectorEnabled, removeExtension, retrievePendingRpcCalls, setParent
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.terminal.gwt.server.RpcTarget
getRpcManager
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth
 
Methods inherited from interface com.vaadin.terminal.VariableOwner
isEnabled, isImmediate
 
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier
addShortcutListener, removeShortcutListener
 

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

TreeTable

public TreeTable(String caption,
                 Container dataSource)
Creates a TreeTable instance with given captions and data source.

Parameters:
caption - the caption for the component
dataSource - the dataSource that is used to list items in the component
Method Detail

paintRowAttributes

protected void paintRowAttributes(PaintTarget target,
                                  Object itemId)
                           throws PaintException
Description copied from class: Table
A method where extended Table implementations may add their custom attributes for rows.

Overrides:
paintRowAttributes in class Table
Throws:
PaintException

paintRowIcon

protected void paintRowIcon(PaintTarget target,
                            Object[][] cells,
                            int indexInRowbuffer)
                     throws PaintException
Overrides:
paintRowIcon in class Table
Throws:
PaintException

changeVariables

public void changeVariables(Object source,
                            Map<String,Object> variables)
Description copied from class: Table
Invoked when the value of a variable has changed.

Specified by:
changeVariables in interface VariableOwner
Overrides:
changeVariables in class Table
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:
Select.changeVariables(java.lang.Object, java.util.Map)

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Description copied from class: AbstractSelect
Paints the content of this component.

Specified by:
paintContent in interface Vaadin6Component
Overrides:
paintContent in class Table
Parameters:
target - the Paint Event.
Throws:
PaintException - if the paint operation failed.

isPartialRowUpdate

protected boolean isPartialRowUpdate()
Description copied from class: Table
Subclass and override this to enable partial row updates and additions, which bypass the normal caching mechanism. This is useful for e.g. TreeTable.

Overrides:
isPartialRowUpdate in class Table
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: Table
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.

Overrides:
getFirstAddedItemIndex in class Table
Returns:
The index of the first added item. For plain Table it is always 0.

getAddedRowCount

protected int getAddedRowCount()
Description copied from class: Table
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.

Overrides:
getAddedRowCount in class Table
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: Table
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.

Overrides:
getFirstUpdatedItemIndex in class Table
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: Table
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.

Overrides:
getUpdatedRowCount in class Table
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: Table
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 by Table.getFirstAddedItemIndex() and Table.getAddedRowCount() should be hidden instead of added.

Overrides:
shouldHideAddedRows in class Table
Returns:
whether the rows to add (see Table.getFirstAddedItemIndex() and Table.getAddedRowCount()) should be added or hidden. For plain Table it is always false.

size

public int size()
Description copied from interface: Container
Gets the number of visible Items in the Container. Filtering can hide items so that they will not be visible through the container API.

Specified by:
size in interface Container
Overrides:
size in class AbstractSelect
Returns:
number of Items in the Container

getContainerDataSource

public Container.Hierarchical getContainerDataSource()
Description copied from class: AbstractSelect
Gets the viewing data-source container.

Specified by:
getContainerDataSource in interface Container.Viewer
Overrides:
getContainerDataSource in class AbstractSelect
Returns:
data source Container
See Also:
Container.Viewer.getContainerDataSource()

setContainerDataSource

public void setContainerDataSource(Container newDataSource)
Description copied from class: AbstractSelect
Sets the Container that serves as the data source of the viewer. As a side-effect the fields value (selection) is set to null due old selection not necessary exists in new Container.

Specified by:
setContainerDataSource in interface Container.Viewer
Overrides:
setContainerDataSource in class Table
Parameters:
newDataSource - the new data source.
See Also:
Container.Viewer.setContainerDataSource(Container)

containerItemSetChange

public void containerItemSetChange(Container.ItemSetChangeEvent event)
Description copied from class: Table
Container datasource item set change. Table must flush its buffers on change.

Specified by:
containerItemSetChange in interface Container.ItemSetChangeListener
Overrides:
containerItemSetChange in class Table
Parameters:
event - change event text
See Also:
Container.ItemSetChangeListener.containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent)

getIdByIndex

protected Object getIdByIndex(int index)
Overrides:
getIdByIndex in class Table

indexOfId

protected int indexOfId(Object itemId)
Overrides:
indexOfId in class Table

nextItemId

public Object nextItemId(Object itemId)
Description copied from class: Table
Gets the ID of the Item following the Item that corresponds to itemId.

Specified by:
nextItemId in interface Container.Ordered
Overrides:
nextItemId in class Table
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: Table
Gets the ID of the last Item in the Container.

Specified by:
lastItemId in interface Container.Ordered
Overrides:
lastItemId in class Table
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: Table
Gets the ID of the Item preceding the Item that corresponds to the itemId.

Specified by:
prevItemId in interface Container.Ordered
Overrides:
prevItemId in class Table
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: Table
Tests if the Item corresponding to the given Item ID is the last Item in the Container.

Specified by:
isLastId in interface Container.Ordered
Overrides:
isLastId in class Table
Returns:
true if the Item is last visible item in the Container, false if not
See Also:
Container.Ordered.isLastId(java.lang.Object)

getItemIds

public Collection<?> getItemIds()
Description copied from class: AbstractSelect
Gets the item Id collection from the container.

Specified by:
getItemIds in interface Container
Overrides:
getItemIds in class AbstractSelect
Returns:
the Collection of item ids.

areChildrenAllowed

public boolean areChildrenAllowed(Object itemId)
Description copied from interface: Container.Hierarchical
Tests if the Item with given ID can have children.

Specified by:
areChildrenAllowed in interface Container.Hierarchical
Parameters:
itemId - ID of the Item in the container whose child capability is to be tested
Returns:
true if the specified Item exists in the Container and it can have children, false if it's not found from the container or it can't have children.

getChildren

public Collection<?> getChildren(Object itemId)
Description copied from interface: Container.Hierarchical
Gets the IDs of all Items that are children of the specified Item. The returned collection is unmodifiable.

Specified by:
getChildren in interface Container.Hierarchical
Parameters:
itemId - ID of the Item whose children the caller is interested in
Returns:
An unmodifiable collection containing the IDs of all other Items that are children in the container hierarchy

getParent

public Object getParent(Object itemId)
Description copied from interface: Container.Hierarchical
Gets the ID of the parent Item of the specified Item.

Specified by:
getParent in interface Container.Hierarchical
Parameters:
itemId - ID of the Item whose parent the caller wishes to find out.
Returns:
the ID of the parent Item. Will be null if the specified Item is a root element.

hasChildren

public boolean hasChildren(Object itemId)
Description copied from interface: Container.Hierarchical

Tests if the Item specified with itemId has child Items or if it is a leaf. The Container.Hierarchical.getChildren(Object itemId) method always returns null for leaf Items.

Note that being a leaf does not imply whether or not an Item is allowed to have children.

.

Specified by:
hasChildren in interface Container.Hierarchical
Parameters:
itemId - ID of the Item to be tested
Returns:
true if the specified Item has children, false if not (is a leaf)

isRoot

public boolean isRoot(Object itemId)
Description copied from interface: Container.Hierarchical
Tests if the Item specified with itemId is a root Item. The hierarchical container can have more than one root and must have at least one unless it is empty. The Container.Hierarchical.getParent(Object itemId) method always returns null for root Items.

Specified by:
isRoot in interface Container.Hierarchical
Parameters:
itemId - ID of the Item whose root status is to be tested
Returns:
true if the specified Item is a root, false if not

rootItemIds

public Collection<?> rootItemIds()
Description copied from interface: Container.Hierarchical
Gets the IDs of all Items in the container that don't have a parent. Such items are called root Items. The returned collection is unmodifiable.

Specified by:
rootItemIds in interface Container.Hierarchical
Returns:
An unmodifiable collection containing IDs of all root elements of the container

setChildrenAllowed

public boolean setChildrenAllowed(Object itemId,
                                  boolean areChildrenAllowed)
                           throws UnsupportedOperationException
Description copied from interface: Container.Hierarchical

Sets the given Item's capability to have children. If the Item identified with itemId already has children and Container.Hierarchical.areChildrenAllowed(Object) is false this method fails and false is returned.

The children must be first explicitly removed with Container.Hierarchical.setParent(Object itemId, Object newParentId)or Container.removeItem(Object itemId).

This operation is optional. If it is not implemented, the method always returns false.

Specified by:
setChildrenAllowed in interface Container.Hierarchical
Parameters:
itemId - ID of the Item in the container whose child capability is to be set
areChildrenAllowed - boolean value specifying if the Item can have children or not
Returns:
true if the operation succeeded, false if not
Throws:
UnsupportedOperationException

setParent

public boolean setParent(Object itemId,
                         Object newParentId)
                  throws UnsupportedOperationException
Description copied from interface: Container.Hierarchical

Sets the parent of an Item. The new parent item must exist and be able to have children. ( Container.Hierarchical.areChildrenAllowed(Object) == true ). It is also possible to detach a node from the hierarchy (and thus make it root) by setting the parent null.

This operation is optional.

Specified by:
setParent in interface Container.Hierarchical
Parameters:
itemId - ID of the item to be set as the child of the Item identified with newParentId
newParentId - ID of the Item that's to be the new parent of the Item identified with itemId
Returns:
true if the operation succeeded, false if not
Throws:
UnsupportedOperationException

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 Item
collapsed - 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.

addListener

public void addListener(Tree.ExpandListener listener)
Adds an expand listener.

Parameters:
listener - the Listener to be added.

removeListener

public void removeListener(Tree.ExpandListener listener)
Removes an expand listener.

Parameters:
listener - the Listener to be removed.

fireExpandEvent

protected void fireExpandEvent(Object itemId)
Emits an expand event.

Parameters:
itemId - the item id.

addListener

public void addListener(Tree.CollapseListener listener)
Adds a collapse listener.

Parameters:
listener - the Listener to be added.

removeListener

public void removeListener(Tree.CollapseListener listener)
Removes a collapse listener.

Parameters:
listener - the Listener to be removed.

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.


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.