1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-24 22:07:33 +00:00

version 1.2019.7

This commit is contained in:
Arnaud Roques 2019-06-26 21:24:49 +02:00
parent 4c46af67df
commit fb108ebb5a
358 changed files with 4638 additions and 2259 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId> <groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId> <artifactId>plantuml</artifactId>
<version>1.2019.7-SNAPSHOT</version> <version>1.2019.8-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>PlantUML</name> <name>PlantUML</name>

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
public enum AlignmentParam { public enum AlignmentParam {
arrowMessageAlignment(HorizontalAlignment.LEFT), arrowMessageAlignment(HorizontalAlignment.LEFT),
stateMessageAlignment(HorizontalAlignment.CENTER),
sequenceMessageAlignment(HorizontalAlignment.LEFT), sequenceMessageAlignment(HorizontalAlignment.LEFT),
sequenceMessageTextAlignment(HorizontalAlignment.LEFT), sequenceMessageTextAlignment(HorizontalAlignment.LEFT),
sequenceReferenceAlignment(HorizontalAlignment.CENTER), sequenceReferenceAlignment(HorizontalAlignment.CENTER),

View File

@ -104,13 +104,14 @@ public class BlockUml {
public BlockUml(List<StringLocated> strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) { public BlockUml(List<StringLocated> strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) {
this.localDefines = defines; this.localDefines = defines;
this.skinParam = skinParam; this.skinParam = skinParam;
final String s0 = strings.get(0).getStringTrimmed(); final String s0 = strings.get(0).getTrimmed().getString();
if (StartUtils.startsWithSymbolAnd("start", s0) == false) { if (StartUtils.startsWithSymbolAnd("start", s0) == false) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
if (mode != null && mode.getPreprocessorMode() == PreprocessorMode.V2_NEW_TIM) { if (mode != null && mode.getPreprocessorMode() == PreprocessorMode.V2_NEW_TIM) {
this.pmode = mode.getPreprocessorMode(); this.pmode = mode.getPreprocessorMode();
final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset()); final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset(),
(DefinitionsContainer) mode);
timLoader.load(strings); timLoader.load(strings);
this.data = timLoader.getResult(); this.data = timLoader.getResult();
this.debug = timLoader.getDebug(); this.debug = timLoader.getDebug();
@ -201,6 +202,17 @@ public class BlockUml {
return Collections.unmodifiableList(data2.subList(1, data2.size() - 1)); return Collections.unmodifiableList(data2.subList(1, data2.size() - 1));
} }
public List<String> getDefinition2(boolean withHeader) {
final List<String> data2 = new ArrayList<String>();
for (StringLocated s : debug) {
data2.add(s.getString());
}
if (withHeader) {
return Collections.unmodifiableList(data2);
}
return Collections.unmodifiableList(data2.subList(1, data2.size() - 1));
}
public Defines getLocalDefines() { public Defines getLocalDefines() {
return localDefines; return localDefines;
} }

View File

@ -139,7 +139,7 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
return Collections.unmodifiableSet(usedFiles); return Collections.unmodifiableSet(usedFiles);
} }
public List<String> getDefinition(String name) { public List<String> getDefinition1(String name) {
for (BlockUml block : blocks) { for (BlockUml block : blocks) {
if (block.isStartDef(name)) { if (block.isStartDef(name)) {
this.defines.importFrom(block.getLocalDefines()); this.defines.importFrom(block.getLocalDefines());
@ -149,6 +149,15 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
return Collections.emptyList(); return Collections.emptyList();
} }
public List<String> getDefinition2(String name) {
for (BlockUml block : blocks) {
if (block.isStartDef(name)) {
return block.getDefinition2(false);
}
}
return Collections.emptyList();
}
public PreprocessorMode getPreprocessorMode() { public PreprocessorMode getPreprocessorMode() {
return mode; return mode;
} }

View File

@ -52,6 +52,7 @@ public enum ColorParam {
activityEnd(HtmlColorUtils.BLACK), activityEnd(HtmlColorUtils.BLACK),
activityBar(HtmlColorUtils.BLACK), activityBar(HtmlColorUtils.BLACK),
swimlaneBorder(HtmlColorUtils.BLACK), swimlaneBorder(HtmlColorUtils.BLACK),
swimlaneTitleBackground(null),
usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE), usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
usecaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), usecaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.preproc2.PreprocessorModeSet;
public interface DefinitionsContainer extends PreprocessorModeSet { public interface DefinitionsContainer extends PreprocessorModeSet {
public List<String> getDefinition(String name); public List<String> getDefinition1(String name);
public List<String> getDefinition2(String name);
} }

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
@ -117,6 +118,8 @@ public interface ISkinParam extends ISkinSimple {
public ConditionStyle getConditionStyle(); public ConditionStyle getConditionStyle();
public ConditionEndStyle getConditionEndStyle();
public double minClassWidth(); public double minClassWidth();
public boolean sameClassWidth(); public boolean sameClassWidth();

View File

@ -63,13 +63,6 @@ public class LineLocationImpl implements LineLocation {
return new LineLocationImpl(desc, parent, position + 1); return new LineLocationImpl(desc, parent, position + 1);
} }
public static LineLocation fromLine(CharSequence cs) {
if (cs instanceof StringLocated) {
return ((StringLocated) cs).getLocation();
}
return null;
}
public int getPosition() { public int getPosition() {
return position; return position;
} }

View File

@ -35,7 +35,6 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public abstract class Log { public abstract class Log {
private static final long start = System.currentTimeMillis(); private static final long start = System.currentTimeMillis();

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3;
import net.sourceforge.plantuml.api.PSystemFactory; import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.bpm.BpmDiagramFactory; import net.sourceforge.plantuml.bpm.BpmDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory; import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -135,6 +136,8 @@ public class PSystemBuilder {
if (result != null && OptionFlags.getInstance().isEnableStats()) { if (result != null && OptionFlags.getInstance().isEnableStats()) {
StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass()); StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass());
} }
Log.info("Compilation duration " + (System.currentTimeMillis() - now));
RegexConcat.printCacheInfo();
} }
} }
@ -144,12 +147,12 @@ public class PSystemBuilder {
factories.add(new PSystemWelcomeFactory()); factories.add(new PSystemWelcomeFactory());
factories.add(new PSystemColorsFactory()); factories.add(new PSystemColorsFactory());
factories.add(new SequenceDiagramFactory(skinParam)); factories.add(new SequenceDiagramFactory(skinParam));
factories.add(new ClassDiagramFactory()); factories.add(new ClassDiagramFactory(skinParam));
factories.add(new ActivityDiagramFactory()); factories.add(new ActivityDiagramFactory(skinParam));
factories.add(new DescriptionDiagramFactory()); factories.add(new DescriptionDiagramFactory(skinParam));
factories.add(new StateDiagramFactory()); factories.add(new StateDiagramFactory(skinParam));
factories.add(new ActivityDiagramFactory3()); factories.add(new ActivityDiagramFactory3(skinParam));
factories.add(new CompositeDiagramFactory()); factories.add(new CompositeDiagramFactory(skinParam));
factories.add(new BpmDiagramFactory(DiagramType.BPM)); factories.add(new BpmDiagramFactory(DiagramType.BPM));
// factories.add(new PostIdDiagramFactory()); // factories.add(new PostIdDiagramFactory());
factories.add(new PSystemLicenseFactory()); factories.add(new PSystemLicenseFactory());

View File

@ -337,12 +337,12 @@ public class Run {
private static void managePattern() { private static void managePattern() {
printPattern(new SequenceDiagramFactory(null)); printPattern(new SequenceDiagramFactory(null));
printPattern(new ClassDiagramFactory()); printPattern(new ClassDiagramFactory(null));
printPattern(new ActivityDiagramFactory()); printPattern(new ActivityDiagramFactory(null));
printPattern(new DescriptionDiagramFactory()); printPattern(new DescriptionDiagramFactory(null));
// printPattern(new ComponentDiagramFactory()); // printPattern(new ComponentDiagramFactory());
printPattern(new StateDiagramFactory()); printPattern(new StateDiagramFactory(null));
printPattern(new ObjectDiagramFactory()); printPattern(new ObjectDiagramFactory(null));
} }
private static void printPattern(UmlDiagramFactory factory) { private static void printPattern(UmlDiagramFactory factory) {
@ -387,6 +387,7 @@ public class Run {
final List<File> files = new ArrayList<File>(); final List<File> files = new ArrayList<File>();
for (String s : option.getResult()) { for (String s : option.getResult()) {
if (option.isDecodeurl()) { if (option.isDecodeurl()) {
error.goOk();
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder(); final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder();
System.out.println("@startuml"); System.out.println("@startuml");
System.out.println(transcoder.decode(s)); System.out.println(transcoder.decode(s));
@ -465,6 +466,7 @@ public class Run {
System.out.println(f); System.out.println(f);
// new Metadata().readAndDisplayMetadata(f); // new Metadata().readAndDisplayMetadata(f);
System.out.println(); System.out.println();
error.goOk();
final String data = new MetadataTag(f, "plantuml").getData(); final String data = new MetadataTag(f, "plantuml").getData();
// File file = new File("tmp.txt"); // File file = new File("tmp.txt");
// PrintWriter pw = new PrintWriter(file, "UTF-8"); // PrintWriter pw = new PrintWriter(file, "UTF-8");
@ -486,12 +488,14 @@ public class Run {
sourceFileReader.setCheckMetadata(option.isCheckMetadata()); sourceFileReader.setCheckMetadata(option.isCheckMetadata());
if (option.isComputeurl()) { if (option.isComputeurl()) {
error.goOk();
for (BlockUml s : sourceFileReader.getBlocks()) { for (BlockUml s : sourceFileReader.getBlocks()) {
System.out.println(s.getEncodedUrl()); System.out.println(s.getEncodedUrl());
} }
return; return;
} }
if (option.isCheckOnly()) { if (option.isCheckOnly()) {
error.goOk();
final boolean hasError = sourceFileReader.hasError(); final boolean hasError = sourceFileReader.hasError();
if (hasError) { if (hasError) {
error.goWithError(); error.goWithError();

View File

@ -62,6 +62,7 @@ import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ColorMapper;
@ -415,6 +416,7 @@ public class SkinParam implements ISkinParam {
result.add("Style"); result.add("Style");
result.add("SequenceParticipant"); result.add("SequenceParticipant");
result.add("ConditionStyle"); result.add("ConditionStyle");
result.add("ConditionEndStyle");
result.add("SameClassWidth"); result.add("SameClassWidth");
result.add("HyperlinkUnderline"); result.add("HyperlinkUnderline");
result.add("Padding"); result.add("Padding");
@ -535,6 +537,8 @@ public class SkinParam implements ISkinParam {
final HorizontalAlignment result = HorizontalAlignment.fromString(value); final HorizontalAlignment result = HorizontalAlignment.fromString(value);
if (result == null && param == AlignmentParam.noteTextAlignment) { if (result == null && param == AlignmentParam.noteTextAlignment) {
return getDefaultTextAlignment(HorizontalAlignment.LEFT); return getDefaultTextAlignment(HorizontalAlignment.LEFT);
} else if (result == null && param == AlignmentParam.stateMessageAlignment) {
return getDefaultTextAlignment(HorizontalAlignment.CENTER);
} else if (result == null) { } else if (result == null) {
return param.getDefaultValue(); return param.getDefaultValue();
} }
@ -847,6 +851,15 @@ public class SkinParam implements ISkinParam {
return p; return p;
} }
public ConditionEndStyle getConditionEndStyle() {
final String value = getValue("conditionEndStyle");
final ConditionEndStyle p = ConditionEndStyle.fromString(value);
if (p == null) {
return ConditionEndStyle.DIAMOND;
}
return p;
}
public double minClassWidth() { public double minClassWidth() {
final String value = getValue("minclasswidth"); final String value = getValue("minclasswidth");
if (value != null && value.matches("\\d+")) { if (value != null && value.matches("\\d+")) {

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ColorMapper;
@ -178,6 +179,10 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getConditionStyle(); return skinParam.getConditionStyle();
} }
public ConditionEndStyle getConditionEndStyle() {
return skinParam.getConditionEndStyle();
}
public double minClassWidth() { public double minClassWidth() {
return skinParam.minClassWidth(); return skinParam.minClassWidth();
} }

View File

@ -35,7 +35,9 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public class StringLocated { import net.sourceforge.plantuml.command.regex.FoxSignature;
final public class StringLocated {
private final String s; private final String s;
private final LineLocation location; private final LineLocation location;
@ -68,8 +70,15 @@ public class StringLocated {
this.getPreprocessorError()); this.getPreprocessorError());
} }
public String getStringTrimmed() { private StringLocated trimmed;
return StringUtils.trin(this.getString());
public StringLocated getTrimmed() {
if (trimmed == null) {
this.trimmed = new StringLocated(StringUtils.trin(this.getString()), location, preprocessorError);
trimmed.fox = this.fox;
trimmed.trimmed = trimmed;
}
return trimmed;
} }
public StringLocated removeInnerComment() { public StringLocated removeInnerComment() {
@ -114,4 +123,12 @@ public class StringLocated {
return preprocessorError; return preprocessorError;
} }
private long fox = -1;
public long getFoxSignature() {
if (fox == -1) {
fox = FoxSignature.getFoxSignature(getString());
}
return fox;
}
} }

View File

@ -460,9 +460,6 @@ public class StringUtils {
} }
public static String trinNoTrace(CharSequence s) { public static String trinNoTrace(CharSequence s) {
// if (s instanceof CharSequence2) {
// return ((CharSequence2) s).getString().trim();
// }
return s.toString().trim(); return s.toString().trim();
} }

View File

@ -452,4 +452,8 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
return i; return i;
} }
public void setHideEmptyDescription(boolean hideEmptyDescription) {
}
} }

View File

@ -39,6 +39,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Code;
@ -58,6 +59,10 @@ public class ActivityDiagram extends CucaDiagram {
private IEntity lastEntityBrancheConsulted; private IEntity lastEntityBrancheConsulted;
private ConditionalContext currentContext; private ConditionalContext currentContext;
public ActivityDiagram(ISkinSimple skinParam) {
super(skinParam);
}
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
return getOrCreateLeafDefault(code, type, symbol); return getOrCreateLeafDefault(code, type, symbol);
} }

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram.command.CommandElse; import net.sourceforge.plantuml.activitydiagram.command.CommandElse;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndPartition; import net.sourceforge.plantuml.activitydiagram.command.CommandEndPartition;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndif; import net.sourceforge.plantuml.activitydiagram.command.CommandEndif;
@ -55,9 +56,16 @@ import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand;
public class ActivityDiagramFactory extends UmlDiagramFactory { public class ActivityDiagramFactory extends UmlDiagramFactory {
private final ISkinSimple skinParam;
public ActivityDiagramFactory(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
@Override @Override
public ActivityDiagram createEmptyDiagram() { public ActivityDiagram createEmptyDiagram() {
return new ActivityDiagram(); return new ActivityDiagram(skinParam);
} }
@Override @Override

View File

@ -35,21 +35,31 @@
*/ */
package net.sourceforge.plantuml.activitydiagram.command; package net.sourceforge.plantuml.activitydiagram.command;
import java.util.List; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
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.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
public class CommandElse extends SingleLineCommand<ActivityDiagram> { public class CommandElse extends SingleLineCommand2<ActivityDiagram> {
public CommandElse() { public CommandElse() {
super("(?i)^else$"); super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandElse.class.getName(), //
RegexLeaf.start(), //
new RegexLeaf("else"), //
RegexLeaf.end()); //
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram system, List<String> arg) { protected CommandExecutionResult executeArg(ActivityDiagram system, LineLocation location, RegexResult arg) {
if (system.getLastEntityConsulted() == null) { if (system.getLastEntityConsulted() == null) {
return CommandExecutionResult.error("No if for this else"); return CommandExecutionResult.error("No if for this else");
} }

View File

@ -35,21 +35,36 @@
*/ */
package net.sourceforge.plantuml.activitydiagram.command; package net.sourceforge.plantuml.activitydiagram.command;
import java.util.List; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
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.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
public class CommandEndPartition extends SingleLineCommand<ActivityDiagram> { public class CommandEndPartition extends SingleLineCommand2<ActivityDiagram> {
public CommandEndPartition() { public CommandEndPartition() {
super("(?i)^(end[%s]?partition|\\})$"); super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandEndPartition.class.getName(), RegexLeaf.start(), //
new RegexOr( //
new RegexConcat( //
new RegexLeaf("end"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("partition")), //
new RegexLeaf("\\}")), //
RegexLeaf.end()); //
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, List<String> arg) { protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
final IEntity currentPackage = diagram.getCurrentGroup(); final IEntity currentPackage = diagram.getCurrentGroup();
if (currentPackage == null) { if (currentPackage == null) {
return CommandExecutionResult.error("No partition defined"); return CommandExecutionResult.error("No partition defined");

View File

@ -35,20 +35,32 @@
*/ */
package net.sourceforge.plantuml.activitydiagram.command; package net.sourceforge.plantuml.activitydiagram.command;
import java.util.List; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandEndif extends SingleLineCommand<ActivityDiagram> { public class CommandEndif extends SingleLineCommand2<ActivityDiagram> {
public CommandEndif() { public CommandEndif() {
super("(?i)^end[%s]?if$"); super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandEndif.class.getName(), //
RegexLeaf.start(), //
new RegexLeaf("end"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("if"), //
RegexLeaf.end()); //
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, List<String> arg) { protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
if (diagram.getLastEntityConsulted() == null) { if (diagram.getLastEntityConsulted() == null) {
return CommandExecutionResult.error("No if for this endif"); return CommandExecutionResult.error("No if for this endif");
} }

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
@ -59,23 +60,25 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandIf.class.getName(), RegexLeaf.start(), //
new RegexOptional(// new RegexOptional(//
new RegexOr("FIRST", // new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), // new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), // new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), // new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), // new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?[=-]*\\>)?"), // new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?[=-]*\\>)?"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), // new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexOr(// new RegexOr(//
new RegexLeaf("IF1", "if[%s]*[%g]([^%g]*)[%g][%s]*(?:as[%s]+([\\p{L}0-9_.]+)[%s]+)?"), // new RegexLeaf("IF1", "if[%s]*[%g]([^%g]*)[%g][%s]*(?:as[%s]+([\\p{L}0-9_.]+)[%s]+)?"), //
new RegexLeaf("IF2", "if[%s]+(.+?)[%s]*")), // new RegexLeaf("IF2", "if[%s]+(.+?)")), //
new RegexLeaf("(?:then)?$")); RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("then")), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -35,25 +35,36 @@
*/ */
package net.sourceforge.plantuml.activitydiagram.command; package net.sourceforge.plantuml.activitydiagram.command;
import java.util.List; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
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.EntityUtils; import net.sourceforge.plantuml.cucadiagram.EntityUtils;
public class CommandInnerConcurrent extends SingleLineCommand<ActivityDiagram> { public class CommandInnerConcurrent extends SingleLineCommand2<ActivityDiagram> {
public CommandInnerConcurrent() { public CommandInnerConcurrent() {
super("(?i)^--\\s*(.*)$"); super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandInnerConcurrent.class.getName(), RegexLeaf.start(), //
new RegexLeaf("--"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NAME", "(.*)"), //
RegexLeaf.end()); //
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, List<String> arg) { protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
if (EntityUtils.groupRoot(diagram.getCurrentGroup())) { if (EntityUtils.groupRoot(diagram.getCurrentGroup())) {
return CommandExecutionResult.error("No inner activity"); return CommandExecutionResult.error("No inner activity");
} }
diagram.concurrentActivity(arg.get(0)); diagram.concurrentActivity(arg.get("NAME", 0));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
@ -71,19 +72,19 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
private static RegexConcat getRegexConcat() { private static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandLinkActivity.class.getName(), RegexLeaf.start(), //
new RegexOptional(// new RegexOptional(//
new RegexOr("FIRST", // new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), // new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), // new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), // new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), // new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp2(), // ColorParser.exp2(), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("ARROW_BODY1", "([-.]+)"), // new RegexLeaf("ARROW_BODY1", "([-.]+)"), //
@ -92,9 +93,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), // new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), // new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), // new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexOr("FIRST2", // new RegexOr("FIRST2", //
new RegexLeaf("STAR2", "(\\(\\*(top|\\d+)?\\))"), // new RegexLeaf("STAR2", "(\\(\\*(top|\\d+)?\\))"), //
new RegexLeaf("OPENBRACKET2", "(\\{)"), // new RegexLeaf("OPENBRACKET2", "(\\{)"), //
@ -102,13 +103,18 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
new RegexLeaf("BAR2", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), // new RegexLeaf("BAR2", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED2", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?"), // new RegexLeaf("QUOTED2", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?"), //
new RegexLeaf("QUOTED_INVISIBLE2", "(\\w.*?)")), // new RegexLeaf("QUOTED_INVISIBLE2", "(\\w.*?)")), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), // new RegexLeaf("STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("PARTITION2", "(?:in[%s]+([%g][^%g]+[%g]|\\S+))?"), // new RegexOptional( //
new RegexLeaf("[%s]*"), // new RegexConcat( //
new RegexLeaf("in"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("PARTITION2", "([%g][^%g]+[%g]|\\S+)") //
)), //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp3(), // ColorParser.exp3(), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2; import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy; import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -80,19 +81,19 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
return "(?i)^[%s]*([^%g]*)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?[%s]*(\\<\\<.*\\>\\>)?[%s]*(?:in[%s]+([%g][^%g]+[%g]|\\S+))?[%s]*(#\\w+)?$"; return "(?i)^[%s]*([^%g]*)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?[%s]*(\\<\\<.*\\>\\>)?[%s]*(?:in[%s]+([%g][^%g]+[%g]|\\S+))?[%s]*(#\\w+)?$";
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandLinkLongActivity.class.getName(), RegexLeaf.start(), //
new RegexOptional(// new RegexOptional(//
new RegexOr("FIRST", // new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), // new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), // new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), // new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), // new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("BACKCOLOR", "(#\\w+)?"), // new RegexLeaf("BACKCOLOR", "(#\\w+)?"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("ARROW_BODY1", "([-.]+)"), // new RegexLeaf("ARROW_BODY1", "([-.]+)"), //
@ -101,17 +102,17 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), // new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), // new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), // new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("DESC", "[%g]([^%g]*?)"), // new RegexLeaf("DESC", "[%g]([^%g]*?)"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("$")); RegexLeaf.end());
} }
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) { protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) {
lines = lines.trim(false); lines = lines.trim(false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
final IEntity entity1 = CommandLinkActivity.getEntity(diagram, line0, true); final IEntity entity1 = CommandLinkActivity.getEntity(diagram, line0, true);
if (entity1 == null) { if (entity1 == null) {
@ -121,9 +122,10 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
if (line0.get("STEREOTYPE", 0) != null) { if (line0.get("STEREOTYPE", 0) != null) {
entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0))); entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0)));
} }
if (line0.get("BACKCOLOR", 0) != null) { final String stringColor = line0.get("BACKCOLOR", 0);
if (stringColor != null) {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
.getColorIfValid(line0.get("BACKCOLOR", 0))); .getColorIfValid(stringColor));
} }
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexOr;
@ -60,17 +61,18 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
private static RegexConcat getRegexConcat() { private static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandPartition.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
new RegexLeaf("partition"), // new RegexLeaf("partition"), //
new RegexLeaf("[%s]+"), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), // new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexOr(// new RegexOr(//
color().getRegex(), // color().getRegex(), //
new RegexLeaf("LEGACYCOLORIGNORED", "(#[0-9a-fA-F]{6}|#?\\w+)?")), // new RegexLeaf("LEGACYCOLORIGNORED", "(#[0-9a-fA-F]{6}|#?\\w+)?")), //
new RegexLeaf("[%s]*\\{?$")); RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{?"),
RegexLeaf.end());
} }
private static ColorParser color() { private static ColorParser color() {

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.AnnotatedWorker;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.Scale; import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
@ -75,6 +76,11 @@ public class ActivityDiagram3 extends UmlDiagram {
private final SwimlanesC swinlanes = new SwimlanesC(getSkinParam(), getPragma()); private final SwimlanesC swinlanes = new SwimlanesC(getSkinParam(), getPragma());
public ActivityDiagram3(ISkinSimple skinParam) {
super(skinParam);
}
private void manageSwimlaneStrategy() { private void manageSwimlaneStrategy() {
if (swimlaneStrategy == null) { if (swimlaneStrategy == null) {
swimlaneStrategy = SwimlaneStrategy.SWIMLANE_FORBIDDEN; swimlaneStrategy = SwimlaneStrategy.SWIMLANE_FORBIDDEN;
@ -319,10 +325,10 @@ public class ActivityDiagram3 extends UmlDiagram {
return CommandExecutionResult.error("Cannot find switch"); return CommandExecutionResult.error("Cannot find switch");
} }
public void startIf(Display test, Display whenThen, HtmlColor color) { public void startIf(Display test, Display whenThen, HtmlColor color, Url url) {
manageSwimlaneStrategy(); manageSwimlaneStrategy();
final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test, final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test,
whenThen, nextLinkRenderer(), color, getSkinParam()); whenThen, nextLinkRenderer(), color, getSkinParam(), url);
current().add(instructionIf); current().add(instructionIf);
setNextLinkRendererInternal(LinkRendering.none()); setNextLinkRendererInternal(LinkRendering.none());
setCurrent(instructionIf); setCurrent(instructionIf);
@ -379,7 +385,7 @@ public class ActivityDiagram3 extends UmlDiagram {
if (current() instanceof InstructionRepeat) { if (current() instanceof InstructionRepeat) {
final InstructionRepeat instructionRepeat = (InstructionRepeat) current(); final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel); final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel);
instructionRepeat.setTest(label, yes, out, nextLinkRenderer(), back); instructionRepeat.setTest(label, yes, out, nextLinkRenderer(), back, swinlanes.getCurrentSwimlane());
setCurrent(instructionRepeat.getParent()); setCurrent(instructionRepeat.getParent());
this.setNextLinkRendererInternal(LinkRendering.none()); this.setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
@ -393,7 +399,7 @@ public class ActivityDiagram3 extends UmlDiagram {
if (current() instanceof InstructionRepeat) { if (current() instanceof InstructionRepeat) {
final InstructionRepeat instructionRepeat = (InstructionRepeat) current(); final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
// final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel); // final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel);
instructionRepeat.setBackward(label); instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane());
// setCurrent(instructionRepeat.getParent()); // setCurrent(instructionRepeat.getParent());
// this.setNextLinkRendererInternal(LinkRendering.none()); // this.setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivity3; import net.sourceforge.plantuml.activitydiagram3.command.CommandActivity3;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLegacy1; import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLegacy1;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLong3; import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLong3;
@ -89,6 +90,12 @@ import net.sourceforge.plantuml.command.UmlDiagramFactory;
public class ActivityDiagramFactory3 extends UmlDiagramFactory { public class ActivityDiagramFactory3 extends UmlDiagramFactory {
private final ISkinSimple skinParam;
public ActivityDiagramFactory3(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
@Override @Override
protected List<Command> createCommands() { protected List<Command> createCommands() {
@ -157,7 +164,7 @@ public class ActivityDiagramFactory3 extends UmlDiagramFactory {
@Override @Override
public ActivityDiagram3 createEmptyDiagram() { public ActivityDiagram3 createEmptyDiagram() {
return new ActivityDiagram3(); return new ActivityDiagram3(skinParam);
} }
} }

View File

@ -42,6 +42,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileDecorateWelding; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileDecorateWelding;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
@ -60,6 +61,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
private Branch elseBranch; private Branch elseBranch;
private boolean endifCalled = false; private boolean endifCalled = false;
private final ISkinParam skinParam; private final ISkinParam skinParam;
private final Url url;
private final Instruction parent; private final Instruction parent;
@ -82,7 +84,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
} }
public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, Display whenThen, public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, Display whenThen,
LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam) { LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam, Url url) {
this.url = url;
this.parent = parent; this.parent = parent;
this.skinParam = skinParam; this.skinParam = skinParam;
this.topInlinkRendering = inlinkRendering; this.topInlinkRendering = inlinkRendering;
@ -106,7 +109,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null, Display.NULL); this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null, Display.NULL);
} }
elseBranch.updateFtile(factory); elseBranch.updateFtile(factory);
Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering); Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url);
if (getPositionedNotes().size() > 0) { if (getPositionedNotes().size() > 0) {
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false); result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false);
} }

View File

@ -54,6 +54,7 @@ public class InstructionRepeat implements Instruction {
private final Instruction parent; private final Instruction parent;
private final LinkRendering nextLinkRenderer; private final LinkRendering nextLinkRenderer;
private final Swimlane swimlane; private final Swimlane swimlane;
private Swimlane swimlaneOut;
private final HtmlColor color; private final HtmlColor color;
private boolean killed = false; private boolean killed = false;
@ -70,7 +71,6 @@ public class InstructionRepeat implements Instruction {
return repeatList.containsBreak(); return repeatList.containsBreak();
} }
public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HtmlColor color, public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HtmlColor color,
Display startLabel) { Display startLabel) {
this.startLabel = startLabel; this.startLabel = startLabel;
@ -90,8 +90,9 @@ public class InstructionRepeat implements Instruction {
return false; return false;
} }
public void setBackward(Display label) { public void setBackward(Display label, Swimlane swimlaneOut) {
this.backward = label; this.backward = label;
this.swimlaneOut = swimlaneOut;
} }
public void add(Instruction ins) { public void add(Instruction ins) {
@ -101,7 +102,7 @@ public class InstructionRepeat implements Instruction {
public Ftile createFtile(FtileFactory factory) { public Ftile createFtile(FtileFactory factory) {
final Ftile back = Display.isNull(backward) ? null : factory.activity(backward, swimlane, BoxStyle.PLAIN, final Ftile back = Display.isNull(backward) ? null : factory.activity(backward, swimlane, BoxStyle.PLAIN,
Colors.empty()); Colors.empty());
final Ftile result = factory.repeat(swimlane, repeatList.getSwimlaneOut(), startLabel, final Ftile result = factory.repeat(swimlane, swimlaneOut, startLabel,
factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering), test, yes, out, color, factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering), test, yes, out, color,
backRepeatLinkRendering, back, isLastOfTheParent()); backRepeatLinkRendering, back, isLastOfTheParent());
if (killed) { if (killed) {
@ -115,7 +116,8 @@ public class InstructionRepeat implements Instruction {
} }
public void setTest(Display test, Display yes, Display out, LinkRendering endRepeatLinkRendering, public void setTest(Display test, Display yes, Display out, LinkRendering endRepeatLinkRendering,
LinkRendering backRepeatLinkRendering) { LinkRendering backRepeatLinkRendering, Swimlane swimlaneOut) {
this.swimlaneOut = swimlaneOut;
this.test = test; this.test = test;
this.yes = yes; this.yes = yes;
this.out = out; this.out = out;

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -59,15 +60,15 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandActivity3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
color().getRegex(), // color().getRegex(), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), // new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("STYLE", ENDING_GROUP), // new RegexLeaf("STYLE", ENDING_GROUP), //
new RegexLeaf("$")); RegexLeaf.end());
} }
private static ColorParser color() { private static ColorParser color() {

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -52,11 +53,11 @@ public class CommandActivityLegacy1 extends SingleLineCommand2<ActivityDiagram3>
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandActivityLegacy1.class.getName(), RegexLeaf.start(), //
new RegexLeaf("-"), // new RegexLeaf("-"), //
new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2; import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy; import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -63,17 +64,17 @@ public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
return ColorParser.simpleColor(ColorType.BACK); return ColorParser.simpleColor(ColorType.BACK);
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandActivityLong3.class.getName(), RegexLeaf.start(), //
color().getRegex(), // color().getRegex(), //
new RegexLeaf(":"), // new RegexLeaf(":"), //
new RegexLeaf("DATA", "(.*)"), // new RegexLeaf("DATA", "(.*)"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
final BoxStyle style = BoxStyle.fromChar(lines.getLastChar()); final BoxStyle style = BoxStyle.fromChar(lines.getLastChar());

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexOr;
@ -53,16 +54,16 @@ public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandArrow3.class.getName(), RegexLeaf.start(), //
new RegexOr(// new RegexOr(//
new RegexLeaf("->"), // new RegexLeaf("->"), //
new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), // new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexOr(// new RegexOr(//
new RegexLeaf("LABEL", "(.*);"), // new RegexLeaf("LABEL", "(.*);"), //
new RegexLeaf("")), // new RegexLeaf("")), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2; import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy; import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexOr;
@ -60,19 +61,19 @@ public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
return "^(.*);$"; return "^(.*);$";
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandArrowLong3.class.getName(), RegexLeaf.start(), //
new RegexOr(// new RegexOr(//
new RegexLeaf("->"), // new RegexLeaf("->"), //
new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), // new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
// diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color)); // diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color));
final String colorString = line0.get("COLOR", 0); final String colorString = line0.get("COLOR", 0);

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -50,13 +51,14 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandBackward3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("backward"), // new RegexLeaf("backward"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), // new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf(";$")); new RegexLeaf(";"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,12 @@ public class CommandBreak extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandBreak.class.getName(), //
new RegexLeaf("^"), // RegexLeaf.start(), //
new RegexLeaf("break"), // new RegexLeaf("break"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -50,13 +51,13 @@ public class CommandCase extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandCase.class.getName(), RegexLeaf.start(), //
new RegexLeaf("case"), // new RegexLeaf("case"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), // new RegexLeaf("TEST", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandCircleSpot3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandCircleSpot3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
new RegexLeaf("SPOT", "\\((\\S)\\)"), // new RegexLeaf("SPOT", "\\((\\S)\\)"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
@ -50,12 +52,16 @@ public class CommandElse3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandElse3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
new RegexLeaf("else"), // new RegexLeaf("else"), //
new RegexLeaf("WHEN", "(?:[%s]*(?:\\(([^()]*)\\))?)?"), // new RegexOptional( //
new RegexLeaf(";?$")); new RegexConcat( //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN", "(?:\\(([^()]*)\\))?") //
)), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
@ -52,18 +54,26 @@ public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandElseIf2.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), // ColorParser.exp4(), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("INLABEL", "(?:\\((.+?)\\))?"), // new RegexOptional(new RegexLeaf("INLABEL", "\\((.+?)\\)")), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("else[%s]*if"), // new RegexLeaf("else"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("if"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), // new RegexLeaf("TEST", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN", "(?:then[%s]*(?:\\((.+?)\\))?)?"), // new RegexOptional( //
new RegexLeaf(";?$")); new RegexConcat( //
new RegexLeaf("then"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("WHEN", "\\((.+?)\\)")) //
)), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -50,12 +51,15 @@ public class CommandElseLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandElseLegacy1.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), // new RegexLeaf("else"), //
new RegexLeaf("else[%s]when"), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("WHEN", "[%s]+(.*)"), // new RegexLeaf("when"), //
new RegexLeaf(";?$")); RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("WHEN", "(.*)"), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandEnd3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandEnd3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
new RegexLeaf("end"), // new RegexLeaf("end"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -35,20 +35,30 @@
*/ */
package net.sourceforge.plantuml.activitydiagram3.command; package net.sourceforge.plantuml.activitydiagram3.command;
import java.util.List; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandEndPartition3 extends SingleLineCommand<ActivityDiagram3> { public class CommandEndPartition3 extends SingleLineCommand2<ActivityDiagram3> {
public CommandEndPartition3() { public CommandEndPartition3() {
super("(?i)^(\\})$"); super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandEndPartition3.class.getName(), //
RegexLeaf.start(), //
new RegexLeaf("(\\})"), //
RegexLeaf.end()); //
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, List<String> arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
// final IEntity currentPackage = diagram.getCurrentGroup(); // final IEntity currentPackage = diagram.getCurrentGroup();
// if (currentPackage == null) { // if (currentPackage == null) {
// return CommandExecutionResult.error("No partition defined"); // return CommandExecutionResult.error("No partition defined");

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandEndSwitch extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandEndSwitch.class.getName(), RegexLeaf.start(), //
new RegexLeaf("endswitch"), // new RegexLeaf("endswitch"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,12 @@ public class CommandEndif3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandEndif3.class.getName(), //
new RegexLeaf("^"), // RegexLeaf.start(), //
new RegexLeaf("endif"), // new RegexLeaf("endif"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandFork3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandFork3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
new RegexLeaf("fork"), // new RegexLeaf("fork"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,13 @@ public class CommandForkAgain3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandForkAgain3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), // new RegexLeaf("fork"), //
new RegexLeaf("fork[%s]?again"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(";?$")); new RegexLeaf("again"), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -40,8 +40,10 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.activitydiagram3.ForkStyle; import net.sourceforge.plantuml.activitydiagram3.ForkStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
public class CommandForkEnd3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandForkEnd3 extends SingleLineCommand2<ActivityDiagram3> {
@ -50,13 +52,30 @@ public class CommandForkEnd3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandForkEnd3.class.getName(), //
new RegexLeaf("^"), // RegexLeaf.start(), //
new RegexLeaf("STYLE", "(end[%s]?fork|fork[%s]?end|end[%s]?merge)"), // new RegexOr("STYLE", //
new RegexLeaf("\\s*"), // new RegexConcat( //
new RegexLeaf("end"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("fork") //
), //
new RegexConcat( //
new RegexLeaf("fork"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("end") //
), //
new RegexConcat( //
new RegexLeaf("end"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("merge") //
) //
), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL", "(\\{.+\\})?"), // new RegexLeaf("LABEL", "(\\{.+\\})?"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,13 +50,13 @@ public class CommandGoto extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandGoto.class.getName(), RegexLeaf.start(), //
new RegexLeaf("goto"), // new RegexLeaf("goto"), //
new RegexLeaf("[%s]+"), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), // new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
new RegexLeaf(";?"), // new RegexLeaf(";?"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -51,12 +52,13 @@ public class CommandGroup3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandGroup3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("group"), // new RegexLeaf("group"), //
new RegexLeaf("\\s*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NAME", "(.*)"), // new RegexLeaf("NAME", "(.*)"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,10 +50,11 @@ public class CommandGroupEnd3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandGroupEnd3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("(end ?group|group ?end)"), // new RegexLeaf("(end ?group|group ?end)"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -36,11 +36,16 @@
package net.sourceforge.plantuml.activitydiagram3.command; package net.sourceforge.plantuml.activitydiagram3.command;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
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.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
@ -52,15 +57,22 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandIf2.class.getName(), RegexLeaf.start(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
ColorParser.exp4(), // ColorParser.exp4(), //
new RegexLeaf("if"), // new RegexLeaf("if"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), // new RegexLeaf("TEST", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN", "(?:then[%s]*(?:\\((.+?)\\))?)?"), // new RegexOptional( //
new RegexLeaf(";?$")); new RegexConcat( //
new RegexLeaf("then"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("WHEN", "\\((.+?)\\)")) //
)), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override
@ -72,7 +84,15 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
test = null; test = null;
} }
diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color); 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));
}
diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, url);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -52,16 +53,21 @@ public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandIf4.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), // ColorParser.exp4(), //
new RegexLeaf("if"), // new RegexLeaf("if"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), // new RegexLeaf("TEST", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*(is|equals?)[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(is|equals?)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN", "\\((.+?)\\)"), // new RegexLeaf("WHEN", "\\((.+?)\\)"), //
new RegexLeaf("[%s]*then[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(";?$")); new RegexLeaf("then"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override
@ -72,7 +78,7 @@ public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
if (test.length() == 0) { if (test.length() == 0) {
test = null; test = null;
} }
diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color); diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, null);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -50,20 +51,25 @@ public class CommandIfLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandIfLegacy1.class.getName(), RegexLeaf.start(), //
new RegexLeaf("if"), // new RegexLeaf("if"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.+?)\\)"), // new RegexLeaf("TEST", "\\((.+?)\\)"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN", "then[%s]when[%s]+(.*)"), // new RegexLeaf("then"), //
new RegexLeaf(";?$")); RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("when"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("WHEN", "(.*)"), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null); diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null, null);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandKill3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandKill3.class.getName(), //
new RegexLeaf("^"), // RegexLeaf.start(), //
new RegexLeaf("kill|detach"), // new RegexLeaf("kill|detach"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,13 +50,13 @@ public class CommandLabel extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandLabel.class.getName(), RegexLeaf.start(), //
new RegexLeaf("label"), // new RegexLeaf("label"), //
new RegexLeaf("[%s]+"), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), // new RegexLeaf("NAME", "([\\p{L}0-9_.]+)"), //
new RegexLeaf(";?"), // new RegexLeaf(";?"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -51,12 +52,13 @@ public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandLink3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("link[%s]+"), // new RegexLeaf("link"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("COLOR", "(#\\w+)"), // new RegexLeaf("COLOR", "(#\\w+)"), //
new RegexLeaf(";?"), // new RegexLeaf(";?"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -50,11 +51,11 @@ public class CommandNolink extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandNolink.class.getName(), RegexLeaf.start(), //
new RegexLeaf("nolink"), // new RegexLeaf("nolink"), //
new RegexLeaf(";?"), // new RegexLeaf(";?"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -59,16 +60,18 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
return ColorParser.simpleColor(ColorType.BACK); return ColorParser.simpleColor(ColorType.BACK);
} }
static IRegex getRegexConcat() {
static RegexConcat getRegexConcat() { return RegexConcat.build(CommandNote3.class.getName(), RegexLeaf.start(), //
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "(note|floating note)"), // new RegexLeaf("TYPE", "(note|floating note)"), //
new RegexLeaf("POSITION", "[%s]*(left|right)?"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("[%s]*"), // new RegexLeaf("POSITION", "(left|right)?"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
new RegexLeaf("[%s]*:[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("NOTE", "(.*)"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2; import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy; import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -60,14 +61,13 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
return ColorParser.simpleColor(ColorType.BACK); return ColorParser.simpleColor(ColorType.BACK);
} }
public String getPatternEnd() { public String getPatternEnd() {
return "(?i)^end[%s]?note$"; return "(?i)^end[%s]?note$";
} }
protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) { protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) {
// final List<? extends CharSequence> in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1)); // final List<? extends CharSequence> in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1));
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getStringTrimmed()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0)); final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0));
@ -77,13 +77,13 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
return diagram.addNote(note, position, type, colors); return diagram.addNote(note, position, type, colors);
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandNoteLong3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(note|floating note)"), // new RegexLeaf("TYPE", "(note|floating note)"), //
new RegexLeaf("POSITION", "[%s]*(left|right)?"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("[%s]*"), // new RegexLeaf("POSITION", "(left|right)?"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
new RegexLeaf("$")); RegexLeaf.end());
} }
} }

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
@ -60,23 +61,24 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandPartition3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(partition|package|rectangle|card)"), // new RegexLeaf("TYPE", "(partition|package|rectangle|card)"), //
new RegexLeaf("[%s]+"), // RegexLeaf.spaceOneOrMore(), //
new RegexOptional(// new RegexOptional(//
new RegexConcat( // new RegexConcat( //
color("BACK1").getRegex(),// color("BACK1").getRegex(),//
new RegexLeaf("[%s]+"))), // RegexLeaf.spaceOneOrMore())), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), // new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), //
new RegexOptional(// new RegexOptional(//
new RegexConcat( // new RegexConcat( //
new RegexLeaf("[%s]+"), // RegexLeaf.spaceOneOrMore(), //
color("BACK2").getRegex())), // color("BACK2").getRegex())), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{?$")); new RegexLeaf("\\{?"), //
RegexLeaf.end());
} }
private USymbol getUSymbol(String type) { private USymbol getUSymbol(String type) {

View File

@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
@ -52,13 +54,14 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandRepeat3.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), // ColorParser.exp4(), //
new RegexLeaf("repeat"), // new RegexLeaf("repeat"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL", "(?::(.*?))?"), // new RegexOptional(new RegexLeaf("LABEL", ":(.*?)")), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
@ -54,37 +55,48 @@ public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandRepeatWhile3.class.getName(), //
new RegexLeaf("^"), // RegexLeaf.start(), //
new RegexLeaf("repeat[%s]?while"), // new RegexLeaf("repeat"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("while"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOr(// new RegexOr(//
new RegexConcat(new RegexLeaf("TEST3", "\\((.*?)\\)"), // new RegexConcat(new RegexLeaf("TEST3", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*(is|equals?)[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(is|equals?)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN3", "\\((.+?)\\)"), // new RegexLeaf("WHEN3", "\\((.+?)\\)"), //
new RegexLeaf("[%s]*(not)[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(not)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("OUT3", "\\((.+?)\\)")), // new RegexLeaf("OUT3", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST4", "\\((.*?)\\)"), // new RegexConcat(new RegexLeaf("TEST4", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*(not)[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(not)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("OUT4", "\\((.+?)\\)")), // new RegexLeaf("OUT4", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST2", "\\((.*?)\\)"), // new RegexConcat(new RegexLeaf("TEST2", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*(is|equals?)[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(is|equals?)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN2", "\\((.+?)\\)") // new RegexLeaf("WHEN2", "\\((.+?)\\)") //
), // ), //
new RegexLeaf("TEST1", "(?:\\((.*)\\))?") // new RegexOptional(new RegexLeaf("TEST1", "\\((.*)\\)")) //
), // ), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexConcat( // new RegexOptional(new RegexConcat( //
new RegexOr(// new RegexOr(//
new RegexLeaf("->"), // new RegexLeaf("->"), //
new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), // new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexOr(// new RegexOr(//
new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("")) // new RegexLeaf("")) //
)), // )), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines3; import net.sourceforge.plantuml.command.CommandMultilines3;
import net.sourceforge.plantuml.command.MultilinesStrategy; import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -62,16 +63,19 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3<ActivityDi
public RegexConcat getPatternEnd2() { public RegexConcat getPatternEnd2() {
return new RegexConcat(// return new RegexConcat(//
new RegexLeaf("TEST1", "(.*)"), new RegexLeaf("\\)"), // new RegexLeaf("TEST1", "(.*)"), new RegexLeaf("\\)"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandRepeatWhile3Multilines.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), // new RegexLeaf("repeat"), //
new RegexLeaf("repeat[%s]?while"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("[%s]*"), // new RegexLeaf("while"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\("), // new RegexLeaf("\\("), //
new RegexLeaf("TEST1", "(.*)$")); new RegexLeaf("TEST1", "(.*)"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandSplit3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandSplit3.class.getName(), //
new RegexLeaf("^"), // RegexLeaf.start(), //
new RegexLeaf("split"), // new RegexLeaf("split"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,13 @@ public class CommandSplitAgain3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandSplitAgain3.class.getName(), //
new RegexLeaf("^"), // RegexLeaf.start(), //
new RegexLeaf("split[%s]?again"), // new RegexLeaf("split"), //
new RegexLeaf(";?$")); RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("again"), //
new RegexLeaf(";?"), RegexLeaf.end());
} }
@Override @Override

