itemsTreeWithNode method

List? itemsTreeWithNode(
  1. AbstractNode node
)

Implementation

List? itemsTreeWithNode(AbstractNode node) {
  List valuesTreeForNode = [];
  for (Iterator i = node.getChildBoundables().iterator; i.moveNext();) {
    Boundable childBoundable = i.current as Boundable;
    if (childBoundable is AbstractNode) {
      List? valuesTreeForChild =
          itemsTreeWithNode(childBoundable as AbstractNode);
      // only add if not null (which indicates an item somewhere in this tree
      if (valuesTreeForChild != null)
        valuesTreeForNode.add(valuesTreeForChild);
    } else if (childBoundable is ItemBoundable) {
      valuesTreeForNode.add((childBoundable as ItemBoundable).getItem());
    } else {
      Assert.shouldNeverReachHere();
    }
  }
  if (valuesTreeForNode.length <= 0) return null;
  return valuesTreeForNode;
}