Exemplo n.º 1
0
  public void drawU(UGraphic ug) {

    final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight();
    ug = ug.apply(new UTranslate(0, suppY1));
    ug.apply(new UChangeColor(borderColor))
        .apply(getThickness())
        .apply(new UChangeBackColor(backColor))
        .draw(Diamond.asPolygon(skinParam().shadowing()));
    // final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
    north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1)));

    // final Dimension2D dimSouth = south.calculateDimension(ug.getStringBounder());
    south.drawU(
        ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, 2 * Diamond.diamondHalfSize)));
    // south.drawU(ug.apply(new UTranslate(-(dimSouth.getWidth() - 2 * Diamond.diamondHalfSize) / 2,
    // 2 * Diamond.diamondHalfSize)));

    final Dimension2D dimWeat1 = west1.calculateDimension(ug.getStringBounder());
    west1.drawU(
        ug.apply(
            new UTranslate(-dimWeat1.getWidth(), -dimWeat1.getHeight() + Diamond.diamondHalfSize)));

    final Dimension2D dimEast1 = east1.calculateDimension(ug.getStringBounder());
    east1.drawU(
        ug.apply(
            new UTranslate(
                Diamond.diamondHalfSize * 2, -dimEast1.getHeight() + Diamond.diamondHalfSize)));
  }
Exemplo n.º 2
0
 public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) {
   if (zIndex != 0) {
     return;
   }
   final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0);
   ug = ug.apply(new UStroke(stroke));
   ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE")))
       .apply(new UTranslate(stroke, stroke))
       .draw(new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke, 10, 10));
   final Dimension2D dimPureText = getPureTextDimension(ug.getStringBounder());
   drawText(ug, (dim.getWidth() - dimPureText.getWidth()) / 2, stroke + marginY);
 }
Exemplo n.º 3
0
	public void draw(UGraphic ug, double x, double y) {

		final TextBlock timeHeader = project.getTimeHeader(dayWith);
		final Row row = getMainRow();
		final TextBlock headers = row.header();

		final double deltaX = headers.calculateDimension(ug.getStringBounder()).getWidth();
		final double deltaY = timeHeader.calculateDimension(ug.getStringBounder()).getHeight();

		headers.drawU(ug.apply(new UTranslate(x, (y + deltaY))));
		final TextBlock tbRow = row.asTextBloc(project.getTimeConverter(dayWith));
		tbRow.drawU(ug.apply(new UTranslate((x + deltaX), (y + deltaY))));

		timeHeader.drawU(ug.apply(new UTranslate((x + deltaX), y)));
	}
Exemplo n.º 4
0
  public void drawU(
      UGraphic ug,
      double xTheoricalPosition,
      double yTheoricalPosition,
      double marginWidth,
      double marginHeight) {
    final Dimension2D dim = getDimension(ug.getStringBounder());

    final double widthTotal = dim.getWidth() + 2 * marginWidth;
    final double heightTotal = dim.getHeight() + 2 * marginHeight;
    final URectangle rect = new URectangle(widthTotal, heightTotal);

    // if (entity.getParent() == null) {
    if (entity.getType() != EntityType.GROUP) {
      ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBackground));
      ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder));
      ug.draw(xTheoricalPosition - marginWidth, yTheoricalPosition - marginHeight, rect);
      // name.drawU(ug, xTheoricalPosition + margin, yTheoricalPosition + margin);
      name.drawU(ug, xTheoricalPosition + 0, yTheoricalPosition + 0);
    } else {
      // final Frame frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()),
      // Color.BLACK, param
      // .getFont(FontParam.CLASS), rose.getHtmlColor(param, ColorParam.classBorder).getColor());
      final Frame frame = new Frame(entity.getDisplay2(), param);

      ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background));
      ug.getParam().setColor(null);
      ug.draw(xTheoricalPosition - marginWidth, yTheoricalPosition - marginWidth, rect);

      final double oldX = ug.getTranslateX();
      final double oldY = ug.getTranslateY();
      ug.translate(xTheoricalPosition - marginWidth, yTheoricalPosition - marginHeight);
      frame.drawU(ug, new Area(new Dimension2DDouble(widthTotal, heightTotal)), null);
      // ug.translate(-xTheoricalPosition + marginWidth,
      // -yTheoricalPosition + marginHeight);
      ug.setTranslate(oldX, oldY);

      // playField.drawInternal(UGraphicUtils.translate(ug, xTheoricalPosition + margin,
      // yTheoricalPosition +
      // margin
      // + frame.getPreferredHeight(ug.getStringBounder())));
      playField.drawInternal(
          UGraphicUtils.translate(
              ug,
              xTheoricalPosition + 0,
              yTheoricalPosition + 0 + frame.getPreferredHeight(ug.getStringBounder())));
    }
  }
