Beispiel #1
0
  // <editor-fold defaultstate="collapsed" desc="Constructors">
  public GoalsTopComponent() {
    initComponents();
    setName(Bundle.CTL_GoalsTopComponent());
    setToolTipText(Bundle.HINT_GoalsTopComponent());

    this.em = new ExplorerManager();
    ActionMap map = this.getActionMap();
    InputMap keys = this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    this.lookup = ExplorerUtils.createLookup(this.em, map);
    this.associateLookup(this.lookup);

    // Make the root node invisible in the view:
    ((TreeTableView) goalsView).setRootVisible(false);
    ((TreeTableView) goalsView).setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);

    updateGoalsList();
  }
  /**
   * Sets the {@link Process} whose information to display
   *
   * @param processFullId
   * @param p
   */
  public void setData(String processFullId, Process p) {
    this.processFullId = processFullId;
    process = p;
    setName(processFullId);
    Activities activities = ((Activities) p.getActivity().getValue());
    AbstractNode root =
        new AbstractNode(
            Children.create(new ActivitiesChildFactory(activities), false), Lookups.singleton(p));
    root.setDisplayName(processFullId);

    em.setRootContext(root);
    Node n = root.getChildren().getNodes()[0];
    Property[] columnProperties = n.getPropertySets()[0].getProperties();
    treeTableView.setProperties(columnProperties);
    treeTableView.setTreePreferredWidth(600);
    treeTableView.setTableColumnPreferredWidth(0, 75);
    treeTableView.setTableColumnPreferredWidth(1, 150);
    ((myTreeTableView) treeTableView).setRenderers();
    openTreeToCurrentState();
  }
 /**
  * Expands the node if the node's state is not equal to "Not started" (i.e. it has been completed)
  * and selects it. Then, continues down it's children by calling this same method.
  *
  * <p>The recursion stops as soon as it gets to a node which has not been started.
  *
  * @param n The node down which to recurse
  */
 private void openTreeToCurrentStateRecursivly(Node n) {
   if (n instanceof ActivityNode) {
     if (!((ActivityNode) n).getCompletionState().equals("Planned")
         && !((ActivityNode) n).getCompletionState().equals("Contingent")
         && !((ActivityNode) n).getCompletionState().equals("Precluded")) {
       try {
         em.setSelectedNodes(new Node[] {n});
       } catch (PropertyVetoException ex) {
         Exceptions.printStackTrace(ex);
       }
       treeTableView.expandNode(n);
     } else {
     }
   } else {
   }
   for (Node child : n.getChildren().getNodes()) {
     openTreeToCurrentStateRecursivly(child);
   }
 }