| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FlattenedTree |
|
| 1.0;1 |
| 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 | 0 | super(); |
| 24 | 0 | this.tree = tree; |
| 25 | 0 | this.dotId = dotId; |
| 26 | 0 | this.depth = depth; |
| 27 | 0 | } |
| 28 | ||
| 29 | public Tree getTree() { | |
| 30 | 0 | return tree; |
| 31 | } | |
| 32 | ||
| 33 | public String getDotId() { | |
| 34 | 0 | return dotId; |
| 35 | } | |
| 36 | ||
| 37 | public int getDepth() { | |
| 38 | 0 | return depth; |
| 39 | } | |
| 40 | ||
| 41 | public boolean isLeaf() { | |
| 42 | 0 | return tree.isLeaf(); |
| 43 | } | |
| 44 | } |