View File

@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
public class CommandSplitEnd3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandSplitEnd3 extends SingleLineCommand2<ActivityDiagram3> {
@ -49,11 +51,22 @@ public class CommandSplitEnd3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandSplitEnd3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), // new RegexOr( //
new RegexLeaf("(end[%s]?split|split[%s]?end)"), // new RegexConcat( //
new RegexLeaf(";?$")); new RegexLeaf("end"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("split") //
), //
new RegexConcat( //
new RegexLeaf("split"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("end") //
) //
), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandStart3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandStart3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
new RegexLeaf("start"), // new RegexLeaf("start"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -49,11 +50,11 @@ public class CommandStop3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandStop3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
new RegexLeaf("stop"), // new RegexLeaf("stop"), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -52,14 +53,14 @@ public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandSwimlane.class.getName(), RegexLeaf.start(), //
new RegexLeaf("\\|"), // new RegexLeaf("\\|"), //
ColorParser.exp6(), // ColorParser.exp6(), //
new RegexLeaf("SWIMLANE", "([^|]+)"), // new RegexLeaf("SWIMLANE", "([^|]+)"), //
new RegexLeaf("\\|"), // new RegexLeaf("\\|"), //
new RegexLeaf("LABEL", "([^|]+)?"), // new RegexLeaf("LABEL", "([^|]+)?"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
@ -52,14 +54,21 @@ public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandSwimlane2.class.getName(), RegexLeaf.start(), //
new RegexLeaf("swimlane[%s]+"), // new RegexLeaf("swimlane"), //
RegexLeaf.spaceOneOrMore(), //
ColorParser.exp7(), // ColorParser.exp7(), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("SWIMLANE", "([^|]+)"), // new RegexLeaf("SWIMLANE", "([^|]+)"), //
new RegexLeaf("LABEL", "(?:[%s]+as[%s]+([^|]+))?"), // new RegexOptional( //
new RegexLeaf("$")); new RegexConcat( //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("LABEL", "([^|]+)") //
)), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -52,14 +53,14 @@ public class CommandSwitch extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandSwitch.class.getName(), RegexLeaf.start(), //
ColorParser.exp4(), // ColorParser.exp4(), //
new RegexLeaf("switch"), // new RegexLeaf("switch"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), // new RegexLeaf("TEST", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
@ -53,16 +54,19 @@ public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(// return RegexConcat.build(CommandWhile3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("^"), //
ColorParser.exp4(), // ColorParser.exp4(), //
new RegexLeaf("while"), // new RegexLeaf("while"), //
new RegexLeaf("TEST", "[%s]*\\((.*?)\\)"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TEST", "\\((.*?)\\)"), //
new RegexOptional(new RegexConcat(// new RegexOptional(new RegexConcat(//
new RegexLeaf("[%s]*(is|equals?)[%s]*"), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(is|equals?)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("YES", "\\((.+?)\\)"))), // new RegexLeaf("YES", "\\((.+?)\\)"))), //
new RegexLeaf(";?$")); new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -39,8 +39,11 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
@ -50,11 +53,24 @@ public class CommandWhileEnd3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandWhileEnd3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("(end[%s]?while|while[%s]?end)"), // new RegexOr( //
new RegexLeaf("OUT", "[%s]*(?:\\((.+?)\\))?"), // new RegexConcat( //
new RegexLeaf(";?$")); new RegexLeaf("end"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("while") //
), //
new RegexConcat( //
new RegexLeaf("while"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("end") //
) //
), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("OUT", "\\((.+?)\\)")), //
new RegexLeaf(";?"), //
RegexLeaf.end());
} }
@Override @Override

