Ejemplo n.º 1
0
  private void doUpdateFigure(Connection connection) {
    if (connection == null || this.isDisposed()) {
      return;
    }
    Shape connectionShape = (Shape) connection;

    connectionShape.setLineStyle(getLineStyle());

    if (this.getText() != null || this.getImage() != null) {
      if (this.getImage() != null) {
        this.connectionLabel.setIcon(this.getImage());
      }
      if (this.getText() != null) {
        this.connectionLabel.setText(this.getText());
      }
      this.connectionLabel.setFont(this.getFont());
    }

    if (highlighted) {
      connectionShape.setForegroundColor(getHighlightColor());
      connectionShape.setLineWidth(getLineWidth() * 2);
    } else {
      connectionShape.setForegroundColor(getLineColor());
      connectionShape.setLineWidth(getLineWidth());
    }

    if (connection instanceof PolylineArcConnection) {
      PolylineArcConnection arcConnection = (PolylineArcConnection) connection;
      arcConnection.setDepth(curveDepth);
    }
    if (connectionFigure != null) {
      applyConnectionRouter(connectionFigure);
    }
    if ((connectionStyle & ZestStyles.CONNECTIONS_DIRECTED) > 0) {
      PolygonDecoration decoration = new PolygonDecoration();
      if (getLineWidth() < 3) {
        decoration.setScale(9, 3);
      } else {
        double logLineWith = getLineWidth() / 2.0;
        decoration.setScale(7 * logLineWith, 3 * logLineWith);
      }
      ((PolylineConnection) connection).setTargetDecoration(decoration);
    }

    IFigure toolTip;
    if (this.getTooltip() == null
        && getText() != null
        && getText().length() > 0
        && hasCustomTooltip == false) {
      toolTip = new Label();
      ((Label) toolTip).setText(getText());
    } else {
      toolTip = this.getTooltip();
    }
    connection.setToolTip(toolTip);
  }
Ejemplo n.º 2
0
 /** @generated */
 protected void setLineWidth(int width) {
   if (primaryShape instanceof Shape) {
     ((Shape) primaryShape).setLineWidth(width);
   }
 }
 /** @generated */
 protected void setLineWidth(int width) {
   if (primaryShape instanceof Shape) {
     ((Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
   }
 }