diff options
author | Ilia Motornyi <elmot@vaadin.com> | 2015-12-03 14:59:05 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-12-03 14:59:12 +0000 |
commit | 2af72ba9636bec70046394c41744f89ce4572e35 (patch) | |
tree | ccb3dc2d2239585f8c3f79eb5f131ff61ca9ce86 /documentation/components/components-treetable.asciidoc | |
parent | 8aa5fabe89f2967e966a64842a608eceaf80d08f (diff) | |
download | vaadin-framework-2af72ba9636bec70046394c41744f89ce4572e35.tar.gz vaadin-framework-2af72ba9636bec70046394c41744f89ce4572e35.zip |
Revert "Merge branch 'documentation'"7.6.0.beta2
This reverts commit f6874bde3d945c8b2d1b5c17ab50e2d0f1f8ff00.
Change-Id: I67ee1c30ba3e3bcc3c43a1dd2e73a822791514bf
Diffstat (limited to 'documentation/components/components-treetable.asciidoc')
-rw-r--r-- | documentation/components/components-treetable.asciidoc | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/documentation/components/components-treetable.asciidoc b/documentation/components/components-treetable.asciidoc deleted file mode 100644 index 97e53cdf76..0000000000 --- a/documentation/components/components-treetable.asciidoc +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: TreeTable -order: 23 -layout: page ---- - -[[components.treetable]] -= [classname]#TreeTable# - -[classname]#TreeTable# is an extension of the [classname]#Table# component with -support for a tree-like hierarchy in the first column. As with -[classname]#Tree#, the hierarchy is determined by the parent-children -relationships defined in the [interfacename]#Container.Hierarchical# interface. -The default container is [classname]#HierarchicalContainer#, but you can bind -[classname]#TreeTable# to any container implementing the interface. - -[[figure.components.treetable.basic]] -.[classname]#TreeTable# Component -image::img/treetable-basic.png[] - -As with [classname]#Tree#, you can define the parent-child relationships with -[methodname]#setParent()#, as is shown in the following example with numeric -item IDs: - - -[source, java] ----- -TreeTable ttable = new TreeTable("My TreeTable"); -ttable.addContainerProperty("Name", String.class, null); -ttable.addContainerProperty("Number", Integer.class, null); - -// Create the tree nodes and set the hierarchy -ttable.addItem(new Object[]{"Menu", null}, 0); -ttable.addItem(new Object[]{"Beverages", null}, 1); -ttable.setParent(1, 0); -ttable.addItem(new Object[]{"Foods", null}, 2); -ttable.setParent(2, 0); -ttable.addItem(new Object[]{"Coffee", 23}, 3); -ttable.addItem(new Object[]{"Tea", 42}, 4); -ttable.setParent(3, 1); -ttable.setParent(4, 1); -ttable.addItem(new Object[]{"Bread", 13}, 5); -ttable.addItem(new Object[]{"Cake", 11}, 6); -ttable.setParent(5, 2); -ttable.setParent(6, 2); ----- - -Some container types may allow defining hierarchies if the container data -itself, without explicitly setting the parent-child relationships with -[methodname]#setParent()#. - -Unlike [classname]#Tree#, a [classname]#TreeTable# can have components in the -hierarchical column, both when the property type is a component type and when -the tree table is in editable mode. - -For other features, we refer you to documentation for [classname]#Table#, as -given in -<<dummy/../../../framework/components/components-table#components.table,"Table">>. - -[[components.treetable.collapsed]] -== Expanding and Collapsing Items - -As in [classname]#Tree#, you can set the expanded/collapsed state of an item -programmatically with [methodname]#setCollapsed()#. Note that if you want to -expand all items, there is no [methodname]#expandItemsRecursively()# like in -[classname]#Tree#. Moreover, the [methodname]#getItemIds()# only returns the IDs -of the currently visible items for ordinary [interfacename]#Hierarchical# (not -[interfacename]#Collapsible#) containers. Hence you can not use that to iterate -over all the items, but you need to get the IDs from the underlying container. - - -[source, java] ----- -// Expand the tree -for (Object itemId: ttable.getContainerDataSource() - .getItemIds()) { - ttable.setCollapsed(itemId, false); - - // As we're at it, also disallow children from - // the current leaves - if (! ttable.hasChildren(itemId)) - ttable.setChildrenAllowed(itemId, false); -} ----- - -In large tables, this explicit setting becomes infeasible, as it needs to be -stored in the [classname]#TreeTable# (more exactly, in the -[classname]#HierarchicalStrategy# object) for all the contained items. You can -use a [interfacename]#Collapsible# container to store the collapsed states in -the container, thereby avoiding the explicit settings and memory overhead. There -are no built-in collapsible containers in the Vaadin core framework, so you -either need to use an add-on container or implement it yourself. - - - - |