summaryrefslogtreecommitdiff
path: root/src/net/sourceforge/plantuml/skin/rose
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/plantuml/skin/rose')
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java83
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java102
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java99
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java294
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java100
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java100
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java106
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java75
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java81
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java75
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java139
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java86
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java100
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java96
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java162
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java71
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java84
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java72
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java136
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java104
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java115
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java98
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java143
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java191
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java73
-rw-r--r--src/net/sourceforge/plantuml/skin/rose/Rose.java307
26 files changed, 3092 insertions, 0 deletions
diff --git a/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java
new file mode 100644
index 0000000..c69804b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java
@@ -0,0 +1,83 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.ArrowComponent;
+import net.sourceforge.plantuml.skin.ArrowConfiguration;
+
+public abstract class AbstractComponentRoseArrow extends AbstractTextualComponent implements ArrowComponent {
+
+ private final int arrowDeltaX = 10;
+ private final int arrowDeltaY = 4;
+ private final HtmlColor foregroundColor;
+ private final ArrowConfiguration arrowConfiguration;
+
+ public AbstractComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay,
+ ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment,
+ double maxMessageSize) {
+ super(stringsToDisplay, font, textHorizontalAlignment, 7, 7, 1, spriteContainer,
+ maxMessageSize, false, null, null);
+ this.arrowConfiguration = arrowConfiguration;
+ this.foregroundColor = foregroundColor;
+ }
+
+ protected final HtmlColor getForegroundColor() {
+ return foregroundColor;
+ }
+
+ final protected int getArrowDeltaX() {
+ return arrowDeltaX;
+ }
+
+ final protected int getArrowDeltaY() {
+ return arrowDeltaY;
+ }
+
+ @Override
+ public final double getPaddingY() {
+ return 4;
+ }
+
+ public final ArrowConfiguration getArrowConfiguration() {
+ return arrowConfiguration;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java
new file mode 100644
index 0000000..de9845e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java
@@ -0,0 +1,102 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.skin.AbstractComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseActiveLine extends AbstractComponent {
+
+ private final SymbolContext symbolContext;
+ private final boolean closeUp;
+ private final boolean closeDown;
+
+ public ComponentRoseActiveLine(SymbolContext symbolContext, boolean closeUp, boolean closeDown) {
+ this.symbolContext = symbolContext;
+ this.closeUp = closeUp;
+ this.closeDown = closeDown;
+ }
+
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int x = (int) (dimensionToUse.getWidth() - getPreferredWidth(stringBounder)) / 2;
+
+ final URectangle rect = new URectangle(getPreferredWidth(stringBounder), dimensionToUse.getHeight());
+ if (symbolContext.isShadowing()) {
+ rect.setDeltaShadow(1);
+ }
+ ug = ug.apply(new UChangeColor(symbolContext.getForeColor()));
+ if (closeUp && closeDown) {
+ ug.apply(new UChangeBackColor(symbolContext.getBackColor())).apply(new UTranslate(x, 0)).draw(rect);
+ return;
+ }
+ ug.apply(new UChangeBackColor(symbolContext.getBackColor())).apply(new UChangeColor(symbolContext.getBackColor()))
+ .apply(new UTranslate(x, 0)).draw(rect);
+
+ final ULine vline = new ULine(0, dimensionToUse.getHeight());
+ ug.apply(new UTranslate(x, 0)).draw(vline);
+ ug.apply(new UTranslate(x + getPreferredWidth(stringBounder), 0)).draw(vline);
+
+ final ULine hline = new ULine(getPreferredWidth(stringBounder), 0);
+ if (closeUp) {
+ ug.apply(new UTranslate(x, 0)).draw(hline);
+ }
+ if (closeDown) {
+ ug.apply(new UTranslate(x, dimensionToUse.getHeight())).draw(hline);
+ }
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return 0;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return 10;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java
new file mode 100644
index 0000000..42c6810
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java
@@ -0,0 +1,99 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.skin.StickMan;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseActor extends AbstractTextualComponent {
+
+ private final TextBlock stickman;
+ private final boolean head;
+
+ public ComponentRoseActor(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
+ ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
+ fontForStereotype, htmlColorForStereotype);
+ this.head = head;
+ this.stickman = new StickMan(biColor);
+ }
+
+ @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);
+ }
+
+ private double getTextMiddlePostion(StringBounder stringBounder) {
+ return (getPreferredWidth(stringBounder) - getTextWidth(stringBounder)) / 2.0;
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return dimStickman.getHeight() + getTextHeight(stringBounder);
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return Math.max(dimStickman.getWidth(), getTextWidth(stringBounder));
+ }
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java
new file mode 100644
index 0000000..01ac5a2
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java
@@ -0,0 +1,294 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.skin.ArrowConfiguration;
+import net.sourceforge.plantuml.skin.ArrowDecoration;
+import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.skin.ArrowDressing;
+import net.sourceforge.plantuml.skin.ArrowHead;
+import net.sourceforge.plantuml.skin.ArrowPart;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UEllipse;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseArrow extends AbstractComponentRoseArrow {
+
+ private final HorizontalAlignment messagePosition;
+ private final boolean niceArrow;
+
+ public ComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer,
+ HorizontalAlignment textHorizontalAlignment, double maxMessageSize, boolean niceArrow) {
+ super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, textHorizontalAlignment, maxMessageSize);
+ this.messagePosition = messagePosition;
+ this.niceArrow = niceArrow;
+ }
+
+ public static final double spaceCrossX = 6;
+ public static final double diamCircle = 8;
+ public static final double thinCircle = 1.5;
+
+ @Override
+ public void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int textHeight = (int) getTextHeight(stringBounder);
+ ug = ug.apply(new UChangeColor(getForegroundColor()));
+
+ final ArrowDressing dressing1 = getArrowConfiguration().getDressing1();
+ final ArrowDressing dressing2 = getArrowConfiguration().getDressing2();
+
+ double start = 0;
+ double len = dimensionToUse.getWidth() - 1;
+
+ final double pos1 = start + 1;
+ final double pos2 = len - 1;
+
+ if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE && dressing2.getHead() == ArrowHead.NONE) {
+ len -= diamCircle / 2;
+ }
+ if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE && dressing2.getHead() != ArrowHead.NONE) {
+ len -= diamCircle / 2 + thinCircle;
+ }
+
+ if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE && dressing1.getHead() == ArrowHead.NONE) {
+ start += diamCircle / 2;
+ len -= diamCircle / 2;
+ }
+ if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE
+ && dressing1.getHead() == ArrowHead.NORMAL) {
+ start += diamCircle + thinCircle;
+ len -= diamCircle + thinCircle;
+ }
+
+ drawDressing1(ug, pos1, dressing1, getArrowConfiguration().getDecoration1());
+ drawDressing2(ug, pos2, dressing2, getArrowConfiguration().getDecoration2());
+
+ if (dressing2.getPart() == ArrowPart.FULL && dressing2.getHead() == ArrowHead.NORMAL) {
+ len -= getArrowDeltaX() / 2;
+ }
+ if (dressing1.getPart() == ArrowPart.FULL && dressing1.getHead() == ArrowHead.NORMAL) {
+ start += getArrowDeltaX() / 2;
+ len -= getArrowDeltaX() / 2;
+ }
+
+ if (dressing2.getHead() == ArrowHead.CROSSX) {
+ len -= 2 * spaceCrossX;
+ }
+ if (dressing1.getHead() == ArrowHead.CROSSX) {
+ start += 2 * spaceCrossX;
+ len -= 2 * spaceCrossX;
+ }
+
+ if (getArrowConfiguration().isDotted()) {
+ ug = stroke(ug, 2, 2);
+ }
+ ug.apply(new UTranslate(start, textHeight)).draw(new ULine(len, 0));
+ if (getArrowConfiguration().isDotted()) {
+ ug = ug.apply(new UStroke());
+ }
+
+ final ArrowDirection direction2 = getDirection2();
+ final double textPos;
+ if (messagePosition == HorizontalAlignment.CENTER) {
+ final double textWidth = getTextBlock().calculateDimension(stringBounder).getWidth();
+ textPos = (dimensionToUse.getWidth() - textWidth) / 2;
+ } else if (messagePosition == HorizontalAlignment.RIGHT) {
+ final double textWidth = getTextBlock().calculateDimension(stringBounder).getWidth();
+ textPos = dimensionToUse.getWidth() - textWidth - getMarginX2()
+ - (direction2 == ArrowDirection.LEFT_TO_RIGHT_NORMAL ? getArrowDeltaX() : 0);
+ } else {
+ textPos = getMarginX1()
+ + (direction2 == ArrowDirection.RIGHT_TO_LEFT_REVERSE
+ || direction2 == ArrowDirection.BOTH_DIRECTION ? getArrowDeltaX() : 0);
+ }
+ getTextBlock().drawU(ug.apply(new UTranslate(textPos, 0)));
+ }
+
+ private void drawDressing1(UGraphic ug, double x, ArrowDressing dressing, ArrowDecoration decoration) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int textHeight = (int) getTextHeight(stringBounder);
+
+ if (decoration == ArrowDecoration.CIRCLE) {
+ final UEllipse circle = new UEllipse(diamCircle, diamCircle);
+ ug.apply(new UStroke(thinCircle))
+ .apply(new UChangeColor(getForegroundColor()))
+ .apply(new UTranslate(x - diamCircle / 2 - thinCircle, textHeight - diamCircle / 2 - thinCircle / 2))
+ .draw(circle);
+ x += diamCircle / 2 + thinCircle;
+ }
+
+ if (dressing.getHead() == ArrowHead.ASYNC) {
+ if (dressing.getPart() != ArrowPart.BOTTOM_PART) {
+ ug.apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY()));
+ }
+ if (dressing.getPart() != ArrowPart.TOP_PART) {
+ ug.apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), getArrowDeltaY()));
+ }
+ } else if (dressing.getHead() == ArrowHead.CROSSX) {
+ ug = ug.apply(new UStroke(2));
+ ug.apply(new UTranslate(spaceCrossX, textHeight - getArrowDeltaX() / 2)).draw(
+ new ULine(getArrowDeltaX(), getArrowDeltaX()));
+ ug.apply(new UTranslate(spaceCrossX, textHeight + getArrowDeltaX() / 2)).draw(
+ new ULine(getArrowDeltaX(), -getArrowDeltaX()));
+ } else if (dressing.getHead() == ArrowHead.NORMAL) {
+ final UPolygon polygon = getPolygonReverse(dressing.getPart(), textHeight);
+ ug.apply(new UChangeBackColor(getForegroundColor())).apply(new UTranslate(x, 0)).draw(polygon);
+ }
+
+ }
+
+ private void drawDressing2(UGraphic ug, double x, ArrowDressing dressing, ArrowDecoration decoration) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int textHeight = (int) getTextHeight(stringBounder);
+
+ if (decoration == ArrowDecoration.CIRCLE) {
+ ug = ug.apply(new UStroke(thinCircle)).apply(new UChangeColor(getForegroundColor()));
+ final UEllipse circle = new UEllipse(diamCircle, diamCircle);
+ ug.apply(new UTranslate(x - diamCircle / 2 + thinCircle, textHeight - diamCircle / 2 - thinCircle / 2))
+ .draw(circle);
+ ug = ug.apply(new UStroke());
+ x -= diamCircle / 2 + thinCircle;
+ }
+
+ if (dressing.getHead() == ArrowHead.ASYNC) {
+ if (dressing.getPart() != ArrowPart.BOTTOM_PART) {
+ ug.apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY()));
+ }
+ if (dressing.getPart() != ArrowPart.TOP_PART) {
+ ug.apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), getArrowDeltaY()));
+ }
+ } else if (dressing.getHead() == ArrowHead.CROSSX) {
+ ug = ug.apply(new UStroke(2));
+ ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), textHeight - getArrowDeltaX() / 2)).draw(
+ new ULine(getArrowDeltaX(), getArrowDeltaX()));
+ ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), textHeight + getArrowDeltaX() / 2)).draw(
+ new ULine(getArrowDeltaX(), -getArrowDeltaX()));
+ ug = ug.apply(new UStroke());
+ } else if (dressing.getHead() == ArrowHead.NORMAL) {
+ final UPolygon polygon = getPolygonNormal(dressing.getPart(), textHeight, x);
+ ug.apply(new UChangeBackColor(getForegroundColor())).draw(polygon);
+ }
+
+ }
+
+ private UPolygon getPolygonNormal(ArrowPart part, final int textHeight, final double x2) {
+ final UPolygon polygon = new UPolygon();
+ if (part == ArrowPart.TOP_PART) {
+ polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
+ polygon.addPoint(x2, textHeight);
+ polygon.addPoint(x2 - getArrowDeltaX(), textHeight);
+ } else if (part == ArrowPart.BOTTOM_PART) {
+ polygon.addPoint(x2 - getArrowDeltaX(), textHeight + 1);
+ polygon.addPoint(x2, textHeight + 1);
+ polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY() + 1);
+ } else {
+ polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
+ polygon.addPoint(x2, textHeight);
+ polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY());
+ if (niceArrow) {
+ polygon.addPoint(x2 - getArrowDeltaX() + 4, textHeight);
+ }
+ }
+ return polygon;
+ }
+
+ private UPolygon getPolygonReverse(ArrowPart part, final int textHeight) {
+ final UPolygon polygon = new UPolygon();
+ if (part == ArrowPart.TOP_PART) {
+ polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
+ polygon.addPoint(0, textHeight);
+ polygon.addPoint(getArrowDeltaX(), textHeight);
+ } else if (part == ArrowPart.BOTTOM_PART) {
+ polygon.addPoint(getArrowDeltaX(), textHeight + 1);
+ polygon.addPoint(0, textHeight + 1);
+ polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY() + 1);
+ } else {
+ polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
+ polygon.addPoint(0, textHeight);
+ polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY());
+ if (niceArrow) {
+ polygon.addPoint(getArrowDeltaX() - 4, textHeight);
+ }
+ }
+ return polygon;
+ }
+
+ public Point2D getStartPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
+ final int textHeight = (int) getTextHeight(stringBounder);
+ if (getDirection2() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) {
+ return new Point2D.Double(getPaddingX(), textHeight + getPaddingY());
+ }
+ return new Point2D.Double(dimensionToUse.getWidth() + getPaddingX(), textHeight + getPaddingY());
+ }
+
+ public Point2D getEndPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
+ final int textHeight = (int) getTextHeight(stringBounder);
+ if (getDirection2() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) {
+ return new Point2D.Double(dimensionToUse.getWidth() + getPaddingX(), textHeight + getPaddingY());
+ }
+ return new Point2D.Double(getPaddingX(), textHeight + getPaddingY());
+ }
+
+ final private ArrowDirection getDirection2() {
+ return getArrowConfiguration().getArrowDirection();
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + getArrowDeltaY() + 2 * getPaddingY();
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return getTextWidth(stringBounder) + getArrowDeltaX();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java
new file mode 100644
index 0000000..a107d07
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java
@@ -0,0 +1,100 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.svek.Boundary;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseBoundary extends AbstractTextualComponent {
+
+ private final TextBlock stickman;
+ private final boolean head;
+
+ public ComponentRoseBoundary(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
+ ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
+ fontForStereotype, htmlColorForStereotype);
+ this.head = head;
+ this.stickman = new Boundary(biColor);
+ }
+
+ @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);
+ }
+
+ private double getTextMiddlePostion(StringBounder stringBounder) {
+ return (getPreferredWidth(stringBounder) - getTextWidth(stringBounder)) / 2.0;
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return dimStickman.getHeight() + getTextHeight(stringBounder);
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return Math.max(dimStickman.getWidth(), getTextWidth(stringBounder));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java
new file mode 100644
index 0000000..2ea4182
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java
@@ -0,0 +1,100 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.svek.Control;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseControl extends AbstractTextualComponent {
+
+ private final TextBlock stickman;
+ private final boolean head;
+
+ public ComponentRoseControl(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
+ ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
+ fontForStereotype, htmlColorForStereotype);
+ this.head = head;
+ this.stickman = new Control(biColor);
+ }
+
+ @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);
+ }
+
+ private double getTextMiddlePostion(StringBounder stringBounder) {
+ return (getPreferredWidth(stringBounder) - getTextWidth(stringBounder)) / 2.0;
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return dimStickman.getHeight() + getTextHeight(stringBounder);
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return Math.max(dimStickman.getWidth(), getTextWidth(stringBounder));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java
new file mode 100644
index 0000000..4c18cef
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java
@@ -0,0 +1,106 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.graphic.USymbol;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseDatabase extends AbstractTextualComponent {
+
+ private final TextBlock stickman;
+ private final boolean head;
+
+ public ComponentRoseDatabase(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
+ ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
+ fontForStereotype, htmlColorForStereotype);
+ this.head = head;
+
+ final SymbolContext symbolContext = new SymbolContext(biColor.getBackColor(), biColor.getForeColor())
+ .withStroke(new UStroke(1.5)).withShadow(biColor.getDeltaShadow() > 0);
+ this.stickman = USymbol.DATABASE.asSmall(TextBlockUtils.empty(16, 17), TextBlockUtils.empty(0, 0),
+ symbolContext);
+ }
+
+ @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);
+ }
+
+ private double getTextMiddlePostion(StringBounder stringBounder) {
+ return (getPreferredWidth(stringBounder) - getTextWidth(stringBounder)) / 2.0;
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return dimStickman.getHeight() + getTextHeight(stringBounder);
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return Math.max(dimStickman.getWidth(), getTextWidth(stringBounder));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java
new file mode 100644
index 0000000..90ad857
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java
@@ -0,0 +1,75 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.AbstractComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseDelayLine extends AbstractComponent {
+
+ private final HtmlColor color;
+
+ public ComponentRoseDelayLine(HtmlColor color) {
+ this.color = color;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ ug = stroke(ug, 1, 4).apply(new UChangeColor(color));
+ final int x = (int) (dimensionToUse.getWidth() / 2);
+ ug.apply(UAntiAliasing.ANTI_ALIASING_OFF).apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight()));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return 20;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return 1;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java
new file mode 100644
index 0000000..8bc81bd
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java
@@ -0,0 +1,81 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseDelayText extends AbstractTextualComponent {
+
+ public ComponentRoseDelayText(FontConfiguration font, Display stringsToDisplay, ISkinSimple spriteContainer) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 0, 0, 4,
+ spriteContainer, 0, false, null, null);
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ final TextBlock textBlock = getTextBlock();
+ final StringBounder stringBounder = ug.getStringBounder();
+ final double textWidth = getTextWidth(stringBounder);
+ final double textHeight = getTextHeight(stringBounder);
+
+ final double xpos = (dimensionToUse.getWidth() - textWidth) / 2;
+ final double ypos = (dimensionToUse.getHeight() - textHeight) / 2;
+
+ textBlock.drawU(ug.apply(new UTranslate(xpos, (ypos + getMarginY()))));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + 20;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return getPureTextWidth(stringBounder);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java
new file mode 100644
index 0000000..810599e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java
@@ -0,0 +1,75 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.AbstractComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseDestroy extends AbstractComponent {
+
+ private final HtmlColor foregroundColor;
+
+ public ComponentRoseDestroy(HtmlColor foregroundColor) {
+ this.foregroundColor = foregroundColor;
+ }
+
+ private final int crossSize = 9;
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ ug = ug.apply(new UStroke(2)).apply(new UChangeColor(foregroundColor));
+
+ ug.draw(new ULine(2 * crossSize, 2 * crossSize));
+ ug.apply(new UTranslate(0, 2 * crossSize)).draw(new ULine(2 * crossSize, -2 * crossSize));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return crossSize * 2;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return crossSize * 2;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java
new file mode 100644
index 0000000..b1e8a37
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java
@@ -0,0 +1,139 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseDivider extends AbstractTextualComponent {
+
+ // private final int outMargin = 5;
+ private final HtmlColor background;
+ private final boolean empty;
+ private final boolean withShadow;
+ private final UStroke stroke;
+
+ public ComponentRoseDivider(FontConfiguration font, HtmlColor background, Display stringsToDisplay,
+ ISkinSimple spriteContainer, boolean withShadow, UStroke stroke) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4,
+ spriteContainer, 0, false, null, null);
+ this.background = background;
+ this.empty = stringsToDisplay.get(0).length() == 0;
+ this.withShadow = withShadow;
+ this.stroke = stroke;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+
+ ug = ug.apply(new UChangeBackColor(background));
+ if (empty) {
+ drawSep(ug.apply(new UTranslate(0, dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth());
+ } else {
+ final TextBlock textBlock = getTextBlock();
+ final StringBounder stringBounder = ug.getStringBounder();
+ final double textWidth = getTextWidth(stringBounder);
+ final double textHeight = getTextHeight(stringBounder);
+ final double deltaX = 6;
+ final double xpos = (dimensionToUse.getWidth() - textWidth - deltaX) / 2;
+ final double ypos = (dimensionToUse.getHeight() - textHeight) / 2;
+
+ drawSep(ug.apply(new UTranslate(0, dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth());
+
+ ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
+ ug = ug.apply(stroke);
+ final URectangle rect = new URectangle(textWidth + deltaX, textHeight);
+ if (withShadow) {
+ rect.setDeltaShadow(4);
+ }
+ ug.apply(new UTranslate(xpos, ypos)).draw(rect);
+ textBlock.drawU(ug.apply(new UTranslate(xpos + deltaX, ypos + getMarginY())));
+
+ // drawSep(ug.apply(new UTranslate(xpos + deltaX + textWidth + stroke.getThickness() + , dimensionToUse
+ // .getHeight() / 2)), 10);
+ }
+ }
+
+ private void drawSep(UGraphic ug, double width) {
+ ug = ug.apply(new UChangeColor(background));
+ drawRectLong(ug.apply(new UTranslate(0, -1)), width);
+ drawDoubleLine(ug, width);
+ }
+
+ private void drawRectLong(UGraphic ug, double width) {
+ final URectangle rectLong = new URectangle(width, 3);
+ if (withShadow) {
+ rectLong.setDeltaShadow(2);
+ }
+ ug = ug.apply(new UStroke());
+ ug.draw(rectLong);
+ }
+
+ private void drawDoubleLine(UGraphic ug, final double width) {
+ ug = ug.apply(new UStroke(stroke.getThickness() / 2)).apply(new UChangeColor(HtmlColorUtils.BLACK));
+ final ULine line = new ULine(width, 0);
+ ug.apply(new UTranslate(0, -1)).draw(line);
+ ug.apply(new UTranslate(0, 2)).draw(line);
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + 20;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return getTextWidth(stringBounder) + 30;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java
new file mode 100644
index 0000000..0e296b4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java
@@ -0,0 +1,86 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseEnglober extends AbstractTextualComponent {
+
+ private final SymbolContext symbolContext;
+
+ public ComponentRoseEnglober(SymbolContext symbolContext, Display strings, FontConfiguration font, ISkinSimple spriteContainer) {
+ super(strings, font, HorizontalAlignment.CENTER, 3, 3, 1, spriteContainer, 0, false, null, null);
+ this.symbolContext = symbolContext;
+ }
+
+ @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) {
+ // ug.getParam().setColor(Color.RED);
+ // ug.getParam().setBackcolor(Color.YELLOW);
+ // ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(),
+ // dimensionToUse.getHeight()));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + 3;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return getTextWidth(stringBounder);
+ }
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java
new file mode 100644
index 0000000..e0b3d2e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java
@@ -0,0 +1,100 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.svek.EntityDomain;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseEntity extends AbstractTextualComponent {
+
+ private final TextBlock stickman;
+ private final boolean head;
+
+ public ComponentRoseEntity(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
+ ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
+ fontForStereotype, htmlColorForStereotype);
+ this.head = head;
+ this.stickman = new EntityDomain(biColor);
+ }
+
+ @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);
+ }
+
+ private double getTextMiddlePostion(StringBounder stringBounder) {
+ return (getPreferredWidth(stringBounder) - getTextWidth(stringBounder)) / 2.0;
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return dimStickman.getHeight() + getTextHeight(stringBounder);
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ final Dimension2D dimStickman = stickman.calculateDimension(stringBounder);
+ return Math.max(dimStickman.getWidth(), getTextWidth(stringBounder));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java
new file mode 100644
index 0000000..0a3421f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java
@@ -0,0 +1,96 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseGroupingElse extends AbstractTextualComponent {
+
+ private final HtmlColor groupBorder;
+ private final HtmlColor backgroundColor;
+
+ // private final UStroke stroke;
+
+ public ComponentRoseGroupingElse(HtmlColor groupBorder, FontConfiguration smallFont, CharSequence comment,
+ ISkinSimple spriteContainer, HtmlColor backgroundColor) {
+ super(comment == null ? null : "[" + comment + "]", smallFont, HorizontalAlignment.LEFT, 5, 5, 1,
+ spriteContainer, 0, null, null);
+ this.groupBorder = groupBorder;
+ this.backgroundColor = backgroundColor;
+ // this.stroke = stroke;
+ }
+
+ @Override
+ protected void drawBackgroundInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight());
+ ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backgroundColor)).draw(rect);
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ ug = stroke(ug, 2, 2).apply(new UChangeColor(groupBorder));
+ ug.apply(new UTranslate(0, 1)).draw(new ULine(dimensionToUse.getWidth(), 0));
+ ug = ug.apply(new UStroke());
+ getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY())));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder);
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return getTextWidth(stringBounder);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java
new file mode 100644
index 0000000..6944322
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java
@@ -0,0 +1,162 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
+
+ private final int cornersize = 10;
+ private final int commentMargin = 0; // 8;
+
+ private final TextBlock commentTextBlock;
+
+ private final HtmlColor background;
+ private final SymbolContext symbolContext;
+
+ public ComponentRoseGroupingHeader(HtmlColor background, SymbolContext symbolContext, FontConfiguration bigFont, UFont smallFont,
+ Display strings, ISkinSimple spriteContainer) {
+ super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null);
+ this.symbolContext = symbolContext;
+ this.background = background;
+ if (strings.size() == 1 || strings.get(1) == null) {
+ this.commentTextBlock = null;
+ } else {
+ final Display display = Display.getWithNewlines("[" + strings.get(1) + "]");
+ this.commentTextBlock = TextBlockUtils.create(display, new FontConfiguration(smallFont, bigFont.getColor(),
+ bigFont.getHyperlinkColor(), bigFont.useUnderlineForHyperlink()), HorizontalAlignment.LEFT,
+ spriteContainer);
+ }
+ if (this.background == null) {
+ throw new IllegalArgumentException();
+ }
+
+ }
+
+ private double getSuppHeightForComment(StringBounder stringBounder) {
+ if (commentTextBlock == null) {
+ return 0;
+ }
+ final double height = commentTextBlock.calculateDimension(stringBounder).getHeight();
+ if (height > 15) {
+ return height - 15;
+ }
+ return 0;
+
+ }
+
+ @Override
+ final public double getPreferredWidth(StringBounder stringBounder) {
+ final double sup;
+ if (commentTextBlock == null) {
+ sup = commentMargin * 2;
+ } else {
+ final Dimension2D size = commentTextBlock.calculateDimension(stringBounder);
+ sup = getMarginX1() + commentMargin + size.getWidth();
+
+ }
+ return getTextWidth(stringBounder) + sup;
+ }
+
+ @Override
+ final public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + 2 * getPaddingY() + getSuppHeightForComment(stringBounder);
+ }
+
+ @Override
+ protected void drawBackgroundInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor()));
+ final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight());
+ rect.setDeltaShadow(symbolContext.getDeltaShadow());
+ ug.apply(new UChangeBackColor(background)).draw(rect);
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor()));
+ final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight());
+ ug.draw(rect);
+
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int textWidth = (int) getTextWidth(stringBounder);
+ final int textHeight = (int) getTextHeight(stringBounder);
+
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(0, 0);
+ polygon.addPoint(textWidth, 0);
+
+ polygon.addPoint(textWidth, textHeight - cornersize);
+ polygon.addPoint(textWidth - cornersize, textHeight);
+
+ polygon.addPoint(0, textHeight);
+ polygon.addPoint(0, 0);
+
+ symbolContext.applyColors(ug).draw(polygon);
+
+ ug = ug.apply(new UStroke());
+
+ getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY())));
+
+ if (commentTextBlock != null) {
+ final int x1 = getMarginX1() + textWidth;
+ final int y2 = getMarginY() + 1;
+
+ commentTextBlock.drawU(ug.apply(new UTranslate(x1 + commentMargin, y2)));
+ }
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java
new file mode 100644
index 0000000..6243331
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java
@@ -0,0 +1,71 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.skin.Component;
+import net.sourceforge.plantuml.skin.Context2D;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+public class ComponentRoseGroupingSpace implements Component {
+
+ private final double space;
+
+ public ComponentRoseGroupingSpace(double space) {
+ this.space = space;
+ }
+
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return 0;
+ }
+
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return space;
+ }
+
+ public void drawU(UGraphic ug, Area area, Context2D context) {
+ }
+
+ public final Dimension2D getPreferredDimension(StringBounder stringBounder) {
+ final double w = getPreferredWidth(stringBounder);
+ final double h = getPreferredHeight(stringBounder);
+ return new Dimension2DDouble(w, h);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java
new file mode 100644
index 0000000..30abb6e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java
@@ -0,0 +1,84 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.AbstractComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseLine extends AbstractComponent {
+
+ private final HtmlColor color;
+ private final boolean continueLine;
+ private final UStroke stroke;
+
+ public ComponentRoseLine(HtmlColor color, boolean continueLine, UStroke stroke) {
+ this.color = color;
+ this.continueLine = continueLine;
+ this.stroke = stroke;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ ug = ug.apply(new UChangeColor(color));
+ if (continueLine) {
+ ug = ug.apply(new UStroke());
+ } else {
+ ug = stroke(ug, 5, 5, stroke.getThickness());
+ }
+ final int x = (int) (dimensionToUse.getWidth() / 2);
+ ug.apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight()));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return 20;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return 1;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java
new file mode 100644
index 0000000..2ecac3a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java
@@ -0,0 +1,72 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.AbstractComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+
+public class ComponentRoseNewpage extends AbstractComponent {
+
+ private final HtmlColor foregroundColor;
+
+ public ComponentRoseNewpage(HtmlColor foregroundColor) {
+ this.foregroundColor = foregroundColor;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final Dimension2D dimensionToUse = area.getDimensionToUse();
+ ug = stroke(ug, 2, 2).apply(new UChangeColor(foregroundColor));
+ ug.draw(new ULine(dimensionToUse.getWidth(), 0));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return 1;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return 0;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java
new file mode 100644
index 0000000..56ee046
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java
@@ -0,0 +1,136 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.creole.Stencil;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+final public class ComponentRoseNote extends AbstractTextualComponent implements Stencil {
+
+ private final int cornersize = 10;
+ private final double paddingX;
+ private final double paddingY;
+ private final SymbolContext symbolContext;
+
+ public ComponentRoseNote(SymbolContext symbolContext, FontConfiguration font, Display strings, double paddingX, double paddingY,
+ ISkinSimple spriteContainer) {
+ super(strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, 0, true, null, null);
+ this.paddingX = paddingX;
+ this.paddingY = paddingY;
+ this.symbolContext = symbolContext;
+ }
+
+ @Override
+ final public double getPreferredWidth(StringBounder stringBounder) {
+ final double result = getTextWidth(stringBounder) + 2 * getPaddingX() + symbolContext.getDeltaShadow();
+ return result;
+ }
+
+ @Override
+ final public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + 2 * getPaddingY() + symbolContext.getDeltaShadow();
+ }
+
+ @Override
+ public double getPaddingX() {
+ return paddingX;
+ }
+
+ @Override
+ public double getPaddingY() {
+ return paddingY;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int textHeight = (int) getTextHeight(stringBounder);
+
+ int x2 = (int) getTextWidth(stringBounder);
+ final double diffX = area.getDimensionToUse().getWidth() - getPreferredWidth(stringBounder);
+ if (diffX < 0) {
+ throw new IllegalArgumentException();
+ }
+ if (area.getDimensionToUse().getWidth() > getPreferredWidth(stringBounder)) {
+ x2 = (int) (area.getDimensionToUse().getWidth() - 2 * getPaddingX());
+ }
+
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(0, 0);
+ polygon.addPoint(0, textHeight);
+ polygon.addPoint(x2, textHeight);
+ polygon.addPoint(x2, cornersize);
+ polygon.addPoint(x2 - cornersize, 0);
+ polygon.addPoint(0, 0);
+ polygon.setDeltaShadow(symbolContext.getDeltaShadow());
+
+ ug = symbolContext.apply(ug);
+ ug.draw(polygon);
+
+ ug.apply(new UTranslate(x2 - cornersize, 0)).draw(new ULine(0, cornersize));
+ ug.apply(new UTranslate(x2, cornersize)).draw(new ULine(-cornersize, 0));
+ UGraphic ug2 = new UGraphicStencil(ug, this, new UStroke());
+ ug2 = ug2.apply(new UTranslate(getMarginX1() + diffX / 2, getMarginY()));
+
+ getTextBlock().drawU(ug2);
+
+ }
+
+ public double getStartingX(StringBounder stringBounder, double y) {
+ return 0;
+ }
+
+ public double getEndingX(StringBounder stringBounder, double y) {
+ return getTextWidth(stringBounder);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java
new file mode 100644
index 0000000..cac5ef9
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java
@@ -0,0 +1,104 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+final public class ComponentRoseNoteBox extends AbstractTextualComponent {
+
+ private final SymbolContext symbolContext;
+
+ public ComponentRoseNoteBox(SymbolContext symbolContext, FontConfiguration font, Display strings,
+ ISkinSimple spriteContainer) {
+ super(strings, font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, 0, false, null, null);
+ this.symbolContext = symbolContext;
+ }
+
+ @Override
+ final public double getPreferredWidth(StringBounder stringBounder) {
+ final double result = getTextWidth(stringBounder) + 2 * getPaddingX();
+ return result;
+ }
+
+ @Override
+ final public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + 2 * getPaddingY();
+ }
+
+ @Override
+ public double getPaddingX() {
+ return 5;
+ }
+
+ @Override
+ public double getPaddingY() {
+ return 5;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int textHeight = (int) getTextHeight(stringBounder);
+
+ int x2 = (int) getTextWidth(stringBounder);
+ final double diffX = area.getDimensionToUse().getWidth() - getPreferredWidth(stringBounder);
+ if (diffX < 0) {
+ throw new IllegalArgumentException();
+ }
+ if (area.getDimensionToUse().getWidth() > getPreferredWidth(stringBounder)) {
+ x2 = (int) (area.getDimensionToUse().getWidth() - 2 * getPaddingX());
+ }
+
+ ug = symbolContext.apply(ug);
+ final URectangle rect = new URectangle(x2, textHeight);
+ rect.setDeltaShadow(symbolContext.getDeltaShadow());
+ ug.draw(rect);
+ ug = ug.apply(new UStroke());
+
+ getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1() + diffX / 2, getMarginY())));
+
+ }
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java
new file mode 100644
index 0000000..b6505cc
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java
@@ -0,0 +1,115 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+final public class ComponentRoseNoteHexagonal extends AbstractTextualComponent {
+
+ private final int cornersize = 10;
+ private final SymbolContext symbolContext;
+
+
+ public ComponentRoseNoteHexagonal(SymbolContext symbolContext, FontConfiguration font, Display strings,
+ ISkinSimple spriteContainer) {
+ super(strings, font, HorizontalAlignment.LEFT, 12, 12, 4, spriteContainer, 0, false, null, null);
+ this.symbolContext = symbolContext;
+ }
+
+ @Override
+ final public double getPreferredWidth(StringBounder stringBounder) {
+ final double result = getTextWidth(stringBounder) + 2 * getPaddingX();
+ return result;
+ }
+
+ @Override
+ final public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + 2 * getPaddingY();
+ }
+
+ @Override
+ public double getPaddingX() {
+ return 5;
+ }
+
+ @Override
+ public double getPaddingY() {
+ return 5;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final int textHeight = (int) getTextHeight(stringBounder);
+
+ int x2 = (int) getTextWidth(stringBounder);
+ final double diffX = area.getDimensionToUse().getWidth() - getPreferredWidth(stringBounder);
+ if (diffX < 0) {
+ throw new IllegalArgumentException();
+ }
+ if (area.getDimensionToUse().getWidth() > getPreferredWidth(stringBounder)) {
+ x2 = (int) (area.getDimensionToUse().getWidth() - 2 * getPaddingX());
+ }
+
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(cornersize, 0);
+ polygon.addPoint(x2 - cornersize, 0);
+ polygon.addPoint(x2, textHeight / 2);
+ polygon.addPoint(x2 - cornersize, textHeight);
+ polygon.addPoint(cornersize, textHeight);
+ polygon.addPoint(0, textHeight / 2);
+ polygon.addPoint(cornersize, 0);
+
+ ug = symbolContext.apply(ug);
+ polygon.setDeltaShadow(symbolContext.getDeltaShadow());
+ ug.draw(polygon);
+ ug = ug.apply(new UStroke());
+
+ getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1() + diffX / 2, getMarginY())));
+
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java
new file mode 100644
index 0000000..b9cb2dd
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java
@@ -0,0 +1,98 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseParticipant extends AbstractTextualComponent {
+
+ private final HtmlColor back;
+ private final HtmlColor foregroundColor;
+ private final double deltaShadow;
+ private final double roundCorner;
+ private final UStroke stroke;
+
+ public ComponentRoseParticipant(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay,
+ ISkinSimple spriteContainer, double roundCorner, UFont fontForStereotype,
+ HtmlColor htmlColorForStereotype) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, 0, false,
+ fontForStereotype, htmlColorForStereotype);
+ this.back = biColor.getBackColor();
+ this.roundCorner = roundCorner;
+ this.deltaShadow = biColor.getDeltaShadow();
+ this.foregroundColor = biColor.getForeColor();
+ this.stroke = biColor.getStroke();
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ ug = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(foregroundColor));
+ ug = ug.apply(stroke);
+ final URectangle rect = new URectangle(getTextWidth(stringBounder), getTextHeight(stringBounder), roundCorner,
+ roundCorner);
+ rect.setDeltaShadow(deltaShadow);
+ ug.draw(rect);
+ ug = ug.apply(new UStroke());
+ final TextBlock textBlock = getTextBlock();
+ textBlock.drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY())));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + deltaShadow + 1;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return getTextWidth(stringBounder) + deltaShadow;
+ }
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java
new file mode 100644
index 0000000..25cbc61
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java
@@ -0,0 +1,143 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseReference extends AbstractTextualComponent {
+
+ private final HtmlColor background;
+ private final int cornersize = 10;
+ private final TextBlock textHeader;
+ private final double heightFooter = 5;
+ private final double xMargin = 2;
+ private final HorizontalAlignment position;
+ private final SymbolContext symbolContext;
+
+ public ComponentRoseReference(FontConfiguration font, SymbolContext symbolContext, FontConfiguration header,
+ Display stringsToDisplay, HorizontalAlignment position, ISkinSimple spriteContainer, HtmlColor background) {
+ super(stringsToDisplay.subList(1, stringsToDisplay.size()), font, HorizontalAlignment.LEFT, 4, 4, 4,
+ spriteContainer, 0, false, null, null);
+ this.position = position;
+ this.symbolContext = symbolContext;
+ this.background = background;
+
+ this.textHeader = TextBlockUtils.create(stringsToDisplay.subList(0, 1), header, HorizontalAlignment.LEFT,
+ spriteContainer);
+
+ }
+
+ @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))));
+ }
+
+ private double getHeaderHeight(StringBounder stringBounder) {
+ final Dimension2D headerDim = textHeader.calculateDimension(stringBounder);
+ return headerDim.getHeight() + 2 * 1;
+ }
+
+ private double getHeaderWidth(StringBounder stringBounder) {
+ final Dimension2D headerDim = textHeader.calculateDimension(stringBounder);
+ return headerDim.getWidth() + 30 + 15;
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + getHeaderHeight(stringBounder) + heightFooter;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return Math.max(getTextWidth(stringBounder), getHeaderWidth(stringBounder)) + xMargin * 2
+ + symbolContext.getDeltaShadow();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java
new file mode 100644
index 0000000..85058d4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java
@@ -0,0 +1,191 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.skin.ArrowConfiguration;
+import net.sourceforge.plantuml.skin.ArrowDecoration;
+import net.sourceforge.plantuml.skin.ArrowHead;
+import net.sourceforge.plantuml.skin.ArrowPart;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UEllipse;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
+
+ private final double arrowWidth = 45;
+ private final boolean niceArrow;
+
+ public ComponentRoseSelfArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay,
+ ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, double maxMessageSize,
+ boolean niceArrow) {
+ super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, HorizontalAlignment.LEFT,
+ maxMessageSize);
+ this.niceArrow = niceArrow;
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final double textHeight = getTextHeight(stringBounder);
+
+ ug = ug.apply(new UChangeColor(getForegroundColor()));
+ final double xRight = arrowWidth - 3;
+
+ if (getArrowConfiguration().isDotted()) {
+ ug = stroke(ug, 2, 2);
+ }
+
+ double x1 = area.getDeltaX1() < 0 ? area.getDeltaX1() : 0;
+ double x2 = area.getDeltaX1() > 0 ? -area.getDeltaX1() : 0 + 1;
+
+ final double textAndArrowHeight = textHeight + getArrowOnlyHeight(stringBounder);
+ final UEllipse circle = new UEllipse(ComponentRoseArrow.diamCircle, ComponentRoseArrow.diamCircle);
+ if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE) {
+ ug.apply(new UStroke(ComponentRoseArrow.thinCircle))
+ .apply(new UChangeColor(getForegroundColor()))
+ .apply(new UTranslate(x1 + 1 - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle,
+ textHeight - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle / 2))
+ .draw(circle);
+ x1 += ComponentRoseArrow.diamCircle / 2;
+ }
+ if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE) {
+ ug.apply(new UStroke(ComponentRoseArrow.thinCircle))
+ .apply(new UChangeColor(getForegroundColor()))
+ .apply(new UTranslate(x2 - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle,
+ textAndArrowHeight - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle / 2))
+ .draw(circle);
+ x2 += ComponentRoseArrow.diamCircle / 2;
+ }
+ final boolean hasFinalCrossX = getArrowConfiguration().getDressing2().getHead() == ArrowHead.CROSSX;
+ if (hasFinalCrossX) {
+ x2 += 2 * ComponentRoseArrow.spaceCrossX;
+ }
+
+ final double arrowHeight = textAndArrowHeight - textHeight;
+ ug.apply(new UTranslate(x1, textHeight)).draw(new ULine(xRight - x1, 0));
+ ug.apply(new UTranslate(xRight, textHeight)).draw(new ULine(0, arrowHeight));
+ ug.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(xRight - x2, 0));
+
+ if (getArrowConfiguration().isDotted()) {
+ ug = ug.apply(new UStroke());
+ }
+
+ if (getArrowConfiguration().isAsync()) {
+ if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) {
+ ug.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY()));
+ }
+ if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) {
+ ug.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(getArrowDeltaX(), getArrowDeltaY()));
+ }
+ } else if (hasFinalCrossX) {
+ ug = ug.apply(new UStroke(2));
+ ug.apply(
+ new UTranslate(ComponentRoseArrow.spaceCrossX, textHeight - getArrowDeltaX() / 2
+ + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), getArrowDeltaX()));
+ ug.apply(
+ new UTranslate(ComponentRoseArrow.spaceCrossX, textHeight + getArrowDeltaX() / 2
+ + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), -getArrowDeltaX()));
+
+ } else {
+ final UPolygon polygon = getPolygon(textAndArrowHeight);
+ ug.apply(new UChangeBackColor(getForegroundColor())).apply(new UTranslate(x2, 0)).draw(polygon);
+
+ }
+
+ getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), 0)));
+ }
+
+ private UPolygon getPolygon(final double textAndArrowHeight) {
+ final UPolygon polygon = new UPolygon();
+ if (getArrowConfiguration().getPart() == ArrowPart.TOP_PART) {
+ polygon.addPoint(getArrowDeltaX(), textAndArrowHeight - getArrowDeltaY());
+ polygon.addPoint(0, textAndArrowHeight);
+ polygon.addPoint(getArrowDeltaX(), textAndArrowHeight);
+ } else if (getArrowConfiguration().getPart() == ArrowPart.BOTTOM_PART) {
+ polygon.addPoint(getArrowDeltaX(), textAndArrowHeight);
+ polygon.addPoint(0, textAndArrowHeight);
+ polygon.addPoint(getArrowDeltaX(), textAndArrowHeight + getArrowDeltaY());
+ } else {
+ polygon.addPoint(getArrowDeltaX(), textAndArrowHeight - getArrowDeltaY());
+ polygon.addPoint(0, textAndArrowHeight);
+ polygon.addPoint(getArrowDeltaX(), textAndArrowHeight + getArrowDeltaY());
+ if (niceArrow) {
+ polygon.addPoint(getArrowDeltaX() - 4, textAndArrowHeight);
+ }
+ }
+ return polygon;
+ }
+
+ public Point2D getStartPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
+ final int textHeight = (int) getTextHeight(stringBounder);
+ return new Point2D.Double(getPaddingX(), textHeight + getPaddingY());
+ }
+
+ public Point2D getEndPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
+ final int textHeight = (int) getTextHeight(stringBounder);
+ final int textAndArrowHeight = (int) (textHeight + getArrowOnlyHeight(stringBounder));
+ return new Point2D.Double(getPaddingX(), textAndArrowHeight + getPaddingY());
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder) + getArrowDeltaY() + getArrowOnlyHeight(stringBounder) + 2 * getPaddingY();
+ }
+
+ private double getArrowOnlyHeight(StringBounder stringBounder) {
+ return 13;
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return Math.max(getTextWidth(stringBounder), arrowWidth);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java
new file mode 100644
index 0000000..da21aa8
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java
@@ -0,0 +1,73 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.skin.AbstractTextualComponent;
+import net.sourceforge.plantuml.skin.Area;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ComponentRoseTitle extends AbstractTextualComponent {
+
+ private final int outMargin = 5;
+
+ public ComponentRoseTitle(FontConfiguration font, Display stringsToDisplay, ISkinSimple spriteContainer) {
+ super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7,
+ spriteContainer, 0, false, null, null);
+ }
+
+ @Override
+ protected void drawInternalU(UGraphic ug, Area area) {
+ final TextBlock textBlock = getTextBlock();
+ textBlock.drawU(ug.apply(new UTranslate(outMargin + getMarginX1(), getMarginY())));
+ }
+
+ @Override
+ public double getPreferredHeight(StringBounder stringBounder) {
+ return getTextHeight(stringBounder);
+ }
+
+ @Override
+ public double getPreferredWidth(StringBounder stringBounder) {
+ return getTextWidth(stringBounder) + outMargin * 2;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java
new file mode 100644
index 0000000..f8782fe
--- /dev/null
+++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java
@@ -0,0 +1,307 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2014, Arnaud Roques
+ *
+ * Project Info: http://plantuml.sourceforge.net
+ *
+ * This file is part of PlantUML.
+ *
+ * Licensed under The MIT License (Massachusetts Institute of Technology License)
+ *
+ * See http://opensource.org/licenses/MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Author: Arnaud Roques
+ */
+package net.sourceforge.plantuml.skin.rose;
+
+import net.sourceforge.plantuml.AlignParam;
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.LineParam;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.cucadiagram.Stereotype;
+import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.graphic.SymbolContext;
+import net.sourceforge.plantuml.skin.ArrowConfiguration;
+import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.skin.Component;
+import net.sourceforge.plantuml.skin.ComponentType;
+import net.sourceforge.plantuml.skin.Skin;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+
+public class Rose implements Skin {
+
+ final private double paddingX = 5;
+ final private double paddingY = 5;
+
+ public HtmlColor getFontColor(ISkinParam skin, FontParam fontParam) {
+ return skin.getFontHtmlColor(fontParam, null);
+ }
+
+ public HtmlColor getHtmlColor(ISkinParam param, ColorParam color) {
+ return getHtmlColor(param, color, null);
+ }
+
+ public HtmlColor getHtmlColor(ISkinParam param, ColorParam color, Stereotype stereotype) {
+ HtmlColor result = param.getHtmlColor(color, stereotype, false);
+ if (result == null) {
+ result = color.getDefaultValue();
+ if (result == null) {
+ throw new IllegalArgumentException();
+ }
+ }
+ return result;
+ }
+
+ private FontConfiguration getUFont2(ISkinParam param, FontParam fontParam) {
+ final UFont font = param.getFont(fontParam, null, false);
+ final HtmlColor fontColor = getFontColor(param, fontParam);
+ return new FontConfiguration(font, fontColor, param.getHyperlinkColor(), param.useUnderlineForHyperlink());
+ }
+
+ public Component createComponent(ComponentType type, ArrowConfiguration config, ISkinParam param,
+ Display stringsToDisplay) {
+ final UFont fontGrouping = param.getFont(FontParam.SEQUENCE_GROUP, null, false);
+
+ final UFont newFontForStereotype = param.getFont(FontParam.SEQUENCE_STEREOTYPE, null, false);
+
+ if (type.isArrow()) {
+ // if (param.maxMessageSize() > 0) {
+ // final FontConfiguration fc = new FontConfiguration(fontArrow, HtmlColorUtils.BLACK);
+ // stringsToDisplay = DisplayUtils.breakLines(stringsToDisplay, fc, param, param.maxMessageSize());
+ // }
+ final HtmlColor sequenceArrow = config.getColor() == null ? getHtmlColor(param, ColorParam.sequenceArrow)
+ : config.getColor();
+ if (config.getArrowDirection() == ArrowDirection.SELF) {
+ return new ComponentRoseSelfArrow(sequenceArrow, getUFont2(param, FontParam.SEQUENCE_ARROW),
+ stringsToDisplay, config, param, param.maxMessageSize(), param.strictUmlStyle() == false);
+ }
+ final HorizontalAlignment messageHorizontalAlignment = param
+ .getHorizontalAlignment(AlignParam.SEQUENCE_MESSAGE_ALIGN);
+ final HorizontalAlignment textHorizontalAlignment = param
+ .getHorizontalAlignment(AlignParam.SEQUENCE_MESSAGETEXT_ALIGN);
+ return new ComponentRoseArrow(sequenceArrow, getUFont2(param, FontParam.SEQUENCE_ARROW), stringsToDisplay,
+ config, messageHorizontalAlignment, param, textHorizontalAlignment, param.maxMessageSize(),
+ param.strictUmlStyle() == false);
+ }
+ if (type == ComponentType.PARTICIPANT_HEAD) {
+ return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param,
+ FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype,
+ getFontColor(param, FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.PARTICIPANT_TAIL) {
+ return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param,
+ FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype,
+ getFontColor(param, FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.PARTICIPANT_LINE) {
+ final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
+ return new ComponentRoseLine(borderColor, false, getStroke(param, LineParam.sequenceLifeLineBorder, 1));
+ }
+ if (type == ComponentType.CONTINUE_LINE) {
+ final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
+ return new ComponentRoseLine(borderColor, true, getStroke(param, LineParam.sequenceLifeLineBorder, 1.5));
+ }
+ if (type == ComponentType.ACTOR_HEAD) {
+ return new ComponentRoseActor(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.ACTOR_TAIL) {
+ return new ComponentRoseActor(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.BOUNDARY_HEAD) {
+ return new ComponentRoseBoundary(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.BOUNDARY_TAIL) {
+ return new ComponentRoseBoundary(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.CONTROL_HEAD) {
+ return new ComponentRoseControl(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.CONTROL_TAIL) {
+ return new ComponentRoseControl(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.ENTITY_HEAD) {
+ return new ComponentRoseEntity(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.ENTITY_TAIL) {
+ return new ComponentRoseEntity(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.DATABASE_HEAD) {
+ return new ComponentRoseDatabase(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.DATABASE_TAIL) {
+ return new ComponentRoseDatabase(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param,
+ FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param,
+ FontParam.SEQUENCE_STEREOTYPE));
+ }
+ if (type == ComponentType.NOTE) {
+ return new ComponentRoseNote(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param,
+ FontParam.NOTE), stringsToDisplay, paddingX, paddingY, param);
+ }
+ if (type == ComponentType.NOTE_HEXAGONAL) {
+ return new ComponentRoseNoteHexagonal(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param,
+ FontParam.NOTE), stringsToDisplay, param);
+ }
+ if (type == ComponentType.NOTE_BOX) {
+ return new ComponentRoseNoteBox(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param,
+ FontParam.NOTE), stringsToDisplay, param);
+ }
+ if (type == ComponentType.GROUPING_HEADER) {
+ return new ComponentRoseGroupingHeader(param.getBackgroundColor(), getSymbolContext(param,
+ ColorParam.sequenceGroupBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER), fontGrouping,
+ stringsToDisplay, param);
+ }
+ if (type == ComponentType.GROUPING_ELSE) {
+ return new ComponentRoseGroupingElse(getHtmlColor(param, ColorParam.sequenceGroupBorder), getUFont2(param,
+ FontParam.SEQUENCE_GROUP), stringsToDisplay.get(0), param, param.getBackgroundColor());
+ }
+ if (type == ComponentType.GROUPING_SPACE) {
+ return new ComponentRoseGroupingSpace(7);
+ }
+ if (type == ComponentType.ALIVE_BOX_CLOSE_CLOSE) {
+ return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), true, true);
+ }
+ if (type == ComponentType.ALIVE_BOX_CLOSE_OPEN) {
+ return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), true, false);
+ }
+ if (type == ComponentType.ALIVE_BOX_OPEN_CLOSE) {
+ return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), false, true);
+ }
+ if (type == ComponentType.ALIVE_BOX_OPEN_OPEN) {
+ return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), false, false);
+ }
+ if (type == ComponentType.DELAY_LINE) {
+ return new ComponentRoseDelayLine(getHtmlColor(param, ColorParam.sequenceLifeLineBorder));
+ }
+ if (type == ComponentType.DELAY_TEXT) {
+ return new ComponentRoseDelayText(getUFont2(param, FontParam.SEQUENCE_DELAY), stringsToDisplay, param);
+ }
+ if (type == ComponentType.DESTROY) {
+ return new ComponentRoseDestroy(getHtmlColor(param, ColorParam.sequenceLifeLineBorder));
+ }
+ if (type == ComponentType.NEWPAGE) {
+ return new ComponentRoseNewpage(getFontColor(param, FontParam.SEQUENCE_GROUP));
+ }
+ if (type == ComponentType.DIVIDER) {
+ return new ComponentRoseDivider(getUFont2(param, FontParam.SEQUENCE_DIVIDER), getHtmlColor(param,
+ ColorParam.sequenceDividerBackground), stringsToDisplay, param, deltaShadow(param) > 0, getStroke(
+ param, LineParam.sequenceDividerBorder, 2));
+ }
+ if (type == ComponentType.REFERENCE) {
+ return new ComponentRoseReference(getUFont2(param, FontParam.SEQUENCE_REFERENCE), getSymbolContext(param,
+ ColorParam.sequenceReferenceBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER),
+ stringsToDisplay, param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param,
+ getHtmlColor(param, ColorParam.sequenceReferenceBackground));
+ }
+ if (type == ComponentType.TITLE) {
+ return new ComponentRoseTitle(getUFont2(param, FontParam.SEQUENCE_TITLE), stringsToDisplay, param);
+ }
+ if (type == ComponentType.SIGNATURE) {
+ return new ComponentRoseTitle(fontGrouping.toFont2(HtmlColorUtils.BLACK, param.useUnderlineForHyperlink(),
+ param.getHyperlinkColor()), Display.create("This skin was created ", "in April 2009."), param);
+ }
+ if (type == ComponentType.ENGLOBER) {
+ return new ComponentRoseEnglober(getSymbolContext(param, ColorParam.sequenceBoxBorder), stringsToDisplay,
+ getUFont2(param, FontParam.SEQUENCE_BOX), param);
+ }
+
+ return null;
+ }
+
+ private double deltaShadow(ISkinParam param) {
+ return param.shadowing() ? 4.0 : 0;
+ }
+
+ private SymbolContext getSymbolContext(ISkinParam param, ColorParam color) {
+ if (color == ColorParam.participantBorder) {
+ return new SymbolContext(getHtmlColor(param, ColorParam.participantBackground), getHtmlColor(param,
+ ColorParam.participantBorder)).withStroke(
+ getStroke(param, LineParam.sequenceParticipantBorder, 1.5)).withDeltaShadow(deltaShadow(param));
+ }
+ if (color == ColorParam.actorBorder) {
+ return new SymbolContext(getHtmlColor(param, ColorParam.actorBackground), getHtmlColor(param,
+ ColorParam.actorBorder)).withStroke(getStroke(param, LineParam.sequenceActorBorder, 2))
+ .withDeltaShadow(deltaShadow(param));
+ }
+ if (color == ColorParam.sequenceLifeLineBorder) {
+ return new SymbolContext(getHtmlColor(param, ColorParam.sequenceLifeLineBackground), getHtmlColor(param,
+ ColorParam.sequenceLifeLineBorder)).withDeltaShadow(deltaShadow(param));
+ }
+ if (color == ColorParam.noteBorder) {
+ return new SymbolContext(getHtmlColor(param, ColorParam.noteBackground), getHtmlColor(param,
+ ColorParam.noteBorder)).withStroke(getStroke(param, LineParam.noteBorder, 1)).withDeltaShadow(
+ deltaShadow(param));
+ }
+ if (color == ColorParam.sequenceGroupBorder) {
+ return new SymbolContext(getHtmlColor(param, ColorParam.sequenceGroupBackground), getHtmlColor(param,
+ ColorParam.sequenceGroupBorder)).withStroke(getStroke(param, LineParam.sequenceGroupBorder, 2))
+ .withDeltaShadow(deltaShadow(param));
+ }
+ if (color == ColorParam.sequenceBoxBorder) {
+ return new SymbolContext(getHtmlColor(param, ColorParam.sequenceBoxBackground), getHtmlColor(param,
+ ColorParam.sequenceBoxBorder));
+ }
+ if (color == ColorParam.sequenceReferenceBorder) {
+ return new SymbolContext(getHtmlColor(param, ColorParam.sequenceReferenceHeaderBackground), getHtmlColor(
+ param, ColorParam.sequenceReferenceBorder)).withStroke(
+ getStroke(param, LineParam.sequenceReferenceBorder, 2)).withDeltaShadow(deltaShadow(param));
+ }
+ throw new IllegalArgumentException();
+ }
+
+ static public UStroke getStroke(ISkinParam param, LineParam lineParam, double defaultValue) {
+ final UStroke result = param.getThickness(lineParam, null);
+ if (result == null) {
+ return new UStroke(defaultValue);
+ }
+ return result;
+ }
+
+ public Object getProtocolVersion() {
+ return 1;
+ }
+
+}