Example #1
0
  @SuppressWarnings("unchecked")
  private static <T> void setRecursively0(final T c, final Handler<T> handler) {
    if (handler.condition(c)) {
      handler.action(c);
    }

    if (handler instanceof ConditionHandler && ((ConditionHandler<T>) handler).stopCondition(c)) {
      return;
    }

    List<Node> children = null;

    if (c instanceof Parent) {
      children = ((Parent) c).getChildrenUnmodifiable();
    }
    if (children != null) {
      for (Node child : children) {
        if (child instanceof Parent) {
          setRecursively0((T) child, handler);
        }
      }
    }
  }
Example #2
0
 /**
  * Calls the handler recursively on a Node.
  *
  * @param c Node
  * @param handler handler to be called
  * @param <T> the type of the Node.
  */
 public static <T> void setRecursively(final T c, final Handler<T> handler) {
   setRecursively0(c, handler);
   handler.postAction(c);
 }