diff --git a/pom.xml b/pom.xml index 520b20135..93c8a1b1a 100644 --- a/pom.xml +++ b/pom.xml @@ -116,7 +116,7 @@ net/sourceforge/plantuml/openiconic/data/*.txt net/sourceforge/plantuml/openiconic/data/*.svg net/sourceforge/plantuml/fun/*.png - sprite/archimate/*.png + sprites/archimate/*.png net/sourceforge/plantuml/dedication/*.png diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 6f81730bd..570b67751 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -66,7 +66,7 @@ public interface ISkinParam extends ISkinSimple { public HorizontalAlignment getHorizontalAlignment(AlignParam param); - public HorizontalAlignment getDefaultTextAlignment(); + public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue); public int getCircledCharacterRadius(); diff --git a/src/net/sourceforge/plantuml/OptionFlags.java b/src/net/sourceforge/plantuml/OptionFlags.java index 1474d30a3..b7eac28fb 100644 --- a/src/net/sourceforge/plantuml/OptionFlags.java +++ b/src/net/sourceforge/plantuml/OptionFlags.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19870 $ + * Revision $Revision: 20057 $ * */ package net.sourceforge.plantuml; @@ -61,6 +61,7 @@ public class OptionFlags { static public final boolean SWI2 = false; // static public final boolean USE_COMPOUND = false; static public final boolean OMEGA_CROSSING = false; + // static public final boolean LINK_BETWEEN_FIELDS = true; // static public final boolean USE_JDOT = false; diff --git a/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/net/sourceforge/plantuml/PSystemBuilder.java index db892a4d8..c3c6bf1e7 100644 --- a/src/net/sourceforge/plantuml/PSystemBuilder.java +++ b/src/net/sourceforge/plantuml/PSystemBuilder.java @@ -135,7 +135,7 @@ public class PSystemBuilder { factories.add(new PSystemSaltFactory(DiagramType.UML)); factories.add(new PSystemDotFactory(DiagramType.DOT)); factories.add(new PSystemDotFactory(DiagramType.UML)); - if (License.getCurrent() == License.GPL) { + if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) { factories.add(new PSystemDitaaFactory(DiagramType.DITAA)); factories.add(new PSystemDitaaFactory(DiagramType.UML)); factories.add(new PSystemJcckitFactory(DiagramType.JCCKIT)); @@ -153,7 +153,7 @@ public class PSystemBuilder { factories.add(new PSystemOregonFactory()); factories.add(new PSystemCharlieFactory()); factories.add(new PSystemMemorialFactory()); - if (License.getCurrent() == License.GPL) { + if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) { factories.add(new PSystemXearthFactory()); } factories.add(new PSystemProjectFactory2()); diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 755ebbd6d..e5545b00a 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19880 $ + * Revision $Revision: 20003 $ * */ package net.sourceforge.plantuml; @@ -96,7 +96,7 @@ public class SkinParam implements ISkinParam { static String cleanForKey(String key) { key = StringUtils.trin(StringUtils.goLowerCase(key)); key = key.replaceAll("_|\\.|\\s", ""); - key = replaceSmart(key, "partition", "package"); + // key = replaceSmart(key, "partition", "package"); key = replaceSmart(key, "sequenceparticipant", "participant"); key = replaceSmart(key, "sequenceactor", "actor"); if (key.contains("arrow")) { @@ -405,11 +405,11 @@ public class SkinParam implements ISkinParam { return result; } - public HorizontalAlignment getDefaultTextAlignment() { + public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue) { final String value = getValue("defaulttextalignment"); final HorizontalAlignment result = HorizontalAlignment.fromString(value); if (result == null) { - return HorizontalAlignment.CENTER; + return defaultValue; } return result; } diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index ca7aec531..a83604141 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -192,8 +192,8 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.useUnderlineForHyperlink(); } - public HorizontalAlignment getDefaultTextAlignment() { - return skinParam.getDefaultTextAlignment(); + public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue) { + return skinParam.getDefaultTextAlignment(defaultValue); } public double getPadding() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index dfd84fb44..3e3a6ebe0 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -198,7 +198,7 @@ public class ActivityDiagram3 extends UmlDiagram { // } public void fork() { - final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer()); + final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer(), getSkinParam()); current().add(instructionFork); setNextLinkRendererInternal(LinkRendering.none()); setCurrent(instructionFork); @@ -207,7 +207,7 @@ public class ActivityDiagram3 extends UmlDiagram { public CommandExecutionResult forkAgain() { if (current() instanceof InstructionFork) { final InstructionFork currentFork = (InstructionFork) current(); - currentFork.manageOutRendering(nextLinkRenderer()); + currentFork.manageOutRendering(nextLinkRenderer(), false); setNextLinkRendererInternal(LinkRendering.none()); currentFork.forkAgain(); return CommandExecutionResult.ok(); @@ -218,7 +218,7 @@ public class ActivityDiagram3 extends UmlDiagram { public CommandExecutionResult endFork() { if (current() instanceof InstructionFork) { final InstructionFork currentFork = (InstructionFork) current(); - currentFork.manageOutRendering(nextLinkRenderer()); + currentFork.manageOutRendering(nextLinkRenderer(), true); setNextLinkRendererInternal(LinkRendering.none()); setCurrent(currentFork.getParent()); return CommandExecutionResult.ok(); @@ -349,7 +349,7 @@ public class ActivityDiagram3 extends UmlDiagram { public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor, HtmlColor borderColor) { manageSwimlaneStrategy(); final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor, - swinlanes.getCurrentSwimlane(), borderColor); + swinlanes.getCurrentSwimlane(), borderColor, nextLinkRenderer()); current().add(instructionGroup); setCurrent(instructionGroup); } @@ -403,8 +403,8 @@ public class ActivityDiagram3 extends UmlDiagram { setNextLink(link); } - public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type) { - final boolean ok = current().addNote(note, position, type); + public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type, Colors colors) { + final boolean ok = current().addNote(note, position, type, colors); if (ok == false) { return CommandExecutionResult.error("Cannot add note here"); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java index ff59b3108..32149e020 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -80,8 +81,8 @@ public class Branch { return list.kill(); } - public boolean addNote(Display note, NotePosition position, NoteType type) { - return list.addNote(note, position, type); + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { + return list.addNote(note, position, type, colors); } public final void setInlinkRendering(LinkRendering inlinkRendering) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java b/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java index bab46ccf4..65e814a30 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java @@ -37,6 +37,7 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -50,6 +51,6 @@ public interface Instruction extends Swimable { public LinkRendering getInLinkRendering(); - public boolean addNote(Display note, NotePosition position, NoteType type); + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java index bfbe77c07..c67573888 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java @@ -37,22 +37,28 @@ import java.util.ArrayList; 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.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; -public class InstructionFork implements Instruction { +public class InstructionFork extends WithNote implements Instruction { private final List forks = new ArrayList(); private final Instruction parent; private final LinkRendering inlinkRendering; + private final ISkinParam skinParam; + boolean finished = false; - public InstructionFork(Instruction parent, LinkRendering inlinkRendering) { + public InstructionFork(Instruction parent, LinkRendering inlinkRendering, ISkinParam skinParam) { this.parent = parent; this.inlinkRendering = inlinkRendering; + this.skinParam = skinParam; this.forks.add(new InstructionList()); if (inlinkRendering == null) { throw new IllegalArgumentException(); @@ -72,7 +78,11 @@ public class InstructionFork implements Instruction { for (InstructionList list : forks) { all.add(list.createFtile(factory)); } - return factory.createFork(getSwimlaneIn(), all); + Ftile result = factory.createFork(getSwimlaneIn(), all); + if (getPositionedNotes().size() > 0) { + result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false); + } + return result; } public Instruction getParent() { @@ -91,11 +101,15 @@ public class InstructionFork implements Instruction { return inlinkRendering; } - public boolean addNote(Display note, NotePosition position, NoteType type) { - if (getLastList().getLast() == null) { - return getLastList().addNote(note, position, type); + @Override + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { + if (finished) { + return super.addNote(note, position, type, colors); } - return getLastList().addNote(note, position, type); + if (getLastList().getLast() == null) { + return getLastList().addNote(note, position, type, colors); + } + return getLastList().addNote(note, position, type, colors); } public Set getSwimlanes() { @@ -111,7 +125,10 @@ public class InstructionFork implements Instruction { return getLastList().getSwimlaneOut(); } - public void manageOutRendering(LinkRendering nextLinkRenderer) { + public void manageOutRendering(LinkRendering nextLinkRenderer, boolean endFork) { + if (endFork) { + this.finished = true; + } if (nextLinkRenderer == null) { return; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java index 03b843d6b..2f7cafb02 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java @@ -40,6 +40,7 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -50,13 +51,15 @@ public class InstructionGroup implements Instruction, InstructionCollection { private final HtmlColor backColor; private final HtmlColor borderColor; private final HtmlColor titleColor; + private final LinkRendering linkRendering; private final Display test; private Display headerNote = Display.NULL; public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor, - Swimlane swimlane, HtmlColor borderColor) { + Swimlane swimlane, HtmlColor borderColor, LinkRendering linkRendering) { this.list = new InstructionList(swimlane); + this.linkRendering = linkRendering; this.parent = parent; this.test = test; this.borderColor = borderColor; @@ -81,15 +84,15 @@ public class InstructionGroup implements Instruction, InstructionCollection { } public LinkRendering getInLinkRendering() { - return LinkRendering.none(); + return linkRendering; } - public boolean addNote(Display note, NotePosition position, NoteType type) { + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { if (list.isEmpty()) { this.headerNote = note; return true; } - return list.addNote(note, position, type); + return list.addNote(note, position, type, colors); } public Set getSwimlanes() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java index 963d54071..e2fe65c45 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java @@ -46,10 +46,11 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; -public class InstructionIf implements Instruction, InstructionCollection { +public class InstructionIf extends WithNote implements Instruction, InstructionCollection { private final List thens = new ArrayList(); private Branch elseBranch; @@ -81,10 +82,6 @@ public class InstructionIf implements Instruction, InstructionCollection { current.add(ins); } - private Display note; - private NotePosition position; - private NoteType type; - public Ftile createFtile(FtileFactory factory) { for (Branch branch : thens) { branch.updateFtile(factory); @@ -94,8 +91,8 @@ public class InstructionIf implements Instruction, InstructionCollection { } elseBranch.updateFtile(factory); Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering); - if (note != null) { - result = new FtileWithNoteOpale(result, note, position, type, skinParam, false); + if (getPositionedNotes().size() > 0) { + result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false); } return result; } @@ -152,14 +149,12 @@ public class InstructionIf implements Instruction, InstructionCollection { return topInlinkRendering; } - public boolean addNote(Display note, NotePosition position, NoteType type) { - if (current.isEmpty()) { - this.note = note; - this.position = position; - this.type = type; - return true; + @Override + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { + if (endifCalled || current.isEmpty()) { + return super.addNote(note, position, type, colors); } else { - return current.addNote(note, position, type); + return current.addNote(note, position, type, colors); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java index 6d56951d6..c8d011382 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java @@ -44,6 +44,7 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -120,11 +121,11 @@ public class InstructionList extends WithNote implements Instruction, Instructio return all.get(all.size() - 1); } - public boolean addNote(Display note, NotePosition position, NoteType type) { + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { if (getLast() == null) { - return super.addNote(note, position, type); + return super.addNote(note, position, type, colors); } - return getLast().addNote(note, position, type); + return getLast().addNote(note, position, type, colors); } public Set getSwimlanes() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java index c74051b4c..cdf13c5a4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java @@ -39,6 +39,7 @@ 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.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -83,7 +84,7 @@ public class InstructionPartition implements Instruction { return list.getInLinkRendering(); } - public boolean addNote(Display note, NotePosition position, NoteType type) { + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { throw new UnsupportedOperationException(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java index cc8fbb2bb..901d2f81a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java @@ -41,6 +41,7 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -119,8 +120,8 @@ public class InstructionRepeat implements Instruction { return nextLinkRenderer; } - public boolean addNote(Display note, NotePosition position, NoteType type) { - return repeatList.addNote(note, position, type); + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { + return repeatList.addNote(note, position, type, colors); } public Set getSwimlanes() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java index 4602703e0..438cc2754 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java @@ -41,6 +41,7 @@ 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.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -102,8 +103,8 @@ public class InstructionSplit implements Instruction { return inlinkRendering; } - public boolean addNote(Display note, NotePosition position, NoteType type) { - return getLast().addNote(note, position, type); + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { + return getLast().addNote(note, position, type, colors); } public Set getSwimlanes() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java index 346d7a06e..06a86d648 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java @@ -43,10 +43,11 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; -public class InstructionWhile implements Instruction, InstructionCollection { +public class InstructionWhile extends WithNote implements Instruction, InstructionCollection { private final InstructionList repeatList = new InstructionList(); private final Instruction parent; @@ -91,15 +92,11 @@ public class InstructionWhile implements Instruction, InstructionCollection { repeatList.add(ins); } - private Display note; - private NotePosition position; - private NoteType type; - 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, type, skinParam, false); + if (getPositionedNotes().size() > 0) { + tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), skinParam, false); } if (killed) { return new FtileKilled(tmp); @@ -136,14 +133,12 @@ public class InstructionWhile implements Instruction, InstructionCollection { this.afterEndwhile = linkRenderer; } - public boolean addNote(Display note, NotePosition position, NoteType type) { + @Override + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { if (repeatList.isEmpty()) { - this.note = note; - this.position = position; - this.type = type; - return true; + return super.addNote(note, position, type, colors); } else { - return repeatList.addNote(note, position, type); + return repeatList.addNote(note, position, type, colors); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/PositionedNote.java b/src/net/sourceforge/plantuml/activitydiagram3/PositionedNote.java new file mode 100644 index 000000000..6ec5ec24f --- /dev/null +++ b/src/net/sourceforge/plantuml/activitydiagram3/PositionedNote.java @@ -0,0 +1,75 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 9786 $ + * + */ +package net.sourceforge.plantuml.activitydiagram3; + +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.sequencediagram.NotePosition; +import net.sourceforge.plantuml.sequencediagram.NoteType; + +public class PositionedNote { + + private final Display display; + private final NotePosition notePosition; + private final NoteType type; + private final Colors colors; + + public PositionedNote(Display display, NotePosition position, NoteType type, Colors colors) { + this.display = display; + this.notePosition = position; + this.type = type; + this.colors = colors; + } + + public PositionedNote(Display note, NotePosition position, NoteType type) { + this(note, position, type, null); + } + + public Display getDisplay() { + return display; + } + + public NotePosition getNotePosition() { + return notePosition; + } + + public NoteType getType() { + return type; + } + + public Colors getColors() { + return colors; + } + +} diff --git a/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java b/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java index e0f45ab9e..72b42d2f4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java @@ -33,31 +33,36 @@ */ package net.sourceforge.plantuml.activitydiagram3; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; + 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.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; public class WithNote { - private Display note; - private NotePosition notePosition; - private NoteType type; + private final Collection notes = new ArrayList(); - public boolean addNote(Display note, NotePosition position, NoteType type) { - this.note = note; - this.notePosition = position; - this.type = type; + public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) { + this.notes.add(new PositionedNote(note, position, type, colors)); return true; } final protected Ftile eventuallyAddNote(FtileFactory factory, Ftile ftile, Swimlane swimlane) { - if (note != null) { - return factory.addNote(ftile, note, notePosition, type, swimlane); + if (notes.size() == 0) { + return ftile; } - return ftile; + return factory.addNote(ftile, swimlane, notes); + } + + public Collection getPositionedNotes() { + return Collections.unmodifiableCollection(notes); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java index d16b7cddc..d8a4e5ac4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java @@ -50,7 +50,7 @@ import net.sourceforge.plantuml.graphic.color.Colors; public class CommandActivity3 extends SingleLineCommand2 { - public static final String ENDING_GROUP = "(;|(?}\\]])(?:[/<}\\]])|(?]{1,999})(?)(?:\\>)|(?}\\]])(?:[/<}\\]])|(?]{1,999})(?)(?:\\>)|(? { public CommandNote3() { super(getRegexConcat()); } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + static RegexConcat getRegexConcat() { return new RegexConcat(new RegexLeaf("^"), // new RegexLeaf("TYPE", "(note|floating note)"), // new RegexLeaf("POSITION", "[%s]*(left|right)?"), // + new RegexLeaf("[%s]*"), // + color().getRegex(), // new RegexLeaf("[%s]*:[%s]*"), // new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("$")); @@ -60,10 +70,11 @@ public class CommandNote3 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) { + final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); final Display note = Display.getWithNewlines(arg.get("NOTE", 0)); final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0)); final NoteType type = NoteType.defaultType(arg.get("TYPE", 0)); - return diagram.addNote(note, position, type); + return diagram.addNote(note, position, type, colors); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java index 212ec2058..34617338c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java @@ -43,6 +43,9 @@ 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.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -51,6 +54,11 @@ public class CommandNoteLong3 extends CommandMultilines2 { public CommandNoteLong3() { super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + public String getPatternEnd() { return "(?i)^end[%s]?note$"; @@ -64,13 +72,16 @@ public class CommandNoteLong3 extends CommandMultilines2 { final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0)); final NoteType type = NoteType.defaultType(line0.get("TYPE", 0)); final Display note = lines.toDisplay(); - return diagram.addNote(note, position, type); + final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); + return diagram.addNote(note, position, type, colors); } static RegexConcat getRegexConcat() { return new RegexConcat(new RegexLeaf("^"), // new RegexLeaf("TYPE", "(note|floating note)"), // new RegexLeaf("POSITION", "[%s]*(left|right)?"), // + new RegexLeaf("[%s]*"), // + color().getRegex(), // new RegexLeaf("$")); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java index 57ecee6a9..725738ebf 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java @@ -88,7 +88,7 @@ public enum BoxStyle { ug.apply(new UTranslate(width - PADDING, 0)).draw(vline); } }, - SDL_SAVE('/') { + SDL_SAVE('\\') { @Override protected Shadowable getShape(double width, double height) { final UPolygon result = new UPolygon(); @@ -99,6 +99,17 @@ public enum BoxStyle { return result; } }, + SDL_ANTISAVE('/') { + @Override + protected Shadowable getShape(double width, double height) { + final UPolygon result = new UPolygon(); + result.addPoint(DELTA_INPUT_OUTPUT, 0.0); + result.addPoint(width, 0.0); + result.addPoint(width - DELTA_INPUT_OUTPUT, height); + result.addPoint(0, height); + return result; + } + }, SDL_CONTINUOUS('}') { @Override protected Shadowable getShape(double width, double height) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java index 949e19330..6997bd3e4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java @@ -33,18 +33,18 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile; +import java.util.Collection; import java.util.List; 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.PositionedNote; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.color.Colors; -import net.sourceforge.plantuml.sequencediagram.NotePosition; -import net.sourceforge.plantuml.sequencediagram.NoteType; public interface FtileFactory { @@ -60,7 +60,7 @@ public interface FtileFactory { public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors); - public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane); + public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection notes); public Ftile addUrl(Ftile ftile, Url url); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java index 57ebe027b..ab3215ba9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java @@ -33,6 +33,7 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile; +import java.util.Collection; import java.util.List; import net.sourceforge.plantuml.FontParam; @@ -40,6 +41,7 @@ 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.PositionedNote; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -50,8 +52,6 @@ import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.Colors; -import net.sourceforge.plantuml.sequencediagram.NotePosition; -import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.skin.rose.Rose; public class FtileFactoryDelegator implements FtileFactory { @@ -110,8 +110,8 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.activity(label, swimlane, style, colors); } - public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) { - return factory.addNote(ftile, note, notePosition, type, swimlane); + public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection notes) { + return factory.addNote(ftile, swimlane, notes); } public Ftile addUrl(Ftile ftile, Url url) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java index 3f51dc885..7b525e077 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java @@ -33,12 +33,14 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; +import java.util.Collection; + +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.activitydiagram3.PositionedNote; 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.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator { @@ -48,13 +50,22 @@ public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator { } @Override - public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) { - if (note == null) { + public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection notes) { + if (notes.size() == 0) { throw new IllegalArgumentException(); } - if (ftile == null) { - return new FtileNoteAlone(skinParam().shadowing(), note, skinParam(), type == NoteType.NOTE, swimlane); + if (notes.size() > 1) { + throw new IllegalArgumentException(); } - return new FtileWithNoteOpale(ftile, note, notePosition, type, skinParam(), true); + ISkinParam skinParam = skinParam(); + final PositionedNote note = notes.iterator().next(); + if (note.getColors() != null) { + skinParam = note.getColors().mute(skinParam); + } + if (ftile == null) { + return new FtileNoteAlone(skinParam.shadowing(), note.getDisplay(), skinParam, + note.getType() == NoteType.NOTE, swimlane); + } + return FtileWithNoteOpale.create(ftile, notes, skinParam, true); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java index fae05e786..0572f3669 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java @@ -66,11 +66,10 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering(); final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow(); - final FontParam fontParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND - : FontParam.ACTIVITY_ARROW; - final FontConfiguration fc = new FontConfiguration(skinParam(), fontParam, null); + final FontConfiguration fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null); + final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ACTIVITY_ARROW, null); return FtileRepeat.create(backRepeatLinkRendering, swimlane, swimlaneOut, repeat, test, yes, out, borderColor, - backColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fc); + backColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fcDiamond, fcArrow); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java index 3fc377355..6e7d089e5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java @@ -71,7 +71,6 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; class FtileIfAndStop extends AbstractFtile { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index c469a7b0f..b5f781c8e 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -180,7 +180,7 @@ class FtileIfLongHorizontal extends AbstractFtile { 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, topInColor)); + conns.add(result.new ConnectionHorizontal(diam1, diam2, arrowColor)); } conns.add(result.new ConnectionIn(topInColor)); conns.add(result.new ConnectionLastElseIn(FtileIfWithLinks.getInColor(branch2, arrowColor))); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java index 3a192bd79..9aa130d8a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java @@ -101,20 +101,20 @@ class FtileRepeat extends AbstractFtile { public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Swimlane swimlaneOut, Ftile repeat, Display test, Display yes, Display out, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, Rainbow endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer, - FontConfiguration fontConfiguration) { + FontConfiguration fcDiamond, FontConfiguration fcArrow) { + + final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE ? fcDiamond : fcArrow; final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0) : test.create( - fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); - final TextBlock yesTb = yes.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); - final TextBlock outTb = out.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); + fontConfiguration1, HorizontalAlignment.LEFT, spriteContainer); + final TextBlock yesTb = yes.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer); + final TextBlock outTb = out.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer); final Ftile diamond1 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, swimlane); final FtileRepeat result; if (conditionStyle == ConditionStyle.INSIDE) { final Ftile diamond2 = new FtileDiamondInside(repeat.skinParam(), backColor, borderColor, swimlaneOut, tbTest).withEast(yesTb).withSouth(outTb); - // 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.skinParam(), backColor, borderColor, swimlane) @@ -129,13 +129,13 @@ class FtileRepeat extends AbstractFtile { final List conns = new ArrayList(); final Display in1 = repeat.getInLinkRendering().getDisplay(); - final TextBlock tbin1 = in1 == null ? null : in1.create(fontConfiguration, HorizontalAlignment.LEFT, - spriteContainer, CreoleMode.SIMPLE_LINE); + final TextBlock tbin1 = in1 == null ? null : in1.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer, + CreoleMode.SIMPLE_LINE); conns.add(result.new ConnectionIn(repeat.getInLinkRendering().getRainbow(arrowColor), tbin1)); final Display backLink1 = backRepeatLinkRendering.getDisplay(); - final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fontConfiguration, - HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE); + final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fcArrow, HorizontalAlignment.LEFT, + spriteContainer, CreoleMode.SIMPLE_LINE); if (repeat.getSwimlaneIn() == repeat.getSwimlaneOut()) { conns.add(result.new ConnectionBackSimple(backRepeatLinkRendering.getRainbow(arrowColor), tbbackLink1)); } else { @@ -145,8 +145,8 @@ class FtileRepeat extends AbstractFtile { } final Display out1 = repeat.getOutLinkRendering().getDisplay(); - final TextBlock tbout1 = out1 == null ? null : out1.create(fontConfiguration, HorizontalAlignment.LEFT, - spriteContainer, CreoleMode.SIMPLE_LINE); + final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer, + CreoleMode.SIMPLE_LINE); final Rainbow tmpColor = endRepeatLinkColor.withDefault(arrowColor); conns.add(result.new ConnectionOut(tmpColor, tbout1)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java index 1af585e1f..dc7e24dfb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java @@ -35,6 +35,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; +import java.util.Collection; import java.util.Set; import net.sourceforge.plantuml.ColorParam; @@ -42,6 +43,7 @@ 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.PositionedNote; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; @@ -52,7 +54,6 @@ 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; @@ -87,12 +88,24 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil { return tile.getSwimlaneOut(); } - public FtileWithNoteOpale(Ftile tile, Display note, NotePosition notePosition, NoteType type, ISkinParam skinParam, - boolean withLink) { + public static Ftile create(Ftile tile, Collection notes, ISkinParam skinParam, boolean withLink) { + if (notes.size() > 1) { + return new FtileWithNotes(tile, notes, skinParam); + } + if (notes.size() == 0) { + throw new IllegalArgumentException(); + } + return new FtileWithNoteOpale(tile, notes.iterator().next(), skinParam, withLink); + } + + private FtileWithNoteOpale(Ftile tile, PositionedNote note, ISkinParam skinParam, boolean withLink) { super(tile.skinParam()); + if (note.getColors() != null) { + skinParam = note.getColors().mute(skinParam); + } this.tile = tile; - this.notePosition = notePosition; - if (type == NoteType.FLOATING_NOTE) { + this.notePosition = note.getNotePosition(); + if (note.getType() == NoteType.FLOATING_NOTE) { withLink = false; } @@ -103,8 +116,8 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil { final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) - .createSheet(note); + final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note + .getDisplay()); final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1)); opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java new file mode 100644 index 000000000..f440f8215 --- /dev/null +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java @@ -0,0 +1,190 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 8475 $ + * + */ +package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; + +import java.awt.geom.Dimension2D; +import java.util.Collection; +import java.util.Set; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.activitydiagram3.PositionedNote; +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.CreoleMode; +import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Sheet; +import net.sourceforge.plantuml.creole.SheetBlock1; +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.sequencediagram.NotePosition; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.svek.image.Opale; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.utils.MathUtils; + +public class FtileWithNotes extends AbstractFtile /* implements Stencil */{ + + private final Ftile tile; + + private TextBlock left; + private TextBlock right; + + private final double suppSpace = 20; + + public Set getSwimlanes() { + return tile.getSwimlanes(); + } + + public Swimlane getSwimlaneIn() { + return tile.getSwimlaneIn(); + } + + public Swimlane getSwimlaneOut() { + return tile.getSwimlaneOut(); + } + + public FtileWithNotes(Ftile tile, Collection notes, ISkinParam skinParam) { + super(tile.skinParam()); + // if (note.getColors() != null) { + // skinParam = note.getColors().mute(skinParam); + // } + this.tile = tile; + + final Rose rose = new Rose(); + + final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + + final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + + for (PositionedNote note : notes) { + final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + .createSheet(note.getDisplay()); + final SheetBlock1 sheet1 = new SheetBlock1(sheet, 0, skinParam.getPadding()); + + final TextBlock opale = TextBlockUtils.withMargin(new Opale(borderColor, noteBackgroundColor, sheet1, + skinParam.shadowing(), false), 10, 10); + if (note.getNotePosition() == NotePosition.LEFT) { + if (left == null) { + left = opale; + } else { + left = TextBlockUtils.mergeTB(left, opale, HorizontalAlignment.CENTER); + } + } else { + if (right == null) { + right = opale; + } else { + right = TextBlockUtils.mergeTB(right, opale, HorizontalAlignment.CENTER); + } + } + } + + if (left == null) { + left = TextBlockUtils.empty(0, 0); + } + if (right == null) { + right = TextBlockUtils.empty(0, 0); + } + + } + + private UTranslate getTranslate(StringBounder stringBounder) { + final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); + final Dimension2D dimTile = tile.calculateDimension(stringBounder); + final double xDelta = left.calculateDimension(stringBounder).getWidth(); + final double yDelta = (dimTotal.getHeight() - dimTile.getHeight()) / 2; + return new UTranslate(xDelta, yDelta); + } + + private UTranslate getTranslateForLeft(StringBounder stringBounder) { + final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); + final Dimension2D dimLeft = left.calculateDimension(stringBounder); + final double xDelta = 0; + final double yDelta = (dimTotal.getHeight() - dimLeft.getHeight()) / 2; + return new UTranslate(xDelta, yDelta); + } + + private UTranslate getTranslateForRight(StringBounder stringBounder) { + final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); + final Dimension2D dimRight = right.calculateDimension(stringBounder); + final double xDelta = dimTotal.getWidth() - dimRight.getWidth(); + final double yDelta = (dimTotal.getHeight() - dimRight.getHeight()) / 2; + return new UTranslate(xDelta, yDelta); + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + ug.apply(getTranslateForLeft(stringBounder)).draw(left); + ug.apply(getTranslateForRight(stringBounder)).draw(right); + 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 dimTile = tile.calculateDimension(stringBounder); + final Dimension2D dimLeft = left.calculateDimension(stringBounder); + final Dimension2D dimRight = right.calculateDimension(stringBounder); + final double height = MathUtils.max(dimLeft.getHeight(), dimRight.getHeight(), dimTile.getHeight()); + return new Dimension2DDouble(dimTile.getWidth() + dimLeft.getWidth() + dimRight.getWidth(), 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/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index 1812b0994..6d8c28899 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import net.sourceforge.plantuml.ColorParam; @@ -42,6 +43,7 @@ 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.PositionedNote; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple; @@ -57,8 +59,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.color.Colors; -import net.sourceforge.plantuml.sequencediagram.NotePosition; -import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; @@ -100,7 +100,7 @@ public class VCompactFactory implements FtileFactory { return new FtileBox(colors.mute(skinParam), label, font, swimlane, style); } - public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) { + public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection notes) { return ftile; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java index 8d5a36614..6fdb1e6a8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java @@ -118,8 +118,8 @@ public class FtileBox extends AbstractFtile { this.swimlane = swimlane; this.inRenreding = new LinkRendering(HtmlColorAndStyle.build(skinParam)); final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null); - final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) - .createSheet(label); + final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), + skinParam, CreoleMode.FULL).createSheet(label); this.tb = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), new MyStencil(), new UStroke(1)); this.print = label.toString(); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java index a0c9f37ca..b71308bee 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; -import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; public class CommandHideShowSpecificClass extends SingleLineCommand2 { @@ -67,11 +67,14 @@ public class CommandHideShowSpecificClass extends SingleLineCommand2