public class TreeTable extends Table implements Container.Hierarchical
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.
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
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
AbstractSelect.AbstractSelectTargetDetails, AbstractSelect.AcceptItem, AbstractSelect.CaptionChangeListener, AbstractSelect.DefaultNewItemHandler, AbstractSelect.Filtering, AbstractSelect.ItemCaptionMode, AbstractSelect.ItemDescriptionGenerator, AbstractSelect.NewItemHandler, AbstractSelect.TargetItemIs, AbstractSelect.VerticalLocationIs
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
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
HasChildMeasurementHint.ChildMeasurementHint
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
Field.ValueChangeEvent
Buffered.SourceException
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
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
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
DESIGN_ATTR_PLAIN_TEXT
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
void |
addCollapseListener(Tree.CollapseListener listener)
Adds a collapse listener.
|
void |
addExpandListener(Tree.ExpandListener listener)
Adds an expand listener.
|
Object |
addItem()
Creates a new item into container with container managed id.
|
Item |
addItem(Object itemId)
Create a new item into container.
|
Object |
addItem(Object[] cells,
Object itemId)
Adds the new row to table and fill the visible cells (except generated
columns) with given values.
|
Object |
addItemAfter(Object previousItemId)
Adds new item after the given item.
|
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Adds new item after the given item.
|
void |
addItems(Collection<?> itemIds)
Adds given items with given item ids to container.
|
void |
addItems(Object... itemId)
Adds given items with given item ids to container.
|
void |
addListener(Tree.CollapseListener listener)
Deprecated.
As of 7.0, replaced by
#addCollapseListener(CollapseListener) |
void |
addListener(Tree.ExpandListener listener)
Deprecated.
As of 7.0, replaced by
#addExpandListener(ExpandListener) |
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)
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) |
Object |
getParent(Object itemId)
Gets the ID of the parent Item of the specified Item.
|
protected TreeTableState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
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.
|
protected void |
readBody(org.jsoup.nodes.Element design,
DesignContext context) |
protected Object |
readItem(org.jsoup.nodes.Element tr,
Set<String> selected,
DesignContext context)
Reads an Item from a design and inserts it into the data source.
|
void |
removeCollapseListener(Tree.CollapseListener listener)
Removes a collapse listener.
|
void |
removeExpandListener(Tree.ExpandListener listener)
Removes an expand listener.
|
void |
removeListener(Tree.CollapseListener listener)
Deprecated.
As of 7.0, replaced by
#removeCollapseListener(CollapseListener) |
void |
removeListener(Tree.ExpandListener listener)
Deprecated.
As of 7.0, replaced by
#removeExpandListener(ExpandListener) |
Collection<?> |
rootItemIds()
Gets the IDs of all Items in the container that don't have a parent.
|
protected boolean |
rowHeadersAreEnabled()
Checks whether row headers are visible.
|
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 items in the container.
|
protected org.jsoup.nodes.Element |
writeItem(org.jsoup.nodes.Element tbody,
Object itemId,
DesignContext context)
Writes a data source Item to a design.
|
protected void |
writeItems(org.jsoup.nodes.Element tbody,
Collection<?> itemIds,
int depth,
DesignContext context) |
protected void |
writeItems(org.jsoup.nodes.Element design,
DesignContext context)
Writes the data source items to a design.
|
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, 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, setNewItemsAllowed, setPageLength, setRowGenerator, setRowHeaderMode, setSelectable, setSortAscending, setSortContainerPropertyId, setSortDisabled, setSortEnabled, setTableFieldFactory, setVisible, setVisibleColumns, sort, sort, translateDropTargetDetails, unregisterComponent, valueChange, writeDesign
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
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
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
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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
removeItem
addContainerProperty, containsId, getContainerProperty, getContainerPropertyIds, getItem, getType, removeAllItems, removeContainerProperty
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, removeAttachListener, removeDetachListener, removeExtension, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
forEach, spliterator
isEnabled, isImmediate
addShortcutListener, removeShortcutListener
public TreeTable()
public TreeTable(String caption)
caption
- the caption for the TreeTableprotected void paintRowAttributes(PaintTarget target, Object itemId) throws PaintException
Table
paintRowAttributes
in class Table
PaintException
protected void paintRowIcon(PaintTarget target, Object[][] cells, int indexInRowbuffer) throws PaintException
paintRowIcon
in class Table
PaintException
protected boolean rowHeadersAreEnabled()
Table
rowHeadersAreEnabled
in class Table
false
if row headers are hidden, true
otherwisepublic void changeVariables(Object source, Map<String,Object> variables)
Table
changeVariables
in interface VariableOwner
changeVariables
in class Table
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.ComboBox.changeVariables(java.lang.Object, java.util.Map)
public void paintContent(PaintTarget target) throws PaintException
AbstractSelect
paintContent
in interface LegacyComponent
paintContent
in class Table
target
- the Paint Event.PaintException
- if the paint operation failed.protected boolean isPartialRowUpdate()
Table
isPartialRowUpdate
in class Table
protected int getFirstAddedItemIndex()
Table
getFirstAddedItemIndex
in class Table
protected int getAddedRowCount()
Table
getAddedRowCount
in class Table
Table.getFirstAddedItemIndex()
. For plain Table it is always
0.protected int getFirstUpdatedItemIndex()
Table
getFirstUpdatedItemIndex
in class Table
protected int getUpdatedRowCount()
Table
getUpdatedRowCount
in class Table
Table.getFirstUpdatedItemIndex()
. For plain table it is always
0.protected boolean shouldHideAddedRows()
Table
Table.getFirstAddedItemIndex()
and Table.getAddedRowCount()
should
be hidden instead of added.shouldHideAddedRows
in class Table
Table.getFirstAddedItemIndex()
and Table.getAddedRowCount()
) should be added or hidden. For
plain Table it is always false.public int size()
AbstractSelect
size
in interface Container
size
in class AbstractSelect
Container.size()
public Container.Hierarchical getContainerDataSource()
AbstractSelect
getContainerDataSource
in interface Container.Viewer
getContainerDataSource
in class AbstractSelect
Container.Viewer#getContainerDataSource()
public void setContainerDataSource(Container newDataSource)
Table
Table.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.
setContainerDataSource
in interface Container.Viewer
setContainerDataSource
in class Table
newDataSource
- the new data source.Container.Viewer#setContainerDataSource(Container)
public void containerItemSetChange(Container.ItemSetChangeEvent event)
Table
containerItemSetChange
in interface Container.ItemSetChangeListener
containerItemSetChange
in class Table
event
- change event textContainer.ItemSetChangeListener#containerItemSetChange(Container.ItemSetChangeEvent)
protected Object getIdByIndex(int index)
Table
Container.Indexed
.
See Container.Indexed#getIdByIndex(int)
for more information
about the exceptions that can be thrown.getIdByIndex
in class Table
index
- the index for which the item ID should be fetchedpublic Object nextItemId(Object itemId)
Table
nextItemId
in interface Container.Ordered
nextItemId
in class Table
itemId
- ID of a visible Item in the Containernull
Container.Ordered#nextItemId(java.lang.Object)
public Object lastItemId()
Table
lastItemId
in interface Container.Ordered
lastItemId
in class Table
Container.Ordered#lastItemId()
public Object prevItemId(Object itemId)
Table
prevItemId
in interface Container.Ordered
prevItemId
in class Table
itemId
- ID of a visible Item in the Containernull
Container.Ordered#prevItemId(java.lang.Object)
public boolean isLastId(Object itemId)
Table
isLastId
in interface Container.Ordered
isLastId
in class Table
true
if the Item is last visible item in the
Container, false
if notContainer.Ordered#isLastId(java.lang.Object)
public Collection<?> getItemIds()
AbstractSelect
getItemIds
in interface Container
getItemIds
in class AbstractSelect
public boolean areChildrenAllowed(Object itemId)
Container.Hierarchical
areChildrenAllowed
in interface Container.Hierarchical
itemId
- ID of the Item in the container whose child capability is
to be testedtrue
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.public Collection<?> getChildren(Object itemId)
Container.Hierarchical
getChildren
in interface Container.Hierarchical
itemId
- ID of the Item whose children the caller is interested incollection
containing the IDs of all other Items that are children in
the container hierarchy; null
if item does not have
any children.public Object getParent(Object itemId)
Container.Hierarchical
getParent
in interface Container.Hierarchical
itemId
- ID of the Item whose parent the caller wishes to find out.null
if the
specified Item is a root element.public boolean hasChildren(Object itemId)
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.
hasChildren
in interface Container.Hierarchical
itemId
- ID of the Item to be testedtrue
if the specified Item has children,
false
if not (is a leaf)public boolean isRoot(Object itemId)
Container.Hierarchical
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.isRoot
in interface Container.Hierarchical
itemId
- ID of the Item whose root status is to be testedtrue
if the specified Item is a root,
false
if notpublic Collection<?> rootItemIds()
Container.Hierarchical
root
Items. The returned
collection is unmodifiable.rootItemIds
in interface Container.Hierarchical
collection
containing IDs of all root elements of the containerpublic boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) throws UnsupportedOperationException
Container.Hierarchical
Sets the given Item's capability to have children. If the Item
identified with itemId
already has children and
is false this method
fails and Container.Hierarchical.areChildrenAllowed(Object)
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
.
setChildrenAllowed
in interface Container.Hierarchical
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
nottrue
if the operation succeeded,
false
if notUnsupportedOperationException
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 parent Container.Hierarchical.areChildrenAllowed(Object)
== truenull
.
This operation is optional.
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance.
setParent
in interface Container.Hierarchical
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
true
if the operation succeeded,
false
if notUnsupportedOperationException
public Object addItem() throws UnsupportedOperationException
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
addItem
in interface Container
addItem
in class AbstractSelect
UnsupportedOperationException
- if adding an item without an explicit item ID is not
supported by the containerContainer.addItem()
public Item addItem(Object itemId) throws UnsupportedOperationException
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
addItem
in interface Container
addItem
in class AbstractSelect
itemId
- the Identification of the item to be created.UnsupportedOperationException
- if adding an item with an explicit item ID is not supported
by the containerContainer.addItem(java.lang.Object)
public Object addItem(Object[] cells, Object itemId) throws UnsupportedOperationException
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
addItem
in class Table
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.UnsupportedOperationException
public Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
addItemAfter
in interface Container.Ordered
addItemAfter
in class Table
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.UnsupportedOperationException
- if the operation is not supported by the containerContainer.Ordered#addItemAfter(java.lang.Object, java.lang.Object)
public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
addItemAfter
in interface Container.Ordered
addItemAfter
in class Table
previousItemId
- Id of the visible item in ordered container after which to
insert the new item.UnsupportedOperationException
- if the operation is not supported by the containerContainer.Ordered#addItemAfter(java.lang.Object)
public void addItems(Collection<?> itemIds) throws UnsupportedOperationException
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
addItems
in class AbstractSelect
itemIds
- item identifiers to be added to underlying containerUnsupportedOperationException
- if the underlying container don't support adding items with
identifierspublic void addItems(Object... itemId) throws UnsupportedOperationException
Note: Constructing a big hierarchical data set using the
methods in TreeTable
may cause a decrease in performance. Instead a
Container.Hierarchical
container should be populated before setting it
to the TreeTable
.
addItems
in class AbstractSelect
itemId
- item identifiers to be added to underlying containerUnsupportedOperationException
- if the underlying container don't support adding items with
identifierspublic void setCollapsed(Object itemId, boolean collapsed)
itemId
- the identifier of the Itemcollapsed
- true if the Item should be collapsed, false if expandedpublic boolean isCollapsed(Object itemId)
itemId
- the identifier of the checked ItemCollapsible.isCollapsed(Object)
public void setHierarchyColumn(Object hierarchyColumnId)
hierarchyColumnId
- public Object getHierarchyColumnId()
public void addExpandListener(Tree.ExpandListener listener)
listener
- the Listener to be added.@Deprecated public void addListener(Tree.ExpandListener listener)
#addExpandListener(ExpandListener)
public void removeExpandListener(Tree.ExpandListener listener)
listener
- the Listener to be removed.@Deprecated public void removeListener(Tree.ExpandListener listener)
#removeExpandListener(ExpandListener)
protected void fireExpandEvent(Object itemId)
itemId
- the item id.public void addCollapseListener(Tree.CollapseListener listener)
listener
- the Listener to be added.@Deprecated public void addListener(Tree.CollapseListener listener)
#addCollapseListener(CollapseListener)
public void removeCollapseListener(Tree.CollapseListener listener)
listener
- the Listener to be removed.@Deprecated public void removeListener(Tree.CollapseListener listener)
#removeCollapseListener(CollapseListener)
protected void fireCollapseEvent(Object itemId)
itemId
- the item id.public boolean isAnimationsEnabled()
public void setAnimationsEnabled(boolean animationsEnabled)
animationsEnabled
- true or false whether to enable animations or not.protected List<Object> getItemIds(int firstIndex, int rows)
getItemIds
in class Table
protected void readBody(org.jsoup.nodes.Element design, DesignContext context)
protected Object readItem(org.jsoup.nodes.Element tr, Set<String> selected, DesignContext context)
AbstractSelect
readItem
in class Table
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 parsingprotected void writeItems(org.jsoup.nodes.Element design, DesignContext context)
AbstractSelect
writeItems
in class Table
design
- the element into which to insert the itemscontext
- the DesignContext instance used in writingprotected void writeItems(org.jsoup.nodes.Element tbody, Collection<?> itemIds, int depth, DesignContext context)
protected org.jsoup.nodes.Element writeItem(org.jsoup.nodes.Element tbody, Object itemId, DesignContext context)
AbstractSelect
protected TreeTableState getState()
AbstractComponent
Copyright © 2019 Vaadin Ltd. All rights reserved.