Ejemplo n.º 1
0
 @Override
 public void applyPreservingExpansionState(Task rootTask, Predicate<Task> callable) {
   MutableTreeTableNode rootNode = getNode(rootTask);
   List<MutableTreeTableNode> subtree = TreeUtil.collectSubtree(rootNode);
   Collections.reverse(subtree);
   LinkedHashMap<Task, Boolean> states = Maps.newLinkedHashMap();
   for (MutableTreeTableNode node : subtree) {
     Task t = (Task) node.getUserObject();
     states.put(t, t.getExpand());
   }
   callable.apply(rootTask);
   for (Map.Entry<Task, Boolean> state : states.entrySet()) {
     setExpanded(state.getKey(), state.getValue());
   }
 }
Ejemplo n.º 2
0
  /** add an object with the expand information */
  DefaultMutableTreeTableNode addObjectWithExpand(Object child, MutableTreeTableNode parent) {
    DefaultMutableTreeTableNode childNode = new TaskNode((Task) child);

    if (parent == null) {
      parent = getRootNode();
    }

    getTreeModel().insertNodeInto(childNode, parent, parent.getChildCount());
    myProject.refreshProjectInformation();

    return childNode;
  }