diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/data/HasHierarchicalDataProvider.java | 13 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Tree.java | 10 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/ui/TreeGrid.java | 19 |
3 files changed, 13 insertions, 29 deletions
diff --git a/server/src/main/java/com/vaadin/data/HasHierarchicalDataProvider.java b/server/src/main/java/com/vaadin/data/HasHierarchicalDataProvider.java index 52ea205663..56aeb315c6 100644 --- a/server/src/main/java/com/vaadin/data/HasHierarchicalDataProvider.java +++ b/server/src/main/java/com/vaadin/data/HasHierarchicalDataProvider.java @@ -38,6 +38,16 @@ import com.vaadin.data.provider.TreeDataProvider; public interface HasHierarchicalDataProvider<T> extends HasDataProvider<T> { /** + * Sets a new {@link TreeDataProvider} wrapping the given {@link TreeData}. + * + * @param treeData + * the tree data to set + */ + public default void setTreeData(TreeData<T> treeData) { + setDataProvider(new TreeDataProvider<>(treeData)); + } + + /** * Gets the backing {@link TreeData} instance of the data provider, if the * data provider is a {@link TreeDataProvider}. * @@ -51,7 +61,8 @@ public interface HasHierarchicalDataProvider<T> extends HasDataProvider<T> { if (getDataProvider() instanceof TreeDataProvider) { return ((TreeDataProvider<T>) getDataProvider()).getTreeData(); } else { - throw new IllegalStateException(""); + throw new IllegalStateException( + "Data provider is not an instance of TreeDataProvider"); } } diff --git a/server/src/main/java/com/vaadin/ui/Tree.java b/server/src/main/java/com/vaadin/ui/Tree.java index 4ddd74caa4..c89d0796bc 100644 --- a/server/src/main/java/com/vaadin/ui/Tree.java +++ b/server/src/main/java/com/vaadin/ui/Tree.java @@ -261,16 +261,6 @@ public class Tree<T> extends Composite } /** - * Constructs a new Tree Component with given {@code TreeData}. - * - * @param treeData - * the tree data for component - */ - public Tree(TreeData<T> treeData) { - this(null, new TreeDataProvider<>(treeData)); - } - - /** * Constructs a new Tree Component with given * {@code HierarchicalDataProvider}. * diff --git a/server/src/main/java/com/vaadin/ui/TreeGrid.java b/server/src/main/java/com/vaadin/ui/TreeGrid.java index b73794e25a..310a7c6cf5 100644 --- a/server/src/main/java/com/vaadin/ui/TreeGrid.java +++ b/server/src/main/java/com/vaadin/ui/TreeGrid.java @@ -107,23 +107,6 @@ public class TreeGrid<T> extends Grid<T> } /** - * Creates a {@code TreeGrid} using the given in-memory data, without - * support for creating columns based on property names. Use an alternative - * constructor, such as {@link TreeGrid#TreeGrid(Class)}, to create a - * {@code TreeGrid} that automatically sets up columns based on the type of - * presented data. - * - * @see TreeData - * - * @param data - * the data to use, not {@code null} - */ - public TreeGrid(TreeData<T> data) { - this(); - setDataProvider(new TreeDataProvider<>(data)); - } - - /** * Creates a {@code TreeGrid} using a custom {@link PropertySet} * implementation and custom data communicator. * <p> @@ -551,7 +534,7 @@ public class TreeGrid<T> extends Grid<T> /** * Gets the item collapse allowed provider. - * + * * @return the item collapse allowed provider */ public ItemCollapseAllowedProvider<T> getItemCollapseAllowedProvider() { |