Exemplo n.º 1
0
  /**
   * @param startNode
   * @return the finish node corresponding to the start node
   */
  private TableNodeItem finishNode(TableNodeItem startNode) {

    TableNodeItem nodeFinish = null;
    String startNodeName = startNode.getString(NAME);
    String finishNodeName = startNodeName.substring(0, startNodeName.lastIndexOf(START)) + "Finish";
    int startNodes = 1;
    int finishNodes = 0;
    Iterator nodes = (startNode.getGraph()).nodes();

    while (nodes.hasNext()) {
      TableNodeItem node = (TableNodeItem) nodes.next();
      if (node.getInt(ID) > startNode.getInt(ID) && (node.getString(NAME)).equals(startNodeName)) {
        startNodes++;
      }
      if (node.getInt(ID) > startNode.getInt(ID) && (node.getString(NAME)).equals(finishNodeName)) {
        finishNodes++;
      }

      if (startNodes == finishNodes) {
        nodeFinish = node;
        break;
      }
    }

    return nodeFinish;
  }
Exemplo n.º 2
0
  /**
   * expands one level at a time when step node is clicked
   *
   * @param item
   */
  public void expandOneLevel(VisualItem item) {

    Visualization vis = item.getVisualization();
    TableNodeItem stepItem = (TableNodeItem) item;
    TableNodeItem stepParent = getStepParent(stepItem);
    TableNodeItem stepChild = getStepChild(stepItem);

    int finishNodeId = 0;
    Iterator visualItems = vis.visibleItems();
    VisualItem node;

    while (visualItems.hasNext()) {
      node = (VisualItem) visualItems.next();
      if (node instanceof TableNodeItem
          && node.getInt(ID) > (stepParent.getInt(ID) + 1)
          && node.getInt(ID) < stepChild.getInt(ID)
          && node.getString(TYPE).equals(START)
          && node.getInt(ID) > finishNodeId) {
        collapseExpand(node);
        finishNodeId = finishNode((TableNodeItem) node).getInt(ID);
      }
    }
  }
Exemplo n.º 3
0
  /**
   * sets all "Step" type nodes (and their incident edges) connected to the startNode passed as
   * parameter visible
   *
   * @param startNode
   */
  private void setStepVisible(TableNodeItem startNode) {

    TableNodeItem startNodeParent = getParent(startNode);
    Iterator<TableNodeItem> children = children(startNodeParent);
    TableNodeItem child = null;
    Iterator stepEdges = null;
    TableEdgeItem stepEdge;

    assert children.hasNext();
    while (children.hasNext()) {
      child = children.next();
      if (child.getString(TYPE).equals(STEP)) {
        child.setVisible(true);
        stepEdges = child.edges();
        break;
      }
    }
    while (stepEdges.hasNext()) {
      stepEdge = (TableEdgeItem) stepEdges.next();
      stepEdge.setVisible(true);
    }

    stepId = child.getInt(ID);
  }