summaryrefslogtreecommitdiff
path: root/src/net/sourceforge/plantuml/activitydiagram3
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-07-21 14:52:03 +0200
committerAndrew Shadura <andrew@shadura.me>2015-07-21 14:52:03 +0200
commit26b872bb194ec7622997914bba53309a94b64d20 (patch)
treea79b966bf55dd61702b900b8ba40be4d2b3403db /src/net/sourceforge/plantuml/activitydiagram3
Imported Upstream version 8024
Diffstat (limited to 'src/net/sourceforge/plantuml/activitydiagram3')
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java450
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java143
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/Branch.java124
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/Instruction.java55
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java110
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java73
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java103
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java166
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java73
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java158
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java90
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java112
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java100
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java118
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java69
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.java72
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java133
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java87
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java63
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java86
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java65
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java103
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java78
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java99
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java67
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java77
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java67
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java58
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java65
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java64
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java63
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java62
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java65
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java65
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java61
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java78
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2Multilines.java95
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java77
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java69
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java62
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java66
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java68
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java65
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java76
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java83
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java74
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java68
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java97
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java64
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java63
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java62
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java67
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java67
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandStopLegacy1.java67
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java71
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java71
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java75
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java63
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java60
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java72
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java91
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java176
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java225
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java48
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java63
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java44
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java120
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java129
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java58
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java139
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java95
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java83
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java174
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java144
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java58
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java56
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java94
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java72
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java50
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java87
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java66
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java101
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java71
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.java83
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java60
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java59
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java61
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java415
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java52
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java47
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java95
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java358
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java63
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java109
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java103
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java98
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java66
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java58
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java116
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java193
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java60
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java416
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java79
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java77
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java75
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java121
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java168
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIf.java595
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java319
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong.java516
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java511
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java369
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java115
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java397
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java187
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java66
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java99
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java174
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java92
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java156
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java90
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java106
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java106
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java53
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java53
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java61
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java145
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java147
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java161
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java161
130 files changed, 15179 insertions, 0 deletions
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java
new file mode 100644
index 0000000..cbcd1ec
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java
@@ -0,0 +1,450 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.awt.geom.Dimension2D;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.FileFormatOption;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.Scale;
+import net.sourceforge.plantuml.UmlDiagram;
+import net.sourceforge.plantuml.UmlDiagramType;
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
+import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.core.DiagramDescription;
+import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
+import net.sourceforge.plantuml.core.ImageData;
+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.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockCompressed;
+import net.sourceforge.plantuml.graphic.TextBlockRecentred;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.svek.DecorateEntityImage;
+import net.sourceforge.plantuml.svek.DecorateTextBlock;
+import net.sourceforge.plantuml.ugraphic.ImageBuilder;
+import net.sourceforge.plantuml.ugraphic.UFont;
+
+public class ActivityDiagram3 extends UmlDiagram {
+
+ enum SwimlaneStrategy {
+ SWIMLANE_FORBIDDEN, SWIMLANE_ALLOWED;
+ }
+
+ private SwimlaneStrategy swimlaneStrategy;
+
+ private final Swimlanes swinlanes = new Swimlanes(getSkinParam());
+
+ private void manageSwimlaneStrategy() {
+ if (swimlaneStrategy == null) {
+ swimlaneStrategy = SwimlaneStrategy.SWIMLANE_FORBIDDEN;
+ }
+ }
+
+ public CommandExecutionResult swimlane(String name, HtmlColor color, Display label) {
+ if (swimlaneStrategy == null) {
+ swimlaneStrategy = SwimlaneStrategy.SWIMLANE_ALLOWED;
+ }
+ if (swimlaneStrategy == SwimlaneStrategy.SWIMLANE_FORBIDDEN) {
+ return CommandExecutionResult.error("This swimlane must be defined at the start of the diagram.");
+ }
+
+ swinlanes.swimlane(name, color, label);
+ return CommandExecutionResult.ok();
+ }
+
+ private void setCurrent(Instruction ins) {
+ swinlanes.setCurrent(ins);
+ }
+
+ private Instruction current() {
+ return swinlanes.getCurrent();
+ }
+
+ private LinkRendering nextLinkRenderer() {
+ return swinlanes.nextLinkRenderer();
+ }
+
+ public void addActivity(Display activity, HtmlColor color, BoxStyle style, Url url) {
+ manageSwimlaneStrategy();
+ final InstructionSimple ins = new InstructionSimple(activity, color, nextLinkRenderer(),
+ swinlanes.getCurrentSwimlane(), style, url);
+ current().add(ins);
+ setNextLinkRendererInternal(null);
+ manageHasUrl(activity);
+ if (url != null) {
+ hasUrl = true;
+ }
+ }
+
+ public CommandExecutionResult addGoto(String name) {
+ final InstructionGoto ins = new InstructionGoto(swinlanes.getCurrentSwimlane(), name);
+ current().add(ins);
+ setNextLinkRendererInternal(null);
+ return CommandExecutionResult.ok();
+ }
+
+ public CommandExecutionResult addLabel(String name) {
+ final InstructionLabel ins = new InstructionLabel(swinlanes.getCurrentSwimlane(), name);
+ current().add(ins);
+ setNextLinkRendererInternal(null);
+ return CommandExecutionResult.ok();
+ }
+
+ public void start() {
+ manageSwimlaneStrategy();
+ current().add(new InstructionStart(swinlanes.getCurrentSwimlane()));
+ }
+
+ public void stop() {
+ manageSwimlaneStrategy();
+ current().add(new InstructionStop(swinlanes.getCurrentSwimlane(), nextLinkRenderer()));
+ }
+
+ public DiagramDescription getDescription() {
+ return new DiagramDescriptionImpl("activity3", getClass());
+ }
+
+ @Override
+ public UmlDiagramType getUmlDiagramType() {
+ return UmlDiagramType.ACTIVITY;
+ }
+
+ private TextBlock addLegend(TextBlock original) {
+ final Display legend = getLegend();
+ if (legend == null) {
+ return original;
+ }
+ final TextBlock text = EntityImageLegend.create(legend, getSkinParam());
+
+ return DecorateEntityImage.add(original, text, getLegendAlignment(), getLegendVerticalAlignment());
+ }
+
+ @Override
+ protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
+ throws IOException {
+ // BUG42
+ // COMPRESSION
+ // TextBlock result = swinlanes;
+ TextBlock result = new TextBlockCompressed(swinlanes);
+ result = new TextBlockRecentred(result);
+ result = addLegend(result);
+ result = addTitle(result);
+ result = addHeaderAndFooter(result);
+ final ISkinParam skinParam = getSkinParam();
+ final Dimension2D dim = TextBlockUtils.getMinMax(result).getDimension();
+ final double margin = 10;
+ final double dpiFactor = getDpiFactor(fileFormatOption, Dimension2DDouble.delta(dim, 2 * margin, 0));
+
+ final ImageBuilder imageBuilder = new ImageBuilder(skinParam.getColorMapper(), dpiFactor, getSkinParam()
+ .getBackgroundColor(), fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(),
+ margin, margin, getAnimation(), getSkinParam().handwritten());
+ imageBuilder.addUDrawable(result);
+
+ return imageBuilder.writeImageTOBEMOVED(fileFormatOption.getFileFormat(), os);
+
+ }
+
+ private final double getDpiFactor(FileFormatOption fileFormatOption, final Dimension2D dim) {
+ final double dpiFactor;
+ final Scale scale = getScale();
+ if (scale == null) {
+ dpiFactor = getDpiFactor(fileFormatOption);
+ } else {
+ dpiFactor = scale.getScale(dim.getWidth(), dim.getHeight());
+ }
+ return dpiFactor;
+ }
+
+ private TextBlock addTitle(TextBlock original) {
+ final Display title = getTitle();
+ if (title == null) {
+ return original;
+ }
+ final TextBlock text = TextBlockUtils.create(title, new FontConfiguration(getFont(FontParam.TITLE),
+ getFontColor(FontParam.TITLE, null), getSkinParam().getHyperlinkColor(), getSkinParam()
+ .useUnderlineForHyperlink()), HorizontalAlignment.CENTER, getSkinParam());
+
+ return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER);
+ }
+
+ private TextBlock addHeaderAndFooter(TextBlock original) {
+ final Display footer = getFooter();
+ final Display header = getHeader();
+ if (footer == null && header == null) {
+ return original;
+ }
+ final TextBlock textFooter = footer == null ? null : TextBlockUtils.create(footer, new FontConfiguration(
+ getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(),
+ getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam());
+ final TextBlock textHeader = header == null ? null : TextBlockUtils.create(header, new FontConfiguration(
+ getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(),
+ getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam());
+
+ return new DecorateTextBlock(original, textHeader, getHeaderAlignment(), textFooter, getFooterAlignment());
+ }
+
+ private final UFont getFont(FontParam fontParam) {
+ final ISkinParam skinParam = getSkinParam();
+ return skinParam.getFont(fontParam, null, false);
+ }
+
+ private final HtmlColor getFontColor(FontParam fontParam, Stereotype stereotype2) {
+ final ISkinParam skinParam = getSkinParam();
+ return skinParam.getFontHtmlColor(fontParam, stereotype2);
+ }
+
+ public void fork() {
+ final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer());
+ current().add(instructionFork);
+ setNextLinkRendererInternal(null);
+ setCurrent(instructionFork);
+ }
+
+ public CommandExecutionResult forkAgain() {
+ if (current() instanceof InstructionFork) {
+ ((InstructionFork) current()).forkAgain();
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find fork");
+ }
+
+ public CommandExecutionResult endFork() {
+ if (current() instanceof InstructionFork) {
+ setCurrent(((InstructionFork) current()).getParent());
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find fork");
+ }
+
+ public void split() {
+ final InstructionSplit instructionSplit = new InstructionSplit(current(), nextLinkRenderer());
+ setNextLinkRendererInternal(null);
+ current().add(instructionSplit);
+ setCurrent(instructionSplit);
+ }
+
+ public CommandExecutionResult splitAgain() {
+ if (current() instanceof InstructionSplit) {
+ ((InstructionSplit) current()).splitAgain(nextLinkRenderer());
+ setNextLinkRendererInternal(null);
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find split");
+ }
+
+ public CommandExecutionResult endSplit() {
+ if (current() instanceof InstructionSplit) {
+ ((InstructionSplit) current()).endSplit(nextLinkRenderer());
+ setNextLinkRendererInternal(null);
+ setCurrent(((InstructionSplit) current()).getParent());
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find split");
+ }
+
+ public void startIf(Display test, Display whenThen, HtmlColor color) {
+ manageSwimlaneStrategy();
+ final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test,
+ whenThen, nextLinkRenderer(), color, getSkinParam());
+ current().add(instructionIf);
+ setNextLinkRendererInternal(null);
+ setCurrent(instructionIf);
+ }
+
+ public CommandExecutionResult elseIf(Display test, Display whenThen, HtmlColor color) {
+ if (current() instanceof InstructionIf) {
+ ((InstructionIf) current()).elseIf(test, whenThen, nextLinkRenderer(), color);
+ setNextLinkRendererInternal(null);
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find if");
+ }
+
+ public CommandExecutionResult else2(Display whenElse) {
+ if (current() instanceof InstructionIf) {
+ final boolean result = ((InstructionIf) current()).swithToElse2(whenElse, nextLinkRenderer());
+ if (result == false) {
+ return CommandExecutionResult.error("Cannot find if");
+ }
+ setNextLinkRendererInternal(null);
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find if");
+ }
+
+ public CommandExecutionResult endif() {
+ if (current() instanceof InstructionIf) {
+ ((InstructionIf) current()).endif(nextLinkRenderer());
+ setNextLinkRendererInternal(null);
+ setCurrent(((InstructionIf) current()).getParent());
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find if");
+ }
+
+ public void startRepeat(HtmlColor color) {
+ manageSwimlaneStrategy();
+ final InstructionRepeat instructionRepeat = new InstructionRepeat(swinlanes.getCurrentSwimlane(), current(),
+ nextLinkRenderer(), color);
+ current().add(instructionRepeat);
+ setCurrent(instructionRepeat);
+ setNextLinkRendererInternal(null);
+
+ }
+
+ public CommandExecutionResult repeatWhile(Display label, Display yes, Display out, Display linkLabel,
+ HtmlColor linkColor) {
+ manageSwimlaneStrategy();
+ if (current() instanceof InstructionRepeat) {
+ final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
+ final LinkRendering back = new LinkRendering(linkColor);
+ back.setDisplay(linkLabel);
+ instructionRepeat.setTest(label, yes, out, nextLinkRenderer(), back);
+ setCurrent(instructionRepeat.getParent());
+ this.setNextLinkRendererInternal(null);
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find repeat");
+
+ }
+
+ public void doWhile(Display test, Display yes, HtmlColor color) {
+ manageSwimlaneStrategy();
+ final InstructionWhile instructionWhile = new InstructionWhile(swinlanes.getCurrentSwimlane(), current(), test,
+ nextLinkRenderer(), yes, color, getSkinParam());
+ current().add(instructionWhile);
+ setCurrent(instructionWhile);
+ }
+
+ public CommandExecutionResult endwhile(Display out) {
+ if (current() instanceof InstructionWhile) {
+ ((InstructionWhile) current()).endwhile(nextLinkRenderer(), out);
+ setNextLinkRendererInternal(null);
+ setCurrent(((InstructionWhile) current()).getParent());
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find while");
+ }
+
+ final public CommandExecutionResult kill() {
+ if (current().kill() == false) {
+ return CommandExecutionResult.error("kill cannot be used here");
+ }
+ return CommandExecutionResult.ok();
+ }
+
+ public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor) {
+ manageSwimlaneStrategy();
+ final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor);
+ current().add(instructionGroup);
+ setCurrent(instructionGroup);
+ }
+
+ public CommandExecutionResult endGroup() {
+ if (current() instanceof InstructionGroup) {
+ setCurrent(((InstructionGroup) current()).getParent());
+ return CommandExecutionResult.ok();
+ }
+ return CommandExecutionResult.error("Cannot find group");
+ }
+
+ private void setNextLinkRendererInternal(LinkRendering link) {
+ swinlanes.setNextLinkRenderer(link);
+ }
+
+ private void setNextLink(LinkRendering linkRenderer) {
+ if (current() instanceof InstructionList) {
+ final Instruction last = ((InstructionList) current()).getLast();
+ if (last instanceof InstructionWhile) {
+ ((InstructionWhile) last).afterEndwhile(linkRenderer);
+ }
+ }
+ this.setNextLinkRendererInternal(linkRenderer);
+ }
+
+ private final Rose rose = new Rose();
+
+ public void setLabelNextArrow(Display label) {
+ if (nextLinkRenderer() == null) {
+ final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+ this.setNextLink(new LinkRendering(arrowColor));
+ }
+ nextLinkRenderer().setDisplay(label);
+ }
+
+ public void setColorNextArrow(HtmlColor color) {
+ if (color == null) {
+ return;
+ }
+ final LinkRendering link = new LinkRendering(color);
+ setNextLink(link);
+ }
+
+ public CommandExecutionResult addNote(Display note, NotePosition position) {
+ current().addNote(note, position);
+ manageHasUrl(note);
+ return CommandExecutionResult.ok();
+ }
+
+ private boolean hasUrl = false;
+
+ private void manageHasUrl(Display display) {
+ if (display.hasUrl()) {
+ hasUrl = true;
+ }
+ }
+
+ @Override
+ public boolean hasUrl() {
+ return hasUrl;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java
new file mode 100644
index 0000000..38c57b0
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.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.activitydiagram3;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.plantuml.activitydiagram3.command.CommandActivity3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLegacy1;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLong3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandArrow3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandArrowLong3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandElse3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandElseIf2;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandElseLegacy1;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandEndPartition3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandEndif3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandFork3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandForkAgain3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandForkEnd3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandGoto;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandGroup3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandGroupEnd3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandIf2;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandIf2Multilines;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandIf4;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandIfLegacy1;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandKill3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandLabel;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandLink3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandNote3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandNoteLong3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandPartition3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandRepeat3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandRepeatWhile3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandSplit3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandSplitAgain3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandSplitEnd3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandStart3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandStop3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandStopLegacy1;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane2;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandWhile3;
+import net.sourceforge.plantuml.activitydiagram3.command.CommandWhileEnd3;
+import net.sourceforge.plantuml.command.Command;
+import net.sourceforge.plantuml.command.CommandFootboxIgnored;
+import net.sourceforge.plantuml.command.UmlDiagramFactory;
+
+public class ActivityDiagramFactory3 extends UmlDiagramFactory {
+
+ @Override
+ protected List<Command> createCommands() {
+
+ final List<Command> cmds = new ArrayList<Command>();
+ cmds.add(new CommandFootboxIgnored());
+
+ addCommonCommands(cmds);
+ cmds.add(new CommandSwimlane());
+ cmds.add(new CommandSwimlane2());
+ cmds.add(new CommandPartition3());
+ cmds.add(new CommandEndPartition3());
+ cmds.add(new CommandGroup3());
+ cmds.add(new CommandGroupEnd3());
+ cmds.add(new CommandArrow3());
+ cmds.add(new CommandArrowLong3());
+ cmds.add(new CommandActivity3());
+ cmds.add(new CommandIf4());
+ cmds.add(new CommandIf2());
+ cmds.add(new CommandIf2Multilines());
+ cmds.add(new CommandIfLegacy1());
+ cmds.add(new CommandElseIf2());
+ cmds.add(new CommandElse3());
+ cmds.add(new CommandElseLegacy1());
+ cmds.add(new CommandEndif3());
+ cmds.add(new CommandRepeat3());
+ cmds.add(new CommandRepeatWhile3());
+ cmds.add(new CommandWhile3());
+ cmds.add(new CommandWhileEnd3());
+ cmds.add(new CommandFork3());
+ cmds.add(new CommandForkAgain3());
+ cmds.add(new CommandForkEnd3());
+ cmds.add(new CommandSplit3());
+ cmds.add(new CommandSplitAgain3());
+ cmds.add(new CommandSplitEnd3());
+// cmds.add(new CommandGroup3());
+// cmds.add(new CommandGroupEnd3());
+ cmds.add(new CommandStart3());
+ cmds.add(new CommandStop3());
+ cmds.add(new CommandStopLegacy1());
+ cmds.add(new CommandKill3());
+ cmds.add(new CommandLink3());
+ cmds.add(new CommandNote3());
+ cmds.add(new CommandNoteLong3());
+
+ cmds.add(new CommandActivityLong3());
+ cmds.add(new CommandActivityLegacy1());
+
+ cmds.add(new CommandLabel());
+ cmds.add(new CommandGoto());
+
+
+ return cmds;
+ }
+
+ @Override
+ public ActivityDiagram3 createEmptyDiagram() {
+ return new ActivityDiagram3();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java
new file mode 100644
index 0000000..ebf5cc4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java
@@ -0,0 +1,124 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.Collection;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class Branch {
+
+ private final InstructionList list;
+ private final Display labelTest;
+ private final Display labelPositive;
+ private final HtmlColor color;
+
+ private LinkRendering inlinkRendering;
+
+ private Ftile ftile;
+
+ public boolean isOnlySingleStop() {
+ return list.isOnlySingleStop();
+ }
+
+ public Branch(Swimlane swimlane, Display labelPositive, Display labelTest, HtmlColor color) {
+ this.list = new InstructionList(swimlane);
+ this.labelTest = labelTest;
+ this.labelPositive = labelPositive;
+ this.color = color;
+ }
+
+ public void add(Instruction ins) {
+ list.add(ins);
+ }
+
+ public boolean kill() {
+ return list.kill();
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ list.addNote(note, position);
+ }
+
+ public final void setInlinkRendering(LinkRendering inlinkRendering) {
+ this.inlinkRendering = inlinkRendering;
+ }
+
+ public void updateFtile(FtileFactory factory) {
+ this.ftile = factory.decorateOut(list.createFtile(factory), inlinkRendering);
+ }
+
+ public Collection<? extends Swimlane> getSwimlanes() {
+ return list.getSwimlanes();
+ }
+
+ public final Display getLabelPositive() {
+ final LinkRendering in = ftile.getInLinkRendering();
+ if (in != null && in.getDisplay() != null) {
+ return in.getDisplay();
+ }
+ return labelPositive;
+ }
+
+ public final Display getLabelTest() {
+ return labelTest;
+ }
+
+ public final HtmlColor getInlinkRenderingColor() {
+ return inlinkRendering == null ? null : inlinkRendering.getColor();
+ }
+
+ public final Ftile getFtile() {
+ return ftile;
+ }
+
+ public boolean shadowing() {
+ return ftile.shadowing();
+ }
+
+ public final HtmlColor getColor() {
+ return color;
+ }
+
+ public boolean isEmpty() {
+ return list.isEmpty();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java b/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java
new file mode 100644
index 0000000..3b71f5c
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java
@@ -0,0 +1,55 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public interface Instruction extends Swimable {
+
+ public Ftile createFtile(FtileFactory factory);
+
+ public void add(Instruction other);
+
+ public boolean kill();
+
+ public LinkRendering getInLinkRendering();
+
+ public void addNote(Display note, NotePosition position);
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java
new file mode 100644
index 0000000..6c44474
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java
@@ -0,0 +1,110 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionFork implements Instruction {
+
+ private final List<InstructionList> forks = new ArrayList<InstructionList>();
+ private final Instruction parent;
+ private final LinkRendering inlinkRendering;
+
+ public InstructionFork(Instruction parent, LinkRendering inlinkRendering) {
+ this.parent = parent;
+ this.inlinkRendering = inlinkRendering;
+ this.forks.add(new InstructionList());
+ }
+
+ private InstructionList getLast() {
+ return forks.get(forks.size() - 1);
+ }
+
+
+ public void add(Instruction ins) {
+ getLast().add(ins);
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ final List<Ftile> all = new ArrayList<Ftile>();
+ for (InstructionList list : forks) {
+ all.add(list.createFtile(factory));
+ }
+ return factory.createFork(getSwimlaneIn(), all);
+ }
+
+ public Instruction getParent() {
+ return parent;
+ }
+
+ public void forkAgain() {
+ this.forks.add(new InstructionList());
+ }
+
+ final public boolean kill() {
+ return getLast().kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return inlinkRendering;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ getLast().addNote(note, position);
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return InstructionList.getSwimlanes2(forks);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ // return parent.getSwimlaneOut();
+ return forks.get(0).getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getLast().getSwimlaneOut();
+ }
+
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java
new file mode 100644
index 0000000..5858a99
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.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.activitydiagram3;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGoto;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionGoto extends MonoSwimable implements Instruction {
+
+ private final String name;
+
+ public InstructionGoto(Swimlane swimlane, String name) {
+ super(swimlane);
+ this.name = name;
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ return new FtileGoto(factory.shadowing(), getSwimlaneIn(), name);
+ }
+
+ public void add(Instruction other) {
+ throw new UnsupportedOperationException();
+ }
+
+ final public boolean kill() {
+ return false;
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return null;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java
new file mode 100644
index 0000000..844b2c1
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java
@@ -0,0 +1,103 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionGroup implements Instruction {
+
+ private final InstructionList list = new InstructionList();
+ private final Instruction parent;
+ private final HtmlColor backColor;
+ private final HtmlColor titleColor;
+
+ private final Display test;
+ private Display headerNote;
+
+ public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor) {
+ this.parent = parent;
+ this.test = test;
+ this.backColor = backColor;
+ this.titleColor = titleColor;
+ }
+
+ public void add(Instruction ins) {
+ list.add(ins);
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ return factory.createGroup(list.createFtile(factory), test, backColor, titleColor, headerNote);
+ }
+
+ public Instruction getParent() {
+ return parent;
+ }
+
+ final public boolean kill() {
+ return list.kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return null;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ if (list.isEmpty()) {
+ this.headerNote = note;
+ return;
+ }
+ list.addNote(note, position);
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return list.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return list.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return list.getSwimlaneOut();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
new file mode 100644
index 0000000..d2fb46a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
@@ -0,0 +1,166 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionIf implements Instruction {
+
+ private final List<Branch> thens = new ArrayList<Branch>();
+ private Branch elseBranch;
+ private final ISkinParam skinParam;
+
+ private final Instruction parent;
+
+ private Branch current;
+ private final LinkRendering inlinkRendering;
+
+ private final Swimlane swimlane;
+
+ public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, Display whenThen,
+ LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam) {
+ this.parent = parent;
+ this.skinParam = skinParam;
+
+ this.inlinkRendering = inlinkRendering;
+ this.swimlane = swimlane;
+ this.thens.add(new Branch(swimlane, whenThen, labelTest, color));
+ this.current = this.thens.get(0);
+ }
+
+ public void add(Instruction ins) {
+ current.add(ins);
+ }
+
+ private Display note;
+ private NotePosition position;
+
+ public Ftile createFtile(FtileFactory factory) {
+ for (Branch branch : thens) {
+ branch.updateFtile(factory);
+ }
+ if (elseBranch == null) {
+ this.elseBranch = new Branch(swimlane, null, null, null);
+ }
+ elseBranch.updateFtile(factory);
+ Ftile result = factory.createIf(swimlane, thens, elseBranch);
+ if (note != null) {
+ result = new FtileWithNoteOpale(result, note, position, skinParam, false);
+ }
+ return result;
+ }
+
+ public Instruction getParent() {
+ return parent;
+ }
+
+ public boolean swithToElse2(Display whenElse, LinkRendering nextLinkRenderer) {
+ if (elseBranch != null) {
+ return false;
+ }
+ this.current.setInlinkRendering(nextLinkRenderer);
+ this.elseBranch = new Branch(swimlane, whenElse, null, null);
+ this.current = elseBranch;
+ return true;
+ }
+
+ public void elseIf(Display test, Display whenThen, LinkRendering nextLinkRenderer, HtmlColor color) {
+ if (elseBranch != null) {
+ throw new IllegalStateException();
+ }
+ this.current.setInlinkRendering(nextLinkRenderer);
+ this.current = new Branch(swimlane, whenThen, test, color);
+ this.thens.add(current);
+
+ }
+
+ public void endif(LinkRendering nextLinkRenderer) {
+ if (elseBranch == null) {
+ this.elseBranch = new Branch(swimlane, null, null, null);
+ }
+ this.current.setInlinkRendering(nextLinkRenderer);
+ }
+
+ final public boolean kill() {
+ return current.kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return inlinkRendering;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ if (current.isEmpty()) {
+ this.note = note;
+ this.position = position;
+ } else {
+ current.addNote(note, position);
+ }
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ if (swimlane != null) {
+ result.add(swimlane);
+ }
+ for (Branch branch : thens) {
+ result.addAll(branch.getSwimlanes());
+ }
+ result.addAll(elseBranch.getSwimlanes());
+ return Collections.unmodifiableSet(result);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java
new file mode 100644
index 0000000..4c9e3e5
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.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.activitydiagram3;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileLabel;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionLabel extends MonoSwimable implements Instruction {
+
+ private final String name;
+
+ public InstructionLabel(Swimlane swimlane, String name) {
+ super(swimlane);
+ this.name = name;
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ return new FtileLabel(factory.shadowing(), getSwimlaneIn(), name);
+ }
+
+ public void add(Instruction other) {
+ throw new UnsupportedOperationException();
+ }
+
+ final public boolean kill() {
+ return false;
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return null;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java
new file mode 100644
index 0000000..ef77acf
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java
@@ -0,0 +1,158 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionList implements Instruction {
+
+ private final List<Instruction> all = new ArrayList<Instruction>();
+ private final Swimlane defaultSwimlane;
+
+ public boolean isOnlySingleStop() {
+ if (all.size() == 1) {
+ final Instruction last = getLast();
+ return last instanceof InstructionStop;
+ }
+ return false;
+ }
+
+ public InstructionList() {
+ this(null);
+ }
+
+ public boolean isEmpty() {
+ return all.isEmpty();
+ }
+
+ public InstructionList(Swimlane defaultSwimlane) {
+ this.defaultSwimlane = defaultSwimlane;
+ }
+
+ public void add(Instruction ins) {
+ all.add(ins);
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ if (all.size() == 0) {
+ return new FtileEmpty(factory.shadowing(), defaultSwimlane);
+ }
+ Ftile result = null;
+ for (Instruction ins : all) {
+ Ftile cur = ins.createFtile(factory);
+ if (ins.getInLinkRendering() != null) {
+ cur = factory.decorateIn(cur, ins.getInLinkRendering());
+ }
+ if (result == null) {
+ result = cur;
+ } else {
+ result = factory.assembly(result, cur);
+ }
+ }
+ if (outlinkRendering != null) {
+ result = factory.decorateOut(result, outlinkRendering);
+ }
+ // if (killed) {
+ // result = new FtileKilled(result);
+ // }
+ return result;
+ }
+
+ final public boolean kill() {
+ if (all.size() == 0) {
+ return false;
+ }
+ return getLast().kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return all.iterator().next().getInLinkRendering();
+ }
+
+ public Instruction getLast() {
+ if (all.size() == 0) {
+ return null;
+ }
+ return all.get(all.size() - 1);
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ getLast().addNote(note, position);
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return getSwimlanes2(all);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ if (getSwimlanes().size() == 0) {
+ return null;
+ }
+ return all.get(0).getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ if (getSwimlanes().size() == 0) {
+ return null;
+ }
+ return getLast().getSwimlaneOut();
+ }
+
+ public static Set<Swimlane> getSwimlanes2(List<? extends Instruction> list) {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ for (Instruction ins : list) {
+ result.addAll(ins.getSwimlanes());
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+ private LinkRendering outlinkRendering;
+
+ public void setOutRendering(LinkRendering outlinkRendering) {
+ this.outlinkRendering = outlinkRendering;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java
new file mode 100644
index 0000000..8a35bd4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java
@@ -0,0 +1,90 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionPartition implements Instruction {
+
+ private final InstructionList list = new InstructionList();
+ private final Instruction parent;
+
+ public InstructionPartition(Instruction parent, String partitionTitle) {
+ this.parent = parent;
+ }
+
+ public Instruction getParent() {
+ return parent;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return list.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return list.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return list.getSwimlaneOut();
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ return list.createFtile(factory);
+ }
+
+ public void add(Instruction other) {
+ list.add(other);
+ }
+
+ public boolean kill() {
+ return list.kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return list.getInLinkRendering();
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java
new file mode 100644
index 0000000..97ee9f4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java
@@ -0,0 +1,112 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionRepeat implements Instruction {
+
+ private final InstructionList repeatList = new InstructionList();
+ private final Instruction parent;
+ private final LinkRendering nextLinkRenderer;
+ private final Swimlane swimlane;
+ private final HtmlColor color;
+
+ private Display test;
+ private Display yes;
+ private Display out;
+ private LinkRendering endRepeatLinkRendering;
+ private LinkRendering backRepeatLinkRendering;
+
+ public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HtmlColor color) {
+ this.parent = parent;
+ this.swimlane = swimlane;
+ this.nextLinkRenderer = nextLinkRenderer;
+ this.color = color;
+ }
+
+ public void add(Instruction ins) {
+ repeatList.add(ins);
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ return factory.repeat(swimlane, factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering),
+ test, yes, out, color, backRepeatLinkRendering);
+ }
+
+ public Instruction getParent() {
+ return parent;
+ }
+
+ public void setTest(Display test, Display yes, Display out, LinkRendering endRepeatLinkRendering, LinkRendering backRepeatLinkRendering) {
+ this.test = test;
+ this.yes = yes;
+ this.out = out;
+ this.endRepeatLinkRendering = endRepeatLinkRendering;
+ this.backRepeatLinkRendering = backRepeatLinkRendering;
+ }
+
+ final public boolean kill() {
+ return repeatList.kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return nextLinkRenderer;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ repeatList.addNote(note, position);
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return repeatList.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return parent.getSwimlaneOut();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return repeatList.getSwimlaneOut();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java
new file mode 100644
index 0000000..d08e2df
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.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.activitydiagram3;
+
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionSimple extends MonoSwimable implements Instruction {
+
+ private boolean killed = false;
+ private final Display label;
+ private final HtmlColor color;
+ private final LinkRendering inlinkRendering;
+ private Display note;
+ private NotePosition notePosition;
+ private final BoxStyle style;
+ private final Url url;
+
+ public InstructionSimple(Display label, HtmlColor color, LinkRendering inlinkRendering, Swimlane swimlane,
+ BoxStyle style, Url url) {
+ super(swimlane);
+ this.url = url;
+ this.style = style;
+ this.label = label;
+ this.color = color;
+ this.inlinkRendering = inlinkRendering;
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ Ftile result = factory.activity(label, color, getSwimlaneIn(), style);
+ if (url != null) {
+ result = factory.addUrl(result, url);
+ }
+ if (note != null) {
+ result = factory.addNote(result, note, notePosition);
+ }
+ if (killed) {
+ return new FtileKilled(result);
+ }
+ return result;
+ }
+
+ public void add(Instruction other) {
+ throw new UnsupportedOperationException();
+ }
+
+ final public boolean kill() {
+ this.killed = true;
+ return true;
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return inlinkRendering;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ this.note = note;
+ this.notePosition = position;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java
new file mode 100644
index 0000000..f2c0eb2
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java
@@ -0,0 +1,118 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionSplit implements Instruction {
+
+ private final List<InstructionList> splits = new ArrayList<InstructionList>();
+ private final Instruction parent;
+ private final LinkRendering inlinkRendering;
+
+ public InstructionSplit(Instruction parent, LinkRendering inlinkRendering) {
+ this.parent = parent;
+ this.splits.add(new InstructionList());
+ this.inlinkRendering = inlinkRendering;
+ }
+
+ private InstructionList getLast() {
+ return splits.get(splits.size() - 1);
+ }
+
+ public void add(Instruction ins) {
+ getLast().add(ins);
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ final List<Ftile> all = new ArrayList<Ftile>();
+ for (InstructionList list : splits) {
+ all.add(list.createFtile(factory));
+ }
+ return factory.createSplit(all);
+ }
+
+ public Instruction getParent() {
+ return parent;
+ }
+
+ public void splitAgain(LinkRendering inlinkRendering) {
+ if (inlinkRendering != null) {
+ getLast().setOutRendering(inlinkRendering);
+ }
+ final InstructionList list = new InstructionList();
+ this.splits.add(list);
+ }
+
+ public void endSplit(LinkRendering inlinkRendering) {
+ if (inlinkRendering != null) {
+ getLast().setOutRendering(inlinkRendering);
+ }
+
+ }
+
+ final public boolean kill() {
+ return getLast().kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return inlinkRendering;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ getLast().addNote(note, position);
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return InstructionList.getSwimlanes2(splits);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return parent.getSwimlaneOut();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getLast().getSwimlaneOut();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java
new file mode 100644
index 0000000..b75e654
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java
@@ -0,0 +1,69 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionStart extends MonoSwimable implements Instruction {
+
+ public InstructionStart(Swimlane swimlane) {
+ super(swimlane);
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ return factory.start(getSwimlaneIn());
+ }
+
+ public void add(Instruction other) {
+ throw new UnsupportedOperationException();
+ }
+
+ final public boolean kill() {
+ return false;
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return null;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.java
new file mode 100644
index 0000000..7f4eb3e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.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.activitydiagram3;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionStop extends MonoSwimable implements Instruction {
+
+ private final LinkRendering inlinkRendering;
+
+ public InstructionStop(Swimlane swimlane, LinkRendering inlinkRendering) {
+ super(swimlane);
+ this.inlinkRendering = inlinkRendering;
+ }
+
+ public Ftile createFtile(FtileFactory factory) {
+ return factory.stop(getSwimlaneIn());
+ }
+
+ public void add(Instruction other) {
+ throw new UnsupportedOperationException();
+ }
+
+ final public boolean kill() {
+ return false;
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return inlinkRendering;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java
new file mode 100644
index 0000000..28554eb
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java
@@ -0,0 +1,133 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.Set;
+
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class InstructionWhile implements Instruction {
+
+ private final InstructionList repeatList = new InstructionList();
+ private final Instruction parent;
+ private final LinkRendering nextLinkRenderer;
+ private final HtmlColor color;
+
+ private final Display test;
+ private final Display yes;
+ private Display out;
+ private LinkRendering endInlinkRendering;
+ private LinkRendering afterEndwhile;
+ private final Swimlane swimlane;
+ private final ISkinParam skinParam;
+
+ public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer,
+ Display yes, HtmlColor color, ISkinParam skinParam) {
+ this.parent = parent;
+ this.test = test;
+ this.nextLinkRenderer = nextLinkRenderer;
+ this.yes = yes;
+ this.swimlane = swimlane;
+ this.color = color;
+ this.skinParam = skinParam;
+ }
+
+ public void add(Instruction ins) {
+ repeatList.add(ins);
+ }
+
+ private Display note;
+ private NotePosition position;
+
+ public Ftile createFtile(FtileFactory factory) {
+ Ftile tmp = factory.decorateOut(repeatList.createFtile(factory), endInlinkRendering);
+ tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color);
+ if (note != null) {
+ tmp = new FtileWithNoteOpale(tmp, note, position, skinParam, false);
+ }
+ // tmp = factory.decorateOut(tmp, afterEndwhile);
+ return tmp;
+ }
+
+ public Instruction getParent() {
+ return parent;
+ }
+
+ final public boolean kill() {
+ return repeatList.kill();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return nextLinkRenderer;
+ }
+
+ public void endwhile(LinkRendering nextLinkRenderer, Display out) {
+ this.endInlinkRendering = nextLinkRenderer;
+ this.out = out;
+ }
+
+ public void afterEndwhile(LinkRendering linkRenderer) {
+ this.afterEndwhile = linkRenderer;
+ }
+
+ public void addNote(Display note, NotePosition position) {
+ if (repeatList.isEmpty()) {
+ this.note = note;
+ this.position = position;
+ } else {
+ repeatList.addNote(note, position);
+ }
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return repeatList.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return parent.getSwimlaneOut();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java b/src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java
new file mode 100644
index 0000000..8883338
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java
@@ -0,0 +1,87 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+
+public class LinkRendering {
+
+ private final HtmlColor color;
+ private Display display;
+
+ public LinkRendering(HtmlColor color) {
+ this.color = color;
+ }
+
+ public void setDisplay(Display display) {
+ this.display = display;
+ }
+
+ public Display getDisplay() {
+ return display;
+ }
+
+ public HtmlColor getColor() {
+ return color;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " " + display + " " + color;
+ }
+
+ public static HtmlColor getColor(LinkRendering inLinkRendering, HtmlColor defaultColor) {
+ if (inLinkRendering == null || inLinkRendering.getColor() == null) {
+ return defaultColor;
+ }
+ return inLinkRendering.getColor();
+ }
+
+ public static HtmlColor getColor(HtmlColor col, HtmlColor defaultColor) {
+ if (col == null) {
+ return defaultColor;
+ }
+ return col;
+ }
+
+ public static Display getDisplay(LinkRendering linkRendering) {
+ if (linkRendering == null) {
+ return null;
+ }
+ return linkRendering.getDisplay();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java b/src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java
new file mode 100644
index 0000000..c6f49a3
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java
@@ -0,0 +1,63 @@
+/* ========================================================================
+ * 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.activitydiagram3;
+
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+
+public class MonoSwimable implements Swimable {
+
+ private final Swimlane swimlane;
+
+ public MonoSwimable(Swimlane swimlane) {
+ this.swimlane = swimlane;
+ }
+
+ final public Set<Swimlane> getSwimlanes() {
+ return swimlane == null ? Collections.<Swimlane> emptySet() : Collections.<Swimlane> singleton(swimlane);
+ }
+
+ final public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ final public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java
new file mode 100644
index 0000000..16d7b1f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.UrlBuilder;
+import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public static final String ENDING_GROUP = "(;|(?<![/|<>}\\]])(?:[/<}\\]])|(?<!\\</?\\w{1,5})(?<!\\<img[^>]{1,999})(?<!\\<\\$\\w{1,999})(?<!\\>)(?:\\>)|(?<!\\|.{1,999})(?:\\|))";
+
+ public CommandActivity3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
+ new RegexLeaf("COLOR", "(?::?(" + HtmlColorUtils.COLOR_REGEXP + "))?"), //
+ new RegexLeaf(":"), //
+ new RegexLeaf("LABEL", "(.*)"), //
+ new RegexLeaf("STYLE", ENDING_GROUP), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+
+ final Url url;
+ if (arg.get("URL", 0) == null) {
+ url = null;
+ } else {
+ final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
+ url = urlBuilder.getUrl(arg.get("URL", 0));
+ }
+
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+ final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0));
+ diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), color, style, url);
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java
new file mode 100644
index 0000000..1b3ea3f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java
@@ -0,0 +1,65 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+
+public class CommandActivityLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandActivityLegacy1() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("-"), //
+ new RegexLeaf("LABEL", "(.*)"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), null, BoxStyle.PLAIN, null);
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java
new file mode 100644
index 0000000..4f70a4b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java
@@ -0,0 +1,103 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.CommandMultilines2;
+import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.StringUtils;
+
+public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
+
+ public CommandActivityLong3() {
+ super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
+ }
+
+ @Override
+ public String getPatternEnd() {
+ return "^(.*)" + CommandActivity3.ENDING_GROUP + "$";
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("COLOR", "(?::?(" + HtmlColorUtils.COLOR_REGEXP + "))?"), //
+ new RegexLeaf(":"), //
+ new RegexLeaf("DATA", "(.*)"), //
+ new RegexLeaf("$"));
+ }
+
+ public CommandExecutionResult executeNow(ActivityDiagram3 diagram, List<String> lines) {
+ lines = StringUtils.removeEmptyColumns(lines);
+ final RegexResult line0 = getStartingPattern().matcher(lines.get(0).trim());
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
+ final BoxStyle style = BoxStyle.fromChar(getLastChar(lines));
+ removeStarting(lines, line0.get("DATA", 0));
+ removeEnding(lines);
+ diagram.addActivity(Display.create(lines), color, style, null);
+ return CommandExecutionResult.ok();
+ }
+
+ private char getLastChar(List<String> lines) {
+ final String s = lines.get(lines.size() - 1);
+ return s.charAt(s.length() - 1);
+ }
+
+ private void removeStarting(List<String> lines, String data) {
+ if (lines.size() == 0) {
+ return;
+ }
+ lines.set(0, data);
+ }
+
+ private void removeEnding(List<String> lines) {
+ if (lines.size() == 0) {
+ return;
+ }
+ final int n = lines.size() - 1;
+ final String s = lines.get(n);
+ lines.set(n, s.substring(0, s.length() - 1));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java
new file mode 100644
index 0000000..5b9469e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java
@@ -0,0 +1,78 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+
+public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandArrow3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexOr(//
+ new RegexLeaf("->"), //
+ new RegexLeaf("COLOR", "-\\[(#\\w+)\\]->")), //
+ new RegexLeaf("[%s]*"), //
+ new RegexOr(//
+ new RegexLeaf("LABEL", "(.*);"), //
+ new RegexLeaf("")), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+ diagram.setColorNextArrow(color);
+ final String label = arg.get("LABEL", 0);
+ if (label != null && label.length() > 0) {
+ diagram.setLabelNextArrow(Display.getWithNewlines(label));
+ }
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java
new file mode 100644
index 0000000..a7b0789
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.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.activitydiagram3.command;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.CommandMultilines2;
+import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.StringUtils;
+
+public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
+
+ public CommandArrowLong3() {
+ super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
+ }
+
+ @Override
+ public String getPatternEnd() {
+ return "^(.*);$";
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexOr(//
+ new RegexLeaf("->"), //
+ new RegexLeaf("COLOR", "-\\[(#\\w+)\\]->")), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("LABEL", "(.*)"), //
+ new RegexLeaf("$"));
+ }
+
+ public CommandExecutionResult executeNow(ActivityDiagram3 diagram, List<String> lines) {
+ lines = StringUtils.removeEmptyColumns(lines);
+ final RegexResult line0 = getStartingPattern().matcher(lines.get(0).trim());
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
+ diagram.setColorNextArrow(color);
+ removeStarting(lines, line0.get("LABEL", 0));
+ removeEnding(lines);
+ diagram.setLabelNextArrow(Display.create(lines));
+ return CommandExecutionResult.ok();
+ }
+
+ private void removeStarting(List<String> lines, String data) {
+ if (lines.size() == 0) {
+ return;
+ }
+ lines.set(0, data);
+ }
+
+ private void removeEnding(List<String> lines) {
+ if (lines.size() == 0) {
+ return;
+ }
+ final int n = lines.size() - 1;
+ final String s = lines.get(n);
+ lines.set(n, s.substring(0, s.length() - 1));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
new file mode 100644
index 0000000..2c2b9d3
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
@@ -0,0 +1,67 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+
+public class CommandElse3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandElse3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("else"), //
+ new RegexLeaf("WHEN", "(?:[%s]*(?:\\(([^()]*)\\))?)?"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ // if (getSystem().getLastEntityConsulted() == null) {
+ // return CommandExecutionResult.error("No if for this endif");
+ // }
+ return diagram.else2(Display.getWithNewlines(arg.get("WHEN", 0)));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
new file mode 100644
index 0000000..0bc837e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
@@ -0,0 +1,77 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorSet;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandElseIf2() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
+ new RegexLeaf("else[%s]*if"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("WHEN", "(?:then[%s]*(?:\\((.+?)\\))?)?"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+
+ String test = arg.get("TEST", 0);
+ if (test.length() == 0) {
+ test = null;
+ }
+
+ return diagram.elseIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java
new file mode 100644
index 0000000..97f036e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java
@@ -0,0 +1,67 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+
+public class CommandElseLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandElseLegacy1() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("else[%s]when"), //
+ new RegexLeaf("WHEN", "[%s]+(.*)"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ // if (getSystem().getLastEntityConsulted() == null) {
+ // return CommandExecutionResult.error("No if for this endif");
+ // }
+ return diagram.else2(Display.getWithNewlines(arg.get("WHEN", 0)));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
new file mode 100644
index 0000000..26f2798
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
@@ -0,0 +1,58 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand;
+
+public class CommandEndPartition3 extends SingleLineCommand<ActivityDiagram3> {
+
+ public CommandEndPartition3() {
+ super("(?i)^(\\})$");
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, List<String> arg) {
+// final IEntity currentPackage = diagram.getCurrentGroup();
+// if (currentPackage == null) {
+// return CommandExecutionResult.error("No partition defined");
+// }
+ return diagram.endGroup();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java
new file mode 100644
index 0000000..b6cac84
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java
@@ -0,0 +1,65 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandEndif3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandEndif3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("endif"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ // if (getSystem().getLastEntityConsulted() == null) {
+ // return CommandExecutionResult.error("No if for this endif");
+ // }
+ return diagram.endif();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java
new file mode 100644
index 0000000..1cdca1e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java
@@ -0,0 +1,64 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandFork3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandFork3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("fork"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ diagram.fork();
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java
new file mode 100644
index 0000000..8026bec
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java
@@ -0,0 +1,63 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandForkAgain3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandForkAgain3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("fork[%s]?again"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ return diagram.forkAgain();
+
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java
new file mode 100644
index 0000000..a25d215
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java
@@ -0,0 +1,62 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandForkEnd3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandForkEnd3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("(end[%s]?fork|fork[%s]?end)"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ return diagram.endFork();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java
new file mode 100644
index 0000000..2a9658a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java
@@ -0,0 +1,65 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandGoto extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandGoto() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("goto"), //
+ new RegexLeaf("[%s]+"), //
+ new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
+ new RegexLeaf(";?"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final String name = arg.get("NAME", 0);
+ return diagram.addGoto(name);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java
new file mode 100644
index 0000000..0384587
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java
@@ -0,0 +1,65 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+
+public class CommandGroup3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandGroup3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("group"), //
+ new RegexLeaf("\\s*"), //
+ new RegexLeaf("NAME", "(.*)"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ diagram.startGroup(Display.getWithNewlines(arg.get("NAME", 0)), null, null);
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java
new file mode 100644
index 0000000..60947ff
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java
@@ -0,0 +1,61 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandGroupEnd3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandGroupEnd3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("(end ?group|group ?end)"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ return diagram.endGroup();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
new file mode 100644
index 0000000..37e6ca7
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
@@ -0,0 +1,78 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandIf2() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
+ new RegexLeaf("if"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("WHEN", "(?:then[%s]*(?:\\((.+?)\\))?)?"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+
+ String test = arg.get("TEST", 0);
+ if (test.length() == 0) {
+ test = null;
+ }
+
+ diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color);
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2Multilines.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2Multilines.java
new file mode 100644
index 0000000..cf0c812
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2Multilines.java
@@ -0,0 +1,95 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.CommandMultilines2;
+import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.MyPattern;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.StringUtils;
+
+public class CommandIf2Multilines extends CommandMultilines2<ActivityDiagram3> {
+
+ public CommandIf2Multilines() {
+ super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
+ }
+
+ @Override
+ public String getPatternEnd() {
+ return "(?i)^(.*?)\\)[%s]*(?:then[%s]*(?:\\((.+?)\\))?)?;?$";
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
+ new RegexLeaf("if"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "([^)]*)$"));
+ }
+
+ @Override
+ public CommandExecutionResult executeNow(ActivityDiagram3 diagram, List<String> lines) {
+ StringUtils.trim(lines, false);
+ final RegexResult line0 = getStartingPattern().matcher(lines.get(0).trim());
+ final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()),
+ lines.get(lines.size() - 1));
+
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
+
+ final String test = line0.get("TEST", 0);
+ Display testDisplay = Display.getWithNewlines(test);
+ for (int i = 1; i < lines.size() - 1; i++) {
+ testDisplay = testDisplay.add(lines.get(i));
+ }
+ final String trailTest = lineLast.get(0);
+ if (StringUtils.isEmpty(trailTest) == false) {
+ testDisplay = testDisplay.add(trailTest);
+ }
+
+ diagram.startIf(testDisplay, Display.getWithNewlines(lineLast.get(1)), color);
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
new file mode 100644
index 0000000..a0d0d11
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
@@ -0,0 +1,77 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandIf4() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
+ new RegexLeaf("if"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ new RegexLeaf("WHEN", "\\((.+?)\\)"), //
+ new RegexLeaf("[%s]*then[%s]*"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+
+ String test = arg.get("TEST", 0);
+ if (test.length() == 0) {
+ test = null;
+ }
+ diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color);
+
+ return CommandExecutionResult.ok();
+ }
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
new file mode 100644
index 0000000..e14386e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
@@ -0,0 +1,69 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+
+public class CommandIfLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandIfLegacy1() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("if"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("TEST", "\\((.+?)\\)"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("WHEN", "then[%s]when[%s]+(.*)"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+
+ diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null);
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java
new file mode 100644
index 0000000..45432bf
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java
@@ -0,0 +1,62 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandKill3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandKill3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("kill|detach"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ return diagram.kill();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java
new file mode 100644
index 0000000..62171b6
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java
@@ -0,0 +1,66 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandLabel extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandLabel() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("label"), //
+ new RegexLeaf("[%s]+"), //
+ new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
+ new RegexLeaf(";?"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+
+ final String name = arg.get("NAME", 0);
+ return diagram.addLabel(name);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java
new file mode 100644
index 0000000..15fc795
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java
@@ -0,0 +1,68 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+
+public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandLink3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("link[%s]+"), //
+ new RegexLeaf("COLOR", "(#\\w+)"), //
+ new RegexLeaf(";?"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+ if (color != null) {
+ diagram.setColorNextArrow(color);
+ }
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java
new file mode 100644
index 0000000..a2f4e27
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java
@@ -0,0 +1,65 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+
+public class CommandNolink extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandNolink() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("nolink"), //
+ new RegexLeaf(";?"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ // diagram.setColorNextArrow(color);
+ diagram.setLabelNextArrow(Display.getWithNewlines("NOLINK"));
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java
new file mode 100644
index 0000000..9bb2691
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java
@@ -0,0 +1,76 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.StringUtils;
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandNote3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("note"), //
+ new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
+ new RegexLeaf("[%s]*:[%s]*"), //
+ new RegexLeaf("NOTE", "(.*)"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final Display note = Display.getWithNewlines(arg.get("NOTE", 0));
+ final NotePosition position = getPosition(arg.get("POSITION", 0));
+ return diagram.addNote(note, position);
+ }
+
+ private NotePosition getPosition(String s) {
+ if (s == null) {
+ return NotePosition.LEFT;
+ }
+ return NotePosition.valueOf(StringUtils.goUpperCase(s));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java
new file mode 100644
index 0000000..34ee7bd
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.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.activitydiagram3.command;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.CommandMultilines2;
+import net.sourceforge.plantuml.command.MultilinesStrategy;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+import net.sourceforge.plantuml.StringUtils;
+
+public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
+
+ public CommandNoteLong3() {
+ super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
+ }
+
+ public String getPatternEnd() {
+ return "(?i)^end[%s]?note$";
+ }
+
+ public CommandExecutionResult executeNow(final ActivityDiagram3 diagram, List<String> lines) {
+ // final RegexResult line0 = getStartingPattern().matcher(lines.get(0).trim());
+ final List<String> in = StringUtils.removeEmptyColumns(lines.subList(1, lines.size() - 1));
+ final RegexResult line0 = getStartingPattern().matcher(lines.get(0).trim());
+ final NotePosition position = getPosition(line0.get("POSITION", 0));
+ final Display note = Display.create(in);
+ return diagram.addNote(note, position);
+ }
+
+ private NotePosition getPosition(String s) {
+ if (s == null) {
+ return NotePosition.LEFT;
+ }
+ return NotePosition.valueOf(StringUtils.goUpperCase(s));
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("note"), //
+ new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
+ new RegexLeaf("$"));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java
new file mode 100644
index 0000000..c86053e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java
@@ -0,0 +1,74 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.StringUtils;
+
+public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandPartition3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("partition"), //
+ new RegexLeaf("[%s]+"), //
+ new RegexLeaf("BACKCOLOR", "(?:(#\\w+)[%s]+)?"), //
+ new RegexLeaf("TITLECOLOR", "(?:(#\\w+)[%s]+)?"), //
+ new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), //
+ new RegexLeaf("[%s]*\\{?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final String partitionTitle = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
+ final HtmlColor backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("BACKCOLOR", 0));
+ final HtmlColor titleColor = diagram.getSkinParam().getIHtmlColorSet()
+ .getColorIfValid(arg.get("TITLECOLOR", 0));
+ diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor);
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java
new file mode 100644
index 0000000..c8c4c29
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java
@@ -0,0 +1,68 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandRepeat3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
+ new RegexLeaf("repeat"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+
+ diagram.startRepeat(color);
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
new file mode 100644
index 0000000..916f41e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
@@ -0,0 +1,97 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexOr;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+
+public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandRepeatWhile3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("repeat[%s]?while"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexOr(//
+ new RegexConcat(new RegexLeaf("TEST3", "\\((.*?)\\)"), //
+ new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ new RegexLeaf("WHEN3", "\\((.+?)\\)"), //
+ new RegexLeaf("[%s]*(not)[%s]*"), //
+ new RegexLeaf("OUT3", "\\((.+?)\\)")), //
+ new RegexConcat(new RegexLeaf("TEST4", "\\((.*?)\\)"), //
+ new RegexLeaf("[%s]*(not)[%s]*"), //
+ new RegexLeaf("OUT4", "\\((.+?)\\)")), //
+ new RegexConcat(new RegexLeaf("TEST2", "\\((.*?)\\)"), //
+ new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ new RegexLeaf("WHEN2", "\\((.+?)\\)") //
+ ), //
+ new RegexLeaf("TEST1", "(?:\\((.*)\\))?") //
+ ), //
+ new RegexLeaf("[%s]*"), //
+ new RegexOptional(new RegexConcat( //
+ new RegexOr(//
+ new RegexLeaf("->"), //
+ new RegexLeaf("COLOR", "-\\[(#\\w+)\\]->")), //
+ new RegexLeaf("[%s]*"), //
+ new RegexOr(//
+ new RegexLeaf("LABEL", "(.*)"), //
+ new RegexLeaf("")) //
+ )), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final Display test = Display.getWithNewlines(arg.getLazzy("TEST", 0));
+ final Display yes = Display.getWithNewlines(arg.getLazzy("WHEN", 0));
+ final Display out = Display.getWithNewlines(arg.getLazzy("OUT", 0));
+ final HtmlColor linkColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+ final Display linkLabel = Display.getWithNewlines(arg.get("LABEL", 0));
+ return diagram.repeatWhile(test, yes, out, linkLabel, linkColor);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java
new file mode 100644
index 0000000..7d95a9a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java
@@ -0,0 +1,64 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandSplit3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandSplit3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("split"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ diagram.split();
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java
new file mode 100644
index 0000000..ea73e9f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java
@@ -0,0 +1,63 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandSplitAgain3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandSplitAgain3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("split[%s]?again"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ return diagram.splitAgain();
+
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java
new file mode 100644
index 0000000..68b76e4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java
@@ -0,0 +1,62 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandSplitEnd3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandSplitEnd3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("(end[%s]?split|split[%s]?end)"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ return diagram.endSplit();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java
new file mode 100644
index 0000000..cb81024
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java
@@ -0,0 +1,67 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandStart3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandStart3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("start"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ // if (getSystem().getLastEntityConsulted() == null) {
+ // return CommandExecutionResult.error("No if for this endif");
+ // }
+ diagram.start();
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java
new file mode 100644
index 0000000..ae7c128
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java
@@ -0,0 +1,67 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandStop3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandStop3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("stop"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ // if (getSystem().getLastEntityConsulted() == null) {
+ // return CommandExecutionResult.error("No if for this endif");
+ // }
+ diagram.stop();
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStopLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStopLegacy1.java
new file mode 100644
index 0000000..afc103e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStopLegacy1.java
@@ -0,0 +1,67 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+
+public class CommandStopLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandStopLegacy1() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("end"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ // if (getSystem().getLastEntityConsulted() == null) {
+ // return CommandExecutionResult.error("No if for this endif");
+ // }
+ diagram.stop();
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java
new file mode 100644
index 0000000..0024161
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandSwimlane() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("\\|"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + ")\\|)?"), //
+ new RegexLeaf("SWIMLANE", "([^|]+)"), //
+ new RegexLeaf("\\|"), //
+ new RegexLeaf("LABEL", "([^|]+)?"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+ final String name = arg.get("SWIMLANE", 0);
+ final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
+ return diagram.swimlane(name, color, label);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java
new file mode 100644
index 0000000..428b0eb
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandSwimlane2() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("swimlane[%s]+"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "))?"), //
+ new RegexLeaf("[%s]*"), //
+ new RegexLeaf("SWIMLANE", "([^|]+)"), //
+ new RegexLeaf("LABEL", "(?:[%s]+as[%s]+([^|]+))?"), //
+ new RegexLeaf("$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+ final String name = arg.get("SWIMLANE", 0);
+ final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
+ return diagram.swimlane(name, color, label);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java
new file mode 100644
index 0000000..55c6395
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorSet;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+
+public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandWhile3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(//
+ new RegexLeaf("^"), //
+ new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
+ new RegexLeaf("while"), //
+ new RegexLeaf("TEST", "[%s]*\\((.+?)\\)"), //
+ new RegexOptional(new RegexConcat(//
+ new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ new RegexLeaf("YES", "\\((.+?)\\)"))), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
+ diagram.doWhile(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("YES", 0)), color);
+
+ return CommandExecutionResult.ok();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java
new file mode 100644
index 0000000..a406e13
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java
@@ -0,0 +1,63 @@
+/* ========================================================================
+ * 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.activitydiagram3.command;
+
+import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
+import net.sourceforge.plantuml.command.CommandExecutionResult;
+import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.RegexConcat;
+import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexResult;
+import net.sourceforge.plantuml.cucadiagram.Display;
+
+public class CommandWhileEnd3 extends SingleLineCommand2<ActivityDiagram3> {
+
+ public CommandWhileEnd3() {
+ super(getRegexConcat());
+ }
+
+ static RegexConcat getRegexConcat() {
+ return new RegexConcat(new RegexLeaf("^"), //
+ new RegexLeaf("(end[%s]?while|while[%s]?end)"), //
+ new RegexLeaf("OUT", "[%s]*(?:\\((.+?)\\))?"), //
+ new RegexLeaf(";?$"));
+ }
+
+ @Override
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ return diagram.endwhile(Display.getWithNewlines(arg.get("OUT", 0)));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java
new file mode 100644
index 0000000..61b64cb
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java
@@ -0,0 +1,60 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+public abstract class AbstractConnection implements Connection {
+
+ private final Ftile ftile1;
+ private final Ftile ftile2;
+
+ public AbstractConnection(Ftile ftile1, Ftile ftile2) {
+ this.ftile1 = ftile1;
+ this.ftile2 = ftile2;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + ftile1 + "]->[" + ftile2 + "]";
+ }
+
+ final public Ftile getFtile1() {
+ return ftile1;
+ }
+
+ final public Ftile getFtile2() {
+ return ftile2;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java
new file mode 100644
index 0000000..14fcb23
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.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.activitydiagram3.ftile;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public abstract class AbstractFtile implements Ftile {
+
+ private final boolean shadowing;
+
+ public AbstractFtile(boolean shadowing) {
+ this.shadowing = shadowing;
+ }
+
+ final public boolean shadowing() {
+ return shadowing;
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return null;
+ }
+
+ public LinkRendering getOutLinkRendering() {
+ return null;
+ }
+
+ public Collection<Connection> getInnerConnections() {
+ return Collections.emptyList();
+ }
+
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java
new file mode 100644
index 0000000..3876ce0
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java
@@ -0,0 +1,91 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.Direction;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+
+public class Arrows {
+
+ final static private double delta1 = 10;
+ final static private double delta2 = 4;
+
+ public static UPolygon asToUp() {
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(-delta2, delta1);
+ polygon.addPoint(0, 0);
+ polygon.addPoint(delta2, delta1);
+ polygon.addPoint(0, delta1 - 4);
+ return polygon;
+ }
+
+ public static UPolygon asToDown() {
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(-delta2, -delta1);
+ polygon.addPoint(0, 0);
+ polygon.addPoint(delta2, -delta1);
+ polygon.addPoint(0, -delta1 + 4);
+ return polygon;
+ }
+
+ public static UPolygon asToRight() {
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(-delta1, -delta2);
+ polygon.addPoint(0, 0);
+ polygon.addPoint(-delta1, delta2);
+ polygon.addPoint(-delta1 + 4, 0);
+ return polygon;
+ }
+
+ public static UPolygon asToLeft() {
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(delta1, -delta2);
+ polygon.addPoint(0, 0);
+ polygon.addPoint(delta1, delta2);
+ polygon.addPoint(delta1 - 4, 0);
+ return polygon;
+ }
+
+ public static UPolygon asTo(Direction direction) {
+ if (direction == Direction.UP) {
+ return asToUp();
+ }
+ if (direction == Direction.DOWN) {
+ return asToDown();
+ }
+ throw new IllegalArgumentException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java
new file mode 100644
index 0000000..81c552a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java
@@ -0,0 +1,176 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.graphic.UDrawable;
+import net.sourceforge.plantuml.ugraphic.Shadowable;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UPath;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.USegmentType;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+// Created from Luc Trudeau original work
+public enum BoxStyle {
+ PLAIN {
+ @Override
+ protected Shadowable getShape(double width, double height) {
+ return new URectangle(width, height, CORNER, CORNER);
+ }
+ },
+ SDL_INPUT('<') {
+ @Override
+ protected Shadowable getShape(double width, double height) {
+ final UPolygon result = new UPolygon();
+ result.addPoint(0, 0);
+ result.addPoint(width + DELTA_INPUT_OUTPUT, 0);
+ result.addPoint(width, height / 2);
+ result.addPoint(width + DELTA_INPUT_OUTPUT, height);
+ result.addPoint(0, height);
+ return result;
+ }
+ },
+ SDL_OUTPUT('>') {
+ @Override
+ protected Shadowable getShape(double width, double height) {
+ final UPolygon result = new UPolygon();
+ result.addPoint(0.0, 0.0);
+ result.addPoint(width, 0.0);
+ result.addPoint(width + DELTA_INPUT_OUTPUT, height / 2);
+ result.addPoint(width, height);
+ result.addPoint(0.0, height);
+ return result;
+ }
+ },
+ SDL_PROCEDURE('|') {
+ @Override
+ protected void drawInternal(UGraphic ug, double width, double height, boolean shadowing) {
+ final URectangle rect = new URectangle(width, height);
+ if (shadowing) {
+ rect.setDeltaShadow(3);
+ }
+ ug.draw(rect);
+ final ULine vline = new ULine(0, height);
+ ug.apply(new UTranslate(PADDING, 0)).draw(vline);
+ ug.apply(new UTranslate(width - PADDING, 0)).draw(vline);
+ }
+ },
+ SDL_SAVE('/') {
+ @Override
+ protected Shadowable getShape(double width, double height) {
+ final UPolygon result = new UPolygon();
+ result.addPoint(0.0, 0.0);
+ result.addPoint(width - DELTA_INPUT_OUTPUT, 0.0);
+ result.addPoint(width, height);
+ result.addPoint(DELTA_INPUT_OUTPUT, height);
+ return result;
+ }
+ },
+ SDL_CONTINUOUS('}') {
+ @Override
+ protected Shadowable getShape(double width, double height) {
+ final UPath result = new UPath();
+ final double c1[] = { DELTA_CONTINUOUS, 0 };
+ final double c2[] = { 0, height / 2 };
+ final double c3[] = { DELTA_CONTINUOUS, height };
+
+ result.add(c1, USegmentType.SEG_MOVETO);
+ result.add(c2, USegmentType.SEG_LINETO);
+ result.add(c3, USegmentType.SEG_LINETO);
+
+ final double c4[] = { width - DELTA_CONTINUOUS, 0 };
+ final double c5[] = { width, height / 2 };
+ final double c6[] = { width - DELTA_CONTINUOUS, height };
+
+ result.add(c4, USegmentType.SEG_MOVETO);
+ result.add(c5, USegmentType.SEG_LINETO);
+ result.add(c6, USegmentType.SEG_LINETO);
+ return result;
+ }
+ },
+ SDL_TASK(']') {
+ @Override
+ protected Shadowable getShape(double width, double height) {
+ return new URectangle(width, height);
+ }
+ };
+
+ private static final int CORNER = 25;
+ private final char style;
+ private static int DELTA_INPUT_OUTPUT = 10;
+ private static double DELTA_CONTINUOUS = 5.0;
+ private static int PADDING = 5;
+
+ private BoxStyle() {
+ this('\0');
+ }
+
+ private BoxStyle(char style) {
+ this.style = style;
+ }
+
+ public static BoxStyle fromChar(char style) {
+ for (BoxStyle bs : BoxStyle.values()) {
+ if (bs.style == style) {
+ return bs;
+ }
+ }
+ return PLAIN;
+ }
+
+ public final UDrawable getUDrawable(final double width, final double height, final boolean shadowing) {
+ return new UDrawable() {
+ public void drawU(UGraphic ug) {
+ drawInternal(ug, width, height, shadowing);
+ }
+ };
+ }
+
+ protected Shadowable getShape(double width, double height) {
+ return null;
+ }
+
+ protected void drawInternal(UGraphic ug, double width, double height, boolean shadowing) {
+ final Shadowable s = getShape(width, height);
+ if (shadowing) {
+ s.setDeltaShadow(3);
+ }
+ ug.draw(s);
+
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java
new file mode 100644
index 0000000..46fb126
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java
@@ -0,0 +1,225 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Line2D;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.ColorMapper;
+import net.sourceforge.plantuml.ugraphic.MinMax;
+import net.sourceforge.plantuml.ugraphic.UChange;
+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.UParam;
+import net.sourceforge.plantuml.ugraphic.UParamNull;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UShape;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class CollisionDetector implements UGraphic {
+
+ public UGraphic apply(UChange change) {
+ if (change instanceof UTranslate) {
+ return new CollisionDetector(stringBounder, translate.compose((UTranslate) change), this.context);
+ } else if (change instanceof UStroke) {
+ return new CollisionDetector(this);
+ } else if (change instanceof UChangeBackColor) {
+ return new CollisionDetector(this);
+ } else if (change instanceof UChangeColor) {
+ return new CollisionDetector(this);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ private final StringBounder stringBounder;
+ private final UTranslate translate;
+ private final Context context;
+
+ static class Context {
+ private final List<MinMax> rectangles = new ArrayList<MinMax>();
+ private final List<Snake> snakes = new ArrayList<Snake>();
+ private boolean manageSnakes;
+
+ public void drawDebug(UGraphic ug) {
+ for (MinMax minmax : rectangles) {
+ if (collision(minmax)) {
+ minmax.drawGrey(ug);
+ }
+ }
+ final HtmlColor color = HtmlColorUtils.BLACK;
+ ug = ug.apply(new UChangeColor(color)).apply(new UStroke(5));
+ for (Snake snake : snakes) {
+ for (Line2D line : snake.getHorizontalLines()) {
+ if (collision(line)) {
+ drawLine(ug, line);
+ }
+ }
+ }
+ }
+
+ private void drawLine(UGraphic ug, Line2D line) {
+ ug = ug.apply(new UTranslate(line.getX1(), line.getY1()));
+ ug.draw(new ULine(line.getX2() - line.getX1(), line.getY2() - line.getY1()));
+ }
+
+ private boolean collision(Line2D hline) {
+ for (MinMax r : rectangles) {
+ if (collisionCheck(r, hline)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean collision(MinMax r) {
+ for (Snake snake : snakes) {
+ for (Line2D hline : snake.getHorizontalLines()) {
+ if (collisionCheck(r, hline)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ }
+
+ private static boolean collisionCheck(MinMax rect, Line2D hline) {
+ if (hline.getY1() != hline.getY2()) {
+ throw new IllegalArgumentException();
+ }
+ if (hline.getY1() < rect.getMinY()) {
+ return false;
+ }
+ if (hline.getY1() > rect.getMaxY()) {
+ return false;
+ }
+ final double x1 = Math.min(hline.getX1(), hline.getX2());
+ final double x2 = Math.max(hline.getX1(), hline.getX2());
+ if (x2 < rect.getMinX()) {
+ return false;
+ }
+ if (x1 > rect.getMaxX()) {
+ return false;
+ }
+ return true;
+ }
+
+ public CollisionDetector(StringBounder stringBounder) {
+ this(stringBounder, new UTranslate(), new Context());
+ }
+
+ private CollisionDetector(StringBounder stringBounder, UTranslate translate, Context context) {
+ this.stringBounder = stringBounder;
+ this.translate = translate;
+ this.context = context;
+ }
+
+ private CollisionDetector(CollisionDetector other) {
+ this(other.stringBounder, other.translate, other.context);
+ }
+
+ public StringBounder getStringBounder() {
+ return stringBounder;
+ }
+
+ public UParam getParam() {
+ return new UParamNull();
+ }
+
+ public void draw(UShape shape) {
+ if (shape instanceof UPolygon) {
+ drawPolygone((UPolygon) shape);
+ } else if (shape instanceof URectangle) {
+ drawRectangle((URectangle) shape);
+ } else if (shape instanceof Snake) {
+ drawSnake((Snake) shape);
+ } /*
+ * else { System.err.println("shape=" + shape.getClass() + " " + shape); }
+ */
+ }
+
+ private void drawSnake(Snake shape) {
+ if (context.manageSnakes) {
+ context.snakes.add(shape.translate(translate));
+ }
+
+ }
+
+ private void drawRectangle(URectangle shape) {
+ context.rectangles.add(shape.getMinMax().translate(translate));
+ }
+
+ private void drawPolygone(UPolygon shape) {
+ context.rectangles.add(shape.getMinMax().translate(translate));
+ }
+
+ public ColorMapper getColorMapper() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void startUrl(Url url) {
+ }
+
+ public void closeAction() {
+ }
+
+ public void flushUg() {
+ }
+
+ public void drawDebug(UGraphic ug) {
+ context.drawDebug(ug);
+ }
+
+ public final void setManageSnakes(boolean manageSnakes) {
+ this.context.manageSnakes = manageSnakes;
+ }
+
+ public boolean isSpecialTxt() {
+ return false;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java
new file mode 100644
index 0000000..a2b3417
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java
@@ -0,0 +1,48 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.graphic.UDrawable;
+import net.sourceforge.plantuml.ugraphic.UShape;
+
+
+public interface Connection extends UDrawable, UShape {
+
+ public Ftile getFtile1();
+
+ public Ftile getFtile2();
+
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java
new file mode 100644
index 0000000..2ee0557
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java
@@ -0,0 +1,63 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+public class ConnectionCross extends AbstractConnection {
+
+ private final Connection connection;
+
+ public ConnectionCross(Connection connection) {
+ super(connection.getFtile1(), connection.getFtile2());
+ this.connection = connection;
+ }
+
+ public void drawU(UGraphic ug) {
+ if (connection instanceof ConnectionTranslatable) {
+ final ConnectionTranslatable conn = (ConnectionTranslatable) connection;
+
+ final Swimlane swimlane1 = getFtile1().getSwimlaneOut();
+ final Swimlane swimlane2 = getFtile2().getSwimlaneIn();
+ if (swimlane1 == null) {
+ throw new IllegalStateException("" + getFtile1().getClass());
+ }
+ if (swimlane2 == null) {
+ throw new IllegalStateException("" + getFtile2().getClass());
+ }
+ conn.drawTranslate(ug, swimlane1.getTranslate(), swimlane2.getTranslate());
+ }
+ }
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java
new file mode 100644
index 0000000..12e1153
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java
@@ -0,0 +1,44 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public interface ConnectionTranslatable extends Connection {
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2);
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java
new file mode 100644
index 0000000..965fe0b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java
@@ -0,0 +1,120 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.creole.Stencil;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+
+public class Diamond {
+
+ final static public double diamondHalfSize = 12;
+
+ public static UPolygon asPolygon(boolean shadowing) {
+ final UPolygon diams = new UPolygon();
+
+ diams.addPoint(diamondHalfSize, 0);
+ diams.addPoint(diamondHalfSize * 2, diamondHalfSize);
+ diams.addPoint(diamondHalfSize, diamondHalfSize * 2);
+ diams.addPoint(0, diamondHalfSize);
+ diams.addPoint(diamondHalfSize, 0);
+
+ if (shadowing) {
+ diams.setDeltaShadow(3);
+ }
+
+ return diams;
+ }
+
+ public static UPolygon asPolygon(boolean shadowing, double width, double height) {
+ final UPolygon diams = new UPolygon();
+
+ diams.addPoint(diamondHalfSize, 0);
+ diams.addPoint(width - diamondHalfSize, 0);
+ diams.addPoint(width, height / 2);
+ diams.addPoint(width - diamondHalfSize, height);
+ diams.addPoint(diamondHalfSize, height);
+ diams.addPoint(0, height / 2);
+ diams.addPoint(diamondHalfSize, 0);
+
+ if (shadowing) {
+ diams.setDeltaShadow(3);
+ }
+
+ return diams;
+ }
+
+ public static Stencil asStencil(final TextBlock tb) {
+ return new Stencil() {
+
+ private final double getDeltaX(double height, double y) {
+ final double p = y / height * 2;
+ if (p <= 1) {
+ return diamondHalfSize * p;
+ }
+ return diamondHalfSize * (2 - p);
+ }
+
+ public double getStartingX(StringBounder stringBounder, double y) {
+ final Dimension2D dim = tb.calculateDimension(stringBounder);
+ return -getDeltaX(dim.getHeight(), y);
+ }
+
+ public double getEndingX(StringBounder stringBounder, double y) {
+ final Dimension2D dim = tb.calculateDimension(stringBounder);
+ return dim.getWidth() + getDeltaX(dim.getHeight(), y);
+ }
+ };
+ }
+
+ public static UPolygon asPolygonFoo1(boolean shadowing, double width, double height) {
+ final UPolygon diams = new UPolygon();
+
+ diams.addPoint(width / 2, 0);
+ diams.addPoint(width, height / 2);
+ diams.addPoint(width / 2, height);
+ diams.addPoint(0, height / 2);
+
+ if (shadowing) {
+ diams.setDeltaShadow(3);
+ }
+
+ return diams;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java
new file mode 100644
index 0000000..9b78750
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java
@@ -0,0 +1,129 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+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.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.skin.rose.Rose;
+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.UTranslate;
+
+public class EntityImageLegend implements TextBlock {
+
+ private final int cornersize = 10;
+ private final HtmlColor noteBackgroundColor;
+ private final HtmlColor borderColor;
+ private final int marginX = 6;
+ private final int marginY = 5;
+ private final boolean withShadow;
+
+ private final TextBlock textBlock;
+
+ private EntityImageLegend(Display note, ISkinParam skinParam) {
+ this.withShadow = false;
+ final Rose rose = new Rose();
+
+ noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.legendBackground);
+
+ borderColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder);
+ final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.LEGEND);
+ final UFont fontNote = skinParam.getFont(FontParam.LEGEND, null, false);
+
+ this.textBlock = TextBlockUtils.create(note, new FontConfiguration(fontNote, fontColor,
+ skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, skinParam);
+ }
+
+ public static TextBlock create(Display legend, ISkinParam skinParam) {
+ return TextBlockUtils.withMargin(new EntityImageLegend(legend, skinParam), 8, 8);
+ }
+
+ private double getTextHeight(StringBounder stringBounder) {
+ final Dimension2D size = textBlock.calculateDimension(stringBounder);
+ return size.getHeight() + 2 * marginY;
+ }
+
+ private double getPureTextWidth(StringBounder stringBounder) {
+ final Dimension2D size = textBlock.calculateDimension(stringBounder);
+ return size.getWidth();
+ }
+
+ private double getTextWidth(StringBounder stringBounder) {
+ return getPureTextWidth(stringBounder) + 2 * marginX;
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ final double height = getTextHeight(stringBounder);
+ final double width = getTextWidth(stringBounder);
+ return new Dimension2DDouble(width + 1, height + 1);
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final UPolygon polygon = getPolygonNormal(stringBounder);
+ if (withShadow) {
+ polygon.setDeltaShadow(4);
+ }
+ ug = ug.apply(new UChangeBackColor(noteBackgroundColor)).apply(new UChangeColor(borderColor));
+ ug.draw(polygon);
+ textBlock.drawU(ug.apply(new UTranslate(marginX, marginY)));
+ }
+
+ private UPolygon getPolygonNormal(final StringBounder stringBounder) {
+ final UPolygon polygon = new UPolygon();
+ polygon.addPoint(0, 0);
+ polygon.addPoint(0, getTextHeight(stringBounder));
+ final double width = getTextWidth(stringBounder);
+ polygon.addPoint(width, getTextHeight(stringBounder));
+ polygon.addPoint(width, 0);
+ polygon.addPoint(0, 0);
+ return polygon;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java
new file mode 100644
index 0000000..c58eebe
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java
@@ -0,0 +1,58 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.util.Collection;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public interface Ftile extends Swimable, TextBlock {
+
+ public boolean shadowing();
+
+ public LinkRendering getInLinkRendering();
+
+ public LinkRendering getOutLinkRendering();
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder);
+
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder);
+
+ public Collection<Connection> getInnerConnections();
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java
new file mode 100644
index 0000000..c9be210
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileAssemblySimple implements Ftile {
+
+ private final Ftile tile1;
+ private final Ftile tile2;
+
+ @Override
+ public String toString() {
+ return "FtileAssemblySimple " + tile1 + " && " + tile2;
+ }
+
+ public FtileAssemblySimple(Ftile tile1, Ftile tile2) {
+ this.tile1 = tile1;
+ this.tile2 = tile2;
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return tile1.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return tile2.getSwimlaneOut();
+ }
+
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == tile1) {
+ return getTranslated1(stringBounder);
+ }
+ if (child == tile2) {
+ return getTranslated2(stringBounder);
+ }
+ UTranslate tmp = tile1.getTranslateFor(child, stringBounder);
+ if (tmp != null) {
+ return tmp.compose(getTranslated1(stringBounder));
+ }
+ tmp = tile2.getTranslateFor(child, stringBounder);
+ if (tmp != null) {
+ return tmp.compose(getTranslated2(stringBounder));
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ ug.apply(getTranslated1(stringBounder)).draw(tile1);
+ ug.apply(getTranslated2(stringBounder)).draw(tile2);
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return tile1.getInLinkRendering();
+ }
+
+ public LinkRendering getOutLinkRendering() {
+ return null;
+ }
+
+ private FtileGeometry calculateDimension;
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ if (calculateDimension == null) {
+ calculateDimension = tile1.calculateDimension(stringBounder).appendBottom(
+ tile2.calculateDimension(stringBounder));
+ }
+ return calculateDimension;
+ }
+
+ private UTranslate getTranslated1(StringBounder stringBounder) {
+ final double left = calculateDimension(stringBounder).getLeft();
+ return new UTranslate(left - tile1.calculateDimension(stringBounder).getLeft(), 0);
+ }
+
+ private UTranslate getTranslated2(StringBounder stringBounder) {
+ final Dimension2D dim1 = tile1.calculateDimension(stringBounder);
+ final double left = calculateDimension(stringBounder).getLeft();
+ return new UTranslate(left - tile2.calculateDimension(stringBounder).getLeft(), dim1.getHeight());
+ }
+
+ public Collection<Connection> getInnerConnections() {
+ return Collections.emptyList();
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ result.addAll(tile1.getSwimlanes());
+ result.addAll(tile2.getSwimlanes());
+ return Collections.unmodifiableSet(result);
+ }
+
+ public boolean shadowing() {
+ return tile1.shadowing() || tile2.shadowing();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java
new file mode 100644
index 0000000..fe9b71d
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java
@@ -0,0 +1,95 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+public class FtileEmpty extends AbstractFtile {
+
+ private final double width;
+ private final double height;
+ private final Swimlane swimlaneIn;
+ private final Swimlane swimlaneOut;
+
+ public FtileEmpty(boolean shadowing, double width, double height) {
+ this(shadowing, width, height, null, null);
+ }
+
+ public FtileEmpty(boolean shadowing, double width, double height, Swimlane swimlaneIn, Swimlane swimlaneOut) {
+ super(shadowing);
+ this.width = width;
+ this.height = height;
+ this.swimlaneIn = swimlaneIn;
+ this.swimlaneOut = swimlaneOut;
+
+ }
+
+ public FtileEmpty(boolean shadowing) {
+ this(shadowing, 0, 0, null, null);
+ }
+
+ public FtileEmpty(boolean shadowing, Swimlane swimlane) {
+ this(shadowing, 0, 0, swimlane, swimlane);
+ }
+
+ @Override
+ public String toString() {
+ return "FtileEmpty";
+ }
+
+ public void drawU(UGraphic ug) {
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ return new FtileGeometry(width, height, width / 2, 0, height);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlaneIn;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlaneOut;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return Collections.emptySet();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java
new file mode 100644
index 0000000..0be313e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.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.activitydiagram3.ftile;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public interface FtileFactory extends ISkinSimple {
+
+ public StringBounder getStringBounder();
+
+ public boolean shadowing();
+
+ public Ftile start(Swimlane swimlane);
+
+ public Ftile stop(Swimlane swimlane);
+
+ public Ftile activity(Display label, HtmlColor color, Swimlane swimlane, BoxStyle style);
+
+ public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition);
+
+ public Ftile addUrl(Ftile ftile, Url url);
+
+ public Ftile decorateIn(Ftile ftile, LinkRendering linkRendering);
+
+ public Ftile decorateOut(Ftile ftile, LinkRendering linkRendering);
+
+ public Ftile assembly(Ftile tile1, Ftile tile2);
+
+ public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering);
+
+ public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
+ LinkRendering afterEndwhile, HtmlColor color);
+
+ public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch);
+
+ public Ftile createFork(Swimlane swimlane, List<Ftile> all);
+
+ public Ftile createSplit(List<Ftile> all);
+
+ public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, Display headerNote);
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java
new file mode 100644
index 0000000..cd0de1f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java
@@ -0,0 +1,174 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.ugraphic.Sprite;
+
+public class FtileFactoryDelegator implements FtileFactory {
+
+ private final FtileFactory factory;
+ private final ISkinParam skinParam;
+ private final Rose rose = new Rose();
+
+ protected HtmlColor getInLinkRenderingColor(Ftile tile) {
+ final HtmlColor color;
+ final LinkRendering linkRendering = tile.getInLinkRendering();
+ if (linkRendering == null || linkRendering.getColor() == null) {
+ color = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+ } else {
+ color = linkRendering.getColor();
+ }
+ return color;
+ }
+
+ protected Display getInLinkRenderingDisplay(Ftile tile) {
+ final LinkRendering linkRendering = tile.getInLinkRendering();
+ if (linkRendering == null) {
+ return null;
+ }
+ return linkRendering.getDisplay();
+ }
+
+ public FtileFactoryDelegator(FtileFactory factory, ISkinParam skinParam) {
+ this.factory = factory;
+ this.skinParam = skinParam;
+ }
+
+ public Ftile start(Swimlane swimlane) {
+ return factory.start(swimlane);
+ }
+
+ public Ftile stop(Swimlane swimlane) {
+ return factory.stop(swimlane);
+ }
+
+ public Ftile activity(Display label, HtmlColor color, Swimlane swimlane, BoxStyle style) {
+ return factory.activity(label, color, swimlane, style);
+ }
+
+ public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
+ return factory.addNote(ftile, note, notePosition);
+ }
+
+ public Ftile addUrl(Ftile ftile, Url url) {
+ return factory.addUrl(ftile, url);
+ }
+
+ public Ftile decorateIn(Ftile ftile, LinkRendering linkRendering) {
+ return factory.decorateIn(ftile, linkRendering);
+ }
+
+ public Ftile decorateOut(Ftile ftile, LinkRendering linkRendering) {
+ return factory.decorateOut(ftile, linkRendering);
+ }
+
+ public Ftile assembly(Ftile tile1, Ftile tile2) {
+ return factory.assembly(tile1, tile2);
+ }
+
+ public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering) {
+ return factory.repeat(swimlane, repeat, test, yes, out, color, backRepeatLinkRendering);
+ }
+
+ public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
+ LinkRendering afterEndwhile, HtmlColor color) {
+ return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color);
+ }
+
+ public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch) {
+ return factory.createIf(swimlane, thens, elseBranch);
+ }
+
+ public Ftile createFork(Swimlane swimlane, List<Ftile> all) {
+ return factory.createFork(swimlane, all);
+ }
+
+ public Ftile createSplit(List<Ftile> all) {
+ return factory.createSplit(all);
+ }
+
+ public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, Display headerNote) {
+ return factory.createGroup(list, name, backColor, titleColor, headerNote);
+ }
+
+ public StringBounder getStringBounder() {
+ return factory.getStringBounder();
+ }
+
+ protected final ISkinParam getSkinParam() {
+ return skinParam;
+ }
+
+ protected final Rose getRose() {
+ return rose;
+ }
+
+ public boolean shadowing() {
+ return skinParam.shadowing();
+ }
+
+ protected FtileFactory getFactory() {
+ return factory;
+ }
+
+ public Sprite getSprite(String name) {
+ return skinParam.getSprite(name);
+ }
+
+ public String getValue(String key) {
+ return skinParam.getValue(key);
+ }
+
+ public double getPadding() {
+ return skinParam.getPadding();
+ }
+
+ public boolean useGuillemet() {
+ return skinParam.useGuillemet();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java
new file mode 100644
index 0000000..62c74da
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java
@@ -0,0 +1,144 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileGeometry extends Dimension2D {
+
+ private final double width;
+ private final double height;
+ private final double left;
+ private final double inY;
+ private final double outY;
+
+ public FtileGeometry(Dimension2D dim, double left, double inY) {
+ this(dim.getWidth(), dim.getHeight(), left, inY);
+ }
+
+ public FtileGeometry(double width, double height, double left, double inY) {
+ this(width, height, left, inY, Double.MIN_NORMAL);
+ }
+
+ @Override
+ public String toString() {
+ return "[" + width + "x" + height + " left=" + left + "]";
+ }
+
+ @Override
+ public void setSize(double width, double height) {
+ throw new UnsupportedOperationException();
+ }
+
+ public FtileGeometry(double width, double height, double left, double inY, double outY) {
+ this.left = left;
+ this.inY = inY;
+ this.outY = outY;
+ this.width = width;
+ this.height = height;
+ }
+
+ public FtileGeometry(Dimension2D dim, double left, double inY, double outY) {
+ this(dim.getWidth(), dim.getHeight(), left, inY, outY);
+ }
+
+ public boolean hasPointOut() {
+ return outY != Double.MIN_NORMAL;
+ }
+
+ public Point2D getPointIn() {
+ return new Point2D.Double(left, inY);
+ }
+
+ public Point2D getPointOut() {
+ if (outY == Double.MIN_NORMAL) {
+ throw new UnsupportedOperationException();
+ }
+ return new Point2D.Double(left, outY);
+ }
+
+ public FtileGeometry withoutPointOut() {
+ return new FtileGeometry(width, height, left, inY);
+ }
+
+ public FtileGeometry translate(UTranslate translate) {
+ final double dx = translate.getDx();
+ final double dy = translate.getDy();
+ if (this.outY == Double.MIN_NORMAL) {
+ return new FtileGeometry(width, height, left + dx, inY + dy);
+ }
+ return new FtileGeometry(width, height, left + dx, inY + dy, outY + dy);
+ }
+
+ public final double getInY() {
+ return inY;
+ }
+
+ public final double getLeft() {
+ return left;
+ }
+
+ public double getOutY() {
+ return outY;
+ }
+
+ public final double getWidth() {
+ return width;
+ }
+
+ public final double getHeight() {
+ return height;
+ }
+
+ public FtileGeometry addDim(double deltaWidth, double deltaHeight) {
+ return new FtileGeometry(width + deltaWidth, height + deltaHeight, left, inY, outY + deltaHeight);
+ }
+
+ public FtileGeometry addMarginX(double marginx) {
+ return new FtileGeometry(width + 2 * marginx, height, left + marginx, inY, outY);
+ }
+
+ public FtileGeometry fixedHeight(double fixedHeight) {
+ return new FtileGeometry(width, fixedHeight, left, inY, outY);
+ }
+
+ public FtileGeometry appendBottom(FtileGeometry other) {
+ return new FtileGeometryMerger(this, other).getResult();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java
new file mode 100644
index 0000000..7acab23
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java
@@ -0,0 +1,58 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+public class FtileGeometryMerger {
+
+ private final FtileGeometry result;
+
+ public FtileGeometryMerger(FtileGeometry geo1, FtileGeometry geo2) {
+ final double left = Math.max(geo1.getLeft(), geo2.getLeft());
+ final double dx1 = left - geo1.getLeft();
+ final double dx2 = left - geo2.getLeft();
+ final double width = Math.max(geo1.getWidth() + dx1, geo2.getWidth() + dx2);
+ final double height = geo1.getHeight() + geo2.getHeight();
+
+ if (geo2.hasPointOut()) {
+ result = new FtileGeometry(width, height, left, geo1.getInY(), geo2.getOutY() + geo1.getHeight());
+ } else {
+ result = new FtileGeometry(width, height, left, geo1.getInY());
+ }
+ }
+
+ public final FtileGeometry getResult() {
+ return result;
+ }
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java
new file mode 100644
index 0000000..8f1125f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java
@@ -0,0 +1,56 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.graphic.StringBounder;
+
+public class FtileGoto extends FtileEmpty {
+
+ private final String name;
+
+ public FtileGoto(boolean shadowing, Swimlane swimlane, String name) {
+ super(shadowing, swimlane);
+ this.name = name;
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ return super.calculateDimension(stringBounder).withoutPointOut();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java
new file mode 100644
index 0000000..636b066
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java
@@ -0,0 +1,94 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileHeightFixed extends AbstractFtile {
+
+ private final Ftile tile;
+ private final double fixedHeight;
+
+ public FtileHeightFixed(Ftile tile, double fixedHeight) {
+ super(tile.shadowing());
+ this.tile = tile;
+ this.fixedHeight = fixedHeight;
+ }
+
+ @Override
+ public LinkRendering getInLinkRendering() {
+ return tile.getInLinkRendering();
+ }
+
+ @Override
+ public LinkRendering getOutLinkRendering() {
+ return tile.getOutLinkRendering();
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return tile.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return tile.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return tile.getSwimlaneOut();
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ return tile.calculateDimension(stringBounder).translate(getTranslate(stringBounder)).fixedHeight(fixedHeight);
+ }
+
+ private UTranslate getTranslate(StringBounder stringBounder) {
+ final Dimension2D dim = tile.calculateDimension(stringBounder);
+ if (dim.getHeight() > fixedHeight) {
+ throw new IllegalStateException();
+ }
+ return new UTranslate(0, (fixedHeight - dim.getHeight()) / 2);
+ }
+
+ public void drawU(UGraphic ug) {
+ ug.apply(getTranslate(ug.getStringBounder())).draw(tile);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java
new file mode 100644
index 0000000..65529ac
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.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.activitydiagram3.ftile;
+
+import java.util.Set;
+
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+public class FtileKilled extends AbstractFtile {
+
+ private final Ftile tile;
+
+ public FtileKilled(Ftile tileToKill) {
+ super(tileToKill.shadowing());
+ this.tile = tileToKill;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return tile.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return tile.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return tile.getSwimlaneOut();
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final FtileGeometry geo = tile.calculateDimension(stringBounder);
+ return new FtileGeometry(tile.calculateDimension(stringBounder), geo.getLeft(), geo.getInY());
+ }
+
+ public void drawU(UGraphic ug) {
+ ug.draw(tile);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java
new file mode 100644
index 0000000..c9d4110
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java
@@ -0,0 +1,50 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+public class FtileLabel extends FtileEmpty {
+
+ private final String name;
+
+ public FtileLabel(boolean shadowing, Swimlane swimlane, String name) {
+ super(shadowing, swimlane);
+ this.name = name;
+ }
+
+ public final String getName() {
+ return name;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java
new file mode 100644
index 0000000..aaa874c
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java
@@ -0,0 +1,87 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileMarged extends AbstractFtile {
+
+ private final Ftile tile;
+ private final double margin;
+
+ public FtileMarged(Ftile tile, double margin) {
+ super(tile.shadowing());
+ this.tile = tile;
+ this.margin = margin;
+ }
+
+ @Override
+ public LinkRendering getInLinkRendering() {
+ return tile.getInLinkRendering();
+ }
+
+ @Override
+ public LinkRendering getOutLinkRendering() {
+ return tile.getOutLinkRendering();
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return tile.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return tile.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return tile.getSwimlaneOut();
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final FtileGeometry orig = tile.calculateDimension(stringBounder);
+ return new FtileGeometry(orig.getWidth() + 2 * margin, orig.getHeight(), orig.getLeft() + margin,
+ orig.getInY(), orig.getOutY());
+ }
+
+ public void drawU(UGraphic ug) {
+ ug.apply(new UTranslate(margin, 0)).draw(tile);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java
new file mode 100644
index 0000000..9b7fc54
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java
@@ -0,0 +1,66 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorate;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileMargedVertically extends FtileDecorate {
+
+ private final double margin1;
+ private final double margin2;
+
+ public FtileMargedVertically(Ftile tile, double margin1, double margin2) {
+ super(tile);
+ this.margin1 = margin1;
+ this.margin2 = margin2;
+ }
+
+ public void drawU(UGraphic ug) {
+ if (margin1 > 0) {
+ ug = ug.apply(new UTranslate(0, margin1));
+ }
+ ug.draw(getFtileDelegated());
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final FtileGeometry orig = getFtileDelegated().calculateDimension(stringBounder);
+ return new FtileGeometry(orig.getWidth(), orig.getHeight() + margin1 + margin2, orig.getLeft(), orig.getInY()
+ + margin1, orig.getOutY() + margin1);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java
new file mode 100644
index 0000000..97a3569
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java
@@ -0,0 +1,101 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorate;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileMinWidth extends FtileDecorate {
+
+ private final double minWidth;
+
+ public FtileMinWidth(Ftile tile, double minWidth) {
+ super(tile);
+ this.minWidth = minWidth;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final UTranslate change = getUTranslateInternal(stringBounder);
+ super.drawU(ug.apply(change));
+ }
+
+ @Override
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final FtileGeometry geo = super.calculateDimension(stringBounder);
+ final double left = getPoint2(geo.getLeft(), stringBounder);
+ if (geo.hasPointOut() == false) {
+ return new FtileGeometry(getDimensionInternal(stringBounder), left, geo.getInY());
+ }
+ return new FtileGeometry(getDimensionInternal(stringBounder), left, geo.getInY(), geo.getOutY());
+ }
+
+ private Dimension2D getDimensionInternal(StringBounder stringBounder) {
+ final Dimension2D dim = getFtileDelegated().calculateDimension(stringBounder);
+ if (dim.getWidth() < minWidth) {
+ return new Dimension2DDouble(minWidth, dim.getHeight());
+ }
+ return dim;
+ }
+
+ private UTranslate getUTranslateInternal(final StringBounder stringBounder) {
+ final Dimension2D dimTile = getFtileDelegated().calculateDimension(stringBounder);
+ final Dimension2D dimTotal = getDimensionInternal(stringBounder);
+ final UTranslate change = new UTranslate((dimTotal.getWidth() - dimTile.getWidth()) / 2, 0);
+ return change;
+ }
+
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == getFtileDelegated()) {
+ return getUTranslateInternal(stringBounder);
+ }
+ return null;
+ }
+
+ private double getPoint2(double x, StringBounder stringBounder) {
+ final Dimension2D dim = getFtileDelegated().calculateDimension(stringBounder);
+ if (dim.getWidth() < minWidth) {
+ final double diff = minWidth - dim.getWidth();
+ return x + diff / 2;
+ }
+ return x;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java
new file mode 100644
index 0000000..8ef5fb4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.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.activitydiagram3.ftile;
+
+import java.util.Collection;
+
+public class FtileUtils {
+
+ public static Ftile addConnection(Ftile ftile, Connection connection) {
+ return new FtileWithConnection(ftile, connection);
+ }
+
+ public static Ftile addConnection(Ftile ftile, Collection<Connection> connections) {
+ return new FtileWithConnection(ftile, connections);
+ }
+
+ public static Ftile withSwimlaneOut(Ftile ftile, Swimlane out) {
+ return new FtileWithSwimlanes(ftile, ftile.getSwimlaneIn(), out);
+ }
+
+ public static Ftile addBottom(Ftile ftile, double marginBottom) {
+ return new FtileMargedVertically(ftile, 0, marginBottom);
+ }
+
+ public static Ftile addVerticalMargin(Ftile ftile, double marginTop, double marginBottom) {
+ if (marginTop == 0 && marginBottom == 0) {
+ return ftile;
+ }
+ return new FtileMargedVertically(ftile, marginTop, marginBottom);
+ }
+
+ private static Ftile neverNull(Ftile ftile) {
+ if (ftile == null) {
+ return new FtileEmpty(false);
+ }
+ return ftile;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.java
new file mode 100644
index 0000000..a1b47cc
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.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.activitydiagram3.ftile;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorate;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+class FtileWithConnection extends FtileDecorate {
+
+ private final List<Connection> connections = new ArrayList<Connection>();
+
+ FtileWithConnection(Ftile ftile, Collection<Connection> connections) {
+ super(ftile);
+ if (connections == null || connections.size() == 0) {
+ throw new IllegalArgumentException();
+ }
+ this.connections.addAll(connections);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " " + connections;
+ }
+
+ public FtileWithConnection(Ftile ftile, Connection connection) {
+ this(ftile, Arrays.asList(connection));
+ if (connection == null) {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public void drawU(UGraphic ug) {
+ getFtileDelegated().drawU(ug);
+ for (Connection c : connections) {
+ ug.draw(c);
+ }
+ }
+
+ public Collection<Connection> getInnerConnections() {
+ final List<Connection> result = new ArrayList<Connection>(super.getInnerConnections());
+ result.addAll(connections);
+ return Collections.unmodifiableList(connections);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java
new file mode 100644
index 0000000..12e346d
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java
@@ -0,0 +1,60 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorate;
+
+class FtileWithSwimlanes extends FtileDecorate {
+
+ private final Swimlane in;
+ private final Swimlane out;
+
+ FtileWithSwimlanes(Ftile ftile, Swimlane in, Swimlane out) {
+ super(ftile);
+ this.in = in;
+ this.out = out;
+ }
+
+ @Override
+ public Swimlane getSwimlaneIn() {
+ return in;
+ }
+
+ @Override
+ public Swimlane getSwimlaneOut() {
+ return out;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java
new file mode 100644
index 0000000..87926d6
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java
@@ -0,0 +1,59 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorate;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+public class FtileWithUrl extends FtileDecorate {
+
+ private final Url url;
+
+ public FtileWithUrl(Ftile ftile, Url url) {
+ super(ftile);
+ if (url == null) {
+ throw new IllegalArgumentException();
+ }
+ this.url = url;
+ }
+
+ public void drawU(UGraphic ug) {
+ ug.startUrl(url);
+ getFtileDelegated().drawU(ug);
+ ug.closeAction();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java
new file mode 100644
index 0000000..2b48832
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java
@@ -0,0 +1,61 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorGoto;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+public class GotoInterceptor implements TextBlock {
+
+ private final TextBlock swinlanes;
+
+ public GotoInterceptor(TextBlock swinlanes) {
+ this.swinlanes = swinlanes;
+ }
+
+ public void drawU(UGraphic ug) {
+ new UGraphicInterceptorGoto(ug).draw(swinlanes);
+
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ return swinlanes.calculateDimension(stringBounder);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
new file mode 100644
index 0000000..12cb49f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
@@ -0,0 +1,415 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import net.sourceforge.plantuml.Direction;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.ugraphic.CompressionTransform;
+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.UPolygon;
+import net.sourceforge.plantuml.ugraphic.UShape;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class Snake implements UShape {
+
+ private final List<Point2D.Double> points = new ArrayList<Point2D.Double>();
+ private final UPolygon endDecoration;
+ private final HtmlColor color;
+ private TextBlock textBlock;
+ private boolean mergeable = true;
+ private Direction emphasizeDirection;
+
+ public Snake transformX(CompressionTransform compressionTransform) {
+ final Snake result = new Snake(color, endDecoration);
+ result.textBlock = this.textBlock;
+ result.mergeable = this.mergeable;
+ result.emphasizeDirection = this.emphasizeDirection;
+ for (Point2D.Double pt : points) {
+ final double x = compressionTransform.transform(pt.x);
+ final double y = pt.y;
+ result.addPoint(x, y);
+ }
+ return result;
+ }
+
+ public Snake(HtmlColor color, UPolygon endDecoration) {
+ this.endDecoration = endDecoration;
+ this.color = color;
+ }
+
+ public Snake(HtmlColor color) {
+ this(color, null);
+ }
+
+ public void setLabel(TextBlock label) {
+ this.textBlock = label;
+ }
+
+ public Snake move(double dx, double dy) {
+ final Snake result = new Snake(color, endDecoration);
+ for (Point2D pt : points) {
+ result.addPoint(pt.getX() + dx, pt.getY() + dy);
+ }
+ result.textBlock = this.textBlock;
+ result.mergeable = this.mergeable;
+ result.emphasizeDirection = this.emphasizeDirection;
+ return result;
+ }
+
+ public Snake translate(UTranslate translate) {
+ return move(translate.getDx(), translate.getDy());
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder result = new StringBuilder();
+ for (int i = 0; i < points.size() - 1; i++) {
+ result.append(getDirectionAtPoint(i) + " ");
+ }
+ return result + points.toString();
+ }
+
+ SnakeDirection getDirection() {
+ if (points.size() < 2) {
+ throw new IllegalStateException();
+ }
+ return SnakeDirection.getDirection(points.get(0), points.get(1));
+ }
+
+ public void addPoint(double x, double y) {
+ this.points.add(new Point2D.Double(x, y));
+ }
+
+ public void addPoint(Point2D p) {
+ addPoint(p.getX(), p.getY());
+ }
+
+ public void drawInternal(UGraphic ug) {
+ ug = ug.apply(new UChangeColor(color));
+ ug = ug.apply(new UChangeBackColor(color));
+ ug = ug.apply(new UStroke(1.5));
+ boolean drawn = false;
+ for (int i = 0; i < points.size() - 1; i++) {
+ final java.awt.geom.Point2D.Double p1 = points.get(i);
+ final java.awt.geom.Point2D.Double p2 = points.get(i + 1);
+ final Line2D line = new Line2D.Double(p1, p2);
+ if (drawn == false && emphasizeDirection != null && Direction.fromVector(p1, p2) == emphasizeDirection) {
+ drawLine(ug, line, emphasizeDirection);
+ drawn = true;
+ } else {
+ drawLine(ug, line, null);
+ }
+ }
+ if (endDecoration != null) {
+ final Point2D end = points.get(points.size() - 1);
+ ug.apply(new UTranslate(end)).apply(new UStroke()).draw(endDecoration);
+ }
+ if (textBlock != null) {
+ final Point2D position = getTextBlockPosition(ug.getStringBounder());
+ // double max = getMaxX(ug.getStringBounder());
+ // ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(0,
+ // position.getY())).draw(new URectangle(max, 10));
+ textBlock.drawU(ug.apply(new UTranslate(position)));
+ }
+ }
+
+ public double getMaxX(StringBounder stringBounder) {
+ double result = -Double.MAX_VALUE;
+ for (Point2D pt : points) {
+ result = Math.max(result, pt.getX());
+ }
+ if (textBlock != null) {
+ final Point2D position = getTextBlockPosition(stringBounder);
+ final Dimension2D dim = textBlock.calculateDimension(stringBounder);
+ result = Math.max(result, position.getX() + dim.getWidth());
+ }
+ return result;
+ }
+
+ private Point2D getTextBlockPosition(StringBounder stringBounder) {
+ final Point2D pt1 = points.get(0);
+ final Point2D pt2 = points.get(1);
+ final Dimension2D dim = textBlock.calculateDimension(stringBounder);
+ final double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
+ return new Point2D.Double(Math.max(pt1.getX(), pt2.getX()) + 4, y);
+ }
+
+ public List<Line2D> getHorizontalLines() {
+ final List<Line2D> result = new ArrayList<Line2D>();
+ for (int i = 0; i < points.size() - 1; i++) {
+ final Point2D pt1 = points.get(i);
+ final Point2D pt2 = points.get(i + 1);
+ if (pt1.getY() == pt2.getY()) {
+ final Line2D line = new Line2D.Double(pt1, pt2);
+ result.add(line);
+ }
+ }
+ return result;
+
+ }
+
+ private Point2D getFirst() {
+ return points.get(0);
+ }
+
+ public Point2D getLast() {
+ return points.get(points.size() - 1);
+ }
+
+ private boolean same(Point2D pt1, Point2D pt2) {
+ return pt1.distance(pt2) < 0.001;
+ // return pt1.getX() == pt2.getX() && pt1.getY() == pt2.getY();
+ }
+
+ public Snake merge(Snake other) {
+ if (mergeable == false || other.mergeable == false) {
+ return null;
+ }
+ if (same(this.getLast(), other.getFirst())) {
+ final UPolygon oneOf = endDecoration == null ? other.endDecoration : endDecoration;
+ final Snake result = new Snake(color, oneOf);
+ result.textBlock = textBlock == null ? other.textBlock : textBlock;
+ result.emphasizeDirection = emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection;
+ result.points.addAll(this.points);
+ result.points.addAll(other.points);
+ result.mergeMe();
+ return result;
+ }
+ if (same(this.getFirst(), other.getLast())) {
+ return other.merge(this);
+ }
+ return null;
+ }
+
+ private void mergeMe() {
+ boolean change = false;
+ do {
+ change = false;
+ change = change || removeNullVector();
+ change = change || removeRedondantDirection();
+ change = change || removePattern1();
+ change = change || removePattern2();
+ change = change || removePattern3();
+ change = change || removePattern4();
+ change = change || removePattern5();
+ change = change || removePattern6();
+ change = change || removePattern7();
+ } while (change);
+ }
+
+ private boolean removeNullVector() {
+ for (int i = 0; i < points.size() - 1; i++) {
+ final Direction dir = getDirectionAtPoint(i);
+ if (dir == null) {
+ points.remove(i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean removeRedondantDirection() {
+ for (int i = 0; i < points.size() - 2; i++) {
+ final Direction dir1 = getDirectionAtPoint(i);
+ final Direction dir2 = getDirectionAtPoint(i + 1);
+ if (dir1 == dir2) {
+ points.remove(i + 1);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean removePattern1() {
+ for (int i = 0; i < points.size() - 5; i++) {
+ final List<Direction> patternAt = getPatternAt(i);
+ if (Arrays.asList(Direction.DOWN, Direction.LEFT, Direction.DOWN, Direction.RIGHT).equals(patternAt)
+ || Arrays.asList(Direction.DOWN, Direction.RIGHT, Direction.DOWN, Direction.LEFT).equals(patternAt)) {
+ final Point2D.Double newPoint = new Point2D.Double(points.get(i + 1).x, points.get(i + 3).y);
+ points.remove(i + 3);
+ points.remove(i + 2);
+ points.remove(i + 1);
+ points.add(i + 1, newPoint);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean removePattern7() {
+ if (points.size() > 4) {
+ final int i = 0;
+ final List<Direction> patternAt = getPatternAt(i);
+ if (Arrays.asList(Direction.RIGHT, Direction.DOWN, Direction.LEFT, Direction.DOWN).equals(patternAt)
+ && points.get(i + 3).x > points.get(i).x) {
+ final Point2D.Double newPoint = new Point2D.Double(points.get(i + 3).x, points.get(i).y);
+ points.remove(i + 2);
+ points.remove(i + 1);
+ points.add(i + 1, newPoint);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean removePattern2() {
+ for (int i = 0; i < points.size() - 5; i++) {
+ final List<Direction> patternAt = getPatternAt(i);
+ if (Arrays.asList(Direction.RIGHT, Direction.DOWN, Direction.RIGHT, Direction.UP).equals(patternAt)
+ || Arrays.asList(Direction.LEFT, Direction.DOWN, Direction.LEFT, Direction.UP).equals(patternAt)) {
+ final Point2D.Double newPoint = new Point2D.Double(points.get(i + 3).x, points.get(i + 1).y);
+ points.remove(i + 3);
+ points.remove(i + 2);
+ points.remove(i + 1);
+ points.add(i + 1, newPoint);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean removePattern3() {
+ for (int i = 0; i < points.size() - 4; i++) {
+ final List<Direction> patternAt = getPatternAt(i);
+ if (Arrays.asList(Direction.DOWN, Direction.RIGHT, Direction.DOWN, Direction.RIGHT).equals(patternAt)
+ || Arrays.asList(Direction.DOWN, Direction.LEFT, Direction.DOWN, Direction.LEFT).equals(patternAt)) {
+ final Point2D.Double newPoint = new Point2D.Double(points.get(i + 1).x, points.get(i + 3).y);
+ points.remove(i + 3);
+ points.remove(i + 2);
+ points.remove(i + 1);
+ points.add(i + 1, newPoint);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean removePattern4() {
+ final int i = points.size() - 5;
+ if (i >= 0) {
+ final List<Direction> patternAt = getPatternAt(i);
+ if (Arrays.asList(Direction.DOWN, Direction.LEFT, Direction.DOWN, Direction.RIGHT).equals(patternAt)) {
+ final Point2D.Double p1 = points.get(i + 1);
+ final Point2D.Double p4 = points.get(i + 4);
+ if (p4.x > p1.x) {
+ final Point2D.Double newPoint = new Point2D.Double(points.get(i + 1).x, points.get(i + 3).y);
+ points.remove(i + 3);
+ points.remove(i + 2);
+ points.remove(i + 1);
+ points.add(i + 1, newPoint);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean removePattern5() {
+ final int i = points.size() - 5;
+ if (i >= 0) {
+ final List<Direction> patternAt = getPatternAt(i);
+ if (Arrays.asList(Direction.DOWN, Direction.RIGHT, Direction.DOWN, Direction.LEFT).equals(patternAt)) {
+ final Point2D.Double p1 = points.get(i + 1);
+ final Point2D.Double p4 = points.get(i + 4);
+ if (p4.x < p1.x) {
+ final Point2D.Double newPoint = new Point2D.Double(points.get(i + 1).x, points.get(i + 3).y);
+ points.remove(i + 3);
+ points.remove(i + 2);
+ points.remove(i + 1);
+ points.add(i + 1, newPoint);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean removePattern6() {
+ for (int i = 0; i < points.size() - 2; i++) {
+ if (isForwardAndBackwardAt(i)) {
+ points.remove(i + 1);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private List<Direction> getPatternAt(int i) {
+ return Arrays.asList(getDirectionAtPoint(i), getDirectionAtPoint(i + 1), getDirectionAtPoint(i + 2),
+ getDirectionAtPoint(i + 3));
+ }
+
+ private boolean isForwardAndBackwardAt(int i) {
+ return getDirectionAtPoint(i) == getDirectionAtPoint(i + 1).getInv();
+ }
+
+ private Direction getDirectionAtPoint(int i) {
+ return Direction.fromVector(points.get(i), points.get(i + 1));
+ }
+
+ private void drawLine(UGraphic ug, Line2D line, Direction direction) {
+ drawLine(ug, line.getX1(), line.getY1(), line.getX2(), line.getY2(), direction);
+ }
+
+ private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2, Direction direction) {
+ ug = ug.apply(new UTranslate(x1, y1));
+ if (direction != null) {
+ ug.apply(new UTranslate((x2 - x1) / 2, (y2 - y1) / 2)).draw(Arrows.asTo(direction));
+ }
+ ug.draw(new ULine(x2 - x1, y2 - y1));
+ }
+
+ public void goUnmergeable() {
+ this.mergeable = false;
+ }
+
+ public void emphasizeDirection(Direction direction) {
+ this.emphasizeDirection = direction;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java
new file mode 100644
index 0000000..78ca620
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java
@@ -0,0 +1,52 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Point2D;
+
+public enum SnakeDirection {
+ VERTICAL_THEN_HORIZONTAL, HORIZONTAL_THEN_VERTICAL;
+
+ public static SnakeDirection getDirection(Point2D pt1, Point2D pt2) {
+ if (pt1.getX() == pt2.getX()) {
+ return VERTICAL_THEN_HORIZONTAL;
+ }
+ if (pt1.getY() == pt2.getY()) {
+ return HORIZONTAL_THEN_VERTICAL;
+ }
+ throw new IllegalArgumentException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java
new file mode 100644
index 0000000..fc45588
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java
@@ -0,0 +1,47 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.util.Set;
+
+public interface Swimable {
+
+ public Set<Swimlane> getSwimlanes();
+
+ public Swimlane getSwimlaneIn();
+
+ public Swimlane getSwimlaneOut();
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java
new file mode 100644
index 0000000..4c472a0
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java
@@ -0,0 +1,95 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import net.sourceforge.plantuml.SpecificBackcolorable;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class Swimlane implements SpecificBackcolorable {
+
+ private final String name;
+ private HtmlColor color;
+ private Display display;
+
+ private UTranslate translate = new UTranslate();
+ private double totalWidth;
+
+ public Swimlane(String name) {
+ this.name = name;
+ this.display = Display.getWithNewlines(name);
+
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Display getDisplay() {
+ return display;
+ }
+
+ public void setDisplay(Display label) {
+ this.display = label;
+ }
+
+ public final UTranslate getTranslate() {
+ return translate;
+ }
+
+ public final void setTranslateAndWidth(UTranslate translate, double totalWidth) {
+ this.translate = translate;
+ this.totalWidth = totalWidth;
+ }
+
+ public HtmlColor getSpecificBackColor() {
+ return color;
+ }
+
+ public void setSpecificBackcolor(HtmlColor specificBackcolor) {
+ this.color = specificBackcolor;
+ }
+
+ public final double getTotalWidth() {
+ return totalWidth;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java
new file mode 100644
index 0000000..0ec582a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java
@@ -0,0 +1,358 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.OptionFlags;
+import net.sourceforge.plantuml.activitydiagram3.Instruction;
+import net.sourceforge.plantuml.activitydiagram3.InstructionList;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAddNote;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAddUrl;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAssembly;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorCreateFork;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorCreateGroup;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorCreateSplit;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorIf;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorRepeat;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorWhile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorOneSwimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.VCompactFactory;
+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.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.graphic.UGraphicDelegator;
+import net.sourceforge.plantuml.svek.UGraphicForSnake;
+import net.sourceforge.plantuml.ugraphic.CompressionTransform;
+import net.sourceforge.plantuml.ugraphic.LimitFinder;
+import net.sourceforge.plantuml.ugraphic.MinMax;
+import net.sourceforge.plantuml.ugraphic.SlotFinderX;
+import net.sourceforge.plantuml.ugraphic.SlotSet;
+import net.sourceforge.plantuml.ugraphic.UChange;
+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.ULine;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UShape;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class Swimlanes implements TextBlock {
+
+ private final ISkinParam skinParam;;
+
+ private final List<Swimlane> swimlanes = new ArrayList<Swimlane>();
+ private final FontConfiguration fontConfiguration;
+ private Swimlane currentSwimlane = null;
+
+ private final Instruction root = new InstructionList();
+ private Instruction currentInstruction = root;
+
+ private LinkRendering nextLinkRenderer;
+
+ public Swimlanes(ISkinParam skinParam) {
+ this.skinParam = skinParam;
+ final UFont font = skinParam.getFont(FontParam.TITLE, null, false);
+ this.fontConfiguration = new FontConfiguration(font, HtmlColorUtils.BLACK, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+
+ }
+
+ private FtileFactory getFtileFactory() {
+ FtileFactory factory = new VCompactFactory(skinParam, TextBlockUtils.getDummyStringBounder());
+ factory = new FtileFactoryDelegatorAddUrl(factory, skinParam);
+ factory = new FtileFactoryDelegatorAssembly(factory, skinParam);
+ factory = new FtileFactoryDelegatorIf(factory, skinParam);
+ factory = new FtileFactoryDelegatorWhile(factory, skinParam);
+ factory = new FtileFactoryDelegatorRepeat(factory, skinParam);
+ factory = new FtileFactoryDelegatorCreateFork(factory, skinParam);
+ factory = new FtileFactoryDelegatorCreateSplit(factory, skinParam);
+ factory = new FtileFactoryDelegatorAddNote(factory, skinParam);
+ factory = new FtileFactoryDelegatorCreateGroup(factory, skinParam);
+ return factory;
+ }
+
+ public void swimlane(String name, HtmlColor color, Display label) {
+ currentSwimlane = getOrCreate(name);
+ if (color != null) {
+ currentSwimlane.setSpecificBackcolor(color);
+ }
+ if (label != null) {
+ currentSwimlane.setDisplay(label);
+ }
+ }
+
+ private Swimlane getOrCreate(String name) {
+ for (Swimlane s : swimlanes) {
+ if (s.getName().equals(name)) {
+ return s;
+ }
+ }
+ final Swimlane result = new Swimlane(name);
+ swimlanes.add(result);
+ return result;
+ }
+
+ class Cross extends UGraphicDelegator {
+
+ private Cross(UGraphic ug) {
+ super(ug);
+ }
+
+ @Override
+ public void draw(UShape shape) {
+ if (shape instanceof Ftile) {
+ final Ftile tile = (Ftile) shape;
+ tile.drawU(this);
+ } else if (shape instanceof Connection) {
+ final Connection connection = (Connection) shape;
+ final Ftile tile1 = connection.getFtile1();
+ final Ftile tile2 = connection.getFtile2();
+
+ if (tile1 == null || tile2 == null) {
+ return;
+ }
+ if (tile1.getSwimlaneOut() != tile2.getSwimlaneIn()) {
+ final ConnectionCross connectionCross = new ConnectionCross(connection);
+ connectionCross.drawU(getUg());
+ }
+ }
+ }
+
+ public UGraphic apply(UChange change) {
+ return new Cross(getUg().apply(change));
+ }
+
+ }
+
+ static final double separationMargin = 10;
+
+ public void drawU(UGraphic ug) {
+ final FtileFactory factory = getFtileFactory();
+ TextBlock full = root.createFtile(factory);
+
+ ug = new UGraphicForSnake(ug);
+ if (swimlanes.size() <= 1) {
+ full = new TextBlockInterceptorUDrawable(full);
+ // BUG42
+ // full.drawU(ug);
+ full.drawU(ug);
+ ug.flushUg();
+ return;
+ }
+
+ if (OptionFlags.SWI2) {
+
+ final SlotFinderX slotFinder = new SlotFinderX(ug.getStringBounder());
+ drawWhenSwimlanes(slotFinder, full);
+ final SlotSet slotX = slotFinder.getXSlotSet().reverse();
+ //
+ // // final SlotSet ysSlotSet = slotFinder.getYSlotSet().reverse().smaller(5.0);
+ //
+ System.err.println("slotX=" + slotX);
+
+ printDebug(ug, slotX, HtmlColorUtils.GRAY, full);
+
+ double x2 = 0;
+ double y2 = 0;
+ final double stepy = 40;
+ int i = 0;
+ final SlotSet deconnectedSwimlanes = new SlotSet();
+ for (Swimlane swimlane : swimlanes) {
+ final UGraphic ug2 = ug.apply(new UChangeColor(HtmlColorUtils.GREEN)).apply(
+ new UChangeBackColor(HtmlColorUtils.GREEN));
+ final double totalWidth = swimlane.getTotalWidth();
+ final SlotSet slot2 = slotX.filter(x2 + separationMargin, x2 + totalWidth - separationMargin);
+ deconnectedSwimlanes.addAll(slot2);
+ // ug2.apply(new UTranslate(x2, y2)).draw(new URectangle(totalWidth, stepy));
+ x2 += totalWidth;
+ y2 += stepy;
+ i++;
+ }
+ // printDebug(ug, deconnectedSwimlanes, HtmlColorUtils.GRAY, full);
+
+ //
+ final CompressionTransform compressionTransform = new CompressionTransform(deconnectedSwimlanes);
+ // ug = new UGraphicCompress2(ug, compressionTransform);
+ drawWhenSwimlanes(ug, full);
+ } else {
+ drawWhenSwimlanes(ug, full);
+ }
+ // getCollisionDetector(ug, titleHeightTranslate).drawDebug(ug);
+ }
+
+ static private void printDebug(UGraphic ug, SlotSet slot, HtmlColor col, TextBlock full) {
+ slot.drawDebugX(ug.apply(new UChangeColor(col)).apply(new UChangeBackColor(col)),
+ full.calculateDimension(ug.getStringBounder()).getHeight());
+
+ }
+
+ private void drawWhenSwimlanes(UGraphic ug, TextBlock full) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimensionFull = full.calculateDimension(stringBounder);
+
+ final UTranslate titleHeightTranslate = getTitleHeightTranslate(stringBounder);
+
+ computeSize(ug, full);
+
+ double x2 = 0;
+ for (Swimlane swimlane : swimlanes) {
+ if (swimlane.getSpecificBackColor() != null) {
+ final UGraphic background = ug.apply(new UChangeBackColor(swimlane.getSpecificBackColor()))
+ .apply(new UChangeColor(swimlane.getSpecificBackColor())).apply(new UTranslate(x2, 0));
+ background.draw(new URectangle(swimlane.getTotalWidth(), dimensionFull.getHeight()
+ + titleHeightTranslate.getDy()));
+ }
+
+ if (OptionFlags.SWI2 == false) {
+ final TextBlock swTitle = TextBlockUtils.create(swimlane.getDisplay(), fontConfiguration,
+ HorizontalAlignment.LEFT, skinParam);
+ final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
+ final double posTitle = x2 + (swimlane.getTotalWidth() - titleWidth) / 2;
+ swTitle.drawU(ug.apply(new UTranslate(posTitle, 0)));
+ }
+
+ drawSeparation(ug.apply(new UTranslate(x2, 0)), dimensionFull.getHeight() + titleHeightTranslate.getDy());
+
+ full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane).apply(swimlane.getTranslate()).apply(
+ titleHeightTranslate));
+ x2 += swimlane.getTotalWidth();
+
+ }
+ drawSeparation(ug.apply(new UTranslate(x2, 0)), dimensionFull.getHeight() + titleHeightTranslate.getDy());
+ final Cross cross = new Cross(ug.apply(titleHeightTranslate));
+ full.drawU(cross);
+ cross.flushUg();
+ }
+
+ private void computeSize(UGraphic ug, TextBlock full) {
+ double x1 = 0;
+ final StringBounder stringBounder = ug.getStringBounder();
+ for (Swimlane swimlane : swimlanes) {
+
+ final LimitFinder limitFinder = new LimitFinder(stringBounder, false);
+ final UGraphicInterceptorOneSwimlane interceptor = new UGraphicInterceptorOneSwimlane(new UGraphicForSnake(
+ limitFinder), swimlane);
+ full.drawU(interceptor);
+ interceptor.flushUg();
+ final MinMax minMax = limitFinder.getMinMax();
+
+ final double drawingWidth = minMax.getWidth() + 2 * separationMargin;
+ final TextBlock swTitle = TextBlockUtils.create(swimlane.getDisplay(), fontConfiguration,
+ HorizontalAlignment.LEFT, skinParam);
+ final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
+ final double totalWidth = Math.max(drawingWidth, titleWidth + 2 * separationMargin);
+
+ final UTranslate translate = new UTranslate(x1 - minMax.getMinX() + separationMargin
+ + (totalWidth - drawingWidth) / 2.0, 0);
+ swimlane.setTranslateAndWidth(translate, totalWidth);
+
+ x1 += totalWidth;
+ }
+ }
+
+ private UTranslate getTitleHeightTranslate(final StringBounder stringBounder) {
+ double titlesHeight = 0;
+ for (Swimlane swimlane : swimlanes) {
+ final TextBlock swTitle = TextBlockUtils.create(swimlane.getDisplay(), fontConfiguration,
+ HorizontalAlignment.LEFT, skinParam);
+
+ titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight());
+ }
+ final UTranslate titleHeightTranslate = new UTranslate(0, titlesHeight);
+ return titleHeightTranslate;
+ }
+
+ private CollisionDetector getCollisionDetector(UGraphic ug, final UTranslate titleHeightTranslate) {
+ final FtileFactory factory = getFtileFactory();
+ final TextBlock full = root.createFtile(factory);
+ ug = new UGraphicForSnake(ug);
+
+ final CollisionDetector collisionDetector = new CollisionDetector(ug.getStringBounder());
+
+ for (Swimlane swimlane : swimlanes) {
+ full.drawU(new UGraphicInterceptorOneSwimlane(collisionDetector, swimlane).apply(swimlane.getTranslate())
+ .apply(titleHeightTranslate));
+ }
+
+ collisionDetector.setManageSnakes(true);
+ final Cross cross = new Cross(collisionDetector.apply(titleHeightTranslate));
+ full.drawU(cross);
+ cross.flushUg();
+
+ return collisionDetector;
+ }
+
+ private void drawSeparation(UGraphic ug, double height) {
+ ug.apply(new UStroke(2)).apply(new UChangeColor(HtmlColorUtils.BLACK)).draw(new ULine(0, height));
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ return TextBlockUtils.getMinMax(this, stringBounder).getDimension();
+ }
+
+ public Instruction getCurrent() {
+ return currentInstruction;
+ }
+
+ public void setCurrent(Instruction current) {
+ this.currentInstruction = current;
+ }
+
+ public LinkRendering nextLinkRenderer() {
+ return nextLinkRenderer;
+ }
+
+ public void setNextLinkRenderer(LinkRendering link) {
+ this.nextLinkRenderer = link;
+ }
+
+ public Swimlane getCurrentSwimlane() {
+ return currentSwimlane;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java
new file mode 100644
index 0000000..a4d24cb
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java
@@ -0,0 +1,63 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Dimension2D;
+import java.util.HashMap;
+
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class TextBlockInterceptorUDrawable implements TextBlock {
+
+ private final TextBlock textBlock;
+
+ public TextBlockInterceptorUDrawable(TextBlock textBlock) {
+ this.textBlock = textBlock;
+ }
+
+ public void drawU(UGraphic ug) {
+ textBlock.drawU(new UGraphicInterceptorUDrawable2(ug, new HashMap<String, UTranslate>()));
+ ug.flushUg();
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ return TextBlockUtils.getMinMax(this, stringBounder).getDimension();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java
new file mode 100644
index 0000000..fe284fe
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java
@@ -0,0 +1,109 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile;
+
+import java.awt.geom.Point2D;
+import java.util.Map;
+
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.graphic.UDrawable;
+import net.sourceforge.plantuml.graphic.UGraphicDelegator;
+import net.sourceforge.plantuml.svek.UGraphicForSnake;
+import net.sourceforge.plantuml.ugraphic.UChange;
+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.UShape;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator {
+
+ private final Map<String, UTranslate> positions;
+
+ public UGraphicInterceptorUDrawable2(UGraphic ug, Map<String, UTranslate> positions) {
+ super(ug);
+ this.positions = positions;
+ }
+
+ public void draw(UShape shape) {
+ if (shape instanceof Ftile) {
+ final Ftile ftile = (Ftile) shape;
+ // System.err.println("ftile=" + ftile);
+ ftile.drawU(this);
+ if (ftile instanceof FtileLabel) {
+ positions.put(((FtileLabel) ftile).getName(), getPosition());
+ // System.err.println("ug=" + getUg().getClass());
+ }
+ if (ftile instanceof FtileGoto) {
+ // System.err.println("positions=" + positions);
+ drawGoto((FtileGoto) ftile);
+ }
+ } else if (shape instanceof UDrawable) {
+ final UDrawable drawable = (UDrawable) shape;
+ drawable.drawU(this);
+ } else {
+ getUg().draw(shape);
+ }
+
+ }
+
+ private UTranslate getPosition() {
+ return ((UGraphicForSnake) getUg()).getTranslation();
+ }
+
+ private void drawGoto(FtileGoto ftile) {
+ final FtileGeometry geom = ftile.calculateDimension(getStringBounder());
+ final Point2D pt = geom.getPointIn();
+ UGraphic ugGoto = getUg().apply(new UChangeColor(HtmlColorUtils.GREEN)).apply(
+ new UChangeBackColor(HtmlColorUtils.GREEN));
+ ugGoto = ugGoto.apply(new UTranslate(pt));
+ final UTranslate posNow = getPosition();
+ final UTranslate dest = positions.get(ftile.getName());
+ final double dx = dest.getDx() - posNow.getDx();
+ final double dy = dest.getDy() - posNow.getDy();
+ ugGoto.draw(new UEllipse(3, 3));
+ ugGoto.apply(new UTranslate(dx, dy)).draw(new UEllipse(3, 3));
+ ugGoto.draw(new ULine(dx, 0));
+ ugGoto.apply(new UTranslate(dx, 0)).draw(new ULine(0, dy));
+ // ugGoto.draw(new ULine(dx, dy));
+ }
+
+ public UGraphic apply(UChange change) {
+ return new UGraphicInterceptorUDrawable2(getUg().apply(change), positions);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java
new file mode 100644
index 0000000..1690fee
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java
@@ -0,0 +1,103 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Point2D;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class ConnectionVerticalDown extends AbstractConnection implements ConnectionTranslatable {
+
+ private final Point2D p1;
+ private final Point2D p2;
+ private final HtmlColor color;
+ private final TextBlock textBlock;
+
+ public ConnectionVerticalDown(Ftile ftile1, Ftile ftile2, Point2D p1, Point2D p2, HtmlColor color,
+ TextBlock textBlock) {
+ super(ftile1, ftile2);
+ this.p1 = p1;
+ this.p2 = p2;
+ this.color = color;
+ this.textBlock = textBlock;
+ }
+
+ public void drawU(UGraphic ug) {
+ ug.draw(getSimpleSnake());
+ }
+
+ public double getMaxX(StringBounder stringBounder) {
+ return getSimpleSnake().getMaxX(stringBounder);
+ }
+
+ private Snake getSimpleSnake() {
+ final Snake snake = new Snake(color, Arrows.asToDown());
+ snake.setLabel(textBlock);
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ return snake;
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final Snake snake = new Snake(color, Arrows.asToDown());
+ snake.setLabel(textBlock);
+ final Point2D mp1a = translate1.getTranslated(p1);
+ final Point2D mp2b = translate2.getTranslated(p2);
+ final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
+ snake.addPoint(mp1a);
+ snake.addPoint(mp1a.getX(), middle);
+ snake.addPoint(mp2b.getX(), middle);
+ snake.addPoint(mp2b);
+ ug.draw(snake);
+
+ // final Snake small = new Snake(color, Arrows.asToDown());
+ // small.addPoint(mp2b.getX(), middle);
+ // small.addPoint(mp2b);
+ // ug.draw(small);
+
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java
new file mode 100644
index 0000000..afaf69b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.creole.CreoleParser;
+import net.sourceforge.plantuml.creole.Sheet;
+import net.sourceforge.plantuml.creole.SheetBlock1;
+import net.sourceforge.plantuml.creole.SheetBlock2;
+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.TextBlock;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.svek.image.Opale;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+
+public class FloatingNote implements Stencil, TextBlock {
+
+ private final Opale opale;
+
+ public FloatingNote(Display note, ISkinParam skinParam) {
+
+ final Rose rose = new Rose();
+ final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE);
+ final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false);
+
+ final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
+ final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
+
+ final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
+
+ final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, false).createSheet(note);
+ final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
+ this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false);
+
+ // this.text = sheetBlock2;
+
+ }
+
+ public void drawU(UGraphic ug) {
+ opale.drawU(ug);
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ return opale.calculateDimension(stringBounder);
+ }
+
+ public double getStartingX(StringBounder stringBounder, double y) {
+ return -opale.getMarginX1();
+ }
+
+ public double getEndingX(StringBounder stringBounder, double y) {
+ return opale.calculateDimension(stringBounder).getWidth() - opale.getMarginX1();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java
new file mode 100644
index 0000000..5cdbd52
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java
@@ -0,0 +1,66 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+
+public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator {
+
+ // private final Rose rose = new Rose();
+
+ public FtileFactoryDelegatorAddNote(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
+ if (note == null) {
+ throw new IllegalArgumentException();
+ }
+ // final HtmlColor colorlink;
+ // final LinkRendering inlinkRendering = ftile.getInLinkRendering();
+ // if (inlinkRendering == null || inlinkRendering.getColor() == null) {
+ // colorlink = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+ // } else {
+ // colorlink = inlinkRendering.getColor();
+ // }
+ return new FtileWithNoteOpale(ftile, note, notePosition, getSkinParam(), true);
+ }
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java
new file mode 100644
index 0000000..8dcdb8f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java
@@ -0,0 +1,58 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithUrl;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox;
+
+public class FtileFactoryDelegatorAddUrl extends FtileFactoryDelegator {
+
+ public FtileFactoryDelegatorAddUrl(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile addUrl(Ftile ftile, Url url) {
+ if (ftile instanceof FtileBox) {
+ return new FtileWithUrl(ftile, url);
+ }
+ return ftile;
+ }
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java
new file mode 100644
index 0000000..29bf617
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java
@@ -0,0 +1,116 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Point2D;
+
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedVertically;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+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.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator {
+
+ public FtileFactoryDelegatorAssembly(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile assembly(final Ftile tile1, final Ftile tile2) {
+ double height = 35;
+ final TextBlock textBlock = getTextBlock(getInLinkRenderingDisplay(tile2));
+ final StringBounder stringBounder = getStringBounder();
+ if (textBlock != null) {
+ height += textBlock.calculateDimension(stringBounder).getHeight();
+ }
+ // final Ftile space = new FtileEmpty(getFactory().shadowing(), 1, height);
+ final Ftile tile1andSpace = FtileUtils.addBottom(tile1, height);
+ Ftile result = super.assembly(tile1andSpace, tile2);
+ final FtileGeometry geo = tile1.calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return result;
+ }
+ final UTranslate translate1 = result.getTranslateFor(tile1andSpace, stringBounder);
+ final Point2D p1 = geo.translate(translate1).getPointOut();
+ final UTranslate translate2 = result.getTranslateFor(tile2, stringBounder);
+ final Point2D p2 = tile2.calculateDimension(stringBounder).translate(translate2).getPointIn();
+
+ final HtmlColor color = getInLinkRenderingColor(tile2);
+
+ final ConnectionVerticalDown connection = new ConnectionVerticalDown(tile1, tile2, p1, p2, color, textBlock);
+ result = FtileUtils.addConnection(result, connection);
+ if (textBlock != null) {
+ final double width = result.calculateDimension(stringBounder).getWidth();
+ // System.err.println("width=" + width);
+ // System.err.println("p1=" + p1);
+ // System.err.println("p2=" + p2);
+ final double maxX = connection.getMaxX(stringBounder);
+ // System.err.println("maxX=" + maxX);
+ final double needed = (maxX - width) * 2;
+ result = new FtileMinWidth(result, needed);
+ }
+ return result;
+ }
+
+ private final Rose rose = new Rose();
+
+ private TextBlock getTextBlock(Display display) {
+ // DUP1433
+ if (display == null) {
+ return null;
+ }
+ final ISkinParam skinParam = getSkinParam();
+ final UFont font = skinParam.getFont(FontParam.ACTIVITY_ARROW, null, false);
+ final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
+ final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+ return TextBlockUtils.create(display, fontConfiguration, HorizontalAlignment.LEFT, null, true);
+ }
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java
new file mode 100644
index 0000000..1686e73
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java
@@ -0,0 +1,193 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixed;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMarged;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
+
+ private final double spaceArroundBlackBar = 20;
+ private final double barHeight = 6;
+ private final double xMargin = 14;
+
+ private final Rose rose = new Rose();
+
+ public FtileFactoryDelegatorCreateFork(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile createFork(Swimlane swimlane, List<Ftile> all) {
+ final HtmlColor colorBar = rose.getHtmlColor(getSkinParam(), ColorParam.activityBar);
+ final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+
+ final Dimension2D dimSuper = super.createFork(swimlane, all).calculateDimension(getStringBounder());
+ final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar;
+
+ final List<Ftile> list = new ArrayList<Ftile>();
+ for (Ftile tmp : all) {
+ list.add(new FtileHeightFixed(new FtileMarged(tmp, xMargin), height1));
+ }
+
+ Ftile inner = super.createFork(swimlane, list);
+
+ final List<Connection> conns = new ArrayList<Connection>();
+
+ final Ftile black = new FtileBlackBlock(shadowing(), colorBar, list.get(0).getSwimlaneIn());
+ double x = 0;
+ for (Ftile tmp : list) {
+ final Dimension2D dim = tmp.calculateDimension(getStringBounder());
+ conns.add(new ConnectionIn(black, tmp, x, arrowColor));
+ conns.add(new ConnectionOut(tmp, black, x, arrowColor, height1));
+ x += dim.getWidth();
+ }
+
+ inner = FtileUtils.addConnection(inner, conns);
+ ((FtileBlackBlock) black).setDimenstion(inner.calculateDimension(getStringBounder()).getWidth(), barHeight);
+ final Ftile tmp1 = new FtileAssemblySimple(black, inner);
+ return new FtileAssemblySimple(tmp1, black);
+ }
+
+ class ConnectionIn extends AbstractConnection implements ConnectionTranslatable {
+
+ private final double x;
+ private final HtmlColor arrowColor;
+
+ public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor) {
+ super(ftile1, ftile2);
+ this.x = x;
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ ug = ug.apply(new UTranslate(x, 0));
+ final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
+ final Snake s = new Snake(arrowColor, Arrows.asToDown());
+ s.addPoint(geo.getLeft(), 0);
+ s.addPoint(geo.getLeft(), geo.getInY());
+ ug.draw(s);
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ ug = ug.apply(new UTranslate(x, 0));
+ final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
+ final Point2D p1 = new Point2D.Double(geo.getLeft(), 0);
+ final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ final Point2D mp1a = translate1.getTranslated(p1);
+ final Point2D mp2b = translate2.getTranslated(p2);
+ final double middle = mp1a.getY() + 4;
+ snake.addPoint(mp1a);
+ snake.addPoint(mp1a.getX(), middle);
+ snake.addPoint(mp2b.getX(), middle);
+ snake.addPoint(mp2b);
+ ug.draw(snake);
+ }
+ }
+
+ class ConnectionOut extends AbstractConnection implements ConnectionTranslatable {
+
+ private final double x;
+ private final HtmlColor arrowColor;
+ private final double height;
+
+ public ConnectionOut(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor, double height) {
+ super(ftile1, ftile2);
+ this.x = x;
+ this.arrowColor = arrowColor;
+ this.height = height;
+ }
+
+ public void drawU(UGraphic ug) {
+ ug = ug.apply(new UTranslate(x, 0));
+ final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
+ if (geo.hasPointOut() == false) {
+ return;
+ }
+ final Snake s = new Snake(arrowColor, Arrows.asToDown());
+ s.addPoint(geo.getLeft(), geo.getOutY());
+ s.addPoint(geo.getLeft(), height);
+ ug.draw(s);
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ ug = ug.apply(new UTranslate(x, 0));
+ final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
+ if (geo.hasPointOut() == false) {
+ return;
+ }
+ final Point2D p1 = new Point2D.Double(geo.getLeft(), geo.getOutY());
+ final Point2D p2 = new Point2D.Double(geo.getLeft(), height);
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ final Point2D mp1a = translate1.getTranslated(p1);
+ final Point2D mp2b = translate2.getTranslated(p2);
+ final double middle = mp2b.getY() - 14;
+ snake.addPoint(mp1a);
+ snake.addPoint(mp1a.getX(), middle);
+ snake.addPoint(mp2b.getX(), middle);
+ snake.addPoint(mp2b);
+ ug.draw(snake);
+ }
+
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java
new file mode 100644
index 0000000..65f9132
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java
@@ -0,0 +1,60 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.skin.rose.Rose;
+
+public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator {
+
+ private final Rose rose = new Rose();
+
+ public FtileFactoryDelegatorCreateGroup(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, Display headerNote) {
+ final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+ return new FtileGroup(list, name, headerNote, arrowColor, backColor, titleColor, getSkinParam());
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java
new file mode 100644
index 0000000..4d55d09
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java
@@ -0,0 +1,416 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.OptionFlags;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixed;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMarged;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+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.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
+
+ private final double spaceArroundBlackBar = 20;
+ private final double barHeight = 6;
+ private final double xMargin = 14;
+
+ private final Rose rose = new Rose();
+
+ public FtileFactoryDelegatorCreateSplit(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ static private boolean isSimpleSwimlanes(List<Ftile> all) {
+ final Set<Swimlane> already = new HashSet<Swimlane>();
+ for (Ftile ftile : all) {
+ final Set<Swimlane> currents = ftile.getSwimlanes();
+ if (currents.size() != 1) {
+ return false;
+ }
+ assert currents.size() == 1;
+ final Swimlane current = currents.iterator().next();
+ if (already.contains(current)) {
+ return false;
+ }
+ already.add(current);
+ }
+ return already.size() > 1;
+ }
+
+ static private boolean isSeveralSwimlanes(List<Ftile> all) {
+ final Set<Swimlane> already = new HashSet<Swimlane>();
+ for (Ftile ftile : all) {
+ final Set<Swimlane> currents = ftile.getSwimlanes();
+ if (currents.size() > 1) {
+ return true;
+ }
+ assert currents.size() == 0 || currents.size() == 1;
+ if (currents.size() == 1) {
+ final Swimlane current = currents.iterator().next();
+ already.add(current);
+ }
+ }
+ return already.size() > 1;
+ }
+
+ @Override
+ public Ftile createSplit(List<Ftile> all) {
+ // OptionFlags.SWI2
+ // if (all != null)
+ // return severalSwimlanes(all);
+ // // if (isSimpleSwimlanes(all)) {
+ // return simpleSwimlanes(all);
+ // // return severalSwimlanes(all);
+ // // } else if (isSeveralSwimlanes(all)) {
+ // // return severalSwimlanes(all);
+ // }
+ final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+
+ final Dimension2D dimSuper = super.createSplit(all).calculateDimension(getStringBounder());
+ final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar;
+
+ final List<Ftile> list = new ArrayList<Ftile>();
+ for (Ftile tmp : all) {
+ list.add(new FtileHeightFixed(new FtileMarged(tmp, xMargin), height1));
+ }
+
+ Ftile inner = super.createSplit(list);
+
+ final List<Connection> conns = new ArrayList<Connection>();
+
+ double x = 0;
+ boolean hasOut = false;
+ for (Ftile tmp : list) {
+ final Dimension2D dim = tmp.calculateDimension(getStringBounder());
+ conns.add(new ConnectionIn(tmp, x, arrowColor, getTextBlock(tmp.getInLinkRendering())));
+ final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut();
+ if (hasOutTmp) {
+ conns.add(new ConnectionOut(tmp, x, arrowColor, height1, getTextBlock(tmp.getOutLinkRendering())));
+ hasOut = true;
+ }
+ x += dim.getWidth();
+ }
+ final double totalWidth = inner.calculateDimension(getStringBounder()).getWidth();
+ conns.add(new ConnectionHline2(inner, OptionFlags.SWI2 ? HtmlColorUtils.BLUE : arrowColor, 0, list, totalWidth));
+ if (hasOut) {
+ conns.add(new ConnectionHline2(inner, OptionFlags.SWI2 ? HtmlColorUtils.GREEN : arrowColor, height1, list,
+ totalWidth));
+ }
+
+ inner = FtileUtils.addConnection(inner, conns);
+ if (hasOut == false) {
+ inner = new FtileKilled(inner);
+ }
+ return inner;
+ }
+
+ // private Ftile severalSwimlanes(List<Ftile> all) {
+ // final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+ // final Dimension2D dimSuper = new FtileForkInner1(all).calculateDimension(getStringBounder());
+ // final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar;
+ // final List<Ftile> list = new ArrayList<Ftile>();
+ // for (Ftile tmp : all) {
+ // list.add(new FtileHeightFixed(new FtileMarged(tmp, xMargin), height1));
+ // // list.add(new FtileMarged(tmp, xMargin));
+ // // list.add(tmp);
+ // }
+ //
+ // Ftile inner = new FtileForkInner1(list);
+ // final List<Connection> conns = new ArrayList<Connection>();
+ // boolean hasOut = false;
+ // for (Ftile tmp : list) {
+ // // final Dimension2D dim = tmp.calculateDimension(getStringBounder());
+ // final UTranslate translateFor = inner.getTranslateFor(tmp, getStringBounder());
+ // if (translateFor == null) {
+ // continue;
+ // }
+ // final double x = translateFor.getDx();
+ // conns.add(new ConnectionIn(tmp, x, arrowColor));
+ // final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut();
+ // if (hasOutTmp) {
+ // conns.add(new ConnectionOut(tmp, x, arrowColor, height1));
+ // hasOut = true;
+ // }
+ // // x += dim.getWidth();
+ // }
+ // final double totalWidth = inner.calculateDimension(getStringBounder()).getWidth();
+ // conns.add(new ConnectionHline2(inner, arrowColor, 0, list, totalWidth));
+ // if (hasOut) {
+ // conns.add(new ConnectionHline2(inner, arrowColor, height1, list, totalWidth));
+ // }
+ // inner = FtileUtils.addConnection(inner, conns);
+ //
+ // return inner;
+ // }
+
+ private TextBlock getTextBlock(LinkRendering linkRendering) {
+ // DUP1433
+ final Display display = LinkRendering.getDisplay(linkRendering);
+ if (display == null) {
+ return null;
+ }
+ final ISkinParam skinParam = getSkinParam();
+ final UFont font = skinParam.getFont(FontParam.ACTIVITY_ARROW, null, false);
+ final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
+ final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+ return TextBlockUtils.create(display, fontConfiguration, HorizontalAlignment.LEFT, null, true);
+ }
+
+ private Ftile simpleSwimlanes(List<Ftile> all) {
+ final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+
+ final Dimension2D dimSuper = new FtileSplit1(all).calculateDimension(getStringBounder());
+ final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar;
+
+ final List<Ftile> list = new ArrayList<Ftile>();
+ for (Ftile tmp : all) {
+ list.add(new FtileHeightFixed(new FtileMarged(tmp, xMargin), height1));
+ }
+
+ Ftile inner = new FtileSplit1(list);
+
+ final List<Connection> conns = new ArrayList<Connection>();
+
+ boolean hasOut = false;
+ for (Ftile tmp : list) {
+ // final Dimension2D dim = tmp.calculateDimension(getStringBounder());
+ final double x = inner.getTranslateFor(tmp, getStringBounder()).getDx();
+ conns.add(new ConnectionIn(tmp, x, arrowColor, null));
+ final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut();
+ if (hasOutTmp) {
+ conns.add(new ConnectionOut(tmp, x, arrowColor, height1, null));
+ hasOut = true;
+ }
+ // x += dim.getWidth();
+ }
+ final double totalWidth = inner.calculateDimension(getStringBounder()).getWidth();
+ conns.add(new ConnectionHline3(inner, arrowColor, 0, list, totalWidth));
+ if (hasOut) {
+ conns.add(new ConnectionHline3(inner, arrowColor, height1, list, totalWidth));
+ }
+ //
+ inner = FtileUtils.addConnection(inner, conns);
+ if (hasOut == false) {
+ inner = new FtileKilled(inner);
+ }
+ return inner;
+
+ }
+
+ static class ConnectionHline2 extends AbstractConnection {
+
+ private final Ftile inner;
+ private final double y;
+ private final HtmlColor arrowColor;
+ private final List<Ftile> list;
+ private final double totalWidth;
+
+ public ConnectionHline2(Ftile inner, HtmlColor arrowColor, double y, List<Ftile> list, double totalWidth) {
+ super(null, null);
+ this.inner = inner;
+ this.y = y;
+ this.arrowColor = arrowColor;
+ this.list = list;
+ this.totalWidth = totalWidth;
+ }
+
+ public void drawU(UGraphic ug) {
+ double minX = Double.MAX_VALUE;
+ double maxX = 0;
+ final StringBounder stringBounder = ug.getStringBounder();
+ for (Ftile tmp : list) {
+ if (y > 0 && tmp.calculateDimension(stringBounder).hasPointOut() == false) {
+ continue;
+ }
+ final UTranslate ut = inner.getTranslateFor(tmp, stringBounder);
+ if (ut == null) {
+ continue;
+ }
+ final double middle = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
+ minX = Math.min(minX, middle);
+ maxX = Math.max(maxX, middle);
+ }
+ if (minX > totalWidth / 2) {
+ minX = totalWidth / 2;
+ }
+ if (maxX < totalWidth / 2) {
+ maxX = totalWidth / 2;
+ }
+
+ final Snake s = new Snake(arrowColor);
+ s.goUnmergeable();
+ s.addPoint(minX, y);
+ s.addPoint(maxX, y);
+ ug.draw(s);
+ }
+ }
+
+ static class ConnectionHline3 extends AbstractConnection implements ConnectionTranslatable {
+
+ private final Ftile inner;
+ private final double y;
+ private final HtmlColor arrowColor;
+ private final List<Ftile> list;
+ private final double totalWidth;
+
+ public ConnectionHline3(Ftile inner, HtmlColor arrowColor, double y, List<Ftile> list, double totalWidth) {
+ super(null, null);
+ this.inner = inner;
+ this.y = y;
+ this.arrowColor = arrowColor;
+ this.list = list;
+ this.totalWidth = totalWidth;
+ }
+
+ public void drawU(UGraphic ug) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final UTranslate left = inner.getSwimlaneIn().getTranslate();
+ double minX = inner.calculateDimension(stringBounder).getLeft() + left.getDx();
+ double maxX = minX;
+
+ for (Ftile tmp : list) {
+ final FtileGeometry tmpGeom = tmp.calculateDimension(stringBounder);
+ final UTranslate tpos = inner.getTranslateFor(tmp, stringBounder);
+ for (Swimlane sw : tmp.getSwimlanes()) {
+ final double x = tmpGeom.translate(sw.getTranslate().compose(tpos)).getLeft();
+ minX = Math.min(minX, x);
+ maxX = Math.max(maxX, x);
+ }
+ }
+ final Dimension2D dimInner = inner.calculateDimension(stringBounder);
+
+ final Snake s = new Snake(arrowColor);
+ // final Snake s = new Snake(HtmlColorUtils.GREEN);
+ s.goUnmergeable();
+ s.addPoint(minX, y);
+ s.addPoint(maxX, y);
+ ug.draw(s);
+ }
+ }
+
+ static class ConnectionIn extends AbstractConnection {
+
+ private final double x;
+ private final HtmlColor arrowColor;
+ private final TextBlock text;
+
+ public ConnectionIn(Ftile tmp, double x, HtmlColor arrowColor, TextBlock text) {
+ super(null, tmp);
+ this.x = x;
+ this.arrowColor = arrowColor;
+ this.text = text;
+ }
+
+ public void drawU(UGraphic ug) {
+ ug = ug.apply(new UTranslate(x, 0));
+ final FtileGeometry geo = getFtile2().calculateDimension(ug.getStringBounder());
+ final double left = geo.getLeft();
+ final Snake s = new Snake(arrowColor, Arrows.asToDown());
+ s.setLabel(text);
+ s.addPoint(left, 0);
+ s.addPoint(left, geo.getInY());
+ ug.draw(s);
+ }
+ }
+
+ static class ConnectionOut extends AbstractConnection {
+
+ private final double x;
+ private final HtmlColor arrowColor;
+ private final double height;
+ private final TextBlock text;
+
+ public ConnectionOut(Ftile tmp, double x, HtmlColor arrowColor, double height, TextBlock text) {
+ super(tmp, null);
+ this.x = x;
+ this.arrowColor = arrowColor;
+ this.height = height;
+ this.text = text;
+ }
+
+ public void drawU(UGraphic ug) {
+ ug = ug.apply(new UTranslate(x, 0));
+ final FtileGeometry geo = getFtile1().calculateDimension(ug.getStringBounder());
+ if (geo.hasPointOut() == false) {
+ assert false;
+ return;
+ }
+ final Snake s = new Snake(arrowColor, Arrows.asToDown());
+ s.setLabel(text);
+ s.goUnmergeable();
+ s.addPoint(geo.getLeft(), geo.getOutY());
+ s.addPoint(geo.getLeft(), height);
+ ug.draw(s);
+ }
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java
new file mode 100644
index 0000000..9de99a1
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java
@@ -0,0 +1,79 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.util.List;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UFont;
+
+public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
+
+ public FtileFactoryDelegatorIf(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch) {
+
+ final ConditionStyle conditionStyle = getSkinParam().getConditionStyle();
+ final UFont fontArrow = getSkinParam().getFont(FontParam.ACTIVITY_ARROW, null, false);
+ final UFont fontTest = getSkinParam().getFont(
+ conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null, false);
+ final Branch branch0 = thens.get(0);
+
+ final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder);
+ final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(getSkinParam(),
+ ColorParam.activityBackground) : branch0.getColor();
+ final HtmlColor arrowColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+
+ if (thens.size() > 1) {
+ return FtileIfLong2.create(swimlane, borderColor, backColor, fontArrow, arrowColor, getFactory(),
+ conditionStyle, thens, elseBranch, getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink());
+ }
+ return FtileIf.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor, getFactory(),
+ conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder());
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java
new file mode 100644
index 0000000..f0467cb
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java
@@ -0,0 +1,77 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UFont;
+
+public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
+
+ public FtileFactoryDelegatorRepeat(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color,
+ LinkRendering backRepeatLinkRendering) {
+ final ConditionStyle conditionStyle = getSkinParam().getConditionStyle();
+ final UFont font = getSkinParam().getFont(
+ conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null,
+ false);
+
+ final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder);
+ final HtmlColor backColor = color == null ? getRose().getHtmlColor(getSkinParam(),
+ ColorParam.activityBackground) : color;
+ final HtmlColor arrowColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+
+ final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering();
+ final HtmlColor endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getColor();
+
+ return FtileRepeat.create(backRepeatLinkRendering, swimlane, repeat, test, yes, out, borderColor, backColor, font, arrowColor,
+ endRepeatLinkColor, conditionStyle, this, getSkinParam().getHyperlinkColor(), getSkinParam()
+ .useUnderlineForHyperlink());
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java
new file mode 100644
index 0000000..a1bd72c
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.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.activitydiagram3.ftile.vcompact;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UFont;
+
+public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
+
+ public FtileFactoryDelegatorWhile(FtileFactory factory, ISkinParam skinParam) {
+ super(factory, skinParam);
+ }
+
+ @Override
+ public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
+ LinkRendering afterEndwhile, HtmlColor color) {
+ final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder);
+ final HtmlColor backColor = color == null ? getRose().getHtmlColor(getSkinParam(),
+ ColorParam.activityBackground) : color;
+ final HtmlColor arrowColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityArrow);
+
+ final ConditionStyle conditionStyle = getSkinParam().getConditionStyle();
+ final UFont fontArrow = getSkinParam().getFont(FontParam.ACTIVITY_ARROW, null, false);
+ final UFont fontTest = getSkinParam().getFont(
+ conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null, false);
+
+ final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering();
+ final HtmlColor endInlinkColor = endInlinkRendering == null ? arrowColor : endInlinkRendering.getColor();
+ return FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out,
+ fontArrow, endInlinkColor, afterEndwhile, getFactory(), conditionStyle, fontTest, getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink());
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java
new file mode 100644
index 0000000..0a37e68
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java
@@ -0,0 +1,121 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+class FtileForkInner extends AbstractFtile {
+
+ private final List<Ftile> forks = new ArrayList<Ftile>();
+
+ public FtileForkInner(List<Ftile> forks) {
+ super(forks.get(0).shadowing());
+ for (Ftile ftile : forks) {
+ this.forks.add(ftile);
+ }
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return forks.get(0).getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return mergeSwimlanes(forks);
+ }
+
+ public static Set<Swimlane> mergeSwimlanes(List<Ftile> tiles) {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ for (Ftile tile : tiles) {
+ result.addAll(tile.getSwimlanes());
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ double xpos = 0;
+ for (Ftile ftile : forks) {
+ ug.apply(new UTranslate(xpos, 0)).draw(ftile);
+ final Dimension2D dim = ftile.calculateDimension(stringBounder);
+ xpos += dim.getWidth();
+ }
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ double height = 0;
+ double width = 0;
+ for (Ftile ftile : forks) {
+ final Dimension2D dim = ftile.calculateDimension(stringBounder);
+ width += dim.getWidth();
+ if (dim.getHeight() > height) {
+ height = dim.getHeight();
+ }
+ }
+ final Dimension2D dimTotal = new Dimension2DDouble(width, height);
+ return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
+ }
+
+ public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) {
+ double xpos = 0;
+ for (Ftile ftile : forks) {
+ if (ftile == searched) {
+ return new UTranslate(xpos, 0);
+ }
+ final Dimension2D dim = ftile.calculateDimension(stringBounder);
+ xpos += dim.getWidth();
+ }
+ throw new IllegalArgumentException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java
new file mode 100644
index 0000000..c46dbcc
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java
@@ -0,0 +1,168 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.Font;
+import java.awt.geom.Dimension2D;
+import java.util.Set;
+
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMarged;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+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.SymbolContext;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.graphic.USymbol;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+import net.sourceforge.plantuml.utils.MathUtils;
+
+public class FtileGroup extends AbstractFtile {
+
+ private final double diffYY2 = 20;
+ private final Ftile inner;
+ private final TextBlock name;
+ private final TextBlock headerNote;
+ private final HtmlColor color;
+ private final HtmlColor backColor;
+ private final HtmlColor titleColor;
+
+ public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor color, HtmlColor backColor,
+ HtmlColor titleColor, ISkinParam skinParam) {
+ super(inner.shadowing());
+ this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor;
+ this.inner = new FtileMarged(inner, 10);
+ this.color = color;
+ this.titleColor = titleColor;
+ final UFont font = new UFont("Serif", Font.PLAIN, 14);
+ final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+ if (title == null) {
+ this.name = TextBlockUtils.empty(0, 0);
+ } else {
+ this.name = TextBlockUtils.create(title, fc, HorizontalAlignment.LEFT, skinParam);
+ }
+ if (displayNote == null) {
+ this.headerNote = TextBlockUtils.empty(0, 0);
+ } else {
+ this.headerNote = new FloatingNote(displayNote, skinParam);
+ }
+ }
+
+ @Override
+ public LinkRendering getInLinkRendering() {
+ return inner.getInLinkRendering();
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return inner.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return inner.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return inner.getSwimlaneOut();
+ }
+
+ private double diffHeightTitle(StringBounder stringBounder) {
+ final Dimension2D dimTitle = name.calculateDimension(stringBounder);
+ return Math.max(25, dimTitle.getHeight() + 20);
+ }
+
+ private UTranslate getTranslate(StringBounder stringBounder) {
+ final double suppWidth = suppWidth(stringBounder);
+ return new UTranslate(suppWidth / 2, diffHeightTitle(stringBounder) + headerNoteHeight(stringBounder));
+ }
+
+ public double suppWidth(StringBounder stringBounder) {
+ final FtileGeometry orig = inner.calculateDimension(stringBounder);
+ final Dimension2D dimTitle = name.calculateDimension(stringBounder);
+ final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder);
+ final double suppWidth = MathUtils
+ .max(orig.getWidth(), dimTitle.getWidth() + 20, dimHeaderNote.getWidth() + 20) - orig.getWidth();
+ return suppWidth;
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final FtileGeometry orig = inner.calculateDimension(stringBounder);
+ final double suppWidth = suppWidth(stringBounder);
+ final double width = orig.getWidth() + suppWidth;
+ final double height = orig.getHeight() + diffHeightTitle(stringBounder) + diffYY2
+ + headerNoteHeight(stringBounder);
+ final double titleAndHeaderNoteHeight = diffHeightTitle(stringBounder) + headerNoteHeight(stringBounder);
+ if (orig.hasPointOut()) {
+ return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, orig.getInY()
+ + titleAndHeaderNoteHeight, orig.getOutY() + titleAndHeaderNoteHeight);
+ }
+ return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, orig.getInY()
+ + titleAndHeaderNoteHeight);
+ }
+
+ private double headerNoteHeight(StringBounder stringBounder) {
+ return headerNote.calculateDimension(stringBounder).getHeight();
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimTotal = calculateDimension(stringBounder);
+
+ final SymbolContext symbolContext = new SymbolContext(backColor, HtmlColorUtils.BLACK).withShadow(shadowing())
+ .withStroke(new UStroke(2));
+ USymbol.FRAME.asBig(name, TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext)
+ .drawU(ug);
+
+ final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder);
+ headerNote.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimHeaderNote.getWidth() - 10,
+ diffHeightTitle(ug.getStringBounder()) - 10)));
+
+ ug.apply(getTranslate(stringBounder)).draw(inner);
+
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIf.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIf.java
new file mode 100644
index 0000000..58fee9a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIf.java
@@ -0,0 +1,595 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.Direction;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
+import net.sourceforge.plantuml.creole.CreoleParser;
+import net.sourceforge.plantuml.creole.Sheet;
+import net.sourceforge.plantuml.creole.SheetBlock1;
+import net.sourceforge.plantuml.creole.SheetBlock2;
+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.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+class FtileIf extends AbstractFtile {
+
+ private final Ftile tile1;
+ private final Ftile tile2;
+ private final Ftile diamond1;
+ private final Ftile diamond2;
+
+ private final HtmlColor arrowColor;
+
+ private FtileIf(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, HtmlColor arrowColor) {
+ super(tile1.shadowing() || tile2.shadowing());
+ this.diamond1 = diamond1;
+ this.diamond2 = diamond2;
+ this.tile1 = tile1;
+ this.tile2 = tile2;
+
+ this.arrowColor = arrowColor;
+
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ if (getSwimlaneIn() != null) {
+ result.add(getSwimlaneIn());
+ }
+ result.addAll(tile1.getSwimlanes());
+ result.addAll(tile2.getSwimlanes());
+ return Collections.unmodifiableSet(result);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return diamond1.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, UFont fontTest,
+ HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1,
+ Branch branch2, ISkinParam skinParam, StringBounder stringBounder) {
+
+ final Display labelTest = branch1.getLabelTest();
+ // if (branch1.isOnlySingleStop() || branch2.isOnlySingleStop()) {
+ // final Branch nonStop = branch1.isOnlySingleStop() ? branch2 : branch1;
+ // return FtileIfAndStop.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor,
+ // ftileFactory, conditionStyle, nonStop, skinParam, stringBounder, labelTest);
+ // }
+
+ final Ftile tile1 = new FtileMinWidth(branch1.getFtile(), 30);
+ final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30);
+
+ final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null);
+
+ final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+ final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+
+ final TextBlock tb1 = TextBlockUtils.create(branch1.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
+ ftileFactory, true);
+ final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
+ ftileFactory, true);
+
+ final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, false).createSheet(labelTest);
+ final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
+ final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));
+
+ final Ftile diamond1;
+ if (conditionStyle == ConditionStyle.INSIDE) {
+ diamond1 = new FtileDiamondInside(tile1.shadowing(), backColor, borderColor, swimlane, tbTest)
+ .withWest(tb1).withEast(tb2);
+ } else if (conditionStyle == ConditionStyle.DIAMOND) {
+ diamond1 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tb1)
+ .withEast(tb2).withNorth(tbTest);
+ } else {
+ throw new IllegalStateException();
+ }
+
+ final Ftile diamond2;
+ if (tile1.calculateDimension(stringBounder).hasPointOut()
+ && tile2.calculateDimension(stringBounder).hasPointOut()) {
+ final Display out1 = LinkRendering.getDisplay(branch1.getFtile().getOutLinkRendering());
+ final TextBlock tbout1 = out1 == null ? null : TextBlockUtils.create(out1, fcArrow,
+ HorizontalAlignment.LEFT, ftileFactory, true);
+ final Display out2 = LinkRendering.getDisplay(branch2.getFtile().getOutLinkRendering());
+ final TextBlock tbout2 = out2 == null ? null : TextBlockUtils.create(out2, fcArrow,
+ HorizontalAlignment.LEFT, ftileFactory, true);
+ diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast(
+ tbout2);
+ } else {
+ diamond2 = new FtileEmpty(tile1.shadowing(), Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2,
+ swimlane, swimlane);
+ }
+ final FtileIf result = new FtileIf(diamond1, tile1, tile2, diamond2, arrowColor);
+
+ final List<Connection> conns = new ArrayList<Connection>();
+ conns.add(result.new ConnectionHorizontalThenVertical(tile1, branch1));
+ conns.add(result.new ConnectionHorizontalThenVertical(tile2, branch2));
+ if (tile1.calculateDimension(stringBounder).hasPointOut()
+ && tile2.calculateDimension(stringBounder).hasPointOut()) {
+ conns.add(result.new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColor(), branch1
+ .isEmpty()));
+ conns.add(result.new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColor(), branch2
+ .isEmpty()));
+ } else if (tile1.calculateDimension(stringBounder).hasPointOut()
+ && tile2.calculateDimension(stringBounder).hasPointOut() == false) {
+ conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColor(),
+ branch1.isEmpty()));
+ } else if (tile1.calculateDimension(stringBounder).hasPointOut() == false
+ && tile2.calculateDimension(stringBounder).hasPointOut()) {
+ conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColor(),
+ branch2.isEmpty()));
+ }
+ // return result;
+ return FtileUtils.addConnection(result, conns);
+ }
+
+ private HtmlColor getInColor(Branch branch) {
+ if (branch.isEmpty()) {
+ return LinkRendering.getColor(branch.getFtile().getOutLinkRendering(), arrowColor);
+ }
+ final LinkRendering linkIn = branch.getFtile().getInLinkRendering();
+ final HtmlColor color = linkIn == null ? arrowColor : linkIn.getColor();
+ return color;
+
+ }
+
+ class ConnectionHorizontalThenVertical extends AbstractConnection implements ConnectionTranslatable {
+
+ private final HtmlColor color;
+ private final UPolygon usingArrow;
+
+ public ConnectionHorizontalThenVertical(Ftile tile, Branch branch) {
+ super(diamond1, tile);
+ color = getInColor(branch);
+ usingArrow = branch.isEmpty() ? null : Arrows.asToDown();
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+ final double x1 = p1.getX();
+ final double y1 = p1.getY();
+ final double x2 = p2.getX();
+ final double y2 = p2.getY();
+
+ final Snake snake = new Snake(color, usingArrow);
+ snake.addPoint(x1, y1);
+ snake.addPoint(x2, y1);
+ snake.addPoint(x2, y2);
+
+ ug.draw(snake);
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ Point2D p1 = getP1(stringBounder);
+ Point2D p2 = getP2(stringBounder);
+ final Direction originalDirection = Direction.leftOrRight(p1, p2);
+ p1 = translate1.getTranslated(p1);
+ p2 = translate2.getTranslated(p2);
+ final Direction newDirection = Direction.leftOrRight(p1, p2);
+ if (originalDirection != newDirection) {
+ final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Diamond.diamondHalfSize;
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Snake small = new Snake(color);
+ small.addPoint(p1);
+ small.addPoint(p1.getX() + delta, p1.getY());
+ small.addPoint(p1.getX() + delta, p1.getY() + dimDiamond1.getHeight() * .75);
+ ug.draw(small);
+ p1 = small.getLast();
+ }
+ final Snake snake = new Snake(color, usingArrow);
+ snake.addPoint(p1);
+ snake.addPoint(p2.getX(), p1.getY());
+ snake.addPoint(p2);
+ ug.draw(snake);
+
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final double diamondWidth = dimDiamond1.getWidth();
+ final double x;
+ if (getFtile2() == tile1) {
+ x = 0;
+ } else if (getFtile2() == tile2) {
+ x = diamondWidth;
+ } else {
+ throw new IllegalStateException();
+ }
+ return getTranslateDiamond1(stringBounder)
+ .getTranslated(new Point2D.Double(x, dimDiamond1.getHeight() / 2));
+ }
+
+ private Point2D getP2(final StringBounder stringBounder) {
+ return translate(stringBounder).getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
+ }
+
+ private UTranslate translate(StringBounder stringBounder) {
+ if (getFtile2() == tile1) {
+ return getTranslate1(stringBounder);
+ }
+ if (getFtile2() == tile2) {
+ return getTranslate2(stringBounder);
+ }
+ throw new IllegalStateException();
+ }
+ }
+
+ class ConnectionVerticalThenHorizontal extends AbstractConnection implements ConnectionTranslatable {
+ private final HtmlColor myArrowColor;
+ private final boolean branchEmpty;
+
+ public ConnectionVerticalThenHorizontal(Ftile tile, HtmlColor myArrowColor, boolean branchEmpty) {
+ super(tile, diamond2);
+ this.myArrowColor = myArrowColor == null ? arrowColor : myArrowColor;
+ this.branchEmpty = branchEmpty;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return;
+ }
+ final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
+ final Point2D p2 = getP2(stringBounder);
+
+ final double x1 = p1.getX();
+ final double y1 = p1.getY();
+ final double x2 = p2.getX();
+ final double y2 = p2.getY();
+
+ final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
+ final Snake snake = new Snake(myArrowColor, arrow);
+ if (branchEmpty) {
+ snake.emphasizeDirection(Direction.DOWN);
+ }
+ snake.addPoint(x1, y1);
+ snake.addPoint(x1, y2);
+ snake.addPoint(x2, y2);
+
+ ug.draw(snake);
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return;
+ }
+ final Point2D p2 = getP2(stringBounder);
+ final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
+ final Direction originalDirection = Direction.leftOrRight(p1, p2);
+
+ final double x1 = p1.getX();
+ final double x2 = p2.getX();
+ final Point2D mp1a = translate1.getTranslated(p1);
+ final Point2D mp2b = translate2.getTranslated(p2);
+ final Direction newDirection = Direction.leftOrRight(mp1a, mp2b);
+ final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
+ if (originalDirection == newDirection) {
+ final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
+ final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY());
+ final Snake snake = new Snake(myArrowColor);
+ final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
+ snake.addPoint(mp1a);
+ snake.addPoint(mp1a.getX(), middle);
+ snake.addPoint(mp2bc.getX(), middle);
+ snake.addPoint(mp2bc);
+ ug.draw(snake);
+ final Snake small = new Snake(myArrowColor, arrow);
+ small.addPoint(mp2bc);
+ small.addPoint(mp2bc.getX(), mp2b.getY());
+ small.addPoint(mp2b);
+ ug.draw(small);
+ } else {
+ final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
+ final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta, mp2b.getY() - 3 * Diamond.diamondHalfSize);
+ final Snake snake = new Snake(myArrowColor);
+ snake.addPoint(mp1a);
+ snake.addPoint(mp1a.getX(), mp2bb.getY());
+ snake.addPoint(mp2bb);
+ ug.draw(snake);
+ final Snake small = new Snake(myArrowColor, arrow);
+ small.addPoint(mp2bb);
+ small.addPoint(mp2bb.getX(), mp2b.getY());
+ small.addPoint(mp2b);
+ ug.draw(small);
+
+ }
+
+ }
+
+ private Point2D getP2(StringBounder stringBounder) {
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final double diamondWidth = dimDiamond2.getWidth();
+ final double x;
+ if (getFtile1() == tile1) {
+ x = 0;
+ } else if (getFtile1() == tile2) {
+ x = diamondWidth;
+ } else {
+ throw new IllegalStateException();
+ }
+ return getTranslateDiamond2(stringBounder)
+ .getTranslated(new Point2D.Double(x, dimDiamond2.getHeight() / 2));
+ }
+
+ private UTranslate translate(StringBounder stringBounder) {
+ if (getFtile1() == tile1) {
+ return getTranslate1(stringBounder);
+ }
+ if (getFtile1() == tile2) {
+ return getTranslate2(stringBounder);
+ }
+ throw new IllegalStateException();
+ }
+ }
+
+ class ConnectionVerticalThenHorizontalDirect extends AbstractConnection implements ConnectionTranslatable {
+ private final HtmlColor myArrowColor;
+ private final boolean branchEmpty;
+
+ public ConnectionVerticalThenHorizontalDirect(Ftile tile, HtmlColor myArrowColor, boolean branchEmpty) {
+ super(tile, diamond2);
+ this.myArrowColor = myArrowColor == null ? arrowColor : myArrowColor;
+ this.branchEmpty = branchEmpty;
+ }
+
+ public void drawU(UGraphic ug) {
+
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+
+ final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return;
+ }
+ final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
+ final Point2D p2 = new Point2D.Double(getLeft(stringBounder), dimTotal.getHeight()
+ - Diamond.diamondHalfSize);
+
+ final double x1 = p1.getX();
+ final double y1 = p1.getY();
+ final double x2 = p2.getX();
+ final double y2 = p2.getY();
+
+ final Snake snake = new Snake(myArrowColor);
+ if (branchEmpty) {
+ snake.emphasizeDirection(Direction.DOWN);
+ }
+ snake.addPoint(x1, y1);
+ snake.addPoint(x1, y2);
+ snake.addPoint(x2, y2);
+ snake.addPoint(x2, dimTotal.getHeight());
+
+ ug.draw(snake);
+ }
+
+ private UTranslate translate(StringBounder stringBounder) {
+ if (getFtile1() == tile1) {
+ return getTranslate1(stringBounder);
+ }
+ if (getFtile1() == tile2) {
+ return getTranslate2(stringBounder);
+ }
+ throw new IllegalStateException();
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+
+ final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return;
+ }
+ final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
+ final Point2D p2 = new Point2D.Double(getLeft(stringBounder), dimTotal.getHeight()
+ - Diamond.diamondHalfSize);
+
+ final Point2D mp1a = translate1.getTranslated(p1);
+ final Point2D mp2b = translate2.getTranslated(p2);
+
+ final Snake snake = new Snake(myArrowColor);
+ // snake.emphasizeDirection(Direction.DOWN);
+
+ final double x1 = mp1a.getX();
+ final double x2 = mp2b.getX();
+ final double y2 = mp2b.getY();
+
+ snake.addPoint(mp1a);
+ snake.addPoint(x1, y2);
+ snake.addPoint(mp2b);
+ snake.addPoint(x2, dimTotal.getHeight());
+
+ ug.draw(snake);
+ }
+ }
+
+ private UTranslate getTranslate1(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dim1 = tile1.calculateDimension(stringBounder);
+
+ final double x1 = 0;
+ final double h = dimDiamond1.getHeight();
+ // final double y1 = (dimTotal.getHeight() - 2 * h - dim1.getHeight()) / 2 + h;
+ final double y1 = h * 1.9;
+ return new UTranslate(x1, y1);
+ }
+
+ private UTranslate getTranslate2(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dim2 = tile2.calculateDimension(stringBounder);
+
+ final double x2 = dimTotal.getWidth() - dim2.getWidth();
+ final double h = dimDiamond1.getHeight();
+ // final double y2 = (dimTotal.getHeight() - 2 * h - dim2.getHeight()) / 2 + h;
+ final double y2 = h * 1.9;
+ return new UTranslate(x2, y2);
+
+ }
+
+ private UTranslate getTranslateDiamond1(StringBounder stringBounder) {
+ final double y1 = 0;
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final double x1 = getLeft(stringBounder) - dimDiamond1.getWidth() / 2;
+ return new UTranslate(x1, y1);
+ }
+
+ private UTranslate getTranslateDiamond2(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final double y2 = dimTotal.getHeight() - dimDiamond2.getHeight();
+ final double x2 = getLeft(stringBounder) - dimDiamond2.getWidth() / 2;
+ return new UTranslate(x2, y2);
+ }
+
+ @Override
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == diamond1) {
+ return getTranslateDiamond1(stringBounder);
+ }
+ if (child == tile1) {
+ return getTranslate1(stringBounder);
+ }
+ if (child == tile2) {
+ return getTranslate2(stringBounder);
+ }
+ if (child == diamond2) {
+ return getTranslateDiamond2(stringBounder);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
+ ug.apply(getTranslate1(stringBounder)).draw(tile1);
+ ug.apply(getTranslate2(stringBounder)).draw(tile2);
+ ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ if (tile1.calculateDimension(stringBounder).hasPointOut()
+ || tile2.calculateDimension(stringBounder).hasPointOut()) {
+ return new FtileGeometry(dimTotal, getLeft(stringBounder), 0, dimTotal.getHeight());
+ }
+ return new FtileGeometry(dimTotal, getLeft(stringBounder), 0);
+ }
+
+ private Dimension2D calculateDimensionInternal;
+
+ private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
+ if (calculateDimensionInternal == null) {
+ calculateDimensionInternal = calculateDimensionInternalSlow(stringBounder);
+ }
+ return calculateDimensionInternal;
+ }
+
+ private Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder) {
+ final FtileGeometry dim1 = tile1.calculateDimension(stringBounder);
+ final FtileGeometry dim2 = tile2.calculateDimension(stringBounder);
+
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+
+ final double withInner = Math.max(dimDiamond1.getWidth(), (dim1.getWidth() - dim1.getLeft()) + dim2.getLeft()
+ + 10);
+ final double width = dim1.getLeft() + withInner + (dim2.getWidth() - dim2.getLeft());
+
+ final Dimension2D dim12 = Dimension2DDouble.mergeLR(dim1, dim2);
+
+ return new Dimension2DDouble(width + 30, dim12.getHeight() + dimDiamond1.getHeight() * 3 + 30);
+ }
+
+ private double getLeft(StringBounder stringBounder) {
+ final double left1 = tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft();
+ final double left2 = tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft();
+ return (left1 + left2) / 2;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java
new file mode 100644
index 0000000..9579bdd
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java
@@ -0,0 +1,319 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
+import net.sourceforge.plantuml.creole.CreoleParser;
+import net.sourceforge.plantuml.creole.Sheet;
+import net.sourceforge.plantuml.creole.SheetBlock1;
+import net.sourceforge.plantuml.creole.SheetBlock2;
+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.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+class FtileIfAndStop extends AbstractFtile {
+
+ private final Ftile tile1;
+ private final Ftile diamond1;
+ private final Ftile stop2;
+
+ private final HtmlColor arrowColor;
+
+ private FtileIfAndStop(Ftile diamond1, Ftile tile1, HtmlColor arrowColor, Ftile stopFtile) {
+ super(tile1.shadowing());
+ this.diamond1 = diamond1;
+ this.tile1 = tile1;
+ this.stop2 = stopFtile;
+
+ this.arrowColor = arrowColor;
+
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ if (getSwimlaneIn() != null) {
+ result.add(getSwimlaneIn());
+ }
+ result.addAll(tile1.getSwimlanes());
+ return Collections.unmodifiableSet(result);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return diamond1.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, UFont fontTest,
+ HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch nonStop,
+ ISkinParam skinParam, StringBounder stringBounder, Display labelTest) {
+
+ backColor = HtmlColorUtils.BLUE;
+
+ // final Ftile tileNonStop = new FtileMinWidth(nonStop.getFtile(), 30);
+ final Ftile tileNonStop = nonStop.getFtile();
+
+ final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null);
+
+ final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+ final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+
+ final Ftile stopFtile = ftileFactory.stop(swimlane);
+
+ // final TextBlock tb1 = TextBlockUtils.create(branch1.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
+ // ftileFactory);
+ // final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
+ // ftileFactory);
+
+ final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, false).createSheet(labelTest);
+ final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
+ final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));
+
+ final Ftile diamond1;
+ if (conditionStyle == ConditionStyle.INSIDE) {
+ diamond1 = new FtileDiamondInside(tileNonStop.shadowing(), backColor, borderColor, swimlane, tbTest);
+ // .withWest(tb1).withEast(tb2);
+ } else if (conditionStyle == ConditionStyle.DIAMOND) {
+ diamond1 = new FtileDiamond(tileNonStop.shadowing(), backColor, borderColor, swimlane).withNorth(tbTest);
+ // .withWest(tb1).withEast(tb2).withNorth(tbTest);
+ } else {
+ throw new IllegalStateException();
+ }
+
+ // final Ftile diamond2;
+ // if (tile1.calculateDimension(stringBounder).hasPointOut()
+ // && tile2.calculateDimension(stringBounder).hasPointOut()) {
+ // diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane);
+ // } else {
+ // diamond2 = new FtileEmpty(tile1.shadowing(), Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2,
+ // swimlane, swimlane);
+ // }
+ final FtileIfAndStop result = new FtileIfAndStop(diamond1, tileNonStop, arrowColor, stopFtile);
+
+ final List<Connection> conns = new ArrayList<Connection>();
+ conns.add(result.new ConnectionHorizontal(arrowColor));
+ // conns.add(result.new ConnectionHorizontalThenVertical(tile2));
+ // if (tile1.calculateDimension(stringBounder).hasPointOut()
+ // && tile2.calculateDimension(stringBounder).hasPointOut()) {
+ // conns.add(result.new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColor()));
+ // conns.add(result.new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColor()));
+ // } else if (tile1.calculateDimension(stringBounder).hasPointOut()
+ // && tile2.calculateDimension(stringBounder).hasPointOut() == false) {
+ // conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColor()));
+ // } else if (tile1.calculateDimension(stringBounder).hasPointOut() == false
+ // && tile2.calculateDimension(stringBounder).hasPointOut()) {
+ // conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColor()));
+ // }
+ return FtileUtils.addConnection(result, conns);
+ // return result;
+ }
+
+ private UTranslate getTranslate1(StringBounder stringBounder) {
+ // final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final FtileGeometry dimTotal = calculateDimension(stringBounder);
+ final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final FtileGeometry dim1 = tile1.calculateDimension(stringBounder);
+
+ final double x1 = calculateDimension(stringBounder).getLeft() - dim1.getLeft();
+ // final double y1 = (dimTotal.getHeight() - 2 * h - dim1.getHeight()) / 2 + h;
+ final double y1 = dimDiamond1.getHeight() + getSuppHeight();
+ return new UTranslate(x1, y1);
+ }
+
+ private int getSuppHeight() {
+ return 30;
+ }
+
+ private UTranslate getTranslateDiamond1(StringBounder stringBounder) {
+ final double y1 = 0;
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ // final double x1 = getLeft(stringBounder) - dimDiamond1.getWidth() / 2;
+ final double x1 = calculateDimension(stringBounder).getLeft() - dimDiamond1.getWidth() / 2;
+ return new UTranslate(x1, y1);
+ }
+
+ private UTranslate getTranslateStop(StringBounder stringBounder) {
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimStop = stop2.calculateDimension(stringBounder);
+ final double y1 = (dimDiamond1.getHeight() - dimStop.getHeight()) / 2;
+ final double x1 = calculateDimension(stringBounder).getLeft() + dimDiamond1.getWidth() / 2
+ + getDiamondStopDistance();
+ return new UTranslate(x1, y1);
+ }
+
+ private double getDiamondStopDistance() {
+ return 40;
+ }
+
+ class ConnectionHorizontal extends AbstractConnection {
+
+ private final HtmlColor color;
+
+ public ConnectionHorizontal(HtmlColor color) {
+ super(diamond1, stop2);
+ this.color = color;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+
+ final Snake snake = new Snake(color, Arrows.asToRight());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final Dimension2D dimDiamond1 = getFtile1().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(dimDiamond1.getWidth(), dimDiamond1.getHeight() / 2);
+
+ return getTranslateDiamond1(stringBounder).getTranslated(p);
+ }
+
+ private Point2D getP2(StringBounder stringBounder) {
+ final Dimension2D dimStop = getFtile2().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(0, dimStop.getHeight() / 2);
+ return getTranslateStop(stringBounder).getTranslated(p);
+ }
+
+ }
+
+ @Override
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == diamond1) {
+ return getTranslateDiamond1(stringBounder);
+ }
+ if (child == tile1) {
+ return getTranslate1(stringBounder);
+ }
+ // if (child == tile2) {
+ // return getTranslate2(stringBounder);
+ // }
+ // if (child == diamond2) {
+ // return getTranslateDiamond2(stringBounder);
+ // }
+ throw new UnsupportedOperationException();
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
+ ug.apply(getTranslate1(stringBounder)).draw(tile1);
+ ug.apply(getTranslateStop(stringBounder)).draw(stop2);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dimStop2 = stop2.calculateDimension(stringBounder);
+ final FtileGeometry dim1 = tile1.calculateDimension(stringBounder).addDim(0,
+ getDiamondStopDistance() + dimStop2.getWidth());
+ final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ return dimDiamond1.appendBottom(dim1).addDim(0, getSuppHeight());
+
+ // final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ // if (tile1.calculateDimension(stringBounder).hasPointOut()) {
+ // return new FtileGeometry(dimTotal, getLeft(stringBounder), 0, dimTotal.getHeight());
+ // }
+ // return new FtileGeometry(dimTotal, getLeft(stringBounder), 0);
+ }
+
+ // private Dimension2D calculateDimensionInternal;
+ //
+ // private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
+ // if (calculateDimensionInternal == null) {
+ // calculateDimensionInternal = calculateDimensionInternalSlow(stringBounder);
+ // }
+ // return calculateDimensionInternal;
+ // }
+ //
+ // private Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder) {
+ // final Dimension2D dim1 = tile1.calculateDimension(stringBounder);
+ // final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ // final Dimension2D dimStop2 = stop2.calculateDimension(stringBounder);
+ // final double width = Math.max(dim1.getWidth(),
+ // dimDiamond1.getWidth() + getDiamondStopDistance() + dimStop2.getWidth());
+ // return new Dimension2DDouble(width + 30, dim1.getHeight() + dimDiamond1.getHeight() + 40);
+ // }
+ //
+ // private double getLeft(StringBounder stringBounder) {
+ // // return calculateDimension(stringBounder).getLeft();
+ // return tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft();
+ // // final double left1 =
+ // tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft();
+ // // // final double left2 =
+ // // // tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft();
+ // // // return (left1 + left2) / 2;
+ // // return left1;
+ // }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong.java
new file mode 100644
index 0000000..26b0ead
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong.java
@@ -0,0 +1,516 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
+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.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+class FtileIfLong extends AbstractFtile {
+
+ private final double xSeparation = 20;
+
+ private final List<Ftile> tiles;
+ private final Ftile tile2;
+ private final List<Ftile> diamonds;
+
+ private final HtmlColor arrowColor;
+
+ private FtileIfLong(List<Ftile> diamonds, List<Ftile> tiles, Ftile tile2, HtmlColor arrowColor) {
+ super(tiles.get(0).shadowing() || tile2.shadowing());
+ this.diamonds = diamonds;
+ this.tiles = tiles;
+ this.tile2 = tile2;
+
+ this.arrowColor = arrowColor;
+
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ if (getSwimlaneIn() != null) {
+ result.add(getSwimlaneIn());
+ }
+ for (Ftile tile : tiles) {
+ result.addAll(tile.getSwimlanes());
+ }
+ result.addAll(tile2.getSwimlanes());
+ return Collections.unmodifiableSet(result);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return diamonds.get(0).getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont font,
+ HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens,
+ Branch branch2, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
+
+ final List<Ftile> tiles = new ArrayList<Ftile>();
+
+ for (Branch branch : thens) {
+ tiles.add(new FtileMinWidth(branch.getFtile(), 30));
+ }
+
+ final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30);
+
+ final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor,
+ useUnderlineForHyperlink);
+
+ final List<Ftile> diamonds = new ArrayList<Ftile>();
+ final List<Connection> conns = new ArrayList<Connection>();
+ for (Branch branch : thens) {
+ final TextBlock tb1 = TextBlockUtils.create(branch.getLabelPositive(), fc, HorizontalAlignment.LEFT,
+ ftileFactory);
+ final TextBlock tbTest = TextBlockUtils.create(branch.getLabelTest(), fc, HorizontalAlignment.LEFT,
+ ftileFactory);
+ FtileDiamondInside diamond = new FtileDiamondInside(branch.shadowing(), backColor, borderColor, swimlane,
+ tbTest);
+ diamond = diamond.withNorth(tb1);
+ diamonds.add(diamond);
+ }
+
+ final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fc, HorizontalAlignment.LEFT,
+ ftileFactory);
+ final int last = diamonds.size() - 1;
+ diamonds.set(last, ((FtileDiamondInside) diamonds.get(last)).withEast(tb2));
+
+ final FtileIfLong result = new FtileIfLong(diamonds, tiles, tile2, arrowColor);
+
+ for (int i = 0; i < thens.size(); i++) {
+ final Ftile ftile = tiles.get(i);
+ final Ftile diam = diamonds.get(i);
+
+ final HtmlColor color = thens.get(i).getInlinkRenderingColor();
+ conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color));
+ conns.add(result.new ConnectionVerticalOut(ftile, arrowColor));
+ }
+
+ for (int i = 0; i < diamonds.size() - 1; i++) {
+ final Ftile diam1 = diamonds.get(i);
+ final Ftile diam2 = diamonds.get(i + 1);
+ conns.add(result.new ConnectionHorizontal(diam1, diam2, arrowColor));
+ }
+ conns.add(result.new ConnectionIn(arrowColor));
+ conns.add(result.new ConnectionLastElseIn(arrowColor));
+ conns.add(result.new ConnectionLastElseOut(arrowColor));
+ conns.add(result.new ConnectionHline(arrowColor));
+
+ return FtileUtils.addConnection(result, conns);
+ }
+
+ class ConnectionHorizontal extends AbstractConnection {
+
+ private final HtmlColor color;
+
+ public ConnectionHorizontal(Ftile diam1, Ftile diam2, HtmlColor color) {
+ super(diam1, diam2);
+ this.color = color;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+
+ final Snake snake = new Snake(color, Arrows.asToRight());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(dimDiamond1.getWidth(), dimDiamond1.getOutY() / 2);
+
+ return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ private Point2D getP2(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = getFtile2().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(0, dimDiamond1.getOutY() / 2);
+ return getTranslateDiamond1(getFtile2(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ class ConnectionIn extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionIn(HtmlColor arrowColor) {
+ super(null, diamonds.get(0));
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final UTranslate tr = getTranslateDiamond1(getFtile2(), ug.getStringBounder());
+ final Point2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn());
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ final Point2D p1 = calculateDimension(ug.getStringBounder()).getPointIn();
+
+ snake.addPoint(p1);
+ snake.addPoint(p2.getX(), p1.getY());
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ }
+
+ class ConnectionLastElseIn extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionLastElseIn(HtmlColor arrowColor) {
+ super(diamonds.get(diamonds.size() - 1), tile2);
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final Point2D p1 = getP1(ug.getStringBounder());
+ final UTranslate tr2 = getTranslate2(ug.getStringBounder());
+ final Point2D p2 = tr2.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn());
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2.getX(), p1.getY());
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(dimDiamond1.getWidth(), dimDiamond1.getOutY() / 2);
+ return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ class ConnectionLastElseOut extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionLastElseOut(HtmlColor arrowColor) {
+ super(tile2, null);
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final UTranslate tr1 = getTranslate2(stringBounder);
+ final FtileGeometry dim = getFtile1().calculateDimension(stringBounder);
+ if (dim.hasPointOut() == false) {
+ return;
+ }
+ final Point2D p1 = tr1.getTranslated(dim.getPointOut());
+ final double totalHeight = calculateDimensionInternal(stringBounder).getHeight();
+ final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ }
+
+ class ConnectionVerticalIn extends AbstractConnection {
+
+ private final HtmlColor color;
+
+ public ConnectionVerticalIn(Ftile diamond, Ftile tile, HtmlColor color) {
+ super(diamond, tile);
+ this.color = color;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+
+ final Snake snake = new Snake(color, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final Point2D p = getFtile1().calculateDimension(stringBounder).getPointOut();
+ return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ private Point2D getP2(StringBounder stringBounder) {
+ final Point2D p = getFtile2().calculateDimension(stringBounder).getPointIn();
+ return getTranslate1(getFtile2(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ class ConnectionVerticalOut extends AbstractConnection {
+
+ private final HtmlColor color;
+
+ public ConnectionVerticalOut(Ftile tile, HtmlColor color) {
+ super(tile, null);
+ this.color = color;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final double totalHeight = calculateDimensionInternal(stringBounder).getHeight();
+ final Point2D p1 = getP1(stringBounder);
+ if (p1 == null) {
+ return;
+ }
+ final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
+
+ final Snake snake = new Snake(color, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return null;
+ }
+ final Point2D p = geo.getPointOut();
+ return getTranslate1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ class ConnectionHline extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionHline(HtmlColor arrowColor) {
+ super(null, null);
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
+
+ final List<Ftile> all = new ArrayList<Ftile>(tiles);
+ all.add(tile2);
+ double minX = totalDim.getWidth() / 2;
+ double maxX = totalDim.getWidth() / 2;
+ for (Ftile tmp : all) {
+ if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
+ continue;
+ }
+ final UTranslate ut = getTranslateFor(tmp, stringBounder);
+ final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
+ minX = Math.min(minX, out);
+ maxX = Math.max(maxX, out);
+ }
+
+ final Snake s = new Snake(arrowColor);
+ s.goUnmergeable();
+ final double height = totalDim.getHeight();
+ s.addPoint(minX, height);
+ s.addPoint(maxX, height);
+ ug.draw(s);
+ }
+ }
+
+ @Override
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == tile2) {
+ return getTranslate2(stringBounder);
+ }
+ if (tiles.contains(child)) {
+ return getTranslate1(child, stringBounder);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ private UTranslate getTranslate2(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dim2 = tile2.calculateDimension(stringBounder);
+
+ final double x2 = dimTotal.getWidth() - dim2.getWidth();
+
+ final double h = getAllDiamondsHeight(stringBounder);
+ final double y2 = (dimTotal.getHeight() - h * 2 - dim2.getHeight()) / 2 + h;
+
+ return new UTranslate(x2, y2);
+
+ }
+
+ private UTranslate getTranslateDiamond1(Ftile diamond1, StringBounder stringBounder) {
+ double x1 = 0;
+
+ for (Ftile diamond : diamonds) {
+ final FtileGeometry dim1 = dimDiamondAndTile(stringBounder, diamond);
+ if (diamond == diamond1) {
+ final FtileGeometry dimDiamond = diamond.calculateDimension(stringBounder);
+ double xresult = x1 + dim1.getLeft() - dimDiamond.getLeft();
+ return new UTranslate(xresult, 25);
+ }
+ x1 += dim1.getWidth() + xSeparation;
+ }
+ throw new IllegalArgumentException();
+
+ }
+
+ private UTranslate getTranslate1(Ftile tile1, StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ double x1 = 0;
+
+ for (Ftile tile : tiles) {
+ final Dimension2D dim1 = dimDiamondAndTile(stringBounder, tile);
+ if (tile == tile1) {
+ final Dimension2D dimTile = tile.calculateDimension(stringBounder);
+ final double h = getAllDiamondsHeight(stringBounder);
+ final double y1 = (dimTotal.getHeight() - 2 * h - dimTile.getHeight()) / 2 + h;
+ return new UTranslate(x1 + (dim1.getWidth() - dimTile.getWidth()) / 2, y1);
+ }
+ x1 += dim1.getWidth() + xSeparation;
+ }
+ throw new IllegalArgumentException();
+
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ for (Ftile tile : tiles) {
+ ug.apply(getTranslate1(tile, stringBounder)).draw(tile);
+ }
+ for (Ftile diamond : diamonds) {
+ ug.apply(getTranslateDiamond1(diamond, stringBounder)).draw(diamond);
+ }
+
+ ug.apply(getTranslate2(stringBounder)).draw(tile2);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+
+ final List<Ftile> all = new ArrayList<Ftile>(tiles);
+ all.add(tile2);
+ for (Ftile tmp : all) {
+ if (tmp.calculateDimension(stringBounder).hasPointOut()) {
+ return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
+ }
+ }
+ return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0);
+
+ }
+
+ private FtileGeometry dimDiamondAndTile(StringBounder stringBounder, Ftile tileOrDiamond) {
+ for (int i = 0; i < tiles.size(); i++) {
+ final Ftile tile = tiles.get(i);
+ final Ftile diamond = diamonds.get(i);
+ if (tile != tileOrDiamond && diamond != tileOrDiamond) {
+ continue;
+ }
+ final FtileGeometry dimTile = tile.calculateDimension(stringBounder);
+ final FtileGeometry dimDiamond = diamond.calculateDimension(stringBounder);
+ return dimDiamond.appendBottom(dimTile);
+ }
+ throw new UnsupportedOperationException();
+
+ }
+
+ private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
+ Dimension2D dimOnlyTiles = new Dimension2DDouble(0, 0);
+ Dimension2D dimOnlyDiamond = new Dimension2DDouble(0, 0);
+ Dimension2D dimBoth = new Dimension2DDouble(0, 0);
+ for (int i = 0; i < tiles.size(); i++) {
+ final Ftile tile = tiles.get(i);
+ final Ftile diamond = diamonds.get(i);
+ final FtileGeometry dimTile = tile.calculateDimension(stringBounder);
+ final FtileGeometry dimDiamond = diamond.calculateDimension(stringBounder);
+ final FtileGeometry both = dimDiamond.appendBottom(dimTile);
+ dimOnlyTiles = Dimension2DDouble.mergeLR(dimOnlyTiles, dimTile);
+ dimOnlyDiamond = Dimension2DDouble.mergeLR(dimOnlyDiamond, dimDiamond);
+ dimBoth = Dimension2DDouble.mergeLR(dimBoth, both);
+ }
+ final FtileGeometry dimTile2 = tile2.calculateDimension(stringBounder);
+ dimOnlyTiles = Dimension2DDouble.mergeLR(dimOnlyTiles, dimTile2);
+ dimBoth = Dimension2DDouble.mergeLR(dimBoth, dimTile2);
+
+ final Dimension2D result = new Dimension2DDouble(dimBoth.getWidth(), dimOnlyDiamond.getHeight() * 4
+ + dimOnlyTiles.getHeight());
+ return Dimension2DDouble.delta(result, xSeparation * tiles.size(), 40);
+ }
+
+ private double getAllDiamondsHeight(StringBounder stringBounder) {
+ Dimension2D dimOnlyDiamond = new Dimension2DDouble(0, 0);
+ for (Ftile diamond : diamonds) {
+ final Dimension2D dimDiamond = diamond.calculateDimension(stringBounder);
+ dimOnlyDiamond = Dimension2DDouble.mergeLR(dimOnlyDiamond, dimDiamond);
+ }
+ return dimOnlyDiamond.getHeight();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java
new file mode 100644
index 0000000..1aaecbc
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java
@@ -0,0 +1,511 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
+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.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+class FtileIfLong2 extends AbstractFtile {
+
+ private final double xSeparation = 20;
+
+ private final List<Ftile> tiles;
+ private final Ftile tile2;
+ private final List<Ftile> diamonds;
+ private final List<Ftile> couples = new ArrayList<Ftile>();
+
+ private final HtmlColor arrowColor;
+
+ private FtileIfLong2(List<Ftile> diamonds, List<Ftile> tiles, Ftile tile2, HtmlColor arrowColor) {
+ super(tiles.get(0).shadowing() || tile2.shadowing());
+ if (diamonds.size() != tiles.size()) {
+ throw new IllegalArgumentException();
+ }
+ for (int i = 0; i < diamonds.size(); i++) {
+ couples.add(new FtileAssemblySimple(diamonds.get(i), tiles.get(i)));
+ }
+ this.tile2 = tile2;
+ this.diamonds = new ArrayList<Ftile>(diamonds);
+ this.tiles = new ArrayList<Ftile>(tiles);
+
+ this.arrowColor = arrowColor;
+
+ }
+
+ private static List<Ftile> alignDiamonds(List<Ftile> diamonds, StringBounder stringBounder) {
+ double maxOutY = 0;
+ for (Ftile diamond : diamonds) {
+ maxOutY = Math.max(maxOutY, diamond.calculateDimension(stringBounder).getOutY());
+ }
+ final List<Ftile> result = new ArrayList<Ftile>();
+ for (int i = 0; i < diamonds.size(); i++) {
+ Ftile diamond = diamonds.get(i);
+ final double missing = maxOutY - diamond.calculateDimension(stringBounder).getOutY();
+ assert missing >= 0;
+ diamond = FtileUtils.addVerticalMargin(diamond, missing / 2, 20);
+ result.add(diamond);
+ }
+ return result;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ if (getSwimlaneIn() != null) {
+ result.add(getSwimlaneIn());
+ }
+ for (Ftile tile : couples) {
+ result.addAll(tile.getSwimlanes());
+ }
+ result.addAll(tile2.getSwimlanes());
+ return Collections.unmodifiableSet(result);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return couples.get(0).getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont font,
+ HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens,
+ Branch branch2, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
+
+ final List<Ftile> tiles = new ArrayList<Ftile>();
+
+ for (Branch branch : thens) {
+ tiles.add(new FtileMinWidth(branch.getFtile(), 30));
+ }
+
+ final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30);
+
+ final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor,
+ useUnderlineForHyperlink);
+
+ List<Ftile> diamonds = new ArrayList<Ftile>();
+ final List<Connection> conns = new ArrayList<Connection>();
+ for (Branch branch : thens) {
+ final TextBlock tb1 = TextBlockUtils.create(branch.getLabelPositive(), fc, HorizontalAlignment.LEFT,
+ ftileFactory);
+ final TextBlock tbTest = TextBlockUtils.create(branch.getLabelTest(), fc, HorizontalAlignment.LEFT,
+ ftileFactory);
+ FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.shadowing(), backColor, borderColor, swimlane,
+ tbTest);
+ diamond = diamond.withNorth(tb1);
+ diamonds.add(diamond);
+ }
+
+ final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fc, HorizontalAlignment.LEFT,
+ ftileFactory);
+ final int last = diamonds.size() - 1;
+ diamonds.set(last, ((FtileDiamondInside2) diamonds.get(last)).withEast(tb2));
+
+ diamonds = alignDiamonds(diamonds, ftileFactory.getStringBounder());
+
+ final FtileIfLong2 result = new FtileIfLong2(diamonds, tiles, tile2, arrowColor);
+
+ for (int i = 0; i < thens.size(); i++) {
+ final Ftile ftile = tiles.get(i);
+ final Ftile diam = diamonds.get(i);
+
+ final HtmlColor color = thens.get(i).getInlinkRenderingColor();
+ conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color));
+ conns.add(result.new ConnectionVerticalOut(ftile, arrowColor));
+ }
+
+ for (int i = 0; i < diamonds.size() - 1; i++) {
+ final Ftile diam1 = diamonds.get(i);
+ final Ftile diam2 = diamonds.get(i + 1);
+ conns.add(result.new ConnectionHorizontal(diam1, diam2, arrowColor));
+ }
+ conns.add(result.new ConnectionIn(arrowColor));
+ conns.add(result.new ConnectionLastElseIn(arrowColor));
+ conns.add(result.new ConnectionLastElseOut(arrowColor));
+ conns.add(result.new ConnectionHline(arrowColor));
+
+ return FtileUtils.addConnection(result, conns);
+ }
+
+ class ConnectionHorizontal extends AbstractConnection {
+
+ private final HtmlColor color;
+
+ public ConnectionHorizontal(Ftile diam1, Ftile diam2, HtmlColor color) {
+ super(diam1, diam2);
+ this.color = color;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+
+ final Snake snake = new Snake(color, Arrows.asToRight());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, getYdiamontOutToLeft(dimDiamond1,
+ stringBounder));
+
+ return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ private Point2D getP2(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = getFtile2().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(0, getYdiamontOutToLeft(dimDiamond1, stringBounder));
+ return getTranslateDiamond1(getFtile2(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ static private double getYdiamontOutToLeft(FtileGeometry dimDiamond1, StringBounder stringBounder) {
+ return (dimDiamond1.getInY() + dimDiamond1.getOutY()) / 2;
+ }
+
+ class ConnectionIn extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionIn(HtmlColor arrowColor) {
+ super(null, diamonds.get(0));
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final UTranslate tr = getTranslateDiamond1(getFtile2(), ug.getStringBounder());
+ final Point2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn());
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ final Point2D p1 = calculateDimensionInternal(ug.getStringBounder()).getPointIn();
+
+ snake.addPoint(p1);
+ snake.addPoint(p2.getX(), p1.getY());
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ }
+
+ class ConnectionLastElseIn extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionLastElseIn(HtmlColor arrowColor) {
+ super(diamonds.get(diamonds.size() - 1), tile2);
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final Point2D p1 = getP1(ug.getStringBounder());
+ final UTranslate tr2 = getTranslate2(ug.getStringBounder());
+ final Point2D p2 = tr2.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn());
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2.getX(), p1.getY());
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder);
+ final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, getYdiamontOutToLeft(dimDiamond1,
+ stringBounder));
+ return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ class ConnectionLastElseOut extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionLastElseOut(HtmlColor arrowColor) {
+ super(tile2, null);
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final UTranslate tr1 = getTranslate2(stringBounder);
+ final FtileGeometry dim = getFtile1().calculateDimension(stringBounder);
+ if (dim.hasPointOut() == false) {
+ return;
+ }
+ final Point2D p1 = tr1.getTranslated(dim.getPointOut());
+ final double totalHeight = calculateDimensionInternal(stringBounder).getHeight();
+ final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ }
+
+ class ConnectionVerticalIn extends AbstractConnection {
+
+ private final HtmlColor color;
+
+ public ConnectionVerticalIn(Ftile diamond, Ftile tile, HtmlColor color) {
+ super(diamond, tile);
+ this.color = color;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+
+ final Snake snake = new Snake(color, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final Point2D p = getFtile1().calculateDimension(stringBounder).getPointOut();
+ return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ private Point2D getP2(StringBounder stringBounder) {
+ final Point2D p = getFtile2().calculateDimension(stringBounder).getPointIn();
+ return getTranslate1(getFtile2(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ class ConnectionVerticalOut extends AbstractConnection {
+
+ private final HtmlColor color;
+
+ public ConnectionVerticalOut(Ftile tile, HtmlColor color) {
+ super(tile, null);
+ this.color = color;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final double totalHeight = calculateDimensionInternal(stringBounder).getHeight();
+ final Point2D p1 = getP1(stringBounder);
+ if (p1 == null) {
+ return;
+ }
+ final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
+
+ final Snake snake = new Snake(color, Arrows.asToDown());
+ snake.addPoint(p1);
+ snake.addPoint(p2);
+ ug.draw(snake);
+ }
+
+ private Point2D getP1(StringBounder stringBounder) {
+ final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return null;
+ }
+ final Point2D p = geo.getPointOut();
+ return getTranslate1(getFtile1(), stringBounder).getTranslated(p);
+ }
+
+ }
+
+ class ConnectionHline extends AbstractConnection {
+
+ private final HtmlColor arrowColor;
+
+ public ConnectionHline(HtmlColor arrowColor) {
+ super(null, null);
+ this.arrowColor = arrowColor;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
+
+ final List<Ftile> all = new ArrayList<Ftile>(couples);
+ all.add(tile2);
+ double minX = totalDim.getWidth() / 2;
+ double maxX = totalDim.getWidth() / 2;
+ for (Ftile tmp : all) {
+ if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
+ continue;
+ }
+ final UTranslate ut = getTranslateFor(tmp, stringBounder);
+ final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
+ minX = Math.min(minX, out);
+ maxX = Math.max(maxX, out);
+ }
+
+ final Snake s = new Snake(arrowColor);
+ s.goUnmergeable();
+ final double height = totalDim.getHeight();
+ s.addPoint(minX, height);
+ s.addPoint(maxX, height);
+ ug.draw(s);
+ }
+ }
+
+ @Override
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == tile2) {
+ return getTranslate2(stringBounder);
+ }
+ if (couples.contains(child)) {
+ return getTranslateCouple1(child, stringBounder);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ private UTranslate getTranslate2(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dim2 = tile2.calculateDimension(stringBounder);
+
+ final double x2 = dimTotal.getWidth() - dim2.getWidth();
+
+ final double h = 0; // getAllDiamondsHeight(stringBounder);
+ final double y2 = (dimTotal.getHeight() - h * 2 - dim2.getHeight()) / 2 + h;
+
+ return new UTranslate(x2, y2);
+
+ }
+
+ private UTranslate getTranslateDiamond1(Ftile diamond, StringBounder stringBounder) {
+ final int idx = diamonds.indexOf(diamond);
+ if (idx == -1) {
+ throw new IllegalArgumentException();
+ }
+ final UTranslate trCouple = getTranslateCouple1(couples.get(idx), stringBounder);
+ final UTranslate in = couples.get(idx).getTranslateFor(diamond, stringBounder);
+ return trCouple.compose(in);
+ }
+
+ public UTranslate getTranslate1(Ftile tile, StringBounder stringBounder) {
+ final int idx = tiles.indexOf(tile);
+ if (idx == -1) {
+ throw new IllegalArgumentException();
+ }
+ final UTranslate trCouple = getTranslateCouple1(couples.get(idx), stringBounder);
+ final UTranslate in = couples.get(idx).getTranslateFor(tile, stringBounder);
+ return trCouple.compose(in);
+ }
+
+ private UTranslate getTranslateCouple1(Ftile candidat, StringBounder stringBounder) {
+ double x1 = 0;
+
+ for (Ftile couple : couples) {
+ final FtileGeometry dim1 = couple.calculateDimension(stringBounder);
+ if (couple == candidat) {
+ return new UTranslate(x1, 25);
+ }
+ x1 += dim1.getWidth() + xSeparation;
+ }
+ throw new IllegalArgumentException();
+
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ for (Ftile couple : couples) {
+ ug.apply(getTranslateCouple1(couple, stringBounder)).draw(couple);
+ }
+
+ ug.apply(getTranslate2(stringBounder)).draw(tile2);
+ }
+
+ private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
+ Dimension2D result = new Dimension2DDouble(0, 0);
+ for (Ftile couple : couples) {
+ result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder));
+ }
+ final FtileGeometry dimTile2 = tile2.calculateDimension(stringBounder);
+ result = Dimension2DDouble.mergeLR(result, dimTile2);
+ result = Dimension2DDouble.delta(result, xSeparation * couples.size(), 100);
+
+ return new FtileGeometry(result, result.getWidth() / 2, 0);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+
+ final List<Ftile> all = new ArrayList<Ftile>(tiles);
+ all.add(tile2);
+ for (Ftile tmp : all) {
+ if (tmp.calculateDimension(stringBounder).hasPointOut()) {
+ return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
+ }
+ }
+ return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0);
+
+ }
+
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
new file mode 100644
index 0000000..c98280f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
@@ -0,0 +1,369 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.Direction;
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondFoo1;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
+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.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+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.UTranslate;
+
+class FtileRepeat extends AbstractFtile {
+
+ private final Ftile repeat;
+ private final Ftile diamond1;
+ private final Ftile diamond2;
+ private final TextBlock tbTest;
+
+ private FtileRepeat(Ftile repeat, Ftile diamond1, Ftile diamond2, TextBlock tbTest) {
+ super(repeat.shadowing());
+ this.repeat = repeat;
+ this.diamond1 = diamond1;
+ this.diamond2 = diamond2;
+ this.tbTest = tbTest;
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return repeat.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return repeat.getSwimlanes();
+ }
+
+ public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Ftile repeat, Display test,
+ Display yes, Display out, HtmlColor borderColor, HtmlColor backColor, UFont fontTest, HtmlColor arrowColor,
+ HtmlColor endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer,
+ HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
+
+ final FontConfiguration fc = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor,
+ useUnderlineForHyperlink);
+ final TextBlock tbTest = TextBlockUtils.create(test, fc, HorizontalAlignment.LEFT, spriteContainer);
+ final TextBlock yesTb = TextBlockUtils.create(yes, fc, HorizontalAlignment.LEFT, spriteContainer);
+ final TextBlock outTb = TextBlockUtils.create(out, fc, HorizontalAlignment.LEFT, spriteContainer);
+
+ final Ftile diamond1 = new FtileDiamond(repeat.shadowing(), backColor, borderColor, swimlane);
+ final FtileRepeat result;
+ if (conditionStyle == ConditionStyle.INSIDE) {
+ final Ftile diamond2 = new FtileDiamondInside(repeat.shadowing(), backColor, borderColor, swimlane, tbTest)
+ .withEast(yesTb).withSouth(outTb);
+ result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0));
+ } else if (conditionStyle == ConditionStyle.DIAMOND) {
+ final Ftile diamond2 = new FtileDiamond(repeat.shadowing(), backColor, borderColor, swimlane)
+ .withEast(tbTest);
+ result = new FtileRepeat(repeat, diamond1, diamond2, tbTest);
+ } else if (conditionStyle == ConditionStyle.FOO1) {
+ final Ftile diamond2 = new FtileDiamondFoo1(repeat.shadowing(), backColor, borderColor, swimlane, tbTest);
+ result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0));
+ } else {
+ throw new IllegalStateException();
+ }
+
+ final List<Connection> conns = new ArrayList<Connection>();
+ final Display in1 = LinkRendering.getDisplay(repeat.getInLinkRendering());
+ final TextBlock tbin1 = in1 == null ? null : TextBlockUtils.create(in1, fc, HorizontalAlignment.LEFT,
+ spriteContainer, true);
+ conns.add(result.new ConnectionIn(LinkRendering.getColor(repeat.getInLinkRendering(), arrowColor), tbin1));
+
+ final Display backLink1 = LinkRendering.getDisplay(backRepeatLinkRendering);
+ final TextBlock tbbackLink1 = backLink1 == null ? null : TextBlockUtils.create(backLink1, fc,
+ HorizontalAlignment.LEFT, spriteContainer, true);
+ conns.add(result.new ConnectionBack(LinkRendering.getColor(backRepeatLinkRendering, arrowColor), tbbackLink1));
+
+ final Display out1 = LinkRendering.getDisplay(repeat.getOutLinkRendering());
+ final TextBlock tbout1 = out1 == null ? null : TextBlockUtils.create(out1, fc, HorizontalAlignment.LEFT,
+ spriteContainer, true);
+ conns.add(result.new ConnectionOut(LinkRendering.getColor(endRepeatLinkColor, arrowColor), tbout1));
+ return FtileUtils.addConnection(result, conns);
+ }
+
+ class ConnectionIn extends AbstractConnection {
+ private final HtmlColor arrowColor;
+ private final TextBlock tbin;
+
+ public ConnectionIn(HtmlColor arrowColor, TextBlock tbin) {
+ super(diamond1, repeat);
+ this.arrowColor = arrowColor;
+ this.tbin = tbin;
+ }
+
+ private Point2D getP1(final StringBounder stringBounder) {
+ return getFtile1().calculateDimension(stringBounder).translate(getTranslateDiamond1(stringBounder))
+ .getPointOut();
+ }
+
+ private Point2D getP2(final StringBounder stringBounder) {
+ return getFtile2().calculateDimension(stringBounder).translate(getTranslateForRepeat(stringBounder))
+ .getPointIn();
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ snake.setLabel(tbin);
+ snake.addPoint(getP1(stringBounder));
+ snake.addPoint(getP2(stringBounder));
+
+ ug.draw(snake);
+ }
+ }
+
+ class ConnectionOut extends AbstractConnection implements ConnectionTranslatable {
+ private final HtmlColor arrowColor;
+ private final TextBlock tbout;
+
+ public ConnectionOut(HtmlColor arrowColor, TextBlock tbout) {
+ super(repeat, diamond2);
+ this.arrowColor = arrowColor;
+ this.tbout = tbout;
+ }
+
+ private Point2D getP1(final StringBounder stringBounder) {
+ return getTranslateForRepeat(stringBounder).getTranslated(
+ getFtile1().calculateDimension(stringBounder).getPointOut());
+ }
+
+ private Point2D getP2(final StringBounder stringBounder) {
+ return getTranslateDiamond2(stringBounder).getTranslated(
+ getFtile2().calculateDimension(stringBounder).getPointIn());
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ snake.setLabel(tbout);
+ snake.addPoint(getP1(stringBounder));
+ snake.addPoint(getP2(stringBounder));
+
+ ug.draw(snake);
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Snake snake = new Snake(arrowColor);
+ snake.setLabel(tbout);
+ final Point2D mp1a = translate1.getTranslated(getP1(stringBounder));
+ final Point2D mp2b = translate2.getTranslated(getP2(stringBounder));
+ final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
+ snake.addPoint(mp1a);
+ snake.addPoint(mp1a.getX(), middle);
+ snake.addPoint(mp2b.getX(), middle);
+ // snake.addPoint(mp2b);
+ ug.draw(snake);
+
+ final Snake small = new Snake(arrowColor, Arrows.asToDown());
+ small.addPoint(mp2b.getX(), middle);
+ small.addPoint(mp2b);
+ ug.draw(small);
+
+ }
+
+ }
+
+ class ConnectionBack extends AbstractConnection {
+ private final HtmlColor arrowColor;
+ private final TextBlock tbback;
+
+ public ConnectionBack(HtmlColor arrowColor, TextBlock tbback) {
+ super(diamond2, repeat);
+ this.arrowColor = arrowColor;
+ this.tbback = tbback;
+ }
+
+ private Point2D getP1(final StringBounder stringBounder) {
+ return getTranslateDiamond2(stringBounder).getTranslated(new Point2D.Double(0, 0));
+ }
+
+ private Point2D getP2(final StringBounder stringBounder) {
+ return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0));
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToLeft());
+ snake.setLabel(tbback);
+ snake.emphasizeDirection(Direction.UP);
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final double x1 = p1.getX() + dimDiamond2.getWidth();
+ final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
+ final double x2 = p2.getX() + dimDiamond1.getWidth();
+ final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
+
+ snake.addPoint(x1, y1);
+ final double yy = dimTotal.getWidth() - Diamond.diamondHalfSize;
+ snake.addPoint(yy, y1);
+ snake.addPoint(yy, y2);
+ snake.addPoint(x2, y2);
+
+ ug.draw(snake);
+ // ug = ug.apply(new UChangeColor(arrowColor)).apply(new UChangeBackColor(arrowColor));
+ // ug.apply(new UTranslate(yy, dimTotal.getHeight() / 2)).draw(Arrows.asToUp());
+ }
+
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ ug.apply(getTranslateForRepeat(stringBounder)).draw(repeat);
+ ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
+ ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
+
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ return new FtileGeometry(dimTotal, getLeft(stringBounder), 0, dimTotal.getHeight());
+ }
+
+ private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
+
+ final double w = tbTest.calculateDimension(stringBounder).getWidth();
+
+ double width = getLeft(stringBounder) + getRight(stringBounder);
+ width = Math.max(width, w + 2 * Diamond.diamondHalfSize);
+ final double height = dimDiamond1.getHeight() + dimRepeat.getHeight() + dimDiamond2.getHeight() + 8
+ * Diamond.diamondHalfSize;
+ return new Dimension2DDouble(width + 2 * Diamond.diamondHalfSize, height);
+
+ }
+
+ @Override
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == repeat) {
+ return getTranslateForRepeat(stringBounder);
+ }
+ if (child == diamond1) {
+ return getTranslateDiamond1(stringBounder);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ private UTranslate getTranslateForRepeat(StringBounder stringBounder) {
+
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
+ final double y = (dimTotal.getHeight() - dimDiamond1.getHeight() - dimDiamond2.getHeight() - dimRepeat
+ .getHeight()) / 2;
+
+ final double left = getLeft(stringBounder);
+ return new UTranslate(left - repeat.calculateDimension(stringBounder).getLeft(), y);
+
+ }
+
+ private UTranslate getTranslateDiamond1(StringBounder stringBounder) {
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final double left = getLeft(stringBounder);
+ return new UTranslate(left - dimDiamond1.getWidth() / 2, 0);
+ }
+
+ private UTranslate getTranslateDiamond2(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final double y2 = dimTotal.getHeight() - dimDiamond2.getHeight();
+ final double left = getLeft(stringBounder);
+ return new UTranslate(left - dimDiamond2.getWidth() / 2, y2);
+ }
+
+ private double getLeft(StringBounder stringBounder) {
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ double left1 = repeat.calculateDimension(stringBounder).getLeft();
+ left1 = Math.max(left1, dimDiamond1.getWidth() / 2);
+ double left2 = repeat.calculateDimension(stringBounder).getLeft();
+ left2 = Math.max(left2, dimDiamond2.getWidth() / 2);
+ return Math.max(left1, left2);
+ }
+
+ private double getRight(StringBounder stringBounder) {
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
+ final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
+ double right1 = dimRepeat.getWidth() - repeat.calculateDimension(stringBounder).getLeft();
+ right1 = Math.max(right1, dimDiamond1.getWidth() / 2);
+ double right2 = dimRepeat.getWidth() - repeat.calculateDimension(stringBounder).getLeft();
+ right2 = Math.max(right2, dimDiamond2.getWidth() / 2);
+ return Math.max(right1, right2);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java
new file mode 100644
index 0000000..84c81c5
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+class FtileSplit1 extends AbstractFtile {
+
+ private final List<Ftile> forks = new ArrayList<Ftile>();
+
+ public FtileSplit1(List<Ftile> forks) {
+ super(forks.get(0).shadowing());
+ for (Ftile ftile : forks) {
+ this.forks.add(ftile);
+ }
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return forks.get(0).getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return null;
+ // return getSwimlaneIn();
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return mergeSwimlanes(forks);
+ }
+
+ public static Set<Swimlane> mergeSwimlanes(List<Ftile> tiles) {
+ final Set<Swimlane> result = new HashSet<Swimlane>();
+ for (Ftile tile : tiles) {
+ result.addAll(tile.getSwimlanes());
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ for (Ftile ftile : forks) {
+ ug.apply(getTranslateFor(ftile, stringBounder)).draw(ftile);
+ }
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ double height = 0;
+ double width = 0;
+ for (Ftile ftile : forks) {
+ final Dimension2D dim = ftile.calculateDimension(stringBounder);
+ if (dim.getWidth() > width) {
+ width = dim.getWidth();
+ }
+ if (dim.getHeight() > height) {
+ height = dim.getHeight();
+ }
+ }
+ final Dimension2D dimTotal = new Dimension2DDouble(width, height);
+ return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
+ }
+
+ public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) {
+ final Dimension2D dim = searched.calculateDimension(stringBounder);
+ final double xpos = calculateDimension(stringBounder).getWidth() - dim.getWidth();
+ return new UTranslate(xpos / 2, 0);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java
new file mode 100644
index 0000000..1ccc403
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java
@@ -0,0 +1,397 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Direction;
+import net.sourceforge.plantuml.FileGroup;
+import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondFoo1;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
+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.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.svek.ConditionStyle;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UEmpty;
+import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+class FtileWhile extends AbstractFtile {
+
+ private final Ftile whileBlock;
+ private final Ftile diamond1;
+ private final TextBlock supplementarySouthText;
+
+ public Set<Swimlane> getSwimlanes() {
+ final Set<Swimlane> result = new HashSet<Swimlane>(whileBlock.getSwimlanes());
+ result.add(getSwimlaneIn());
+ return result;
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return diamond1.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return getSwimlaneIn();
+ }
+
+ private FtileWhile(Ftile whileBlock, Ftile diamond1, TextBlock supplementarySouthText) {
+ super(whileBlock.shadowing());
+ this.whileBlock = whileBlock;
+ this.diamond1 = diamond1;
+ this.supplementarySouthText = supplementarySouthText;
+ }
+
+ private static TextBlock createLabel1(Display test, Display yes, UFont font, ISkinSimple spriteContainer,
+ HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
+ final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor,
+ useUnderlineForHyperlink);
+ final TextBlock tmpb = TextBlockUtils.create(yes, fc, HorizontalAlignment.LEFT, spriteContainer);
+ if (test == null) {
+ return tmpb;
+ }
+ return TextBlockUtils.mergeTB(TextBlockUtils.create(test, fc, HorizontalAlignment.LEFT, spriteContainer), tmpb,
+ HorizontalAlignment.CENTER);
+ }
+
+ public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HtmlColor borderColor,
+ HtmlColor backColor, HtmlColor arrowColor, Display yes, Display out2, UFont fontArrow,
+ HtmlColor endInlinkColor, LinkRendering afterEndwhile, FtileFactory ftileFactory,
+ ConditionStyle conditionStyle, UFont fontTest, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
+
+ final FontConfiguration fcArrow = new FontConfiguration(fontArrow, HtmlColorUtils.BLACK, hyperlinkColor,
+ useUnderlineForHyperlink);
+ final FontConfiguration fcTest = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor,
+ useUnderlineForHyperlink);
+ final TextBlock yesTb = TextBlockUtils.create(yes, fcArrow, HorizontalAlignment.LEFT, ftileFactory);
+ final TextBlock testTb = TextBlockUtils.create(test, fcTest, HorizontalAlignment.LEFT, ftileFactory);
+ final TextBlock out = TextBlockUtils.create(out2, fcArrow, HorizontalAlignment.LEFT, ftileFactory);
+
+ final Ftile diamond1;
+ final TextBlock supplementarySouthText;
+ if (conditionStyle == ConditionStyle.INSIDE) {
+ supplementarySouthText = TextBlockUtils.empty(0, 0);
+ diamond1 = new FtileDiamondInside(whileBlock.shadowing(), backColor, borderColor, swimlane, testTb)
+ .withNorth(yesTb).withWest(out);
+ } else if (conditionStyle == ConditionStyle.FOO1) {
+ supplementarySouthText = TextBlockUtils.empty(0, 0);
+ diamond1 = new FtileDiamondFoo1(whileBlock.shadowing(), backColor, borderColor, swimlane, testTb)
+ .withNorth(yesTb).withWest(out);
+ } else if (conditionStyle == ConditionStyle.DIAMOND) {
+ supplementarySouthText = createLabel1(test, yes, fontArrow, ftileFactory, hyperlinkColor,
+ useUnderlineForHyperlink);
+ diamond1 = new FtileDiamond(whileBlock.shadowing(), backColor, borderColor, swimlane).withWest(out)
+ .withSouth(supplementarySouthText);
+ } else {
+ throw new IllegalStateException();
+ }
+
+ final FtileWhile result = new FtileWhile(whileBlock, diamond1, supplementarySouthText);
+ HtmlColor afterEndwhileColor = arrowColor;
+ if (afterEndwhile != null && afterEndwhile.getColor() != null) {
+ afterEndwhileColor = afterEndwhile.getColor();
+ }
+
+ final List<Connection> conns = new ArrayList<Connection>();
+ conns.add(result.new ConnectionIn(LinkRendering.getColor(whileBlock.getInLinkRendering(), arrowColor)));
+ conns.add(result.new ConnectionBack(endInlinkColor));
+ conns.add(result.new ConnectionOut(afterEndwhileColor));
+ return FtileUtils.addConnection(result, conns);
+ }
+
+ class ConnectionIn extends AbstractConnection implements ConnectionTranslatable {
+ private final HtmlColor arrowColor;
+
+ public ConnectionIn(HtmlColor arrowColor) {
+ super(diamond1, whileBlock);
+ this.arrowColor = arrowColor;
+ }
+
+ private Point2D getP1(final StringBounder stringBounder) {
+ return getTranslateDiamond1(stringBounder).getTranslated(
+ getFtile1().calculateDimension(stringBounder).getPointOut());
+ }
+
+ private Point2D getP2(final StringBounder stringBounder) {
+ return getTranslateForWhile(stringBounder).getTranslated(
+ getFtile2().calculateDimension(stringBounder).getPointIn());
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ snake.addPoint(getP1(stringBounder));
+ snake.addPoint(getP2(stringBounder));
+
+ ug.draw(snake);
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+ final Snake snake = new Snake(arrowColor, Arrows.asToDown());
+ final Point2D mp1a = translate1.getTranslated(p1);
+ final Point2D mp2b = translate2.getTranslated(p2);
+ final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
+ snake.addPoint(mp1a);
+ snake.addPoint(mp1a.getX(), middle);
+ snake.addPoint(mp2b.getX(), middle);
+ snake.addPoint(mp2b);
+ ug.draw(snake);
+ }
+ }
+
+ class ConnectionBack extends AbstractConnection implements ConnectionTranslatable {
+ private final HtmlColor endInlinkColor;
+
+ public ConnectionBack(HtmlColor endInlinkColor) {
+ super(whileBlock, diamond1);
+ this.endInlinkColor = endInlinkColor;
+ }
+
+ private Point2D getP1(final StringBounder stringBounder) {
+ final FtileGeometry geo = whileBlock.calculateDimension(stringBounder);
+ if (geo.hasPointOut() == false) {
+ return null;
+ }
+ return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut());
+ }
+
+ private Point2D getP2(final StringBounder stringBounder) {
+ return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0));
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Snake snake = new Snake(endInlinkColor, Arrows.asToLeft());
+ final Dimension2D dimTotal = calculateDimension(stringBounder);
+ final Point2D p1 = getP1(stringBounder);
+ if (p1 == null) {
+ return;
+ }
+ final Point2D p2 = getP2(stringBounder);
+ final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
+
+ final double x1 = p1.getX();
+ final double y1 = p1.getY();
+ final double x2 = p2.getX() + dimDiamond1.getWidth();
+ final double y2 = p2.getY() + dimDiamond1.getOutY() / 2;
+
+ snake.addPoint(x1, y1);
+ snake.addPoint(x1, y1 + Diamond.diamondHalfSize);
+ final double xx = dimTotal.getWidth();
+ snake.addPoint(xx, y1 + Diamond.diamondHalfSize);
+ snake.addPoint(xx, y2);
+ snake.addPoint(x2, y2);
+ snake.emphasizeDirection(Direction.UP);
+
+ ug.draw(snake);
+
+ ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
+
+ // ug = ug.apply(new UChangeColor(endInlinkColor)).apply(new UChangeBackColor(endInlinkColor));
+ // ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp());
+ }
+
+ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Snake snake = new Snake(endInlinkColor, Arrows.asToLeft());
+ final Dimension2D dimTotal = calculateDimension(stringBounder);
+ final Point2D ap1 = getP1(stringBounder);
+ final Point2D ap2 = getP2(stringBounder);
+ final Point2D p1 = translate1.getTranslated(ap1);
+ final Point2D p2 = translate2.getTranslated(ap2);
+
+ final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
+
+ final double x1 = p1.getX();
+ final double y1 = p1.getY();
+ final double x2 = p2.getX() + dimDiamond1.getWidth();
+ final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
+
+ snake.addPoint(x1, y1);
+ snake.addPoint(x1, y1 + Diamond.diamondHalfSize);
+ final double xx = Math.max(translate1.getDx(), translate2.getDx()) + dimTotal.getWidth();
+ snake.addPoint(xx, y1 + Diamond.diamondHalfSize);
+ snake.addPoint(xx, y2);
+ snake.addPoint(x2, y2);
+
+ ug.draw(snake);
+
+ ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
+
+ ug = ug.apply(new UChangeColor(endInlinkColor)).apply(new UChangeBackColor(endInlinkColor));
+ ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp());
+
+ }
+
+ }
+
+ class ConnectionOut extends AbstractConnection {
+ private final HtmlColor afterEndwhileColor;
+
+ public ConnectionOut(HtmlColor afterEndwhileColor) {
+ super(diamond1, null);
+ this.afterEndwhileColor = afterEndwhileColor;
+ }
+
+ private Point2D getP1(final StringBounder stringBounder) {
+ return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0));
+ }
+
+ private Point2D getP2(final StringBounder stringBounder) {
+ final FtileGeometry dimTotal = calculateDimension(stringBounder);
+ return new Point2D.Double(dimTotal.getLeft(), dimTotal.getHeight());
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final Snake snake = new Snake(afterEndwhileColor);
+
+ final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Point2D p1 = getP1(stringBounder);
+ final Point2D p2 = getP2(stringBounder);
+
+ final double x1 = p1.getX();
+ final double y1 = p1.getY() + dimDiamond1.getOutY() / 2;
+ final double x2 = p2.getX();
+ final double y2 = p2.getY();
+
+ snake.addPoint(x1, y1);
+ snake.addPoint(Diamond.diamondHalfSize, y1);
+ snake.addPoint(Diamond.diamondHalfSize, y2);
+ snake.emphasizeDirection(Direction.DOWN);
+
+ ug.draw(snake);
+ // ug = ug.apply(new UChangeColor(afterEndwhileColor)).apply(new UChangeBackColor(afterEndwhileColor));
+ // ug.apply(new UTranslate(Diamond.diamondHalfSize, (y1 + y2) / 2)).draw(Arrows.asToDown());
+
+ final Snake snake2 = new Snake(afterEndwhileColor);
+ snake2.addPoint(Diamond.diamondHalfSize, y2);
+ snake2.addPoint(x2, y2);
+ ug.draw(snake2);
+
+ }
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ ug.apply(getTranslateForWhile(stringBounder)).draw(whileBlock);
+ ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final FtileGeometry geoDiamond1 = diamond1.calculateDimension(stringBounder);
+ final Dimension2D dimSupplementarySouth = supplementarySouthText.calculateDimension(stringBounder);
+ FtileGeometry geoWhile = whileBlock.calculateDimension(stringBounder);
+ final double diff = dimSupplementarySouth.getWidth() - geoWhile.getWidth();
+ if (diff > 0) {
+ geoWhile = geoWhile.addMarginX(diff / 2);
+ }
+ final FtileGeometry geo = geoDiamond1.appendBottom(geoWhile);
+ final double height = geo.getHeight() + 4 * Diamond.diamondHalfSize + dimSupplementarySouth.getHeight();
+ final double dx = 2 * Diamond.diamondHalfSize;
+ return new FtileGeometry(geo.getWidth() + dx + Diamond.diamondHalfSize, height, geo.getLeft() + dx, 0, height);
+
+ }
+
+ @Override
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ if (child == whileBlock) {
+ return getTranslateForWhile(stringBounder);
+ }
+ if (child == diamond1) {
+ return getTranslateDiamond1(stringBounder);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ private UTranslate getTranslateForWhile(StringBounder stringBounder) {
+ final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
+
+ final FtileGeometry dimTotal = calculateDimension(stringBounder);
+ final FtileGeometry dimWhile = whileBlock.calculateDimension(stringBounder);
+
+ final double y = dimDiamond1.getHeight()
+ + (dimTotal.getHeight() - dimDiamond1.getHeight() - dimWhile.getHeight()) / 2;
+
+ final double x = dimTotal.getLeft() - dimWhile.getLeft();
+ return new UTranslate(x, y);
+
+ }
+
+ private UTranslate getTranslateDiamond1(StringBounder stringBounder) {
+ final FtileGeometry dimTotal = calculateDimension(stringBounder);
+ final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
+
+ final double y1 = 0;
+ final double x1 = dimTotal.getLeft() - dimDiamond1.getLeft();
+ return new UTranslate(x1, y1);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
new file mode 100644
index 0000000..1b3eceb
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
@@ -0,0 +1,187 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.Set;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.Direction;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.creole.CreoleParser;
+import net.sourceforge.plantuml.creole.Sheet;
+import net.sourceforge.plantuml.creole.SheetBlock1;
+import net.sourceforge.plantuml.creole.SheetBlock2;
+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.TextBlock;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.svek.image.Opale;
+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 FtileWithNoteOpale extends AbstractFtile implements Stencil {
+
+ private final Ftile tile;
+ private final Opale opale;
+
+ // private final HtmlColor arrowColor;
+ private final NotePosition notePosition;
+ private final double suppSpace = 20;
+
+ public Set<Swimlane> getSwimlanes() {
+ return tile.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return tile.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return tile.getSwimlaneOut();
+ }
+
+ public FtileWithNoteOpale(Ftile tile, Display note, NotePosition notePosition, ISkinParam skinParam,
+ boolean withLink) {
+ super(tile.shadowing());
+ this.tile = tile;
+ this.notePosition = notePosition;
+ // this.arrowColor = arrowColor;
+
+ final Rose rose = new Rose();
+ final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE);
+ final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false);
+
+ final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
+ final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
+
+ final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
+
+ final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, false).createSheet(note);
+ final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
+ opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink);
+
+ }
+
+ private UTranslate getTranslate(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final Dimension2D dimNote = opale.calculateDimension(stringBounder);
+ final Dimension2D dimTile = tile.calculateDimension(stringBounder);
+ final double yForFtile = (dimTotal.getHeight() - dimTile.getHeight()) / 2;
+ final double marge;
+ if (notePosition == NotePosition.LEFT) {
+ marge = dimNote.getWidth() + suppSpace;
+ } else {
+ marge = 0;
+ }
+
+ return new UTranslate(marge, yForFtile);
+
+ }
+
+ private UTranslate getTranslateForOpale(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimTotal = calculateDimension(stringBounder);
+ final Dimension2D dimNote = opale.calculateDimension(stringBounder);
+
+ final double yForNote = (dimTotal.getHeight() - dimNote.getHeight()) / 2;
+
+ if (notePosition == NotePosition.LEFT) {
+ return new UTranslate(0, yForNote);
+ }
+ final double dx = dimTotal.getWidth() - dimNote.getWidth();
+ return new UTranslate(dx, yForNote);
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimNote = opale.calculateDimension(stringBounder);
+
+ if (notePosition == NotePosition.LEFT) {
+ final Direction strategy = Direction.RIGHT;
+ final Point2D pp1 = new Point2D.Double(dimNote.getWidth(), dimNote.getHeight() / 2);
+ final Point2D pp2 = new Point2D.Double(dimNote.getWidth() + suppSpace, dimNote.getHeight() / 2);
+ opale.setOpale(strategy, pp1, pp2);
+ } else {
+ final Direction strategy = Direction.LEFT;
+ final Point2D pp1 = new Point2D.Double(0, dimNote.getHeight() / 2);
+ final Point2D pp2 = new Point2D.Double(-suppSpace, dimNote.getHeight() / 2);
+ opale.setOpale(strategy, pp1, pp2);
+ }
+ opale.drawU(ug.apply(getTranslateForOpale(ug)));
+ ug.apply(getTranslate(stringBounder)).draw(tile);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ final FtileGeometry orig = tile.calculateDimension(stringBounder);
+ final UTranslate translate = getTranslate(stringBounder);
+ if (orig.hasPointOut()) {
+ return new FtileGeometry(dimTotal, orig.getLeft() + translate.getDx(), orig.getInY() + translate.getDy(),
+ orig.getOutY() + translate.getDy());
+ }
+ return new FtileGeometry(dimTotal, orig.getLeft() + translate.getDx(), orig.getInY() + translate.getDy());
+ }
+
+ private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
+ final Dimension2D dimNote = opale.calculateDimension(stringBounder);
+ final Dimension2D dimTile = tile.calculateDimension(stringBounder);
+ final double height = Math.max(dimNote.getHeight(), dimTile.getHeight());
+ return new Dimension2DDouble(dimTile.getWidth() + 1 * dimNote.getWidth() + suppSpace, height);
+ }
+
+ public double getStartingX(StringBounder stringBounder, double y) {
+ return -opale.getMarginX1();
+ }
+
+ public double getEndingX(StringBounder stringBounder, double y) {
+ return opale.calculateDimension(stringBounder).getWidth() - opale.getMarginX1();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java
new file mode 100644
index 0000000..4f7f853
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java
@@ -0,0 +1,66 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.graphic.UGraphicDelegator;
+import net.sourceforge.plantuml.ugraphic.UChange;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UShape;
+
+public class UGraphicInterceptorGoto extends UGraphicDelegator {
+
+ public UGraphicInterceptorGoto(UGraphic ug) {
+ super(ug);
+ }
+
+ public void draw(UShape shape) {
+ System.err.println("inter=" + shape.getClass());
+
+ if (shape instanceof Ftile) {
+ final Ftile foo = (Ftile) shape;
+ foo.drawU(this);
+ } else {
+ getUg().draw(shape);
+ System.err.println("Drawing " + shape);
+ }
+
+ }
+
+ public UGraphic apply(UChange change) {
+ return new UGraphicInterceptorGoto(getUg().apply(change));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java
new file mode 100644
index 0000000..26d213f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.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.activitydiagram3.ftile.vcompact;
+
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.graphic.UGraphicDelegator;
+import net.sourceforge.plantuml.ugraphic.UChange;
+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.UShape;
+
+public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator {
+
+ private final Swimlane swimlane;
+
+ public UGraphicInterceptorOneSwimlane(UGraphic ug, Swimlane swimlane) {
+ super(ug);
+ this.swimlane = swimlane;
+ }
+
+ public void draw(UShape shape) {
+ // System.err.println("inter=" + shape.getClass());
+ if (shape instanceof Ftile) {
+ final Ftile tile = (Ftile) shape;
+ final Set<Swimlane> swinlanes = tile.getSwimlanes();
+ final boolean contained = swinlanes.contains(swimlane);
+ if (contained) {
+ tile.drawU(this);
+ // drawGoto();
+ }
+ } else if (shape instanceof Connection) {
+ final Connection connection = (Connection) shape;
+ final Ftile tile1 = connection.getFtile1();
+ final Ftile tile2 = connection.getFtile2();
+ final boolean contained1 = tile1 == null || tile1.getSwimlaneOut() == null
+ || tile1.getSwimlaneOut() == swimlane;
+ final boolean contained2 = tile2 == null || tile2.getSwimlaneIn() == null
+ || tile2.getSwimlaneIn() == swimlane;
+
+ if (contained1 && contained2) {
+ connection.drawU(this);
+ }
+ } else {
+ getUg().draw(shape);
+ // System.err.println("Drawing " + shape);
+ }
+
+ }
+
+ private void drawGoto() {
+ final UGraphic ugGoto = getUg().apply(new UChangeColor(HtmlColorUtils.GREEN)).apply(
+ new UChangeBackColor(HtmlColorUtils.GREEN));
+ ugGoto.draw(new ULine(100, 100));
+ }
+
+ public UGraphic apply(UChange change) {
+ return new UGraphicInterceptorOneSwimlane(getUg().apply(change), swimlane);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java
new file mode 100644
index 0000000..bbbeecc
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java
@@ -0,0 +1,174 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vcompact;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.activitydiagram3.Branch;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStart;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStop;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateIn;
+import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOut;
+import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.sequencediagram.NotePosition;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.ugraphic.Sprite;
+import net.sourceforge.plantuml.ugraphic.UFont;
+
+public class VCompactFactory implements FtileFactory {
+
+ private final ISkinParam skinParam;
+ private final Rose rose = new Rose();
+ private final StringBounder stringBounder;
+
+ public StringBounder getStringBounder() {
+ return stringBounder;
+ }
+
+ public VCompactFactory(ISkinParam skinParam, StringBounder stringBounder) {
+ this.skinParam = skinParam;
+ this.stringBounder = stringBounder;
+ }
+
+ public Ftile start(Swimlane swimlane) {
+ final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityStart);
+ return new FtileCircleStart(shadowing(), color, swimlane);
+ }
+
+ public Ftile stop(Swimlane swimlane) {
+ final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
+ return new FtileCircleStop(shadowing(), color, swimlane);
+ }
+
+ public Ftile activity(Display label, final HtmlColor color, Swimlane swimlane, BoxStyle style) {
+ final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder);
+ final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : color;
+ final UFont font = skinParam.getFont(FontParam.ACTIVITY, null, false);
+ final HtmlColor arrowColor = rose.getHtmlColor(skinParam, ColorParam.activityArrow);
+ return new FtileBox(shadowing(), label, borderColor, backColor, font, arrowColor, swimlane, style, skinParam);
+ }
+
+ public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
+ return ftile;
+ }
+
+ public Ftile addUrl(Ftile ftile, Url url) {
+ return ftile;
+ }
+
+ public Ftile assembly(Ftile tile1, Ftile tile2) {
+ return new FtileAssemblySimple(tile1, tile2);
+ }
+
+ public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color,
+ LinkRendering backRepeatLinkRendering) {
+ return repeat;
+ }
+
+ public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
+ LinkRendering afterEndwhile, HtmlColor color) {
+ return whileBlock;
+ }
+
+ public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch) {
+ final List<Ftile> ftiles = new ArrayList<Ftile>();
+ for (Branch branch : thens) {
+ ftiles.add(branch.getFtile());
+ }
+ ftiles.add(elseBranch.getFtile());
+ return new FtileForkInner(ftiles);
+ }
+
+ public Ftile createFork(Swimlane swimlane, List<Ftile> all) {
+ return new FtileForkInner(all);
+ }
+
+ public Ftile createSplit(List<Ftile> all) {
+ return new FtileForkInner(all);
+ }
+
+ public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, Display headerNote) {
+ return list;
+ }
+
+ public Ftile decorateIn(final Ftile ftile, final LinkRendering linkRendering) {
+ return new FtileDecorateIn(ftile, linkRendering);
+ }
+
+ public Ftile decorateOut(final Ftile ftile, final LinkRendering linkRendering) {
+ // if (ftile instanceof FtileWhile) {
+ // if (linkRendering != null) {
+ // ((FtileWhile) ftile).changeAfterEndwhileColor(linkRendering.getColor());
+ // }
+ // return ftile;
+ // }
+ return new FtileDecorateOut(ftile, linkRendering);
+ }
+
+ public boolean shadowing() {
+ return skinParam.shadowing();
+ }
+
+ public Sprite getSprite(String name) {
+ return skinParam.getSprite(name);
+ }
+
+ public String getValue(String key) {
+ return skinParam.getValue(key);
+ }
+
+ public double getPadding() {
+ return skinParam.getPadding();
+ }
+
+ public boolean useGuillemet() {
+ return skinParam.useGuillemet();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java
new file mode 100644
index 0000000..65cd93e
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java
@@ -0,0 +1,92 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+
+public class FtileBlackBlock extends AbstractFtile {
+
+ private double width;
+ private double height;
+ private final HtmlColor colorBar;
+ private final Swimlane swimlane;
+
+ public FtileBlackBlock(boolean shadowing, HtmlColor colorBar, Swimlane swimlane) {
+ super(shadowing);
+ this.colorBar = colorBar;
+ this.swimlane = swimlane;
+ }
+
+ public void setDimenstion(double width, double height) {
+ this.height = height;
+ this.width = width;
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ return new FtileGeometry(width, height, width / 2, 0, height);
+ }
+
+ public void drawU(UGraphic ug) {
+ final URectangle rect = new URectangle(width, height, 5, 5);
+ if (shadowing()) {
+ rect.setDeltaShadow(3);
+ }
+ ug.apply(new UChangeColor(colorBar)).apply(new UChangeBackColor(colorBar)).draw(rect);
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java
new file mode 100644
index 0000000..ebae0c7
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java
@@ -0,0 +1,156 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import java.awt.geom.Dimension2D;
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.creole.CreoleParser;
+import net.sourceforge.plantuml.creole.Sheet;
+import net.sourceforge.plantuml.creole.SheetBlock1;
+import net.sourceforge.plantuml.creole.SheetBlock2;
+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.TextBlock;
+import net.sourceforge.plantuml.graphic.UDrawable;
+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.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileBox extends AbstractFtile {
+
+ private static final int MARGIN = 10;
+
+ private final TextBlock tb;
+
+ private final HtmlColor borderColor;
+ private final HtmlColor backColor;
+ private final LinkRendering inRenreding;
+ private final Swimlane swimlane;
+ private final BoxStyle style;
+
+ final public LinkRendering getInLinkRendering() {
+ return inRenreding;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ if (swimlane == null) {
+ return Collections.emptySet();
+ }
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+ class MyStencil implements Stencil {
+
+ public double getStartingX(StringBounder stringBounder, double y) {
+ return -MARGIN;
+ }
+
+ public double getEndingX(StringBounder stringBounder, double y) {
+ final Dimension2D dim = calculateDimension(stringBounder);
+ return dim.getWidth() - MARGIN;
+ }
+
+ }
+
+ public FtileBox(boolean shadowing, Display label, HtmlColor color, HtmlColor backColor, UFont font,
+ HtmlColor arrowColor, Swimlane swimlane, BoxStyle style, ISkinParam skinParam) {
+ super(shadowing);
+ this.style = style;
+ this.borderColor = color;
+ this.swimlane = swimlane;
+ this.backColor = backColor;
+ this.inRenreding = new LinkRendering(arrowColor);
+ final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY, null);
+ final FontConfiguration fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(),
+ skinParam.useUnderlineForHyperlink());
+
+ final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, false).createSheet(label);
+ this.tb = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), new MyStencil(), new UStroke(1));
+ this.print = label.toString();
+ }
+
+ final private String print;
+
+ @Override
+ public String toString() {
+ return print;
+ }
+
+ public void drawU(UGraphic ug) {
+ final Dimension2D dimTotal = calculateDimension(ug.getStringBounder());
+ final double widthTotal = dimTotal.getWidth();
+ final double heightTotal = dimTotal.getHeight();
+ final UDrawable rect = style.getUDrawable(widthTotal, heightTotal, shadowing());
+
+ ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(new UStroke(1.5));
+ rect.drawU(ug);
+
+ tb.drawU(ug.apply(new UTranslate(MARGIN, MARGIN)));
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dim = tb.calculateDimension(stringBounder);
+ return new FtileGeometry(Dimension2DDouble.delta(dim, 2 * MARGIN, 2 * MARGIN), dim.getWidth() / 2 + MARGIN, 0,
+ dim.getHeight() + 2 * MARGIN);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java
new file mode 100644
index 0000000..9da8a6b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java
@@ -0,0 +1,90 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UEllipse;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+
+public class FtileCircleStart extends AbstractFtile {
+
+ private static final int SIZE = 20;
+
+ private final HtmlColor backColor;
+ private final Swimlane swimlane;
+
+ public FtileCircleStart(boolean shadowing, HtmlColor backColor, Swimlane swimlane) {
+ super(shadowing);
+ this.backColor = backColor;
+ this.swimlane = swimlane;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ if (swimlane == null) {
+ return Collections.emptySet();
+ }
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+ public void drawU(UGraphic ug) {
+ final UEllipse circle = new UEllipse(SIZE, SIZE);
+ if (shadowing()) {
+ circle.setDeltaShadow(3);
+ }
+ ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor)).draw(circle);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ return new FtileGeometry(SIZE, SIZE, SIZE / 2, 0, SIZE);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java
new file mode 100644
index 0000000..abf58f3
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.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.activitydiagram3.ftile.vertical;
+
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+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.UTranslate;
+
+public class FtileCircleStop extends AbstractFtile {
+
+ private static final int SIZE = 20;
+
+ private final HtmlColor backColor;
+ private final Swimlane swimlane;
+
+ public FtileCircleStop(boolean shadowing, HtmlColor backColor, Swimlane swimlane) {
+ super(shadowing);
+ this.backColor = backColor;
+ this.swimlane = swimlane;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ if (swimlane == null) {
+ return Collections.emptySet();
+ }
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+ public void drawU(UGraphic ug) {
+ double xTheoricalPosition = 0;
+ double yTheoricalPosition = 0;
+ xTheoricalPosition = Math.round(xTheoricalPosition);
+ yTheoricalPosition = Math.round(yTheoricalPosition);
+
+ final UEllipse circle = new UEllipse(SIZE, SIZE);
+ if (shadowing()) {
+ circle.setDeltaShadow(3);
+ }
+ ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(null))
+ .apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle);
+
+ final double delta = 4;
+ final UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2);
+ if (shadowing()) {
+ circleSmall.setDeltaShadow(3);
+ }
+ ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor))
+ .apply(new UTranslate(xTheoricalPosition + delta + .5, yTheoricalPosition + delta + .5))
+ .draw(circleSmall);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ return new FtileGeometry(SIZE, SIZE, SIZE / 2, 0);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java
new file mode 100644
index 0000000..4b6e3ca
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.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.activitydiagram3.ftile.vertical;
+
+import java.util.Collection;
+import java.util.Set;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public abstract class FtileDecorate implements Ftile {
+
+ final private Ftile ftile;
+
+ public FtileDecorate(final Ftile ftile) {
+ this.ftile = ftile;
+ }
+
+ @Override
+ public String toString() {
+ return "" + getClass() + " " + ftile;
+ }
+
+ public LinkRendering getOutLinkRendering() {
+ return ftile.getOutLinkRendering();
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return ftile.getInLinkRendering();
+ }
+
+ public void drawU(UGraphic ug) {
+ ftile.drawU(ug);
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ return ftile.calculateDimension(stringBounder);
+ }
+
+ public Collection<Connection> getInnerConnections() {
+ return ftile.getInnerConnections();
+ }
+
+ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
+ return ftile.getTranslateFor(child, stringBounder);
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ return ftile.getSwimlanes();
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return ftile.getSwimlaneIn();
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return ftile.getSwimlaneOut();
+ }
+
+ public boolean shadowing() {
+ return ftile.shadowing();
+ }
+
+ protected final Ftile getFtileDelegated() {
+ return ftile;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java
new file mode 100644
index 0000000..9448ad8
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java
@@ -0,0 +1,53 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+
+public class FtileDecorateIn extends FtileDecorate {
+
+ final private LinkRendering linkRendering;
+
+ public FtileDecorateIn(final Ftile ftile, final LinkRendering linkRendering) {
+ super(ftile);
+ this.linkRendering = linkRendering;
+ }
+
+ public LinkRendering getInLinkRendering() {
+ return linkRendering;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java
new file mode 100644
index 0000000..64593dd
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java
@@ -0,0 +1,53 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+
+public class FtileDecorateOut extends FtileDecorate {
+
+ final private LinkRendering linkRendering;
+
+ public FtileDecorateOut(final Ftile ftile, final LinkRendering linkRendering) {
+ super(ftile);
+ this.linkRendering = linkRendering;
+ }
+
+ public LinkRendering getOutLinkRendering() {
+ return linkRendering;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java
new file mode 100644
index 0000000..7bda33d
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java
@@ -0,0 +1,61 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.graphic.StringBounder;
+
+public class FtileDecoratePointOut extends FtileDecorate {
+
+ final private double dx;
+ final private double dy;
+
+ public FtileDecoratePointOut(final Ftile ftile, final double dx, double dy) {
+ super(ftile);
+ this.dx = dx;
+ if (dx != 0) {
+ throw new IllegalArgumentException();
+ }
+ this.dy = dy;
+ }
+
+ @Override
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final FtileGeometry geo = super.calculateDimension(stringBounder);
+ return new FtileGeometry(geo.getWidth(), geo.getHeight(), geo.getLeft(), geo.getInY(), geo.getOutY() + dy);
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java
new file mode 100644
index 0000000..eb3a91b
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java
@@ -0,0 +1,145 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import java.awt.geom.Dimension2D;
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileDiamond extends AbstractFtile {
+
+ private final HtmlColor backColor;
+ private final HtmlColor borderColor;
+ private final Swimlane swimlane;
+ private final TextBlock north;
+ private final TextBlock south;
+ private final TextBlock west1;
+ private final TextBlock east1;
+
+ public FtileDiamond(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) {
+ this(shadowing, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
+ TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
+ }
+
+ public FtileDiamond withNorth(TextBlock north) {
+ return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1);
+ }
+
+ public FtileDiamond withWest(TextBlock west1) {
+ if (west1 == null) {
+ return this;
+ }
+ return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1);
+ }
+
+ public FtileDiamond withEast(TextBlock east1) {
+ if (east1 == null) {
+ return this;
+ }
+ return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1);
+ }
+
+ public FtileDiamond withSouth(TextBlock south) {
+ return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1);
+ }
+
+ private FtileDiamond(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
+ TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) {
+ super(shadowing);
+ this.backColor = backColor;
+ this.swimlane = swimlane;
+ this.borderColor = borderColor;
+ this.north = north;
+ this.west1 = west1;
+ this.east1 = east1;
+ this.south = south;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ if (swimlane == null) {
+ return Collections.emptySet();
+ }
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+ public void drawU(UGraphic ug) {
+
+ ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor))
+ .draw(Diamond.asPolygon(shadowing()));
+ final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
+ north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -dimNorth.getHeight()
+ - Diamond.diamondHalfSize)));
+
+ final Dimension2D dimSouth = south.calculateDimension(ug.getStringBounder());
+ south.drawU(ug.apply(new UTranslate(-(dimSouth.getWidth() - 2 * Diamond.diamondHalfSize) / 2,
+ 2 * Diamond.diamondHalfSize)));
+
+ final Dimension2D dimWeat1 = west1.calculateDimension(ug.getStringBounder());
+ west1.drawU(ug.apply(new UTranslate(-dimWeat1.getWidth(), -dimWeat1.getHeight() + Diamond.diamondHalfSize)));
+
+ final Dimension2D dimEast1 = east1.calculateDimension(ug.getStringBounder());
+ east1.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 2, -dimEast1.getHeight()
+ + Diamond.diamondHalfSize)));
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
+ return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java
new file mode 100644
index 0000000..6e9ad81
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java
@@ -0,0 +1,147 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import java.awt.geom.Dimension2D;
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileDiamondFoo1 extends AbstractFtile {
+
+ private final HtmlColor backColor;
+ private final HtmlColor borderColor;
+ private final Swimlane swimlane;
+ private final TextBlock label;
+ private final TextBlock west;
+ private final TextBlock east;
+ private final TextBlock north;
+
+ public FtileDiamondFoo1(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
+ TextBlock label) {
+ this(shadowing, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
+ TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
+ }
+
+ public FtileDiamondFoo1 withNorth(TextBlock north) {
+ return new FtileDiamondFoo1(shadowing(), backColor, borderColor, swimlane, label, north, west, east);
+ }
+
+ public FtileDiamondFoo1 withWest(TextBlock west) {
+ return new FtileDiamondFoo1(shadowing(), backColor, borderColor, swimlane, label, north, west, east);
+ }
+
+ public FtileDiamondFoo1 withEast(TextBlock east) {
+ return new FtileDiamondFoo1(shadowing(), backColor, borderColor, swimlane, label, north, west, east);
+ }
+
+ private FtileDiamondFoo1(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
+ TextBlock label, TextBlock north, TextBlock west, TextBlock east) {
+ super(shadowing);
+ this.backColor = backColor;
+ this.swimlane = swimlane;
+ this.borderColor = borderColor;
+ this.label = label;
+ this.west = west;
+ this.east = east;
+ this.north = north;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ if (swimlane == null) {
+ return Collections.emptySet();
+ }
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimLabel = label.calculateDimension(stringBounder);
+ final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
+ ug = ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor));
+ ug.draw(Diamond.asPolygonFoo1(shadowing(), dimTotal.getWidth(), dimTotal.getHeight()));
+
+ north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
+
+ final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
+ final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
+ label.drawU(ug.apply(new UTranslate(lx, ly)));
+
+ final Dimension2D dimWeat = west.calculateDimension(stringBounder);
+ west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + Diamond.diamondHalfSize)));
+
+ final Dimension2D dimEast = east.calculateDimension(stringBounder);
+ east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + Diamond.diamondHalfSize)));
+
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dim = calculateDimensionInternal(stringBounder);
+ return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
+ }
+
+ private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
+ final Dimension2D dimLabel = label.calculateDimension(stringBounder);
+ if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
+ return new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
+ }
+ Dimension2D result = dimLabel;
+ result = Dimension2DDouble.delta(result, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
+ return result;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java
new file mode 100644
index 0000000..7374653
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java
@@ -0,0 +1,161 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import java.awt.geom.Dimension2D;
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileDiamondInside extends AbstractFtile {
+
+ private final HtmlColor backColor;
+ private final HtmlColor borderColor;
+ private final Swimlane swimlane;
+ private final TextBlock label;
+ private final TextBlock west;
+ private final TextBlock east;
+ private final TextBlock north;
+ private final TextBlock south;
+
+ public FtileDiamondInside(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
+ TextBlock label) {
+ this(shadowing, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
+ TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
+ }
+
+ public FtileDiamondInside withNorth(TextBlock north) {
+ return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ public FtileDiamondInside withWest(TextBlock west) {
+ return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ public FtileDiamondInside withEast(TextBlock east) {
+ return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ public FtileDiamondInside withSouth(TextBlock south) {
+ return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ private FtileDiamondInside(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
+ TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
+ super(shadowing);
+ this.backColor = backColor;
+ this.swimlane = swimlane;
+ this.borderColor = borderColor;
+ this.label = label;
+ this.west = west;
+ this.east = east;
+ this.north = north;
+ this.south = south;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ if (swimlane == null) {
+ return Collections.emptySet();
+ }
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimLabel = label.calculateDimension(stringBounder);
+ final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
+ ug = ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor));
+ ug.draw(Diamond.asPolygon(shadowing(), dimTotal.getWidth(), dimTotal.getHeight()));
+
+ north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
+ south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
+
+ final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
+ final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
+ label.drawU(ug.apply(new UTranslate(lx, ly)));
+
+ final Dimension2D dimWeat = west.calculateDimension(stringBounder);
+ west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2)));
+
+ final Dimension2D dimEast = east.calculateDimension(stringBounder);
+ east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2)));
+
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ Dimension2D dim = calculateDimensionAlone(stringBounder);
+ final Dimension2D dimNorth = north.calculateDimension(stringBounder);
+ final double northHeight = dimNorth.getHeight();
+ final double northWidth = dimNorth.getWidth();
+ dim = Dimension2DDouble.delta(dim, 0, northHeight);
+ return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight() - northHeight);
+ }
+
+ private FtileGeometry calculateDimensionAlone(StringBounder stringBounder) {
+ final Dimension2D dimLabel = label.calculateDimension(stringBounder);
+ final Dimension2D dim;
+ if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
+ dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
+ } else {
+ dim = Dimension2DDouble.delta(
+ Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
+ Diamond.diamondHalfSize * 2, 0);
+ }
+ return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java
new file mode 100644
index 0000000..4affeed
--- /dev/null
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java
@@ -0,0 +1,161 @@
+/* ========================================================================
+ * 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.activitydiagram3.ftile.vertical;
+
+import java.awt.geom.Dimension2D;
+import java.util.Collections;
+import java.util.Set;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
+import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
+import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class FtileDiamondInside2 extends AbstractFtile {
+
+ private final HtmlColor backColor;
+ private final HtmlColor borderColor;
+ private final Swimlane swimlane;
+ private final TextBlock label;
+ private final TextBlock west;
+ private final TextBlock east;
+ private final TextBlock north;
+ private final TextBlock south;
+
+ public FtileDiamondInside2(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
+ TextBlock label) {
+ this(shadowing, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
+ TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
+ }
+
+ public FtileDiamondInside2 withNorth(TextBlock north) {
+ return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ public FtileDiamondInside2 withWest(TextBlock west) {
+ return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ public FtileDiamondInside2 withEast(TextBlock east) {
+ return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ public FtileDiamondInside2 withSouth(TextBlock south) {
+ return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
+ }
+
+ private FtileDiamondInside2(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
+ TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
+ super(shadowing);
+ this.backColor = backColor;
+ this.swimlane = swimlane;
+ this.borderColor = borderColor;
+ this.label = label;
+ this.west = west;
+ this.east = east;
+ this.north = north;
+ this.south = south;
+ }
+
+ public Set<Swimlane> getSwimlanes() {
+ if (swimlane == null) {
+ return Collections.emptySet();
+ }
+ return Collections.singleton(swimlane);
+ }
+
+ public Swimlane getSwimlaneIn() {
+ return swimlane;
+ }
+
+ public Swimlane getSwimlaneOut() {
+ return swimlane;
+ }
+
+ public void drawU(UGraphic ug) {
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimLabel = label.calculateDimension(stringBounder);
+ final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
+ ug = ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor));
+ ug.draw(Diamond.asPolygon(shadowing(), dimTotal.getWidth(), dimTotal.getHeight()));
+
+ north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
+ south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
+
+ final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
+ final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
+ label.drawU(ug.apply(new UTranslate(lx, ly)));
+
+ final Dimension2D dimWeat = west.calculateDimension(stringBounder);
+ west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2)));
+
+ final Dimension2D dimEast = east.calculateDimension(stringBounder);
+ east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2)));
+
+ }
+
+ public FtileGeometry calculateDimension(StringBounder stringBounder) {
+ final Dimension2D diamond = calculateDimensionAlone(stringBounder);
+ final Dimension2D north = this.north.calculateDimension(stringBounder);
+ final double height = diamond.getHeight() + north.getHeight();
+ final double left = diamond.getWidth() / 2;
+ final double width = north.getWidth() > left ? left + north.getWidth() : diamond.getWidth();
+ return new FtileGeometry(width, height, left, 0, diamond.getHeight());
+ }
+
+ private FtileGeometry calculateDimensionAlone(StringBounder stringBounder) {
+ final Dimension2D dimLabel = label.calculateDimension(stringBounder);
+ final Dimension2D dim;
+ if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
+ dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
+ } else {
+ dim = Dimension2DDouble.delta(
+ Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
+ Diamond.diamondHalfSize * 2, 0);
+ }
+ return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
+ }
+
+}