aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-05-11 08:50:49 +0300
committerHenri Sara <henri.sara@gmail.com>2017-05-16 15:35:17 +0300
commitf4bbe480693918a9b67f09773b9de03de7b61bd8 (patch)
tree5584eb101eebad2fd6d9c7b61c52bb6d6250a558
parenta053082b0ae9f6875a3093402ff4eac88b310b49 (diff)
downloadvaadin-framework-f4bbe480693918a9b67f09773b9de03de7b61bd8.tar.gz
vaadin-framework-f4bbe480693918a9b67f09773b9de03de7b61bd8.zip
Add setHierarchyColumn(column) overload to TreeGrid
-rw-r--r--server/src/main/java/com/vaadin/ui/TreeGrid.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/TreeGrid.java b/server/src/main/java/com/vaadin/ui/TreeGrid.java
index 1b051d1da6..a6b0fecce5 100644
--- a/server/src/main/java/com/vaadin/ui/TreeGrid.java
+++ b/server/src/main/java/com/vaadin/ui/TreeGrid.java
@@ -146,6 +146,30 @@ public class TreeGrid<T> extends Grid<T>
* <strong>Note:</strong> Changing the Renderer of the hierarchy column is
* not supported.
*
+ * @param column
+ * the column to use for displaying hierarchy
+ */
+ public void setHierarchyColumn(Column<T, ?> column) {
+ Objects.requireNonNull(column, "column may not be null");
+ if (!getColumns().contains(column)) {
+ throw new IllegalArgumentException(
+ "Given column is not a column of this TreeGrid");
+ }
+ column.setHidden(false);
+ column.setHidable(false);
+ getState().hierarchyColumnId = getInternalIdForColumn(column);
+ }
+
+ /**
+ * Set the column that displays the hierarchy of this grid's data. By
+ * default the hierarchy will be displayed in the first column.
+ * <p>
+ * Setting a hierarchy column by calling this method also sets the column to
+ * be visible and not hidable.
+ * <p>
+ * <strong>Note:</strong> Changing the Renderer of the hierarchy column is
+ * not supported.
+ *
* @see Column#setId(String)
*
* @param id