Ejemplo n.º 1
0
  private TreeItem<DisplayWrapper<Node>> createTreeItem(Node node) {
    TreeItem<DisplayWrapper<Node>> treeItem = new TreeItem<>();
    treeItem.setExpanded(true);
    treeItem.setValue(DisplayWrapper.of(node));

    List<Node> children = node.getChildren();

    for (Node child : children) {
      treeItem.getChildren().add(createTreeItem(child));
    }

    return treeItem;
  }
Ejemplo n.º 2
0
  private void redoTree() {
    if (study == null) {
      log.warn("Not redoing tree, since study is null");
      return;
    }

    log.trace("Redoing project tree");

    TreeItem root = new TreeItem(DisplayWrapper.of(study.getName()));

    TreeItem<DisplayWrapper<Node>> subjectNode = createTreeItem(study.getSubjects());
    TreeItem<DisplayWrapper<Node>> actionNode = createTreeItem(study.getActions());
    TreeItem<DisplayWrapper<Node>> modifierFactoryNode =
        createTreeItem(study.getModifierFactories());
    TreeItem<DisplayWrapper<Node>> observationsNode = createTreeItem(study.getObservations());

    root.getChildren().addAll(subjectNode, actionNode, modifierFactoryNode, observationsNode);
    root.setExpanded(true);

    setRoot(root);
  }