1 package org.equanda.tapestry5.data;
2
3 /**
4 * This class is used by the TreeTable component to flatten a given Tree structure
5 * so that it can be represented in an html table.
6 *
7 * A Tree is nested, an html table is flat and this class represent each node of the
8 * tree, but without nesting. The TreeTable component can then convert a Tree structure
9 * (each Tree can contain other Tree childs) into a list of FlattenedTree objects.
10 * The FlattenedTree still remember the position of the node in the original tree in order
11 * to render the tree correctly in html (reference to javascript used
12 * by TreeTable component for details).
13 *
14 * @author Geert Mergan
15 */
16 public class FlattenedTree implements java.io.Serializable {
17
18 private Tree tree;
19 private String dotId;
20 private int depth;
21
22 public FlattenedTree(Tree tree, int depth, String dotId) {
23 super();
24 this.tree = tree;
25 this.dotId = dotId;
26 this.depth = depth;
27 }
28
29 public Tree getTree() {
30 return tree;
31 }
32
33 public String getDotId() {
34 return dotId;
35 }
36
37 public int getDepth() {
38 return depth;
39 }
40
41 public boolean isLeaf() {
42 return tree.isLeaf();
43 }
44 }