View File

@ -85,7 +85,7 @@ public interface FtileFactory {
LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut); LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut);
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile, public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering); LinkRendering topInlinkRendering, Url url);
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile, public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Display labelTest); LinkRendering topInlinkRendering, Display labelTest);

View File

@ -159,8 +159,8 @@ public class FtileFactoryDelegator implements FtileFactory {
} }
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile, public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering) { LinkRendering topInlinkRendering, Url url) {
return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering); return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url);
} }
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile, public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,

View File

@ -84,8 +84,6 @@ public class FtileGeometry extends Dimension2D {
return new Point2D.Double(left, outY); return new Point2D.Double(left, outY);
} }
public FtileGeometry(Dimension2D dim, double left, double inY) { public FtileGeometry(Dimension2D dim, double left, double inY) {
this(dim.getWidth(), dim.getHeight(), left, inY); this(dim.getWidth(), dim.getHeight(), left, inY);
} }
@ -145,6 +143,10 @@ public class FtileGeometry extends Dimension2D {
return left; return left;
} }
public final double getRight() {
return width - left;
}
public double getOutY() { public double getOutY() {
return outY; return outY;
} }

View File

@ -63,6 +63,7 @@ public class Snake implements UShape {
private UPolygon endDecoration; private UPolygon endDecoration;
private final Rainbow color; private final Rainbow color;
private TextBlock textBlock; private TextBlock textBlock;
private String textBlockPosition;
private MergeStrategy mergeable = MergeStrategy.FULL; private MergeStrategy mergeable = MergeStrategy.FULL;
private Direction emphasizeDirection; private Direction emphasizeDirection;
private final HorizontalAlignment horizontalAlignment; private final HorizontalAlignment horizontalAlignment;
@ -110,6 +111,11 @@ public class Snake implements UShape {
this(null, horizontalAlignment, color, null); this(null, horizontalAlignment, color, null);
} }
public void setLabel(TextBlock label, String position) {
this.textBlock = label;
this.textBlockPosition = position;
}
public void setLabel(TextBlock label) { public void setLabel(TextBlock label) {
this.textBlock = label; this.textBlock = label;
} }
@ -206,7 +212,9 @@ public class Snake implements UShape {
double x = Math.max(pt1.getX(), pt2.getX()) + 4; double x = Math.max(pt1.getX(), pt2.getX()) + 4;
final boolean zigzag = worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD"); final boolean zigzag = worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD");
double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2; double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
if (horizontalAlignment == HorizontalAlignment.CENTER && zigzag) { if ("bottom".equalsIgnoreCase(textBlockPosition)) {
x = worm.getLast().getX();
} else if (horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
final Point2D pt3 = worm.get(2); final Point2D pt3 = worm.get(2);
x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2; x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2;
} else if (horizontalAlignment == HorizontalAlignment.RIGHT && zigzag) { } else if (horizontalAlignment == HorizontalAlignment.RIGHT && zigzag) {

View File

@ -35,15 +35,21 @@
*/ */
package net.sourceforge.plantuml.activitydiagram3.ftile; package net.sourceforge.plantuml.activitydiagram3.ftile;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.Pragma;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; 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.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.utils.MathUtils; import net.sourceforge.plantuml.utils.MathUtils;
@ -59,6 +65,13 @@ public class SwimlanesB extends SwimlanesA {
double x2 = 0; double x2 = 0;
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false);
if (color != null) {
final double titleHeight = getTitlesHeight(stringBounder);
final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight);
ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back);
}
for (Swimlane swimlane : swimlanes) { for (Swimlane swimlane : swimlanes) {
final TextBlock swTitle = getTitle(swimlane); final TextBlock swTitle = getTitle(swimlane);
final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth(); final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
@ -68,6 +81,14 @@ public class SwimlanesB extends SwimlanesA {
} }
} }
private double getTitlesWidth(StringBounder stringBounder) {
double x2 = 0;
for (Swimlane swimlane : swimlanes) {
x2 += swimlane.getActualWidth();
}
return x2;
}
private TextBlock getTitle(Swimlane swimlane) { private TextBlock getTitle(Swimlane swimlane) {
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null); final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null);
@ -101,12 +122,17 @@ public class SwimlanesB extends SwimlanesA {
@Override @Override
protected UTranslate getTitleHeightTranslate(final StringBounder stringBounder) { protected UTranslate getTitleHeightTranslate(final StringBounder stringBounder) {
double titlesHeight = getTitlesHeight(stringBounder);
return new UTranslate(0, titlesHeight > 0 ? titlesHeight + 5 : 0);
}
private double getTitlesHeight(StringBounder stringBounder) {
double titlesHeight = 0; double titlesHeight = 0;
for (Swimlane swimlane : swimlanes) { for (Swimlane swimlane : swimlanes) {
final TextBlock swTitle = getTitle(swimlane); final TextBlock swTitle = getTitle(swimlane);
titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight()); titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight());
} }
return new UTranslate(0, titlesHeight); return titlesHeight;
} }
} }

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.Pragma;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -51,6 +52,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
@ -64,9 +66,10 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
@Override @Override
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile, public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering) { LinkRendering topInlinkRendering, Url url) {
final ConditionStyle conditionStyle = skinParam().getConditionStyle(); final ConditionStyle conditionStyle = skinParam().getConditionStyle();
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
final Branch branch0 = thens.get(0); final Branch branch0 = thens.get(0);
final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
@ -89,7 +92,7 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile, fcTest); conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile, fcTest);
} }
return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle, return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle,
thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest); conditionEndStyle, thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest, url);
} }
private HtmlColor fontColor(FontParam param) { private HtmlColor fontColor(FontParam param) {

View File

@ -70,23 +70,6 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
@Override @Override
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile, public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Display labelTest) { LinkRendering topInlinkRendering, Display labelTest) {
// final ConditionStyle conditionStyle = skinParam().getConditionStyle();
//
// final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
// final HtmlColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground);
// final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam());
//
// final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
//
// final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
// : FontParam.ARROW;
// final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null)
// .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND));
//
// return FtileSwitch.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle,
// branches,
// fcArrow, topInlinkRendering, afterEndwhile, fcTest);
// return createNude(swimlane, branches); // return createNude(swimlane, branches);
// return createWithDiamonds(swimlane, branches, labelTest); // return createWithDiamonds(swimlane, branches, labelTest);
return createWithLinks(swimlane, branches, labelTest); return createWithLinks(swimlane, branches, labelTest);
@ -113,11 +96,11 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
private Ftile createWithLinks(Swimlane swimlane, List<Branch> branches, Display labelTest) { private Ftile createWithLinks(Swimlane swimlane, List<Branch> branches, Display labelTest) {
final List<Ftile> ftiles = new ArrayList<Ftile>(); final List<Ftile> ftiles = new ArrayList<Ftile>();
final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
for (Branch branch : branches) { for (Branch branch : branches) {
ftiles.add(new FtileMinWidth(branch.getFtile(), 30)); ftiles.add(new FtileMinWidth(branch.getFtile(), 30));
} }
final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam());
if (ftiles.size() == 1) { if (ftiles.size() == 1) {
final FtileSwitchWithOneLink result = new FtileSwitchWithOneLink(ftiles, branches, swimlane, diamond1, final FtileSwitchWithOneLink result = new FtileSwitchWithOneLink(ftiles, branches, swimlane, diamond1,

View File

@ -56,12 +56,14 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -72,6 +74,7 @@ public class FtileIfDown extends AbstractFtile {
private final Ftile diamond1; private final Ftile diamond1;
private final Ftile diamond2; private final Ftile diamond2;
private final Ftile optionalStop; private final Ftile optionalStop;
private final ConditionEndStyle conditionEndStyle;
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
@ -98,27 +101,34 @@ public class FtileIfDown extends AbstractFtile {
return thenBlock.getSwimlaneOut(); return thenBlock.getSwimlaneOut();
} }
private FtileIfDown(Ftile thenBlock, Ftile diamond1, Ftile diamond2, Ftile optionalStop) { private FtileIfDown(Ftile thenBlock, Ftile diamond1, Ftile diamond2, Ftile optionalStop,
ConditionEndStyle conditionEndStyle) {
super(thenBlock.skinParam()); super(thenBlock.skinParam());
this.thenBlock = thenBlock; this.thenBlock = thenBlock;
this.diamond1 = diamond1; this.diamond1 = diamond1;
this.diamond2 = diamond2; this.diamond2 = diamond2;
this.optionalStop = optionalStop; this.optionalStop = optionalStop;
this.conditionEndStyle = conditionEndStyle;
} }
public static Ftile create(Ftile diamond1, Ftile diamond2, Swimlane swimlane, Ftile thenBlock, Rainbow arrowColor, public static Ftile create(Ftile diamond1, Ftile diamond2, Swimlane swimlane, Ftile thenBlock, Rainbow arrowColor,
FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor) { ConditionEndStyle conditionEndStyle, FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor) {
elseColor = elseColor.withDefault(arrowColor); elseColor = elseColor.withDefault(arrowColor);
final FtileIfDown result = new FtileIfDown(thenBlock, diamond1, optionalStop == null ? diamond2 final FtileIfDown result = new FtileIfDown(thenBlock, diamond1, optionalStop == null ? diamond2
: new FtileEmpty(ftileFactory.skinParam()), optionalStop); : new FtileEmpty(ftileFactory.skinParam()), optionalStop, conditionEndStyle);
final List<Connection> conns = new ArrayList<Connection>(); final List<Connection> conns = new ArrayList<Connection>();
conns.add(result.new ConnectionIn(thenBlock.getInLinkRendering().getRainbow(arrowColor))); conns.add(result.new ConnectionIn(thenBlock.getInLinkRendering().getRainbow(arrowColor)));
final boolean hasPointOut1 = thenBlock.calculateDimension(ftileFactory.getStringBounder()).hasPointOut(); final boolean hasPointOut1 = thenBlock.calculateDimension(ftileFactory.getStringBounder()).hasPointOut();
if (optionalStop == null) { if (optionalStop == null) {
if (hasPointOut1) { if (hasPointOut1) {
if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
conns.add(result.new ConnectionElse(elseColor)); conns.add(result.new ConnectionElse(elseColor));
} else if (conditionEndStyle == ConditionEndStyle.HLINE) {
conns.add(result.new ConnectionElseHline(elseColor));
conns.add(result.new ConnectionHline(elseColor));
}
} else { } else {
conns.add(result.new ConnectionElseNoDiamond(elseColor)); conns.add(result.new ConnectionElseNoDiamond(elseColor));
} }
@ -228,6 +238,14 @@ public class FtileIfDown extends AbstractFtile {
getFtile2().calculateDimension(stringBounder).getPointIn()); getFtile2().calculateDimension(stringBounder).getPointIn());
} }
private Point2D getP2hline(final StringBounder stringBounder) {
final FtileGeometry dimDiamond2 = getFtile2().calculateDimension(stringBounder);
final double x = dimDiamond2.getWidth();
final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
return getTranslateDiamond2(stringBounder)
.getTranslated(new Point2D.Double(x, dimDiamond2.getInY() + half));
}
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
@ -237,7 +255,12 @@ public class FtileIfDown extends AbstractFtile {
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
snake.addPoint(getP1(stringBounder)); snake.addPoint(getP1(stringBounder));
if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
snake.addPoint(getP2(stringBounder)); snake.addPoint(getP2(stringBounder));
} else if (conditionEndStyle == ConditionEndStyle.HLINE) {
snake.addPoint(getP2hline(stringBounder));
}
ug.draw(snake); ug.draw(snake);
} }
@ -271,7 +294,7 @@ public class FtileIfDown extends AbstractFtile {
this.endInlinkColor = endInlinkColor; this.endInlinkColor = endInlinkColor;
} }
private Point2D getP1(StringBounder stringBounder) { protected Point2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x = dimDiamond1.getWidth(); final double x = dimDiamond1.getWidth();
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2; final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
@ -290,7 +313,6 @@ public class FtileIfDown extends AbstractFtile {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
final Point2D p1 = getP1(stringBounder); final Point2D p1 = getP1(stringBounder);
if (calculateDimension(stringBounder).hasPointOut() == false) { if (calculateDimension(stringBounder).hasPointOut() == false) {
return; return;
@ -302,24 +324,72 @@ public class FtileIfDown extends AbstractFtile {
final double x2 = p2.getX(); final double x2 = p2.getX();
final double y2 = p2.getY(); final double y2 = p2.getY();
snake.addPoint(x1, y1);
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder); final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx() final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
+ thenGeom.getWidth()); + thenGeom.getWidth());
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
snake.addPoint(x1, y1);
snake.addPoint(xmax, y1); snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2); snake.addPoint(xmax, y2);
snake.addPoint(x2, y2); snake.addPoint(x2, y2);
snake.emphasizeDirection(Direction.DOWN); snake.emphasizeDirection(Direction.DOWN);
ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize)); ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
ug.draw(snake); ug.draw(snake);
} }
} }
class ConnectionElseHline extends ConnectionElse {
private final Rainbow endInlinkColor;
public ConnectionElseHline(Rainbow endInlinkColor) {
super(endInlinkColor);
this.endInlinkColor = endInlinkColor;
}
@Override
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Point2D p1 = getP1(stringBounder);
if (calculateDimension(stringBounder).hasPointOut() == false) {
return;
}
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 FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
+ thenGeom.getWidth());
/*
* if( conditionEndStyle == ConditionEndStyle.DIAMOND ) { final Snake snake = new
* Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); snake.addPoint(x1, y1);
* snake.addPoint(xmax, y1); snake.addPoint(xmax, y2); snake.addPoint(x2, y2);
* snake.emphasizeDirection(Direction.DOWN); ug.apply(new UTranslate(x2, y2 -
* Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize)); ug.draw(snake); }
*/
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToDown());
snake.addPoint(x1, y1);
snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2);
ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
ug.draw(snake);
/*
* final Snake snake2 = new Snake(arrowHorizontalAlignment(), endInlinkColor); snake2.addPoint(xmax, y2);
* snake2.addPoint(x2, y2); ug.draw(snake2);
*/
}
}
class ConnectionElseNoDiamond extends ConnectionElse { class ConnectionElseNoDiamond extends ConnectionElse {
public ConnectionElseNoDiamond(Rainbow endInlinkColor) { public ConnectionElseNoDiamond(Rainbow endInlinkColor) {
@ -333,6 +403,72 @@ public class FtileIfDown extends AbstractFtile {
} }
// copied from FtileIfLongHorizontal to use with ConditionEndStyle.HLINE
class ConnectionHline extends AbstractConnection {
private final Rainbow endInlinkColor;
public ConnectionHline(Rainbow endInlinkColor) {
super(diamond1, diamond2);
this.endInlinkColor = endInlinkColor;
}
private Point2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x = dimDiamond1.getWidth();
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
return getTranslateDiamond1(stringBounder)
.getTranslated(new Point2D.Double(x, dimDiamond1.getInY() + half));
}
protected Point2D getP2(final StringBounder stringBounder) {
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double x = dimDiamond2.getWidth();
final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
return getTranslateDiamond2(stringBounder)
.getTranslated(new Point2D.Double(x, dimDiamond2.getInY() + half));
}
// the bottom or south point of the diamond that we omitted
protected Point2D getP3(final StringBounder stringBounder) {
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double x = dimDiamond2.getWidth();
return getTranslateDiamond2(stringBounder).getTranslated(new Point2D.Double(x, dimDiamond2.getOutY()));
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Point2D p1 = getP1(stringBounder);
if (calculateDimension(stringBounder).hasPointOut() == false) {
return;
}
final Point2D p2 = getP2(stringBounder);
final Point2D p3 = getP3(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY();
final double x2 = p2.getX();
final double y2 = p2.getY();
final double x3 = p3.getX();
final double y3 = p3.getY();
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
+ thenGeom.getWidth());
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor);
snake.addPoint(xmax, y2);
// ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5,
// Diamond.diamondHalfSize));
snake.addPoint(x2, y2);
snake.addPoint(x3, y3);
snake.goUnmergeable(MergeStrategy.NONE);
ug.draw(snake);
}
}
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
ug.apply(getTranslateForThen(stringBounder)).draw(thenBlock); ug.apply(getTranslateForThen(stringBounder)).draw(thenBlock);

View File

@ -73,6 +73,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
class FtileRepeat extends AbstractFtile { class FtileRepeat extends AbstractFtile {
@ -124,6 +125,7 @@ class FtileRepeat extends AbstractFtile {
final TextBlock outTb = out.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer); final TextBlock outTb = out.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
final Ftile diamond1; final Ftile diamond1;
assert swimlane == repeat.getSwimlaneIn();
if (backStart == null) { if (backStart == null) {
diamond1 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, repeat.getSwimlaneIn()); diamond1 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, repeat.getSwimlaneIn());
} else { } else {
@ -159,7 +161,7 @@ class FtileRepeat extends AbstractFtile {
final Display backLink1 = backRepeatLinkRendering.getDisplay(); final Display backLink1 = backRepeatLinkRendering.getDisplay();
final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fcArrow, HorizontalAlignment.LEFT, final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fcArrow, HorizontalAlignment.LEFT,
spriteContainer, CreoleMode.SIMPLE_LINE); spriteContainer, CreoleMode.SIMPLE_LINE);
if (repeat.getSwimlaneIn() == repeat.getSwimlaneOut()) { if (repeat.getSwimlaneIn() == swimlaneOut) {
if (backward == null) { if (backward == null) {
conns.add(result.new ConnectionBackSimple(backRepeatLinkRendering.getRainbow(arrowColor), tbbackLink1)); conns.add(result.new ConnectionBackSimple(backRepeatLinkRendering.getRainbow(arrowColor), tbbackLink1));
} else { } else {
@ -295,8 +297,6 @@ class FtileRepeat extends AbstractFtile {
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
snake.emphasizeDirection(Direction.UP);
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder); final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
Point2D p1 = getP1(stringBounder); Point2D p1 = getP1(stringBounder);
@ -306,11 +306,20 @@ class FtileRepeat extends AbstractFtile {
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder); final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double y1 = p1.getY() + dimDiamond2.getHeight() / 2; final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
final double x2 = p2.getX() + dimDiamond1.getWidth(); double x2 = p2.getX() + dimDiamond1.getWidth();
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2; final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2 final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
+ Diamond.diamondHalfSize; + Diamond.diamondHalfSize;
UPolygon arrow = Arrows.asToLeft();
if (xmax < x2) {
arrow = Arrows.asToRight();
x2 = p2.getX();
}
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, arrow);
snake.emphasizeDirection(Direction.UP);
snake.addPoint(xmax, y1); snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2); snake.addPoint(xmax, y2);
snake.addPoint(x2, y2); snake.addPoint(x2, y2);
@ -434,7 +443,7 @@ class FtileRepeat extends AbstractFtile {
} }
class ConnectionBackSimple extends AbstractConnection { class ConnectionBackSimple extends AbstractConnection implements ConnectionTranslatable {
private final Rainbow arrowColor; private final Rainbow arrowColor;
private final TextBlock tbback; private final TextBlock tbback;
@ -477,6 +486,34 @@ class FtileRepeat extends AbstractFtile {
ug.draw(snake); ug.draw(snake);
} }
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
snake.setLabel(tbback);
snake.emphasizeDirection(Direction.UP);
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
Point2D p1 = getP1(stringBounder);
Point2D p2 = getP2(stringBounder);
p1 = translate1.getTranslated(p1);
p2 = translate2.getTranslated(p2);
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 xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
+ Diamond.diamondHalfSize;
snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2);
snake.addPoint(x2, y2);
ug.draw(snake);
}
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {

View File

@ -136,7 +136,7 @@ public class VCompactFactory implements FtileFactory {
} }
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile, public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering) { LinkRendering topInlinkRendering, Url url) {
final List<Ftile> ftiles = new ArrayList<Ftile>(); final List<Ftile> ftiles = new ArrayList<Ftile>();
for (Branch branch : thens) { for (Branch branch : thens) {
ftiles.add(branch.getFtile()); ftiles.add(branch.getFtile());

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -46,6 +47,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithUrl;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileIfDown; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileIfDown;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
@ -62,6 +64,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
public class ConditionalBuilder { public class ConditionalBuilder {
@ -72,6 +75,7 @@ public class ConditionalBuilder {
private final Rainbow arrowColor; private final Rainbow arrowColor;
private final FtileFactory ftileFactory; private final FtileFactory ftileFactory;
private final ConditionStyle conditionStyle; private final ConditionStyle conditionStyle;
private final ConditionEndStyle conditionEndStyle;
private final Branch branch1; private final Branch branch1;
private final Branch branch2; private final Branch branch2;
private final ISkinParam skinParam; private final ISkinParam skinParam;
@ -81,22 +85,26 @@ public class ConditionalBuilder {
private final Ftile tile1; private final Ftile tile1;
private final Ftile tile2; private final Ftile tile2;
private final Url url;
public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2, FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle,
ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest) { Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
FontConfiguration fontArrow, FontConfiguration fontTest, Url url) {
this.swimlane = swimlane; this.swimlane = swimlane;
this.borderColor = borderColor; this.borderColor = borderColor;
this.backColor = backColor; this.backColor = backColor;
this.arrowColor = arrowColor; this.arrowColor = arrowColor;
this.ftileFactory = ftileFactory; this.ftileFactory = ftileFactory;
this.conditionStyle = conditionStyle; this.conditionStyle = conditionStyle;
this.conditionEndStyle = conditionEndStyle;
this.branch1 = branch1; this.branch1 = branch1;
this.branch2 = branch2; this.branch2 = branch2;
this.skinParam = skinParam; this.skinParam = skinParam;
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
this.fontArrow = fontArrow; this.fontArrow = fontArrow;
this.fontTest = fontTest; this.fontTest = fontTest;
this.url = url;
this.tile1 = new FtileMinWidth(branch1.getFtile(), 30); this.tile1 = new FtileMinWidth(branch1.getFtile(), 30);
this.tile2 = new FtileMinWidth(branch2.getFtile(), 30); this.tile2 = new FtileMinWidth(branch2.getFtile(), 30);
@ -104,10 +112,12 @@ public class ConditionalBuilder {
} }
static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2, FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle,
ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) { Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
FontConfiguration fcArrow, FontConfiguration fcTest, Url url) {
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor, final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor,
ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder, fcArrow, fcTest); ftileFactory, conditionStyle, conditionEndStyle, branch1, branch2, skinParam, stringBounder, fcArrow,
fcTest, url);
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false) { if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false) {
return builder.createDown(builder.branch1, builder.branch2); return builder.createDown(builder.branch1, builder.branch2);
} }
@ -138,18 +148,20 @@ public class ConditionalBuilder {
final Ftile diamond2 = getDiamond2(branch1, branch2, true); final Ftile diamond2 = getDiamond2(branch1, branch2, true);
if (branch2.isOnlySingleStopOrSpot()) { if (branch2.isOnlySingleStopOrSpot()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
arrowColor, ftileFactory, branch2.getFtile(), branch2.getInlinkRenderingColorAndStyle()); arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(),
branch2.getInlinkRenderingColorAndStyle());
} }
if (branch1.isOnlySingleStopOrSpot()) { if (branch1.isOnlySingleStopOrSpot()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10), return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
arrowColor, ftileFactory, branch1.getFtile(), branch1.getInlinkRenderingColorAndStyle()); arrowColor, conditionEndStyle, ftileFactory, branch1.getFtile(),
branch1.getInlinkRenderingColorAndStyle());
} }
if (branch1.isEmpty()) { if (branch1.isEmpty()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10), return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
arrowColor, ftileFactory, null, null); arrowColor, conditionEndStyle, ftileFactory, null, null);
} }
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor, return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor,
ftileFactory, null, branch2.getInlinkRenderingColorAndStyle()); conditionEndStyle, ftileFactory, null, branch2.getInlinkRenderingColorAndStyle());
} }
private Ftile createNude() { private Ftile createNude() {
@ -173,12 +185,15 @@ public class ConditionalBuilder {
} }
private Ftile createWithLinks() { private Ftile createWithLinks() {
final Ftile diamond1 = getDiamond1(true); Ftile diamond1 = getDiamond1(true);
if (url != null) {
diamond1 = new FtileWithUrl(diamond1, url);
}
final Ftile diamond2 = getDiamond2(branch1, branch2, false); final Ftile diamond2 = getDiamond2(branch1, branch2, false);
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10); final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10); final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor, final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
stringBounder); conditionEndStyle, stringBounder);
final Dimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder); final Dimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
final Dimension2D label2 = getLabelPositive(branch2).calculateDimension(stringBounder); final Dimension2D label2 = getLabelPositive(branch2).calculateDimension(stringBounder);
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1); final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
@ -232,6 +247,10 @@ public class ConditionalBuilder {
private Ftile getDiamond2(Branch branch1, Branch branch2, boolean useNorth) { private Ftile getDiamond2(Branch branch1, Branch branch2, boolean useNorth) {
final Ftile diamond2; final Ftile diamond2;
if (conditionEndStyle == ConditionEndStyle.HLINE) {
return new FtileEmpty(tile1.skinParam(), 0, Diamond.diamondHalfSize, swimlane, swimlane);
}
// else use default ConditionEndStyle.DIAMOND
if (hasTwoBranches()) { if (hasTwoBranches()) {
final Display out1 = branch1.getFtile().getOutLinkRendering().getDisplay(); final Display out1 = branch1.getFtile().getOutLinkRendering().getDisplay();
final TextBlock tbout1 = out1 == null ? null : out1.create(fontArrow, HorizontalAlignment.LEFT, final TextBlock tbout1 = out1 == null ? null : out1.create(fontArrow, HorizontalAlignment.LEFT,

View File

@ -54,20 +54,25 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy; import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorOneSwimlane;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileIfWithLinks extends FtileIfWithDiamonds { public class FtileIfWithLinks extends FtileIfWithDiamonds {
private final ConditionEndStyle conditionEndStyle;
private final Rainbow arrowColor; private final Rainbow arrowColor;
public FtileIfWithLinks(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in, Rainbow arrowColor, public FtileIfWithLinks(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in, Rainbow arrowColor,
StringBounder stringBounder) { ConditionEndStyle conditionEndStyle, StringBounder stringBounder) {
super(diamond1, tile1, tile2, diamond2, in, stringBounder); super(diamond1, tile1, tile2, diamond2, in, stringBounder);
this.arrowColor = arrowColor; this.arrowColor = arrowColor;
this.conditionEndStyle = conditionEndStyle;
if (arrowColor.size() == 0) { if (arrowColor.size() == 0) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -369,17 +374,127 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
} }
// copied from FtileIfLongHorizontal to use with ConditionEndStyle.HLINE
class ConnectionVerticalOut extends AbstractConnection {
private final Rainbow color;
private final TextBlock out2;
public ConnectionVerticalOut(Ftile tile, Rainbow color, TextBlock out2) {
super(tile, null);
this.color = color;
this.out2 = out2;
}
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 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(arrowHorizontalAlignment(), color, Arrows.asToDown());
snake.setLabel(out2);
snake.addPoint(p1);
snake.addPoint(p2);
ug.draw(snake);
}
private UTranslate translate(StringBounder stringBounder) {
if (getFtile1() == tile1) {
return getTranslate1(stringBounder);
}
if (getFtile1() == tile2) {
return getTranslate2(stringBounder);
}
throw new IllegalStateException();
}
/*
* private Point2D getP1(StringBounder stringBounder) {
*
* final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); if (geo.hasPointOut() == false) {
* return null; } final Point2D p = geo.getPointOut(); return getTranslate1(stringBounder).getTranslated(p); }
*/
}
// copied from FtileIfLongHorizontal to use with ConditionEndStyle.HLINE
class ConnectionHline extends AbstractConnection {
private final Rainbow arrowColor;
public ConnectionHline(Rainbow arrowColor) {
super(null, null);
this.arrowColor = arrowColor;
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
final Swimlane intoSw;
if (ug instanceof UGraphicInterceptorOneSwimlane) {
intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane();
} else {
intoSw = null;
}
final List<Ftile> all = new ArrayList<Ftile>();
all.add(tile1);
all.add(tile2);
double minX = totalDim.getWidth() / 2;
double maxX = totalDim.getWidth() / 2;
boolean atLeastOne = false;
for (Ftile tmp : all) {
if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
continue;
}
if (intoSw != null && tmp.getSwimlanes().contains(intoSw) == false) {
continue;
}
if (intoSw != null && tmp.getSwimlaneOut() != intoSw) {
continue;
}
atLeastOne = true;
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);
}
if (atLeastOne == false) {
return;
}
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor);
s.goUnmergeable(MergeStrategy.NONE);
final double height = totalDim.getHeight();
s.addPoint(minX, height);
s.addPoint(maxX, height);
ug.draw(s);
}
}
public Ftile addLinks(Branch branch1, Branch branch2, StringBounder stringBounder) { public Ftile addLinks(Branch branch1, Branch branch2, StringBounder stringBounder) {
final List<Connection> conns = new ArrayList<Connection>(); final List<Connection> conns = new ArrayList<Connection>();
conns.add(new ConnectionHorizontalThenVertical(tile1, branch1)); conns.add(new ConnectionHorizontalThenVertical(tile1, branch1));
conns.add(new ConnectionHorizontalThenVertical(tile2, branch2)); conns.add(new ConnectionHorizontalThenVertical(tile2, branch2));
final boolean hasPointOut1 = tile1.calculateDimension(stringBounder).hasPointOut(); final boolean hasPointOut1 = tile1.calculateDimension(stringBounder).hasPointOut();
final boolean hasPointOut2 = tile2.calculateDimension(stringBounder).hasPointOut(); final boolean hasPointOut2 = tile2.calculateDimension(stringBounder).hasPointOut();
if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
if (hasPointOut1 && hasPointOut2) { if (hasPointOut1 && hasPointOut2) {
conns.add(new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColorAndStyle(), branch1 conns.add(new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColorAndStyle(),
.isEmpty())); branch1.isEmpty()));
conns.add(new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColorAndStyle(), branch2 conns.add(new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColorAndStyle(),
.isEmpty())); branch2.isEmpty()));
} else if (hasPointOut1 && hasPointOut2 == false) { } else if (hasPointOut1 && hasPointOut2 == false) {
conns.add(new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColorAndStyle(), conns.add(new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColorAndStyle(),
branch1.isEmpty())); branch1.isEmpty()));
@ -387,7 +502,21 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
conns.add(new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColorAndStyle(), conns.add(new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColorAndStyle(),
branch2.isEmpty())); branch2.isEmpty()));
} }
} else if (conditionEndStyle == ConditionEndStyle.HLINE) {
if (hasPointOut1 && hasPointOut2) {
conns.add(new ConnectionVerticalOut(tile1, arrowColor, null));
conns.add(new ConnectionVerticalOut(tile2, arrowColor, null));
conns.add(new ConnectionHline(arrowColor));
} else if (hasPointOut1 && hasPointOut2 == false) {
// this is called when the "else" has a break statement
conns.add(new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColorAndStyle(),
branch1.isEmpty()));
} else if (hasPointOut1 == false && hasPointOut2) {
// this is called when the "if" has a break statement
conns.add(new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColorAndStyle(),
branch2.isEmpty()));
}
}
return FtileUtils.addConnection(this, conns); return FtileUtils.addConnection(this, conns);
} }