Exemplo n.º 5
0
  public final void drawU(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final TextBlockInEllipse ellipse = new TextBlockInEllipse(desc, stringBounder);
    if (getSkinParam().shadowing()) {
      ellipse.setDeltaShadow(3);
    }

    if (url != null) {
      ug.startUrl(url);
    }

    ug =
        ug.apply(stroke)
            .apply(
                new UChangeColor(
                    SkinParamUtils.getColor(
                        getSkinParam(), ColorParam.usecaseBorder, getStereo())));
    HtmlColor backcolor = getEntity().getSpecificBackColor();
    if (backcolor == null) {
      backcolor =
          SkinParamUtils.getColor(getSkinParam(), ColorParam.usecaseBackground, getStereo());
    }
    ug = ug.apply(new UChangeBackColor(backcolor));
    final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse());

    ellipse.drawU(ug2);

    if (url != null) {
      ug.closeAction();
    }
  }
Exemplo n.º 6
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());
  }
Exemplo n.º 7
0
  public final void drawU(UGraphic ug) {
    final UEllipse circle = new UEllipse(SIZE, SIZE);
    if (getSkinParam().shadowing()) {
      circle.setDeltaShadow(4);
    }
    ug =
        ug.apply(
                new UChangeBackColor(
                    SkinParamUtils.getColor(
                        getSkinParam(), ColorParam.classBackground, getStereo())))
            .apply(
                new UChangeColor(
                    SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo())));
    if (url != null) {
      ug.startUrl(url);
    }
    ug.apply(new UStroke(1.5)).draw(circle);

    final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder());
    final double widthDesc = dimDesc.getWidth();
    // final double totalWidth = Math.max(widthDesc, SIZE);

    final double x = SIZE / 2 - widthDesc / 2;
    final double y = SIZE;
    desc.drawU(ug.apply(new UTranslate(x, y)));
    if (url != null) {
      ug.closeAction();
    }
  }
Exemplo n.º 8
0
 public void drawU(UGraphic ug) {
   for (GTile tile : tiles) {
     tile.drawU(ug);
     final Dimension2D dim = tile.calculateDimension(ug.getStringBounder());
     ug = ug.apply(new UTranslate(0, dim.getHeight() + space));
   }
 }
Exemplo n.º 9
0
  public void drawU(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final Dimension2D dimLabel = label.calculateDimension(stringBounder);
    final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
    ug =
        ug.apply(new UChangeColor(borderColor))
            .apply(new UStroke(1.5))
            .apply(new UChangeBackColor(backColor));
    ug.draw(Diamond.asPolygon(shadowing(), dimTotal.getWidth(), dimTotal.getHeight()));

    north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
    south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));

    final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
    final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
    label.drawU(ug.apply(new UTranslate(lx, ly)));

    final Dimension2D dimWeat = west.calculateDimension(stringBounder);
    west.drawU(
        ug.apply(
            new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2)));

    final Dimension2D dimEast = east.calculateDimension(stringBounder);
    east.drawU(
        ug.apply(
            new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2)));
  }
