Esempio n. 1
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);
  }
Esempio n. 2
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())));
    }
  }