Ejemplo n.º 1
0
  /**
   * Restituisce il pi? piccolo rettangolo contenente tutti gli oggetti appartenenti alla
   * LinkedList.
   */
  public Rectangle2D getExternalBounds() {
    ElementoProcessoStato tmpProcesso = null;
    int topLeftX;
    int topLeftY;
    int bottomRightX;
    int bottomRightY;
    int tmptopLeftX;
    int tmptopLeftY;
    int tmpbottomRightX;
    int tmpbottomRightY;

    if ((this != null) && (!this.isEmpty())) {
      tmpProcesso = (ElementoProcessoStato) this.get(0);
      topLeftX = tmpProcesso.getTopX();
      topLeftY = tmpProcesso.getTopY();
      bottomRightX = topLeftX + tmpProcesso.getWidth();
      bottomRightY = topLeftY + tmpProcesso.getHeight();
      for (int j = 1; j < this.size(); j++) {
        tmpProcesso = (ElementoProcessoStato) this.get(j);
        tmptopLeftX = tmpProcesso.getTopX();
        if (tmptopLeftX < topLeftX) {
          topLeftX = tmptopLeftX;
        }
        tmptopLeftY = tmpProcesso.getTopY();
        if (tmptopLeftY < topLeftY) {
          topLeftY = tmptopLeftY;
        }
        tmpbottomRightX = tmptopLeftX + tmpProcesso.getWidth();
        if (tmpbottomRightX > bottomRightX) {
          bottomRightX = tmpbottomRightX;
        }
        tmpbottomRightY = tmptopLeftY + tmpProcesso.getHeight();
        if (tmpbottomRightY > bottomRightY) {
          bottomRightY = tmpbottomRightY;
        }
      }
      return new Rectangle2D.Double(
          topLeftX, topLeftY, bottomRightX - topLeftX, bottomRightY - topLeftY);
    } else {
      return null;
    }
  }
Ejemplo n.º 2
0
  /**
   * Restituisce come punto di riferimento della posizione degli oggetti l'estremo in alto a
   * sinistra del primo elemento della lista_ Questo permette di calcolare di quanto spostare gli
   * oggetti della lista usando la posizione del mouse come secondo riferimento.
   */
  public Point getRifPoint() {
    ElementoProcessoStato tmpProcesso = null;
    int topLeftX;
    int topLeftY;

    if ((this != null) && (!this.isEmpty())) {
      tmpProcesso = (ElementoProcessoStato) this.get(0);
      topLeftX = tmpProcesso.getTopX();
      topLeftY = tmpProcesso.getTopY();
      return new Point(topLeftX, topLeftY);
    } else {
      return null;
    }
  }
Ejemplo n.º 3
0
  /**
   * Aggiorna di 'dX' e 'dY' la posizione di tutti gli elementi della lista e degli oggetti di tipo
   * CanaleMessaggio ad essi collegati (presi dalla lista passata come parametro d'ingresso).
   */
  public void updatePosition(Point rif, Point track, ListaCanaleMessaggio listCNL) {
    ElementoProcessoStato tmpProcesso;
    int topLeftX;
    int topLeftY;
    int dX = track.x - rif.x;
    int dY = track.y - rif.y;

    if ((this != null) && (!this.isEmpty())) {
      for (int j = 0; j < this.size(); j++) {
        tmpProcesso = (ElementoProcessoStato) this.get(j);
        topLeftX = tmpProcesso.getTopX() + dX;
        topLeftY = tmpProcesso.getTopY() + dY;
        tmpProcesso.setPoint(new Point(topLeftX, topLeftY));
        listCNL.updateListaCanalePosizione(tmpProcesso);
      }
    } else {
    }
  }