예제 #1
0
  protected void control(List nodes) {
    Iterator sel_nodes = nodes.iterator();
    double mid = (X_min + ((X_max - X_min) / 2));

    while (sel_nodes.hasNext()) {
      ((NodeView) sel_nodes.next()).setXPosition(mid);
    }
  }
예제 #2
0
  protected void control(List nodes) {
    if (nodes.size() <= 1) return;

    Collections.sort(nodes, new YComparator());

    //		double d = Y_max - Y_min;
    //		d = d / (nodes.size() - 1);

    // Note: X, Y are at node centers
    for (int i = 1; i < nodes.size(); i++) {
      ((NodeView) nodes.get(i))
          .setYPosition(
              ((NodeView) nodes.get(i - 1)).getYPosition()
                  + ((NodeView) nodes.get(i - 1)).getHeight() * 0.5
                  + ((NodeView) nodes.get(i)).getHeight() * 0.5);
      ((NodeView) nodes.get(i)).setXPosition(((NodeView) nodes.get(i - 1)).getXPosition());
    }
  }