Package org.zkoss.pivot.util
Class Trees
java.lang.Object
org.zkoss.pivot.util.Trees
Utility class for PivotHeaderTree
- Author:
- simonpai
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CalculatorgetCalculator(PivotField field, int index) Retrieves the Calculator from a field by index.static CalculatorgetCalculator(PivotHeaderNode node, int index) Retrieves the Calculator from a node by index.static ObjectgetKey(PivotField field, Object value) Returns the key defined by GroupHandler on the field, if any.static PivotHeaderNodegetNode(PivotHeaderTree tree, int[] indicies) Seek down PivotHeaderNode by indices.static PivotHeaderNodegetNode(PivotHeaderTree tree, Object[] keys) Seek down PivotHeaderNode based on keys.static intgetSize(PivotHeaderTree tree) Compute the size of tree.static intgetSize(PivotHeaderTree tree, boolean open) Compute the size of tree.static intgetSubtotalCount(PivotField field) Return the count of subtotal Calculators on a fieldstatic intReturn the count of subtotal Calculators on a nodestatic intgetSubtotalCount(PivotHeaderNode node, boolean open) Return the count of subtotal Calculators on a nodestatic booleanisRoot(PivotHeaderNode node) Return true if node is root.static booleanisTerminal(PivotHeaderNode node) Return true if node is leaf or closed.static voidopenDown(PivotHeaderNode node, boolean open) Recursively set open or close to a node and all its descendants.static voidtraverse(PivotHeaderTree tree, boolean asIfOpenAll, int offset, int limit, Trees.NodeRunner runner) Traverse the tree in a depth first, children first fashion, while concern paging.static voidtraverse(PivotHeaderTree tree, boolean open, Trees.NodeRunner runner) Traverse the tree in a depth first, children first fashion.static voidtraverse(PivotHeaderTree tree, Trees.NodeRunner runner) Traverse the tree in a depth first, children first fashion.
-
Constructor Details
-
Trees
public Trees()
-
-
Method Details
-
getSubtotalCount
Return the count of subtotal Calculators on a node -
getSubtotalCount
Return the count of subtotal Calculators on a node- Parameters:
open- compute as if the node were always open.
-
getSubtotalCount
Return the count of subtotal Calculators on a field -
getCalculator
Retrieves the Calculator from a node by index. -
getCalculator
Retrieves the Calculator from a field by index. -
getKey
Returns the key defined by GroupHandler on the field, if any. -
getSize
Compute the size of tree. Subtotal Calculator numbers are taken into account. A full traversal of the tree will be performed upon calling this method. -
getSize
Compute the size of tree. Subtotal Calculator numbers are taken into account. A full traversal of the tree will be performed upon calling this method.- Parameters:
open- compute as if all nodes were open
-
isTerminal
Return true if node is leaf or closed. -
isRoot
Return true if node is root. -
getNode
Seek down PivotHeaderNode based on keys.- Returns:
- null if not found
-
getNode
Seek down PivotHeaderNode by indices.- Returns:
- null if not found
-
openDown
Recursively set open or close to a node and all its descendants. -
traverse
Traverse the tree in a depth first, children first fashion. -
traverse
Traverse the tree in a depth first, children first fashion.- Parameters:
open- traverse as if all nodes were open.
-
traverse
public static void traverse(PivotHeaderTree tree, boolean asIfOpenAll, int offset, int limit, Trees.NodeRunner runner) Traverse the tree in a depth first, children first fashion, while concern paging. runner will not be invoked on nodes that are completely out of range.- Parameters:
asIfOpenAll- traverse as if all nodes were open.offset-limit- no limit if negative
-