Example #1
0
  @Override
  protected void paintFigure(Graphics graphics) {
    graphics.setAntialias(SWT.ON);

    Rectangle bounds = getBounds().getCopy();

    graphics.setForegroundColor(getFillColor());
    graphics.setBackgroundColor(ColorFactory.getLighterColor(getFillColor(), 0.9f));
    graphics.fillGradient(bounds, false);

    // Border
    if (getBorderColor() != null) {
      graphics.setForegroundColor(ColorFactory.getLighterColor(getBorderColor(), 0.82f));
      graphics.drawLine(bounds.x, bounds.y, bounds.x + bounds.width - 1, bounds.y);
      graphics.drawLine(
          bounds.x + bounds.width - 1,
          bounds.y,
          bounds.x + bounds.width - 1,
          bounds.y + bounds.height - 1);

      graphics.setForegroundColor(getBorderColor());
      graphics.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);
      graphics.drawLine(
          bounds.x,
          bounds.y + bounds.height - 1,
          bounds.x + bounds.width - 1,
          bounds.y + bounds.height - 1);
    }

    fIconicDelegate.drawIcon(graphics, bounds);
  }
Example #2
0
  @Override
  protected void setUI() {
    setLayoutManager(new GridLayout());

    FlowPage flowPage = new FlowPage();
    BlockFlow block = new BlockFlow();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(
        new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    block.add(fTextFlow);
    flowPage.add(block);

    add(flowPage, new GridData(SWT.CENTER, SWT.CENTER, true, true));
    fTextPositionDelegate = new TextPositionDelegate(this, flowPage, getDiagramModelObject());

    fIconicDelegate = new IconicDelegate(getDiagramModelObject());
    fIconicDelegate.updateImage();
  }
Example #3
0
 public void updateImage() {
   fIconicDelegate.updateImage();
   repaint();
 }
Example #4
0
 @Override
 public void dispose() {
   fIconicDelegate.dispose();
 }