From c7e28c5d0684e516238e122a45691514d3dc10d8 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Wed, 29 Nov 2017 13:27:39 +0200 Subject: [PATCH] Add disclaimers about performance to TreeTable (#10381) --- .../components/components-treetable.asciidoc | 4 +- .../main/java/com/vaadin/ui/TreeTable.java | 108 ++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/documentation/components/components-treetable.asciidoc b/documentation/components/components-treetable.asciidoc index 97dedd3e7c..34148ccd5f 100644 --- a/documentation/components/components-treetable.asciidoc +++ b/documentation/components/components-treetable.asciidoc @@ -51,7 +51,9 @@ 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()#. +[methodname]#setParent()#. These containers should be used if there is going +to be a lot of data. Setting up a [interfacename]#Container.Hierarchical# before +setting it to the [classname]#TreeTable# will improve the initial performance. Unlike [classname]#Tree#, a [classname]#TreeTable# can have components in the hierarchical column, both when the property type is a component type and when diff --git a/server/src/main/java/com/vaadin/ui/TreeTable.java b/server/src/main/java/com/vaadin/ui/TreeTable.java index 1b912589bf..549b59fe09 100644 --- a/server/src/main/java/com/vaadin/ui/TreeTable.java +++ b/server/src/main/java/com/vaadin/ui/TreeTable.java @@ -32,6 +32,7 @@ import org.jsoup.nodes.Element; import com.vaadin.data.Collapsible; import com.vaadin.data.Container; +import com.vaadin.data.Item; import com.vaadin.data.Container.Hierarchical; import com.vaadin.data.Container.ItemSetChangeEvent; import com.vaadin.data.util.ContainerHierarchicalWrapper; @@ -66,6 +67,11 @@ import com.vaadin.ui.declarative.DesignException; * standard Hierarchical implementations. Developer must however note that * {@link 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 {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. */ @SuppressWarnings({ "serial" }) public class TreeTable extends Table implements Hierarchical { @@ -703,12 +709,114 @@ public class TreeTable extends Table implements Hierarchical { areChildrenAllowed); } + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. + */ @Override public boolean setParent(Object itemId, Object newParentId) throws UnsupportedOperationException { return getContainerDataSource().setParent(itemId, newParentId); } + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. + */ + @Override + public Object addItem() throws UnsupportedOperationException { + return super.addItem(); + } + + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. + */ + @Override + public Item addItem(Object itemId) throws UnsupportedOperationException { + return super.addItem(itemId); + } + + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. + */ + @Override + public Object addItem(Object[] cells, Object itemId) + throws UnsupportedOperationException { + return super.addItem(cells, itemId); + } + + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. + */ + @Override + public Item addItemAfter(Object previousItemId, Object newItemId) + throws UnsupportedOperationException { + return super.addItemAfter(previousItemId, newItemId); + } + + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. + */ + @Override + public Object addItemAfter(Object previousItemId) + throws UnsupportedOperationException { + return super.addItemAfter(previousItemId); + } + + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. + */ + @Override + public void addItems(Collection itemIds) + throws UnsupportedOperationException { + super.addItems(itemIds); + } + + /** + * {@inheritDoc} + *

+ * Note: Constructing a big hierarchical data set using the + * methods in {@link TreeTable} may cause a decrease in performance. Instead a + * {@link Container.Hierarchical} container should be populated before setting it + * to the {@code TreeTable}. + */ + @Override + public void addItems(Object... itemId) + throws UnsupportedOperationException { + super.addItems(itemId); + } + /** * Sets the Item specified by given identifier as collapsed or expanded. If * the Item is collapsed, its children are not displayed to the user. -- 2.39.5