Ejemplo n.º 1
0
  public void addBranch(AgeAbstractClassImprint superClass, AgeAbstractClassImprint subClass) {
    for (ImprintTreeNode supNodes : nodeMap.get(superClass)) {
      ImprintTreeNode nd = nodeCreator.create(subClass);
      createTreeStructure(subClass, nd);
      getData().add(nd, supNodes);

      getData().openAll(supNodes);

      //   System.out.println("Adding "+subClass.getName()+" to "+supNodes.getTitle());
    }
  }
Ejemplo n.º 2
0
  public void setRoot(AgeAbstractClassImprint root) {
    Tree data = getData();

    if (root == null) {
      data.getRoot().setChildren(new TreeNode[0]);
      data.setRoot(data.getRoot());
      return;
    }

    TreeNode rootNode = data.getRoot();

    ImprintTreeNode clsRoot = nodeCreator.create(root);

    createTreeStructure(root, clsRoot);

    rootNode.setChildren(new TreeNode[] {clsRoot});

    data.setRoot(rootNode);

    data.openAll();
  }
Ejemplo n.º 3
0
  private void createTreeStructure(AgeAbstractClassImprint cls, ImprintTreeNode node) {
    addNodeToMap(node);

    if ((direction == Direction.PARENT2CHILD && cls.getChildren() == null)
        || (direction == Direction.CHILD2PARENT && cls.getParents() == null)) return;

    TreeNode[] children =
        new TreeNode
            [direction == Direction.PARENT2CHILD
                ? cls.getChildren().size()
                : cls.getParents().size()];

    int i = 0;
    for (AgeAbstractClassImprint subcls :
        direction == Direction.PARENT2CHILD ? cls.getChildren() : cls.getParents()) {
      ImprintTreeNode ctn = nodeCreator.create(subcls);
      children[i++] = ctn;

      createTreeStructure(subcls, ctn);
    }

    node.setChildren(children);
  }