Exemplo n.º 10
0
  public void drawU(UGraphic ug, Skin skin, ISkinParam skinParam) {
    final StringBounder stringBounder = ug.getStringBounder();

    final double atX = ug.getTranslateX();
    final double atY = ug.getTranslateY();

    ug.translate(getStartingX(stringBounder), 0);

    for (int i = 0; i < events.size(); i++) {
      ComponentType type = ComponentType.ALIVE_BOX_CLOSE_OPEN;
      for (final Iterator<SegmentColored> it = getSegmentsCutted(stringBounder, i).iterator();
          it.hasNext(); ) {
        final SegmentColored seg = it.next();
        final ISkinParam skinParam2 =
            new SkinParamBackcolored(skinParam, seg.getSpecificBackColor());
        if (it.hasNext() == false) {
          type =
              type == ComponentType.ALIVE_BOX_CLOSE_OPEN
                  ? ComponentType.ALIVE_BOX_CLOSE_CLOSE
                  : ComponentType.ALIVE_BOX_OPEN_CLOSE;
        }
        final Component comp = skin.createComponent(type, skinParam2, null);
        type = ComponentType.ALIVE_BOX_OPEN_OPEN;
        final int currentLevel = getLevel(seg.getSegment().getPos1());
        seg.drawU(ug, comp, currentLevel);
      }
    }

    ug.setTranslate(atX, atY);
  }
Exemplo n.º 11
0
 public void drawU(UGraphic ug) {
   final StringBounder stringBounder = ug.getStringBounder();
   final Dimension2D cell = getMaxCellDimension(stringBounder);
   for (Layer layer : distribution.getLayers()) {
     drawLayer(ug, layer, cell.getWidth(), cell.getHeight());
     ug = ug.apply(new UTranslate(0, cell.getHeight()));
   }
 }
Exemplo n.º 12
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)));
 }
Exemplo n.º 13
0
 public void drawU(
     UGraphic ug,
     double xTheoricalPosition,
     double yTheoricalPosition,
     double marginWidth,
     double marginHeight) {
   ug = ug.apply(new UTranslate(xTheoricalPosition, yTheoricalPosition));
   comp.drawU(ug, new Area(getDimension(ug.getStringBounder())), new SimpleContext2D(false));
 }
Exemplo n.º 14
0
 public void drawU(UGraphic ug, double x, double y, int zIndex, Dimension2D dimToUse) {
   if (background != null) {
     final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), x, y);
     ug.getParam().setBackcolor(background);
     ug.draw(x, y, new URectangle(dim.getWidth(), dim.getHeight()));
     ug.getParam().setBackcolor(null);
   }
   block.drawU(ug, x, y);
 }
Exemplo n.º 15
0
  @Override
  public void drawU(UGraphic ug, double x, double y) {
    final StringBounder stringBounder = ug.getStringBounder();
    final double heightNum = numText.calculateDimension(stringBounder).getHeight();

    final double deltaY = calculateDimension(stringBounder).getHeight() - heightNum;

    numText.drawU(ug, x, y + deltaY / 2.0);
    super.drawU(ug, x + getNumberWithAndMargin(stringBounder), y);
  }
  public void drawU(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final Component comp = getComponent(stringBounder);
    final Dimension2D dim = comp.getPreferredDimension(stringBounder);
    final Area area = new Area(dim.getWidth(), dim.getHeight());
    tile.drawU(ug);
    final Real p = getNotePosition(stringBounder);

    comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug);
  }
Exemplo n.º 17
0
 private void drawLayer(UGraphic ug, Layer layer, double w, double h) {
   for (IEntity ent : layer.entities()) {
     final IEntityImage image = computeImage((ILeaf) ent);
     final int longitude = layer.getLongitude(ent);
     final Dimension2D dimImage = image.calculateDimension(ug.getStringBounder());
     final double diffx = w - dimImage.getWidth();
     final double diffy = h - dimImage.getHeight();
     image.drawU(ug.apply(new UTranslate(w * longitude / 2 + diffx / 2, diffy / 2)));
   }
 }
