Esempio n. 1
0
    @Override
    public void paintFigure(Graphics graphics) {

      int offsetX;
      int offsetY;

      if (ci.getShape() == ComponentShape.CIRCLE) {
        offsetX = OFFSET_SMALL_CIRCLE_COMPONENT_ICON;
        offsetY = OFFSET_SMALL_CIRCLE_COMPONENT_ICON;
        graphics.fillOval(this.getBounds());
        graphics.setAntialias(SWT.ON);
        Rectangle b = this.getBounds().getCopy();
        b.width--;
        b.height--;
        graphics.drawOval(b);

        graphics.setAntialias(SWT.OFF);
      } else {
        offsetX = OFFSET_SMALL_SQUARE_COMPONENT_ICON_X;
        offsetY = OFFSET_SMALL_SQUARE_COMPONENT_ICON_Y;
        graphics.fillRectangle(this.getBounds());
        Rectangle b = this.getBounds().getCopy();
        b.width--;
        b.height--;
        graphics.drawRectangle(b);
      }
      graphics.drawImage(
          icon, new Point(this.getLocation().x + offsetX, this.getLocation().y - 1 + offsetY));
    }
Esempio n. 2
0
  @Override
  protected IFigure createFigure() {
    final IFigure figure = createBaseFigure();
    ComponentInterface ci =
        ((WorkflowNode) getModel())
            .getComponentDescription()
            .getComponentInstallation()
            .getComponentRevision()
            .getComponentInterface();

    if (ci.getShape() == ComponentShape.CIRCLE) {
      final int size = 16;
      final int newOffset = 3;
      errorFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      warningFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      final int localX = 22;
      final int localY = 20;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    } else if (ci.getSize() == ComponentSize.SMALL) {
      final int size = 16;
      final int newOffsetX = 22;
      final int newOffsetY = 1;
      warningFigure.setBounds(new Rectangle(newOffsetX, newOffsetY, size, size));
      final int localX = 22;
      final int localY = 22;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    }
    figure.add(errorFigure);
    figure.add(warningFigure);
    figure.add(localFigure);
    figure.add(deprecatedFigure);
    return figure;
  }