View File

@ -52,7 +52,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileSwitchNude extends FtileDimensionMemoize { public class FtileSwitchNude extends FtileDimensionMemoize {
protected final double xSeparation = 20; protected double xSeparation = 20;
protected final List<Ftile> tiles; protected final List<Ftile> tiles;
private final Swimlane in; private final Swimlane in;

View File

@ -55,9 +55,18 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileSwitchWithDiamonds extends FtileSwitchNude { public class FtileSwitchWithDiamonds extends FtileSwitchNude {
private static final double SUPP15 = 15;
static enum Mode {
BIG_DIAMOND, SMALL_DIAMOND
};
protected final Ftile diamond1; protected final Ftile diamond1;
protected final Ftile diamond2; protected final Ftile diamond2;
protected final List<Branch> branches; protected final List<Branch> branches;
private Mode mode;
private final double w13;
private final double w9;
public FtileSwitchWithDiamonds(List<Ftile> tiles, List<Branch> branches, Swimlane in, Ftile diamond1, public FtileSwitchWithDiamonds(List<Ftile> tiles, List<Branch> branches, Swimlane in, Ftile diamond1,
Ftile diamond2, StringBounder stringBounder) { Ftile diamond2, StringBounder stringBounder) {
@ -65,6 +74,24 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
this.branches = branches; this.branches = branches;
this.diamond1 = diamond1; this.diamond1 = diamond1;
this.diamond2 = diamond2; this.diamond2 = diamond2;
w13 = diamond1.calculateDimension(stringBounder).getWidth()
- tiles.get(0).calculateDimension(stringBounder).getRight()
- tiles.get(tiles.size() - 1).calculateDimension(stringBounder).getLeft();
w9 = getW9(stringBounder);
if (w13 > w9) {
mode = Mode.BIG_DIAMOND;
} else {
mode = Mode.SMALL_DIAMOND;
}
}
private double getW9(StringBounder stringBounder) {
double result = 0;
for (int i = 1; i < tiles.size() - 1; i++) {
result += tiles.get(i).calculateDimension(stringBounder).getWidth();
}
return result;
} }
@Override @Override
@ -75,11 +102,11 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
return Collections.unmodifiableCollection(result); return Collections.unmodifiableCollection(result);
} }
public int getYdelta1a(StringBounder stringBounder) { public double getYdelta1a(StringBounder stringBounder) {
return 20; return 20;
} }
public int getYdelta1b(StringBounder stringBounder) { public double getYdelta1b(StringBounder stringBounder) {
return 10; return 10;
} }
@ -88,11 +115,21 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
final FtileGeometry dim1 = diamond1.calculateDimension(stringBounder); final FtileGeometry dim1 = diamond1.calculateDimension(stringBounder);
final FtileGeometry dim2 = diamond2.calculateDimension(stringBounder); final FtileGeometry dim2 = diamond2.calculateDimension(stringBounder);
final double nudeHeight = super.calculateDimensionInternalSlow(stringBounder).getHeight();
if (mode == Mode.BIG_DIAMOND) {
final double height = dim1.getHeight() + nudeHeight + dim2.getHeight() + getYdelta1a(stringBounder)
+ getYdelta1b(stringBounder);
final FtileGeometry tile0 = tiles.get(0).calculateDimension(stringBounder);
final double width = tile0.getWidth() + SUPP15 + w13 + SUPP15
+ +tiles.get(tiles.size() - 1).calculateDimension(stringBounder).getWidth();
return new FtileGeometry(width, height, tile0.getLeft() + SUPP15 + dim1.getLeft(), 0, height);
} else {
final FtileGeometry dimNude = super.calculateDimensionInternalSlow(stringBounder); final FtileGeometry dimNude = super.calculateDimensionInternalSlow(stringBounder);
final FtileGeometry all = dim1.appendBottom(dimNude).appendBottom(dim2); final FtileGeometry all = dim1.appendBottom(dimNude).appendBottom(dim2);
return all.addDim(0, getYdelta1a(stringBounder) + getYdelta1b(stringBounder)); return all.addDim(0, getYdelta1a(stringBounder) + getYdelta1b(stringBounder));
}
} }
@ -101,13 +138,42 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1); ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
if (mode == Mode.BIG_DIAMOND) {
for (Ftile tile : tiles) {
tile.drawU(ug.apply(getTranslateOf(tile, stringBounder)));
}
} else {
super.drawU(ug.apply(getTranslateMain(stringBounder))); super.drawU(ug.apply(getTranslateMain(stringBounder)));
}
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2); ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
} }
protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
final UTranslate main = getTranslateMain(stringBounder);
if (mode == Mode.BIG_DIAMOND) {
double dx = 0;
final double suppx = (w13 - w9) / (tiles.size() - 1);
for (int i = 0; i < tiles.size() - 1; i++) {
if (tile == tiles.get(i)) {
return main.compose(new UTranslate(dx, 0));
}
dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx;
}
if (tile == tiles.get(tiles.size() - 1)) {
final double dx9 = tiles.get(0).calculateDimension(stringBounder).getWidth() + w13 + SUPP15 + SUPP15;
return main.compose(new UTranslate(dx9, 0));
}
throw new IllegalArgumentException();
}
return getTranslateNude(tile, stringBounder).compose(main);
}
protected UTranslate getTranslateMain(StringBounder stringBounder) { protected UTranslate getTranslateMain(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
return new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder)); final double dy1 = dimDiamond1.getHeight() + getYdelta1a(stringBounder);
return new UTranslate(0, dy1);
} }
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) { protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
@ -126,15 +192,9 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
return new UTranslate(x2, y2); return new UTranslate(x2, y2);
} }
protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
}
protected TextBlock getLabelPositive(Branch branch) { protected TextBlock getLabelPositive(Branch branch) {
final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
return branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); return branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
} }
} }

