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))); }
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))); }
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)); } }
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))); }
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()); }
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(); } }
@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); }
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); }
private UGraphic drawOctagon(UGraphic ug) { final Shape shape = bibliotekon.getShape(getEntity()); final Shadowable octagon = shape.getOctagon(); if (getSkinParam().shadowing()) { octagon.setDeltaShadow(4); } ug = applyColors(ug); ug.apply(new UStroke(1.5)).draw(octagon); desc.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); return ug; }
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)))); }
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); }
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()))); } }
public void drawTitleInternal( UGraphic ug, double startingX, double endingX, double y, boolean clearArea) { if (title == null || blankTitle) { return; } final double widthToUse = endingX - startingX; final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); final double space = (widthToUse - dimTitle.getWidth()) / 2; final double x1 = startingX + space; final double y1 = y - dimTitle.getHeight() / 2 - 0.5; ug = ug.apply(new UTranslate(x1, y1)); if (clearArea) { ug.apply(getStroke()).draw(new URectangle(dimTitle)); } title.drawU(ug); }
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; }
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)); } }
@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)))); }
@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); }
private void drawInternalLabel(UGraphic ug) { if (textBlock != null) { final Point2D position = getTextBlockPosition(ug.getStringBounder()); textBlock.drawU(ug.apply(new UTranslate(position))); } }