Exemplo n.º 18
0
 private void manage(UGraphic ug, double x, double y, int n, String last, double pendingX) {
   final double width = n * dayWidth - pendingX;
   ug.apply(new UTranslate(x + pendingX, y)).draw(new URectangle(width, getHeight()));
   final TextBlock b =
       Display.create(last)
           .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
   final Dimension2D dimText = b.calculateDimension(ug.getStringBounder());
   final double diffX = width - dimText.getWidth();
   final double diffY = getHeight() - dimText.getHeight();
   b.drawU(ug.apply(new UTranslate((x + pendingX + diffX / 2), (y + diffY / 2))));
 }
Exemplo n.º 19
0
 private void manage(UGraphic ug, double x, double y, int n, String last, double pendingX) {
   final double width = n * dayWidth - pendingX;
   ug.draw(x + pendingX, y, new URectangle(width, getHeight()));
   final TextBlock b =
       TextBlockUtils.create(
           Arrays.asList(last), fontConfig, HorizontalAlignement.LEFT, new SpriteContainerEmpty());
   final Dimension2D dimText = b.calculateDimension(ug.getStringBounder());
   final double diffX = width - dimText.getWidth();
   final double diffY = getHeight() - dimText.getHeight();
   b.drawU(ug, x + pendingX + diffX / 2, y + diffY / 2);
 }
Exemplo n.º 20
0
  public void drawU(UGraphic ug, double x, double y) {
    ug.getParam().setColor(fontConfiguration.getColor());

    final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true);

    if (tokenizer.hasMoreTokens()) {
      final double tabSize = getTabSize(ug.getStringBounder());
      while (tokenizer.hasMoreTokens()) {
        final String s = tokenizer.nextToken();
        if (s.equals("\t")) {
          final double remainder = x % tabSize;
          x += tabSize - remainder;
        } else {
          final UText utext = new UText(s, fontConfiguration);
          ug.draw(x, y, utext);
          final Dimension2D dim =
              ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), s);
          x += dim.getWidth();
        }
      }
    }
  }
Exemplo n.º 21
0
  public void draw(UGraphic ug, final double x, double y) {
    final StringBounder stringBounder = ug.getStringBounder();
    final double monthHeight = getMonthHeight(stringBounder);
    final double caseWidth = getCaseWidth(stringBounder);
    final double caseHeight = getCaseHeight(stringBounder);
    final int nb = getNbCase();

    ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
    ug.apply(new UTranslate(x, y)).draw(new URectangle(nb * caseWidth, monthHeight));
    final Instant end = project.getEnd();

    Month printed = null;

    double curx = x;
    for (Instant cur = project.getStart();
        cur.compareTo(end) <= 0;
        cur = cur.next(project.getDayClose())) {
      final Day d = cur.getDay();
      if (printed == null || d.getMonth() != printed) {
        ug.apply(new UTranslate(curx, y)).draw(new ULine(0, monthHeight));
        printed = d.getMonth();
        final TextBlock b =
            Display.create(printed.name())
                .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
        final Dimension2D dim = b.calculateDimension(stringBounder);
        b.drawU(ug.apply(new UTranslate(curx, (y + (monthHeight - dim.getHeight()) / 2))));
      }
      curx += caseWidth;
    }

    curx = x;
    y += monthHeight;
    ug.apply(new UTranslate(x, y)).draw(new URectangle(nb * caseWidth, caseHeight));

    for (Instant cur = project.getStart();
        cur.compareTo(end) <= 0;
        cur = cur.next(project.getDayClose())) {
      final Day d = cur.getDay();
      final TextBlock b =
          Display.create("" + d.getNumDay())
              .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
      final Dimension2D dim = b.calculateDimension(stringBounder);
      b.drawU(
          ug.apply(
              new UTranslate(
                  (curx + (caseWidth - dim.getWidth()) / 2),
                  (y + (caseHeight - dim.getHeight()) / 2))));
      curx += caseWidth;
      ug.apply(new UTranslate(curx, y)).draw(new ULine(0, caseHeight));
    }
  }