View File

@ -162,10 +162,10 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
} }
protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) { // protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder)); // return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
//
} // }
class ConnectionVerticalTop extends AbstractConnection { class ConnectionVerticalTop extends AbstractConnection {
@ -189,7 +189,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
final double y2 = p2.getY(); final double y2 = p2.getY();
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
snake.setLabel(getLabelPositive(branch)); snake.setLabel(getLabelPositive(branch), "BOTTOM");
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) { if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
snake.addPoint(x2, p1d.getY()); snake.addPoint(x2, p1d.getY());
snake.addPoint(x2, y2); snake.addPoint(x2, y2);
@ -263,6 +263,14 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
} }
public double getYdelta1a(StringBounder stringBounder) {
double max = 10;
for (Branch branch : branches) {
max = Math.max(max, getLabelPositive(branch).calculateDimension(stringBounder).getHeight());
}
return max + 10;
}
public Ftile addLinks() { public Ftile addLinks() {
final List<Connection> conns = new ArrayList<Connection>(); final List<Connection> conns = new ArrayList<Connection>();
conns.add(new ConnectionHorizontalThenVertical(tiles.get(0), branches.get(0))); conns.add(new ConnectionHorizontalThenVertical(tiles.get(0), branches.get(0)));

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,12 +49,12 @@ public class CommandDockedEvent extends SingleLineCommand2<BpmDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandDockedEvent.class.getName(), RegexLeaf.start(), //
new RegexLeaf(":"), // new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("STYLE", ";"), // new RegexLeaf("STYLE", ";"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,10 +49,10 @@ public class CommandElseBranch extends SingleLineCommand2<BpmDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandElseBranch.class.getName(), //
new RegexLeaf("else"), // RegexLeaf.start(), //
new RegexLeaf("$")); new RegexLeaf("else"), RegexLeaf.end());
} }
@Override @Override

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,10 +49,10 @@ public class CommandEndBranch extends SingleLineCommand2<BpmDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandEndBranch.class.getName(), RegexLeaf.start(), //
new RegexLeaf("end branch"), // new RegexLeaf("end branch"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,12 +49,12 @@ public class CommandGoto extends SingleLineCommand2<BpmDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandGoto.class.getName(), RegexLeaf.start(), //
new RegexLeaf("goto"), // new RegexLeaf("goto"), //
new RegexLeaf("[%s]+"), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), // new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,12 +49,12 @@ public class CommandMerge extends SingleLineCommand2<BpmDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandMerge.class.getName(), RegexLeaf.start(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), // new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf(":?"), // new RegexLeaf(":?"), //
new RegexLeaf("\\<\\+\\>"), // new RegexLeaf("\\<\\+\\>"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,10 +49,10 @@ public class CommandNewBranch extends SingleLineCommand2<BpmDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandNewBranch.class.getName(), RegexLeaf.start(), //
new RegexLeaf("new branch"), // new RegexLeaf("new branch"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,12 +49,12 @@ public class CommandResume extends SingleLineCommand2<BpmDiagram> {
super(getRegexConcat()); super(getRegexConcat());
} }
static RegexConcat getRegexConcat() { static IRegex getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), // return RegexConcat.build(CommandResume.class.getName(), RegexLeaf.start(), //
new RegexLeaf("resume"), // new RegexLeaf("resume"), //
new RegexLeaf("[%s]+"), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), // new RegexLeaf("ID", "([\\p{L}0-9_.@]+)"), //
new RegexLeaf("$")); RegexLeaf.end());
} }
@Override @Override

