code: private static void getAllDescendants(
          TreeModel treeModel, Object node, List<Object> result)
      {
          if (node == null)
          {
              return;
          }
          result.add(node);
          List<Object> children = getChildren(treeModel, node);
          for (Object child : children)
          {
              getAllDescendants(treeModel, child, result);
          }
      }
docs: Compute all descendants of the given node in the given tree model
  
  @param treeModel The tree model
  @param node The node
  @param result The descendants