Exemplo n.º 22
0
 @Override
 protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
   final StringBounder stringBounder = ug.getStringBounder();
   final double xStart = getStartingX(stringBounder);
   ug = ug.apply(new UTranslate(xStart, getStartingY()));
   final Dimension2D dimensionToUse =
       new Dimension2DDouble(
           getPreferredWidth(stringBounder), comp.getPreferredHeight(stringBounder));
   if (url != null) {
     ug.startUrl(url);
   }
   comp.drawU(ug, new Area(dimensionToUse), context);
   if (url != null) {
     ug.closeAction();
   }
 }
Exemplo n.º 23
0
  private UGraphic drawNormal(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final Dimension2D dimTotal = calculateDimension(stringBounder);

    final double widthTotal = dimTotal.getWidth();
    final double heightTotal = dimTotal.getHeight();
    final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER);
    if (getSkinParam().shadowing()) {
      rect.setDeltaShadow(4);
    }

    ug = applyColors(ug);
    ug.apply(new UStroke(1.5)).draw(rect);

    desc.drawU(ug.apply(new UTranslate(MARGIN, MARGIN)));
    return ug;
  }
Exemplo n.º 24
0
  @Override
  protected void drawInternalU(UGraphic ug, Area area) {
    final TextBlock textBlock = getTextBlock();
    final StringBounder stringBounder = ug.getStringBounder();
    final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
    final double delta = (getPreferredWidth(stringBounder) - dimStickman.getWidth()) / 2;

    if (head) {
      textBlock.drawU(
          ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight())));
      ug = ug.apply(new UTranslate(delta, 0));
    } else {
      textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0)));
      ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder)));
    }
    stickman.drawU(ug);
  }
Exemplo n.º 25
0
  public void draw(UGraphic ug, double x, double y) {

    final StringBounder stringBounder = ug.getStringBounder();

    ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
    ug.apply(new UTranslate(x, y))
        .draw(new URectangle(getWidth(stringBounder), getHeight(stringBounder)));

    for (Item it : project.getValidItems()) {
      final TextBlock b =
          Display.create("" + it.getCode())
              .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
      final Dimension2D dim = b.calculateDimension(stringBounder);
      b.drawU(ug.apply(new UTranslate(x, y)));
      y += dim.getHeight();
      ug.apply(new UTranslate(x, y)).draw(new ULine(getWidth(stringBounder), 0));
    }
  }
Exemplo n.º 26
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))));
  }
Exemplo n.º 27
0
  @Override
  protected void drawInternalU(UGraphic ug, Area area) {
    final StringBounder stringBounder = ug.getStringBounder();
    ug =
        ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY))
            .apply(new UChangeColor(HtmlColorUtils.BLACK));
    ug.draw(new URectangle(getPreferredWidth(stringBounder), getPreferredHeight(stringBounder)));

    final String n = type.name();
    final int split = 9;
    final List<String> strings = new ArrayList<String>();
    for (int i = 0; i < n.length(); i += split) {
      strings.add(n.substring(i, Math.min(i + split, n.length())));
    }

    final TextBlock textBlock =
        TextBlockUtils.create(
            Display.create(strings),
            new FontConfiguration(NORMAL, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE),
            HorizontalAlignment.LEFT,
            new SpriteContainerEmpty());
    textBlock.drawU(ug);
  }
Exemplo n.º 28
0
 private void drawInternalLabel(UGraphic ug) {
   if (textBlock != null) {
     final Point2D position = getTextBlockPosition(ug.getStringBounder());
     textBlock.drawU(ug.apply(new UTranslate(position)));
   }
 }
Exemplo n.º 29
0
 public void drawU(UGraphic ug, double x, double y) {
   b1.drawU(ug, x, y);
   final Dimension2D dim1 = b1.calculateDimension(ug.getStringBounder());
   b2.drawU(ug, x, y + dim1.getHeight());
 }
Exemplo n.º 30
0
 public void drawU(UGraphic ug) {
   comp.drawU(ug, new Area(calculateDimension(ug.getStringBounder())), new SimpleContext2D(false));
 }