View File

@ -40,11 +40,16 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram { public abstract class AbstractEntityDiagram extends CucaDiagram {
public AbstractEntityDiagram(ISkinSimple orig) {
super(orig);
}
final protected List<String> getDotStrings() { final protected List<String> getDotStrings() {
final List<String> def = Arrays.asList("nodesep=.35;", "ranksep=0.8;", "edge [fontsize=11,labelfontsize=11];", final List<String> def = Arrays.asList("nodesep=.35;", "ranksep=0.8;", "edge [fontsize=11,labelfontsize=11];",
"node [fontsize=11,height=.35,width=.55];"); "node [fontsize=11,height=.35,width=.55];");

View File

@ -39,6 +39,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
@ -58,6 +59,10 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
public class ClassDiagram extends AbstractClassOrObjectDiagram { public class ClassDiagram extends AbstractClassOrObjectDiagram {
public ClassDiagram(ISkinSimple skinParam) {
super(skinParam);
}
private final String getNamespace(Code fullyCode) { private final String getNamespace(Code fullyCode) {
return getNamespace(fullyCode, fullyCode.getSeparator()); return getNamespace(fullyCode, fullyCode.getSeparator());
} }

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.classdiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod; import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod;
import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing; import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing;
@ -77,10 +78,15 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectM
public class ClassDiagramFactory extends UmlDiagramFactory { public class ClassDiagramFactory extends UmlDiagramFactory {
private final ISkinSimple skinParam;
public ClassDiagramFactory(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
@Override @Override
public ClassDiagram createEmptyDiagram() { public ClassDiagram createEmptyDiagram() {
return new ClassDiagram(); return new ClassDiagram(skinParam);
} }
@Override @Override
@ -124,13 +130,13 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandImport()); cmds.add(new CommandImport());
final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand(new RegexLeaf( final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand("a", new RegexLeaf(
"ENTITY", "(" + CommandCreateClass.CODE_NO_DOTDOT + "|[%g][^%g]+[%g])::([%g][^%g]+[%g]|[^%s]+)")); "ENTITY", "(" + CommandCreateClass.CODE_NO_DOTDOT + "|[%g][^%g]+[%g])::([%g][^%g]+[%g]|[^%s]+)"));
cmds.add(factoryTipOnEntityCommand.createMultiLine(true)); cmds.add(factoryTipOnEntityCommand.createMultiLine(true));
cmds.add(factoryTipOnEntityCommand.createMultiLine(false)); cmds.add(factoryTipOnEntityCommand.createMultiLine(false));
final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand(new RegexLeaf( final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand("class",
"ENTITY", "(" + CommandCreateClass.CODE + "|[%g][^%g]+[%g])")); new RegexLeaf("ENTITY", "(" + CommandCreateClass.CODE + "|[%g][^%g]+[%g])"));
cmds.add(factoryNoteOnEntityCommand.createSingleLine()); cmds.add(factoryNoteOnEntityCommand.createSingleLine());
cmds.add(new CommandUrl()); cmds.add(new CommandUrl());

Some files were not shown because too many files have changed in this diff Show More