Example #1
0
  /*(non-Javadoc)
   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
   */
  protected IFigure createFigure() {
    ComponentFigure figure =
        new ComponentFigure(
            Util.getSWTRGB(getCastedVisualModel().getBackgroundColor()),
            Util.getSWTRGB(getCastedVisualModel().getForegroundColor()),
            getCastedVisualModel().getLineStyle());
    figure.setText(getCastedSemanticModel().getName());

    if (getCastedVisualModel().getDetailLevel() == VisualModel.HIGH_DETAIL)
      figure.showResponsibilites(true);

    updateStereotypeName(figure);
    updateResponsibilities(figure);
    return figure;
  }
Example #2
0
  private void updateSizePortLocation(Rectangle newBounds) {
    Dimension size = newBounds.getSize();
    int newRightXOffset = size.width - 40;
    int height = 0;

    int maxYPort = 0;
    List children = getCastedVisualModel().getChildren();
    for (int i = 0; i < children.size(); i++) {
      VisualModel port = (VisualModel) children.get(i);
      height = 25;

      if (port.getChildren().size() > 0) height = 25 * port.getChildren().size();
      port.setSize(Util.getDimension(40, height));

      if (port.getLocation().getX() > 0)
        port.setLocation(Util.getPoint(newRightXOffset, port.getLocation().getY()));

      maxYPort = Math.max(maxYPort, port.getLocation().getY() + port.getSize().getHeight());
    }

    int dif = size.height - maxYPort;
    if (dif < 0)
      getCastedVisualModel().setSize(Util.getDimension(size.width, size.height - dif + 10));
  }