summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main/java/com/vaadin/ui/Tree.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Tree.java b/server/src/main/java/com/vaadin/ui/Tree.java
index aaff872c95..35bc680213 100644
--- a/server/src/main/java/com/vaadin/ui/Tree.java
+++ b/server/src/main/java/com/vaadin/ui/Tree.java
@@ -218,13 +218,14 @@ public class Tree<T> extends Composite
private TreeGrid<T> treeGrid = new TreeGrid<>();
private ItemCaptionGenerator<T> captionGenerator = String::valueOf;
private IconGenerator<T> iconProvider = t -> null;
+ private final TreeRenderer renderer;
/**
* Constructs a new Tree Component.
*/
public Tree() {
setCompositionRoot(treeGrid);
- TreeRenderer renderer = new TreeRenderer();
+ renderer = new TreeRenderer();
treeGrid.getDataCommunicator().addDataGenerator(renderer);
treeGrid.addColumn(i -> captionGenerator.apply(i), renderer)
.setId("column");
@@ -762,4 +763,25 @@ public class Tree<T> extends Composite
public void setComponentError(ErrorMessage componentError) {
treeGrid.setComponentError(componentError);
}
+
+ /**
+ * 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
+ */
+ public void setRowHeight(double rowHeight) {
+ treeGrid.setRowHeight(rowHeight);
+ }
+
+ /**
+ * Sets the content mode of the item caption.
+ *
+ * @param contentMode
+ * the content mode
+ */
+ public void setContentMode(ContentMode contentMode) {
+ renderer.getState().mode = contentMode;
+ }
}