Пример #1
0
  public void drawU(UGraphic ug, Area area, Context2D context) {
    final Dimension2D dimensionToUse = area.getDimensionToUse();
    final HtmlColor lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder);
    ug.getParam().setColor(lineColor);
    ug.getParam().setBackcolor(null);
    ug.getParam().setStroke(new UStroke(1.4));
    ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
    ug.getParam().setStroke(new UStroke());

    final TextBlock textBlock = createTextBloc();
    textBlock.drawU(ug, 2, 2);

    final Dimension2D textDim = getTextDim(ug.getStringBounder());
    final double x = textDim.getWidth() + 6;
    final double y = textDim.getHeight() + 6;
    final UPolygon poly = new UPolygon();
    poly.addPoint(x, 0);
    poly.addPoint(x, y - 6);
    poly.addPoint(x - 6, y);
    poly.addPoint(0, y);
    poly.addPoint(0, 0);
    ug.getParam().setColor(lineColor);
    ug.getParam().setStroke(new UStroke(1.4));
    ug.draw(0, 0, poly);
    ug.getParam().setStroke(new UStroke());
  }
Пример #2
0
 @Override
 protected void drawBackgroundInternalU(UGraphic ug, Area area) {
   final Dimension2D dimensionToUse = area.getDimensionToUse();
   ug = symbolContext.apply(ug);
   ug.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
   final double xpos = (dimensionToUse.getWidth() - getPureTextWidth(ug.getStringBounder())) / 2;
   getTextBlock().drawU(ug.apply(new UTranslate(xpos, 0)));
 }
  @Override
  protected void drawInternalU(UGraphic ug, Area area) {
    final Dimension2D dimensionToUse = area.getDimensionToUse();
    final StringBounder stringBounder = ug.getStringBounder();
    final int textHeaderWidth = (int) (getHeaderWidth(stringBounder));
    final int textHeaderHeight = (int) (getHeaderHeight(stringBounder));

    final URectangle rect =
        new URectangle(
            dimensionToUse.getWidth() - xMargin * 2 - symbolContext.getDeltaShadow(),
            dimensionToUse.getHeight() - heightFooter);
    rect.setDeltaShadow(symbolContext.getDeltaShadow());
    ug = symbolContext.withBackColor(background).apply(ug);
    ug.apply(new UTranslate(xMargin, 0)).draw(rect);

    final UPolygon polygon = new UPolygon();
    polygon.addPoint(0, 0);
    polygon.addPoint(textHeaderWidth, 0);

    polygon.addPoint(textHeaderWidth, textHeaderHeight - cornersize);
    polygon.addPoint(textHeaderWidth - cornersize, textHeaderHeight);

    polygon.addPoint(0, textHeaderHeight);
    polygon.addPoint(0, 0);

    ug = symbolContext.apply(ug);
    ug.apply(new UTranslate(xMargin, 0)).draw(polygon);

    ug = ug.apply(new UStroke());

    textHeader.drawU(ug.apply(new UTranslate(15, 2)));
    final double textPos;
    if (position == HorizontalAlignment.CENTER) {
      final double textWidth = getTextBlock().calculateDimension(stringBounder).getWidth();
      textPos = (dimensionToUse.getWidth() - textWidth) / 2;
    } else if (position == HorizontalAlignment.RIGHT) {
      final double textWidth = getTextBlock().calculateDimension(stringBounder).getWidth();
      textPos = dimensionToUse.getWidth() - textWidth - getMarginX2() - xMargin;
    } else {
      textPos = getMarginX1() + xMargin;
    }
    getTextBlock().drawU(ug.apply(new UTranslate(textPos, (getMarginY() + textHeaderHeight))));
  }