diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-06-28 11:35:35 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2017-06-28 11:35:35 +0300 |
commit | 29a4578a8d52c0720ff16cedf783223fdc4ea533 (patch) | |
tree | f7b37914a805c451f7a9273df0ac627a25b1171e /server/src/main/java/com/vaadin | |
parent | 6ed5f2a0df068dba713d8e24dc9f78e2a0829a73 (diff) | |
download | vaadin-framework-29a4578a8d52c0720ff16cedf783223fdc4ea533.tar.gz vaadin-framework-29a4578a8d52c0720ff16cedf783223fdc4ea533.zip |
Add isExpanded() method to Tree and TreeGrid
Fixes #9595
Diffstat (limited to 'server/src/main/java/com/vaadin')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Tree.java | 15 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/ui/TreeGrid.java | 13 |
2 files changed, 24 insertions, 4 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Tree.java b/server/src/main/java/com/vaadin/ui/Tree.java index 35bc680213..cd53d1bc08 100644 --- a/server/src/main/java/com/vaadin/ui/Tree.java +++ b/server/src/main/java/com/vaadin/ui/Tree.java @@ -413,6 +413,17 @@ public class Tree<T> extends Composite } /** + * Returns whether a given item is expanded or collapsed. + * + * @param item + * the item to check + * @return true if the item is expanded, false if collapsed + */ + public boolean isExpanded(T item) { + return treeGrid.isExpanded(item); + } + + /** * This method is a shorthand that delegates to the currently set selection * model. * @@ -767,7 +778,7 @@ public class Tree<T> extends Composite /** * Sets the height of a row. If -1 (default), the row height is calculated * based on the theme for an empty row before the Tree is displayed. - * + * * @param rowHeight * The height of a row in pixels or -1 for automatic calculation */ @@ -777,7 +788,7 @@ public class Tree<T> extends Composite /** * Sets the content mode of the item caption. - * + * * @param contentMode * the content mode */ diff --git a/server/src/main/java/com/vaadin/ui/TreeGrid.java b/server/src/main/java/com/vaadin/ui/TreeGrid.java index d32ff1464a..703a83192a 100644 --- a/server/src/main/java/com/vaadin/ui/TreeGrid.java +++ b/server/src/main/java/com/vaadin/ui/TreeGrid.java @@ -52,8 +52,6 @@ import com.vaadin.shared.ui.treegrid.TreeGridState; import com.vaadin.ui.declarative.DesignAttributeHandler; import com.vaadin.ui.declarative.DesignContext; import com.vaadin.ui.declarative.DesignFormatter; -import com.vaadin.ui.renderers.AbstractRenderer; -import com.vaadin.ui.renderers.Renderer; /** * A grid component for displaying hierarchical tabular data. @@ -383,6 +381,17 @@ public class TreeGrid<T> extends Grid<T> }); } + /** + * Returns whether a given item is expanded or collapsed. + * + * @param item + * the item to check + * @return true if the item is expanded, false if collapsed + */ + public boolean isExpanded(T item) { + return getDataCommunicator().isExpanded(item); + } + @Override protected TreeGridState getState() { return (TreeGridState) super.getState(); |