mirror of
https://github.com/octoleo/plantuml.git
synced 2025-04-02 08:11:53 +00:00
version 8030
This commit is contained in:
parent
c5043d5fe3
commit
9ca0fe659d
16
README.md
16
README.md
@ -6,12 +6,12 @@ Generate UML diagram from textual description
|
||||
|
||||
PlantUML is a component that allows to quickly write :
|
||||
|
||||
* [Sequence diagram](http://plantuml.sourceforge.net/sequence.html),
|
||||
* [Use case diagram](http://plantuml.sourceforge.net/usecase.html),
|
||||
* [Class diagram](http://plantuml.sourceforge.net/classes.html),
|
||||
* [Activity diagram](http://plantuml.sourceforge.net/activity2.html),
|
||||
* [Component diagram](http://plantuml.sourceforge.net/component.html),
|
||||
* [State diagram](http://plantuml.sourceforge.net/state.html),
|
||||
* [Object diagram](http://plantuml.sourceforge.net/objects.html)
|
||||
* [Sequence diagram](http://plantuml.com/sequence.html),
|
||||
* [Use case diagram](http://plantuml.com/usecase.html),
|
||||
* [Class diagram](http://plantuml.com/classes.html),
|
||||
* [Activity diagram](http://plantuml.com/activity2.html),
|
||||
* [Component diagram](http://plantuml.com/component.html),
|
||||
* [State diagram](http://plantuml.com/state.html),
|
||||
* [Object diagram](http://plantuml.com/objects.html)
|
||||
|
||||
To know more about PlantUML, please visit http://plantuml.sourceforge.net/
|
||||
To know more about PlantUML, please visit http://plantuml.com/
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16364 $
|
||||
* Revision $Revision: 16778 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -99,6 +99,7 @@ public enum ColorParam {
|
||||
sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true),
|
||||
sequenceReferenceBackground(HtmlColorUtils.WHITE, true),
|
||||
sequenceDividerBackground(HtmlColorUtils.COL_EEEEEE, true),
|
||||
sequenceDividerBorder(HtmlColorUtils.BLACK),
|
||||
sequenceLifeLineBackground(HtmlColorUtils.WHITE, true),
|
||||
sequenceLifeLineBorder(HtmlColorUtils.MY_RED),
|
||||
sequenceArrow(HtmlColorUtils.MY_RED),
|
||||
|
@ -38,6 +38,8 @@ public interface ISkinSimple extends SpriteContainer {
|
||||
public String getValue(String key);
|
||||
|
||||
public double getPadding();
|
||||
|
||||
public String getMonospacedFamily();
|
||||
|
||||
|
||||
}
|
55
src/net/sourceforge/plantuml/ScaleMaxWidthAndHeight.java
Normal file
55
src/net/sourceforge/plantuml/ScaleMaxWidthAndHeight.java
Normal file
@ -0,0 +1,55 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2014, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5401 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
public class ScaleMaxWidthAndHeight implements Scale {
|
||||
|
||||
private final double maxWidth;
|
||||
private final double maxHeight;
|
||||
|
||||
public ScaleMaxWidthAndHeight(double maxWidth, double maxHeight) {
|
||||
this.maxWidth = maxWidth;
|
||||
this.maxHeight = maxHeight;
|
||||
}
|
||||
|
||||
public double getScale(double width, double height) {
|
||||
final double scale1 = maxWidth / width;
|
||||
final double scale2 = maxHeight / height;
|
||||
final double min = Math.min(scale1, scale2);
|
||||
if (min > 1) {
|
||||
return 1;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16447 $
|
||||
* Revision $Revision: 16732 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -45,6 +45,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||
import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
|
||||
import net.sourceforge.plantuml.cucadiagram.Rankdir;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
|
||||
@ -672,4 +673,12 @@ public class SkinParam implements ISkinParam {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getMonospacedFamily() {
|
||||
final String value = getValue("defaultMonospacedFontName");
|
||||
if (value == null) {
|
||||
return CommandCreoleMonospaced.MONOSPACED;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -216,5 +216,9 @@ public class SkinParamDelegator implements ISkinParam {
|
||||
return skinParam.getSvgLinkTarget();
|
||||
}
|
||||
|
||||
public String getMonospacedFamily() {
|
||||
return skinParam.getMonospacedFamily();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
59
src/net/sourceforge/plantuml/SkinParamForceColor.java
Normal file
59
src/net/sourceforge/plantuml/SkinParamForceColor.java
Normal file
@ -0,0 +1,59 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2014, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4246 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
|
||||
public class SkinParamForceColor extends SkinParamDelegator {
|
||||
|
||||
final private ColorParam colorParam;;
|
||||
final private HtmlColor color;
|
||||
|
||||
public SkinParamForceColor(ISkinParam skinParam, ColorParam colorParam, HtmlColor color) {
|
||||
super(skinParam);
|
||||
this.color = color;
|
||||
this.colorParam = colorParam;
|
||||
}
|
||||
|
||||
public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) {
|
||||
System.err.println("param=" + param);
|
||||
if (colorParam == param) {
|
||||
return color;
|
||||
}
|
||||
// return color;
|
||||
return super.getHtmlColor(param, stereotype, clickable);
|
||||
}
|
||||
|
||||
}
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
|
||||
public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
|
||||
@ -53,4 +54,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getMonospacedFamily() {
|
||||
return CommandCreoleMonospaced.MONOSPACED;
|
||||
}
|
||||
|
||||
}
|
@ -82,7 +82,6 @@ public class StringUtils {
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
|
||||
final static public List<String> getSplit(Pattern pattern, String line) {
|
||||
final Matcher m = pattern.matcher(line);
|
||||
if (m.find() == false) {
|
||||
@ -418,6 +417,33 @@ public class StringUtils {
|
||||
return st.replaceAll("\\<\\<([^<>]+)\\>\\>", "\u00AB$1\u00BB");
|
||||
}
|
||||
|
||||
public static String manageUnicodeNotationUplus(String s) {
|
||||
final Pattern pattern = Pattern.compile("\\<U\\+([0-9a-fA-F]{4})\\>");
|
||||
final Matcher matcher = pattern.matcher(s);
|
||||
final StringBuffer result = new StringBuffer();
|
||||
while (matcher.find()) {
|
||||
final String num = matcher.group(1);
|
||||
final int value = Integer.parseInt(num, 16);
|
||||
final char c = (char) value;
|
||||
matcher.appendReplacement(result, "" + c);
|
||||
}
|
||||
matcher.appendTail(result);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String manageAmpDiese(String s) {
|
||||
final Pattern pattern = Pattern.compile("\\&#([0-9]+);");
|
||||
final Matcher matcher = pattern.matcher(s);
|
||||
final StringBuffer result = new StringBuffer();
|
||||
while (matcher.find()) {
|
||||
final String num = matcher.group(1);
|
||||
final char c = (char) Integer.parseInt(num);
|
||||
matcher.appendReplacement(result, "" + c);
|
||||
}
|
||||
matcher.appendTail(result);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String trinNoTrace(CharSequence s) {
|
||||
return s.toString().trim();
|
||||
}
|
||||
|
@ -70,11 +70,11 @@ public class ActivityDiagramFactory extends UmlDiagramFactory {
|
||||
|
||||
final FactoryNoteActivityCommand factoryNoteActivityCommand = new FactoryNoteActivityCommand();
|
||||
cmds.add(factoryNoteActivityCommand.createSingleLine());
|
||||
cmds.add(factoryNoteActivityCommand.createMultiLine());
|
||||
cmds.add(factoryNoteActivityCommand.createMultiLine(false));
|
||||
|
||||
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
|
||||
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
|
||||
|
||||
cmds.add(new CommandIf());
|
||||
cmds.add(new CommandElse());
|
||||
|
@ -34,6 +34,7 @@
|
||||
package net.sourceforge.plantuml.activitydiagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
|
||||
@ -57,7 +58,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
|
||||
@ -76,7 +77,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("BACKCOLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp2(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
|
||||
@ -103,7 +104,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("PARTITION2", "(?:in[%s]+([%g][^%g]+[%g]|\\S+))?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("BACKCOLOR2", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp3(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -126,4 +126,8 @@ public class Branch {
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
public Instruction getLast() {
|
||||
return list.getLast();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
|
||||
public class InstructionGroup implements Instruction {
|
||||
public class InstructionGroup implements Instruction, InstructionCollection {
|
||||
|
||||
private final InstructionList list;
|
||||
private final Instruction parent;
|
||||
@ -101,4 +101,8 @@ public class InstructionGroup implements Instruction {
|
||||
return list.getSwimlaneOut();
|
||||
}
|
||||
|
||||
public Instruction getLast() {
|
||||
return list.getLast();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
|
||||
public class InstructionIf implements Instruction {
|
||||
public class InstructionIf implements Instruction, InstructionCollection {
|
||||
|
||||
private final List<Branch> thens = new ArrayList<Branch>();
|
||||
private Branch elseBranch;
|
||||
@ -163,4 +163,11 @@ public class InstructionIf implements Instruction {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Instruction getLast() {
|
||||
if (elseBranch == null) {
|
||||
return thens.get(thens.size()-1).getLast();
|
||||
}
|
||||
return elseBranch.getLast();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -58,7 +58,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("COLOR", "(?::?(" + HtmlColorUtils.COLOR_REGEXP + "))?"), //
|
||||
ColorParser.exp5(), //
|
||||
new RegexLeaf(":"), //
|
||||
new RegexLeaf("LABEL", "(.*)"), //
|
||||
new RegexLeaf("STYLE", ENDING_GROUP), //
|
||||
|
@ -44,7 +44,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
|
||||
@ -59,7 +59,7 @@ public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("COLOR", "(?::?(" + HtmlColorUtils.COLOR_REGEXP + "))?"), //
|
||||
ColorParser.exp5(), //
|
||||
new RegexLeaf(":"), //
|
||||
new RegexLeaf("DATA", "(.*)"), //
|
||||
new RegexLeaf("$"));
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -51,7 +51,7 @@ public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
|
||||
ColorParser.exp4(), //
|
||||
new RegexLeaf("else[%s]*if"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("TEST", "\\((.*?)\\)"), //
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -51,7 +51,7 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
|
||||
ColorParser.exp4(), //
|
||||
new RegexLeaf("if"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("TEST", "\\((.*?)\\)"), //
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -51,7 +51,7 @@ public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
|
||||
ColorParser.exp4(), //
|
||||
new RegexLeaf("if"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("TEST", "\\((.*?)\\)"), //
|
||||
|
@ -40,7 +40,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -50,7 +50,7 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
|
||||
ColorParser.exp4(), //
|
||||
new RegexLeaf("repeat"), //
|
||||
new RegexLeaf(";?$"));
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3<ActivityDi
|
||||
@Override
|
||||
public RegexConcat getPatternEnd2() {
|
||||
return new RegexConcat(//
|
||||
new RegexLeaf("TEST1", "([^)]*)"), new RegexLeaf("\\)"), //
|
||||
new RegexLeaf("TEST1", "(.*)"), new RegexLeaf("\\)"), //
|
||||
new RegexLeaf(";?$"));
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3<ActivityDi
|
||||
new RegexLeaf("repeat[%s]?while"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("\\("), //
|
||||
new RegexLeaf("TEST1", "([^)]*)$"));
|
||||
new RegexLeaf("TEST1", "(.*)$"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -52,7 +52,7 @@ public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("\\|"), //
|
||||
new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + ")\\|)?"), //
|
||||
ColorParser.exp6(), //
|
||||
new RegexLeaf("SWIMLANE", "([^|]+)"), //
|
||||
new RegexLeaf("\\|"), //
|
||||
new RegexLeaf("LABEL", "([^|]+)?"), //
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -52,7 +52,7 @@ public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("swimlane[%s]+"), //
|
||||
new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "))?"), //
|
||||
ColorParser.exp7(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("SWIMLANE", "([^|]+)"), //
|
||||
new RegexLeaf("LABEL", "(?:[%s]+as[%s]+([^|]+))?"), //
|
||||
|
@ -42,8 +42,7 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorSet;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -54,7 +53,7 @@ public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(//
|
||||
new RegexLeaf("^"), //
|
||||
new RegexLeaf("COLOR", "(?:(" + HtmlColorUtils.COLOR_REGEXP + "):)?"), //
|
||||
ColorParser.exp4(), //
|
||||
new RegexLeaf("while"), //
|
||||
new RegexLeaf("TEST", "[%s]*\\((.+?)\\)"), //
|
||||
new RegexOptional(new RegexConcat(//
|
||||
|
@ -79,7 +79,7 @@ public class FtileFactoryDelegator implements FtileFactory {
|
||||
final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
|
||||
final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
return display.create(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.SIMPLE_LINE);
|
||||
return display.create(fontConfiguration, HorizontalAlignment.LEFT, this, CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -193,4 +193,8 @@ public class FtileFactoryDelegator implements FtileFactory {
|
||||
return skinParam.useGuillemet();
|
||||
}
|
||||
|
||||
public String getMonospacedFamily() {
|
||||
return skinParam.getMonospacedFamily();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,6 +72,10 @@ public class FtileGeometry extends Dimension2D {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public FtileGeometry incHeight(double northHeight) {
|
||||
return new FtileGeometry(width, height + northHeight, left, inY, outY);
|
||||
}
|
||||
|
||||
public FtileGeometry(Dimension2D dim, double left, double inY, double outY) {
|
||||
this(dim.getWidth(), dim.getHeight(), left, inY, outY);
|
||||
}
|
||||
@ -132,6 +136,10 @@ public class FtileGeometry extends Dimension2D {
|
||||
return new FtileGeometry(width + 2 * marginx, height, left + marginx, inY, outY);
|
||||
}
|
||||
|
||||
public FtileGeometry addMarginX(double margin1, double margin2) {
|
||||
return new FtileGeometry(width + margin1 + margin2, height, left + margin1, inY, outY);
|
||||
}
|
||||
|
||||
public FtileGeometry fixedHeight(double fixedHeight) {
|
||||
return new FtileGeometry(width, fixedHeight, left, inY, outY);
|
||||
}
|
||||
|
@ -43,12 +43,14 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
public class FtileMarged extends AbstractFtile {
|
||||
|
||||
private final Ftile tile;
|
||||
private final double margin;
|
||||
private final double margin1;
|
||||
private final double margin2;
|
||||
|
||||
public FtileMarged(Ftile tile, double margin) {
|
||||
public FtileMarged(Ftile tile, double margin1, double margin2) {
|
||||
super(tile.shadowing());
|
||||
this.tile = tile;
|
||||
this.margin = margin;
|
||||
this.margin1 = margin1;
|
||||
this.margin2 = margin2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,12 +77,12 @@ public class FtileMarged extends AbstractFtile {
|
||||
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
final FtileGeometry orig = tile.calculateDimension(stringBounder);
|
||||
return new FtileGeometry(orig.getWidth() + 2 * margin, orig.getHeight(), orig.getLeft() + margin,
|
||||
return new FtileGeometry(orig.getWidth() + margin1 + margin2, orig.getHeight(), orig.getLeft() + margin1,
|
||||
orig.getInY(), orig.getOutY());
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.apply(new UTranslate(margin, 0)).draw(tile);
|
||||
ug.apply(new UTranslate(margin1, 0)).draw(tile);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,10 +60,24 @@ public class FtileUtils {
|
||||
return new FtileMargedVertically(ftile, marginTop, marginBottom);
|
||||
}
|
||||
|
||||
public static Ftile addHorizontalMargin(Ftile ftile, double margin) {
|
||||
return new FtileMarged(ftile, margin);
|
||||
public static Ftile addHorizontalMargin(Ftile ftile, double margin1, double margin2) {
|
||||
if (margin1 == 0 && margin2 == 0) {
|
||||
return ftile;
|
||||
}
|
||||
return new FtileMarged(ftile, margin1, margin2);
|
||||
}
|
||||
|
||||
public static Ftile addHorizontalMargin(Ftile ftile, double margin) {
|
||||
if (margin == 0) {
|
||||
return ftile;
|
||||
}
|
||||
return new FtileMarged(ftile, margin, margin);
|
||||
}
|
||||
|
||||
// public static Ftile addHorizontalMargin(Ftile ftile, double margin) {
|
||||
// return new FtileMarged(ftile, margin);
|
||||
// }
|
||||
|
||||
private static Ftile neverNull(Ftile ftile) {
|
||||
if (ftile == null) {
|
||||
return new FtileEmpty(false);
|
||||
|
@ -84,7 +84,7 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
|
||||
|
||||
final List<Ftile> list = new ArrayList<Ftile>();
|
||||
for (Ftile tmp : all) {
|
||||
list.add(new FtileHeightFixed(new FtileMarged(tmp, xMargin), height1));
|
||||
list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1));
|
||||
}
|
||||
|
||||
Ftile inner = super.createFork(swimlane, list);
|
||||
|
@ -129,7 +129,7 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
|
||||
|
||||
final List<Ftile> list = new ArrayList<Ftile>();
|
||||
for (Ftile tmp : all) {
|
||||
list.add(new FtileHeightFixed(new FtileMarged(tmp, xMargin), height1));
|
||||
list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1));
|
||||
}
|
||||
|
||||
Ftile inner = super.createSplit(list);
|
||||
@ -217,7 +217,7 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
|
||||
|
||||
final List<Ftile> list = new ArrayList<Ftile>();
|
||||
for (Ftile tmp : all) {
|
||||
list.add(new FtileHeightFixed(new FtileMarged(tmp, xMargin), height1));
|
||||
list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1));
|
||||
}
|
||||
|
||||
Ftile inner = new FtileSplit1(list);
|
||||
|
@ -43,6 +43,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMarged;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -78,7 +79,7 @@ public class FtileGroup extends AbstractFtile {
|
||||
HtmlColor titleColor, ISkinParam skinParam) {
|
||||
super(inner.shadowing());
|
||||
this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor;
|
||||
this.inner = new FtileMarged(inner, 10);
|
||||
this.inner = FtileUtils.addHorizontalMargin(inner, 10);
|
||||
this.color = color;
|
||||
this.titleColor = titleColor;
|
||||
final UFont font = new UFont("Serif", Font.PLAIN, 14);
|
||||
|
@ -176,4 +176,8 @@ public class VCompactFactory implements FtileFactory {
|
||||
return skinParam.useGuillemet();
|
||||
}
|
||||
|
||||
public String getMonospacedFamily() {
|
||||
return skinParam.getMonospacedFamily();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
@ -119,7 +121,16 @@ public class ConditionalBuilder {
|
||||
private Ftile createWithDiamonds() {
|
||||
final Ftile diamond1 = getDiamond1();
|
||||
final Ftile diamond2 = getDiamond2();
|
||||
return new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane, stringBounder);
|
||||
final FtileIfWithDiamonds ftile = new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane,
|
||||
stringBounder);
|
||||
final Dimension2D label1 = getLabelBranch1().calculateDimension(stringBounder);
|
||||
final Dimension2D label2 = getLabelBranch2().calculateDimension(stringBounder);
|
||||
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
|
||||
final double diff2 = ftile.computeMarginNeedForBranchLabe2(stringBounder, label2);
|
||||
Ftile result = FtileUtils.addHorizontalMargin(ftile, diff1, diff2);
|
||||
final double suppHeight = ftile.computeVerticalMarginNeedForBranchs(stringBounder, label1, label2);
|
||||
result = FtileUtils.addVerticalMargin(result, suppHeight, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Ftile createWithLinks() {
|
||||
@ -127,19 +138,23 @@ public class ConditionalBuilder {
|
||||
final Ftile diamond2 = getDiamond2();
|
||||
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
|
||||
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
|
||||
return new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor, stringBounder).addLinks(
|
||||
branch1, branch2, stringBounder);
|
||||
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
|
||||
stringBounder);
|
||||
final Dimension2D label1 = getLabelBranch1().calculateDimension(stringBounder);
|
||||
final Dimension2D label2 = getLabelBranch2().calculateDimension(stringBounder);
|
||||
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
|
||||
final double diff2 = ftile.computeMarginNeedForBranchLabe2(stringBounder, label2);
|
||||
final double suppHeight = ftile.computeVerticalMarginNeedForBranchs(stringBounder, label1, label2);
|
||||
Ftile result = ftile.addLinks(branch1, branch2, stringBounder);
|
||||
result = FtileUtils.addHorizontalMargin(result, diff1, diff2);
|
||||
result = FtileUtils.addVerticalMargin(result, suppHeight, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Ftile getDiamond1() {
|
||||
final Display labelTest = branch1.getLabelTest();
|
||||
|
||||
final FontConfiguration fcArrow = fcArrow();
|
||||
|
||||
final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock tb1 = getLabelBranch1();
|
||||
final TextBlock tb2 = getLabelBranch2();
|
||||
|
||||
final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor(), skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
@ -151,17 +166,28 @@ public class ConditionalBuilder {
|
||||
final Ftile diamond1;
|
||||
if (conditionStyle == ConditionStyle.INSIDE) {
|
||||
diamond1 = new FtileDiamondInside(tile1.shadowing(), backColor, borderColor, swimlane, tbTest)
|
||||
.withWest(tb1).withEast(tb2);
|
||||
.withWestAndEast(tb1, tb2);
|
||||
} else if (conditionStyle == ConditionStyle.DIAMOND) {
|
||||
diamond1 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tb1)
|
||||
.withEast(tb2).withNorth(tbTest);
|
||||
diamond1 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withNorth(tbTest)
|
||||
.withWestAndEast(tb1, tb2);
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
return diamond1;
|
||||
}
|
||||
|
||||
private TextBlock getLabelBranch2() {
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow(), HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
return tb2;
|
||||
}
|
||||
|
||||
private TextBlock getLabelBranch1() {
|
||||
final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow(), HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
return tb1;
|
||||
}
|
||||
|
||||
private Ftile getDiamond2() {
|
||||
final FontConfiguration fcArrow = fcArrow();
|
||||
|
||||
|
@ -33,9 +33,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public abstract class FtileDimensionMemoize extends AbstractFtile {
|
||||
@ -44,14 +43,14 @@ public abstract class FtileDimensionMemoize extends AbstractFtile {
|
||||
super(shadowing);
|
||||
}
|
||||
|
||||
private Dimension2D calculateDimensionInternal;
|
||||
private FtileGeometry calculateDimensionInternal;
|
||||
|
||||
protected final Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
|
||||
protected final FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
|
||||
if (calculateDimensionInternal == null) {
|
||||
calculateDimensionInternal = calculateDimensionInternalSlow(stringBounder);
|
||||
}
|
||||
return calculateDimensionInternal;
|
||||
}
|
||||
|
||||
abstract protected Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder);
|
||||
abstract protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder);
|
||||
}
|
||||
|
@ -120,24 +120,25 @@ public class FtileIfNude extends FtileDimensionMemoize {
|
||||
}
|
||||
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
if (tile1.calculateDimension(stringBounder).hasPointOut()
|
||||
|| tile2.calculateDimension(stringBounder).hasPointOut()) {
|
||||
return new FtileGeometry(dimTotal, getLeft(stringBounder), 0, dimTotal.getHeight());
|
||||
return dimTotal;
|
||||
}
|
||||
return new FtileGeometry(dimTotal, getLeft(stringBounder), 0);
|
||||
return dimTotal.withoutPointOut();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder) {
|
||||
protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder) {
|
||||
final FtileGeometry dim1 = tile1.calculateDimension(stringBounder);
|
||||
final FtileGeometry dim2 = tile2.calculateDimension(stringBounder);
|
||||
|
||||
final double width = dim1.getLeft() + withInner(stringBounder) + (dim2.getWidth() - dim2.getLeft());
|
||||
final double innerMargin = withInner(stringBounder);
|
||||
final double width = dim1.getLeft() + innerMargin + (dim2.getWidth() - dim2.getLeft());
|
||||
|
||||
final Dimension2D dim12 = Dimension2DDouble.mergeLR(dim1, dim2);
|
||||
|
||||
return new Dimension2DDouble(width, dim12.getHeight());
|
||||
return new FtileGeometry(width, dim12.getHeight(), dim1.getLeft() + innerMargin / 2, 0);
|
||||
}
|
||||
|
||||
protected double withInner(StringBounder stringBounder) {
|
||||
@ -146,10 +147,10 @@ public class FtileIfNude extends FtileDimensionMemoize {
|
||||
return (dim1.getWidth() - dim1.getLeft()) + dim2.getLeft();
|
||||
}
|
||||
|
||||
protected double getLeft(StringBounder stringBounder) {
|
||||
final double left1 = tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft();
|
||||
final double left2 = tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft();
|
||||
return (left1 + left2) / 2;
|
||||
}
|
||||
// protected double getLeft(StringBounder stringBounder) {
|
||||
// final double left1 = tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft();
|
||||
// final double left2 = tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft();
|
||||
// return (left1 + left2) / 2;
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -35,14 +35,12 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class FtileIfWithDiamonds extends FtileIfNude {
|
||||
|
||||
@ -81,16 +79,19 @@ public class FtileIfWithDiamonds extends FtileIfNude {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder) {
|
||||
protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder) {
|
||||
final FtileGeometry dim1 = diamond1.calculateDimension(stringBounder);
|
||||
final FtileGeometry dim2 = diamond2.calculateDimension(stringBounder);
|
||||
|
||||
final Dimension2D dimNude = super.calculateDimensionInternalSlow(stringBounder);
|
||||
final FtileGeometry dimNude = super.calculateDimensionInternalSlow(stringBounder);
|
||||
|
||||
final double width = MathUtils.max(dim1.getWidth(), dim2.getWidth(), dimNude.getWidth());
|
||||
final double height = dimNude.getHeight() + dim1.getHeight() + dim2.getHeight() + getYdelta1a(stringBounder)
|
||||
+ getYdelta1b(stringBounder);
|
||||
return new Dimension2DDouble(width, height);
|
||||
final FtileGeometry all = dim1.appendBottom(dimNude).appendBottom(dim2);
|
||||
|
||||
return all.addDim(0, getYdelta1a(stringBounder) + getYdelta1b(stringBounder));
|
||||
|
||||
// final double height = dimNude.getHeight() + dim1.getHeight() + dim2.getHeight() + getYdelta1a(stringBounder)
|
||||
// + getYdelta1b(stringBounder);
|
||||
// return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,31 +105,66 @@ public class FtileIfWithDiamonds extends FtileIfNude {
|
||||
|
||||
@Override
|
||||
protected UTranslate getTranslate1(StringBounder stringBounder) {
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return super.getTranslate1(stringBounder).compose(
|
||||
new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate getTranslate2(StringBounder stringBounder) {
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return super.getTranslate2(stringBounder).compose(
|
||||
new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
||||
final double y1 = 0;
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final double x1 = getLeft(stringBounder) - dimDiamond1.getWidth() / 2;
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
// final double x1 = getLeft(stringBounder) - dimDiamond1.getWidth() / 2;
|
||||
final double x1 = dimTotal.getLeft() - dimDiamond1.getLeft();
|
||||
return new UTranslate(x1, y1);
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateDiamond2(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final double y2 = dimTotal.getHeight() - dimDiamond2.getHeight();
|
||||
final double x2 = getLeft(stringBounder) - dimDiamond2.getWidth() / 2;
|
||||
final double x2 = dimTotal.getLeft() - dimDiamond2.getWidth() / 2;
|
||||
return new UTranslate(x2, y2);
|
||||
}
|
||||
|
||||
public double computeMarginNeedForBranchLabe1(StringBounder stringBounder, Dimension2D label1) {
|
||||
final double widthLabelBranch1 = label1.getWidth();
|
||||
final double dxDiamond = getTranslateDiamond1(stringBounder).getDx();
|
||||
final double diff = widthLabelBranch1 - dxDiamond;
|
||||
if (diff > 0) {
|
||||
return diff;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double computeMarginNeedForBranchLabe2(StringBounder stringBounder, Dimension2D label2) {
|
||||
final double widthLabelBranch2 = label2.getWidth();
|
||||
final double theoricalEndNeeded = getTranslateDiamond1(stringBounder).getDx()
|
||||
+ diamond1.calculateDimension(stringBounder).getWidth() + widthLabelBranch2;
|
||||
final double diff = theoricalEndNeeded - calculateDimension(stringBounder).getWidth();
|
||||
if (diff > 0) {
|
||||
return diff;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double computeVerticalMarginNeedForBranchs(StringBounder stringBounder, Dimension2D label1,
|
||||
Dimension2D label2) {
|
||||
final double heightLabels = Math.max(label1.getHeight(), label2.getHeight());
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final double dyDiamond = dimDiamond1.getHeight();
|
||||
final double diff = heightLabels - dyDiamond;
|
||||
if (diff > 0) {
|
||||
return diff;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -288,14 +288,14 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
public void drawU(UGraphic ug) {
|
||||
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||
final Point2D p2 = new Point2D.Double(getLeft(stringBounder), dimTotal.getHeight());
|
||||
final Point2D p2 = new Point2D.Double(dimTotal.getLeft(), dimTotal.getHeight());
|
||||
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
@ -313,18 +313,17 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||
final Point2D p2 = new Point2D.Double(getLeft(stringBounder), dimTotal.getHeight()
|
||||
- Diamond.diamondHalfSize);
|
||||
final Point2D p2 = new Point2D.Double(dimTotal.getLeft(), dimTotal.getHeight() - Diamond.diamondHalfSize);
|
||||
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
@ -344,7 +343,6 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
|
||||
private UTranslate translate(StringBounder stringBounder) {
|
||||
if (getFtile1() == tile1) {
|
||||
return getTranslate1(stringBounder);
|
||||
|
@ -40,6 +40,7 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
@ -141,4 +142,8 @@ public class FtileDiamond extends AbstractFtile {
|
||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
||||
}
|
||||
|
||||
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
||||
return withWest(tb1).withEast(tb2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
@ -81,6 +82,10 @@ public class FtileDiamondInside extends AbstractFtile {
|
||||
return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
}
|
||||
|
||||
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
||||
return withWest(tb1).withEast(tb2);
|
||||
}
|
||||
|
||||
public FtileDiamondInside withSouth(TextBlock south) {
|
||||
return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
}
|
||||
@ -127,8 +132,8 @@ public class FtileDiamondInside extends AbstractFtile {
|
||||
final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
|
||||
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
||||
|
||||
final Dimension2D dimWeat = west.calculateDimension(stringBounder);
|
||||
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2)));
|
||||
final Dimension2D dimWest = west.calculateDimension(stringBounder);
|
||||
west.drawU(ug.apply(new UTranslate(-dimWest.getWidth(), -dimWest.getHeight() + dimTotal.getHeight() / 2)));
|
||||
|
||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2)));
|
||||
@ -136,12 +141,12 @@ public class FtileDiamondInside extends AbstractFtile {
|
||||
}
|
||||
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
Dimension2D dim = calculateDimensionAlone(stringBounder);
|
||||
final Dimension2D dimNorth = north.calculateDimension(stringBounder);
|
||||
final double northHeight = dimNorth.getHeight();
|
||||
final double northWidth = dimNorth.getWidth();
|
||||
dim = Dimension2DDouble.delta(dim, 0, northHeight);
|
||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight() - northHeight);
|
||||
final FtileGeometry dimDiamonAlone = calculateDimensionAlone(stringBounder);
|
||||
final Dimension2D dimWest = west.calculateDimension(stringBounder);
|
||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||
final double northHeight = north.calculateDimension(stringBounder).getHeight();
|
||||
return dimDiamonAlone.incHeight(northHeight);
|
||||
// return dimDiamonAlone.incHeight(northHeight).addMarginX(dimWest.getWidth(), dimEast.getWidth());
|
||||
}
|
||||
|
||||
private FtileGeometry calculateDimensionAlone(StringBounder stringBounder) {
|
||||
|
@ -110,21 +110,23 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
|
||||
|
||||
final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand(new RegexLeaf(
|
||||
"ENTITY", "(" + CommandCreateClass.CODE_NO_DOTDOT + "|[%g][^%g]+[%g])::([^%s]+)"));
|
||||
cmds.add(factoryTipOnEntityCommand.createMultiLine());
|
||||
cmds.add(factoryTipOnEntityCommand.createMultiLine(true));
|
||||
cmds.add(factoryTipOnEntityCommand.createMultiLine(false));
|
||||
|
||||
final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand(new RegexLeaf(
|
||||
"ENTITY", "(" + CommandCreateClass.CODE + "|[%g][^%g]+[%g])"));
|
||||
cmds.add(factoryNoteOnEntityCommand.createSingleLine());
|
||||
cmds.add(new CommandUrl());
|
||||
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine());
|
||||
cmds.add(factoryNoteCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(true));
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(false));
|
||||
cmds.add(factoryNoteCommand.createMultiLine(false));
|
||||
|
||||
cmds.add(new CommandCreateClassMultilines());
|
||||
|
||||
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
|
||||
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
|
||||
|
||||
cmds.add(new CommandDiamondAssociation());
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.classdiagram.command;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
@ -52,7 +50,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -88,7 +86,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
color().getRegex(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), //
|
||||
new RegexLeaf("EXTENDS", "([%s]+(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "))?"), //
|
||||
@ -96,6 +94,10 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
public static ColorParser color() {
|
||||
return ColorParser.simpleColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, RegexResult arg) {
|
||||
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
|
||||
@ -127,7 +129,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
entity.addUrl(url);
|
||||
}
|
||||
|
||||
entity.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
|
||||
entity.setSpecificBackcolor(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
|
||||
entity.setSpecificLineColor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
|
||||
CommandCreateClassMultilines.applyStroke(entity, arg.get("LINECOLOR", 0));
|
||||
|
||||
|
@ -57,7 +57,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
|
||||
@ -99,7 +99,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), //
|
||||
new RegexLeaf("EXTENDS", "([%s]+(extends)[%s]+(" + CODES + "))?"), //
|
||||
|
@ -34,6 +34,7 @@
|
||||
package net.sourceforge.plantuml.classdiagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
|
||||
@ -49,9 +50,8 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -82,7 +82,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,11 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
public class BlocLines implements Iterable<CharSequence> {
|
||||
|
||||
private List<CharSequence> lines;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return lines.toString();
|
||||
}
|
||||
|
||||
private BlocLines(List<? extends CharSequence> lines) {
|
||||
this.lines = Collections.unmodifiableList(lines);
|
||||
|
@ -38,13 +38,23 @@ import net.sourceforge.plantuml.core.Diagram;
|
||||
public class CommandDecoratorMultine<D extends Diagram> implements Command<D> {
|
||||
|
||||
private final SingleLineCommand2<D> cmd;
|
||||
private final boolean removeEmptyColumn;
|
||||
|
||||
public CommandDecoratorMultine(SingleLineCommand2<D> cmd) {
|
||||
this(cmd, false);
|
||||
}
|
||||
|
||||
public CommandDecoratorMultine(SingleLineCommand2<D> cmd, boolean removeEmptyColumn) {
|
||||
this.cmd = cmd;
|
||||
this.removeEmptyColumn = removeEmptyColumn;
|
||||
}
|
||||
|
||||
public CommandExecutionResult execute(D diagram, BlocLines lines) {
|
||||
return cmd.execute(diagram, lines.concat2());
|
||||
if (removeEmptyColumn) {
|
||||
lines = lines.removeEmptyColumns();
|
||||
}
|
||||
lines = lines.concat2();
|
||||
return cmd.execute(diagram, lines);
|
||||
}
|
||||
|
||||
public CommandControl isValid(BlocLines lines) {
|
||||
|
@ -43,7 +43,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -57,7 +57,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*\\{$"));
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
|
||||
@ -46,9 +47,8 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
@ -66,7 +66,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*\\{$"));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2014, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4762 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ScaleMaxWidthAndHeight;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
|
||||
public class CommandScaleMaxWidthAndHeight extends SingleLineCommand<UmlDiagram> {
|
||||
|
||||
public CommandScaleMaxWidthAndHeight() {
|
||||
super("(?i)^scale[%s]+max[%s]+([0-9.]+)[%s]*[*x][%s]*([0-9.]+)$");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(UmlDiagram diagram, List<String> arg) {
|
||||
final double width = Double.parseDouble(arg.get(0));
|
||||
final double height = Double.parseDouble(arg.get(1));
|
||||
diagram.setScale(new ScaleMaxWidthAndHeight(width, height));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
@ -78,7 +78,7 @@ public final class FactorySpriteCommand implements SingleMultiFactoryCommand<Uml
|
||||
};
|
||||
}
|
||||
|
||||
public Command<UmlDiagram> createMultiLine() {
|
||||
public Command<UmlDiagram> createMultiLine(boolean withBracket) {
|
||||
return new CommandMultilines2<UmlDiagram>(getRegexConcatMultiLine(), MultilinesStrategy.REMOVE_STARTING_QUOTE) {
|
||||
|
||||
@Override
|
||||
|
@ -174,7 +174,8 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
return CommandControl.NOT_OK;
|
||||
// throw new IllegalStateException();
|
||||
}
|
||||
|
||||
private CommandExecutionResult manageMultiline2(IteratorCounter2 it, AbstractPSystem system) {
|
||||
@ -273,11 +274,12 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
||||
cmds.add(new CommandScale());
|
||||
cmds.add(new CommandScaleWidthAndHeight());
|
||||
cmds.add(new CommandScaleWidthOrHeight());
|
||||
cmds.add(new CommandScaleMaxWidthAndHeight());
|
||||
cmds.add(new CommandAffineTransform());
|
||||
cmds.add(new CommandAffineTransformMultiline());
|
||||
cmds.add(new CommandHideUnlinked());
|
||||
final FactorySpriteCommand factorySpriteCommand = new FactorySpriteCommand();
|
||||
cmds.add(factorySpriteCommand.createMultiLine());
|
||||
cmds.add(factorySpriteCommand.createMultiLine(false));
|
||||
cmds.add(factorySpriteCommand.createSingleLine());
|
||||
cmds.add(new CommandSpriteFile());
|
||||
|
||||
|
@ -54,7 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public final class FactoryNoteActivityCommand implements SingleMultiFactoryCommand<ActivityDiagram> {
|
||||
@ -62,7 +62,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
|
||||
private RegexConcat getRegexConcatMultiLine() {
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left|top|bottom)[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
@ -70,13 +70,13 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
|
||||
private RegexConcat getRegexConcatSingleLine() {
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left|top|bottom)[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
new RegexLeaf("NOTE", "(.*)"), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
public Command<ActivityDiagram> createMultiLine() {
|
||||
public Command<ActivityDiagram> createMultiLine(boolean withBracket) {
|
||||
return new CommandMultilines2<ActivityDiagram>(getRegexConcatMultiLine(),
|
||||
MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.command.note;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||
import net.sourceforge.plantuml.command.BlocLines;
|
||||
@ -47,10 +45,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public final class FactoryNoteCommand implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
|
||||
|
||||
@ -58,7 +55,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
|
||||
return new RegexConcat(new RegexLeaf("^(note)[%s]+"), //
|
||||
new RegexLeaf("CODE", "as[%s]+([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$") //
|
||||
);
|
||||
}
|
||||
@ -67,7 +64,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("DISPLAY", "[%g]([^%g]+)[%g][%s]+as[%s]+"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$") //
|
||||
);
|
||||
|
||||
@ -85,7 +82,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
|
||||
};
|
||||
}
|
||||
|
||||
public Command<AbstractEntityDiagram> createMultiLine() {
|
||||
public Command<AbstractEntityDiagram> createMultiLine(boolean withBracket) {
|
||||
return new CommandMultilines2<AbstractEntityDiagram>(getRegexConcatMultiLine(),
|
||||
MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
|
@ -57,15 +57,18 @@ import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
|
||||
|
||||
private final IRegex partialPattern;
|
||||
|
||||
public FactoryNoteOnEntityCommand(IRegex partialPattern) {
|
||||
// private final boolean withBracket;
|
||||
|
||||
public FactoryNoteOnEntityCommand(IRegex partialPattern/* , boolean withBracket */) {
|
||||
this.partialPattern = partialPattern;
|
||||
// this.withBracket = withBracket;
|
||||
}
|
||||
|
||||
private RegexConcat getRegexConcatSingleLine(IRegex partialPattern) {
|
||||
@ -75,22 +78,22 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
|
||||
new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), //
|
||||
new RegexLeaf("")), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
new RegexLeaf("NOTE", "(.*)"), //
|
||||
new RegexLeaf("$") //
|
||||
);
|
||||
}
|
||||
|
||||
private RegexConcat getRegexConcatMultiLine(IRegex partialPattern) {
|
||||
private RegexConcat getRegexConcatMultiLine(IRegex partialPattern, final boolean withBracket) {
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left|top|bottom)"), //
|
||||
new RegexOr(//
|
||||
new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), //
|
||||
new RegexLeaf("")), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
new RegexLeaf("[%s]*\\{?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf(withBracket ? "[%s]*\\{" : "[%s]*"), //
|
||||
new RegexLeaf("$") //
|
||||
);
|
||||
}
|
||||
@ -106,13 +109,16 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
|
||||
};
|
||||
}
|
||||
|
||||
public Command<AbstractEntityDiagram> createMultiLine() {
|
||||
return new CommandMultilines2<AbstractEntityDiagram>(getRegexConcatMultiLine(partialPattern),
|
||||
public Command<AbstractEntityDiagram> createMultiLine(final boolean withBracket) {
|
||||
return new CommandMultilines2<AbstractEntityDiagram>(getRegexConcatMultiLine(partialPattern, withBracket),
|
||||
MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
@Override
|
||||
public String getPatternEnd() {
|
||||
return "(?i)^(end[%s]?note|\\})$";
|
||||
if (withBracket) {
|
||||
return "(?i)^(\\})$";
|
||||
}
|
||||
return "(?i)^(end[%s]?note)$";
|
||||
}
|
||||
|
||||
public CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) {
|
||||
@ -152,13 +158,15 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
|
||||
cl1 = diagram.getOrCreateLeaf(code, null, null);
|
||||
}
|
||||
|
||||
final IEntity note = diagram.createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null);
|
||||
final IEntity note = diagram
|
||||
.createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null);
|
||||
note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
|
||||
if (url != null) {
|
||||
note.addUrl(url);
|
||||
}
|
||||
|
||||
final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir(diagram.getSkinParam().getRankdir());
|
||||
final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir(
|
||||
diagram.getSkinParam().getRankdir());
|
||||
final Link link;
|
||||
|
||||
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getDashed();
|
||||
|
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand<CucaDiagram> {
|
||||
|
||||
@ -57,7 +57,7 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left|top|bottom)?[%s]*on[%s]+link"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
new RegexLeaf("NOTE", "(.*)"), //
|
||||
new RegexLeaf("$"));
|
||||
@ -67,11 +67,11 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left|top|bottom)?[%s]*on[%s]+link"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
public Command<CucaDiagram> createMultiLine() {
|
||||
public Command<CucaDiagram> createMultiLine(boolean withBracket) {
|
||||
return new CommandMultilines2<CucaDiagram>(getRegexConcatMultiLine(), MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
@Override
|
||||
|
@ -55,23 +55,26 @@ import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public final class FactoryTipOnEntityCommand implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
|
||||
|
||||
private final IRegex partialPattern;
|
||||
|
||||
public FactoryTipOnEntityCommand(IRegex partialPattern) {
|
||||
// private final boolean withBracket;
|
||||
|
||||
public FactoryTipOnEntityCommand(IRegex partialPattern/* , boolean withBracket */) {
|
||||
this.partialPattern = partialPattern;
|
||||
// this.withBracket = withBracket;
|
||||
}
|
||||
|
||||
private RegexConcat getRegexConcatMultiLine(IRegex partialPattern) {
|
||||
private RegexConcat getRegexConcatMultiLine(IRegex partialPattern, final boolean withBracket) {
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left)"), //
|
||||
new RegexLeaf("[%s]+of[%s]+"), partialPattern, //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
new RegexLeaf("[%s]*\\{?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf(withBracket ? "[%s]*\\{" : "[%s]*"), //
|
||||
new RegexLeaf("$") //
|
||||
);
|
||||
}
|
||||
@ -80,13 +83,16 @@ public final class FactoryTipOnEntityCommand implements SingleMultiFactoryComman
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Command<AbstractEntityDiagram> createMultiLine() {
|
||||
return new CommandMultilines2<AbstractEntityDiagram>(getRegexConcatMultiLine(partialPattern),
|
||||
public Command<AbstractEntityDiagram> createMultiLine(final boolean withBracket) {
|
||||
return new CommandMultilines2<AbstractEntityDiagram>(getRegexConcatMultiLine(partialPattern, withBracket),
|
||||
MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
@Override
|
||||
public String getPatternEnd() {
|
||||
return "(?i)^(end[%s]?note|\\})$";
|
||||
if (withBracket) {
|
||||
return "(?i)^(\\})$";
|
||||
}
|
||||
return "(?i)^(end[%s]?note)$";
|
||||
}
|
||||
|
||||
public CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) {
|
||||
|
@ -40,6 +40,6 @@ public interface SingleMultiFactoryCommand<D extends Diagram> {
|
||||
|
||||
public Command<D> createSingleLine();
|
||||
|
||||
public Command<D> createMultiLine();
|
||||
public Command<D> createMultiLine(boolean withBracket);
|
||||
|
||||
}
|
@ -33,8 +33,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.command.note.sequence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.command.BlocLines;
|
||||
import net.sourceforge.plantuml.command.Command;
|
||||
@ -46,8 +44,7 @@ import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
|
||||
@ -63,7 +60,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left|over)[%s]+"), //
|
||||
new RegexLeaf("PARTICIPANT", "(?:of[%s]+)?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
@ -74,13 +71,13 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left|over)[%s]+"), //
|
||||
new RegexLeaf("PARTICIPANT", "(?:of[%s])?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
new RegexLeaf("NOTE", "(.*)"), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
public Command<SequenceDiagram> createMultiLine() {
|
||||
public Command<SequenceDiagram> createMultiLine(boolean withBracket) {
|
||||
return new CommandMultilines2<SequenceDiagram>(getRegexConcatMultiLine(),
|
||||
MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.command.note.sequence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
@ -49,8 +47,7 @@ import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
@ -61,14 +58,14 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
|
||||
private RegexConcat getRegexConcatMultiLine() {
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left)[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
private RegexConcat getRegexConcatSingleLine() {
|
||||
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left)[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
new RegexLeaf("NOTE", "(.*)"), //
|
||||
new RegexLeaf("$"));
|
||||
@ -85,7 +82,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
|
||||
};
|
||||
}
|
||||
|
||||
public Command<SequenceDiagram> createMultiLine() {
|
||||
public Command<SequenceDiagram> createMultiLine(boolean withBracket) {
|
||||
return new CommandMultilines2<SequenceDiagram>(getRegexConcatMultiLine(),
|
||||
MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
|
@ -44,7 +44,7 @@ import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
@ -59,7 +59,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), //
|
||||
new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), //
|
||||
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$") //
|
||||
);
|
||||
}
|
||||
@ -71,7 +71,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), //
|
||||
new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), //
|
||||
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
new RegexLeaf("NOTE", "(.*)"), //
|
||||
new RegexLeaf("$"));
|
||||
@ -90,7 +90,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
};
|
||||
}
|
||||
|
||||
public Command<SequenceDiagram> createMultiLine() {
|
||||
public Command<SequenceDiagram> createMultiLine(boolean withBracket) {
|
||||
return new CommandMultilines2<SequenceDiagram>(getRegexConcatMultiLine(),
|
||||
MultilinesStrategy.KEEP_STARTING_QUOTE) {
|
||||
|
||||
|
@ -117,8 +117,9 @@ public class AtomText implements Atom {
|
||||
private AtomText(String text, FontConfiguration style, Url url, DelayedDouble marginLeft, DelayedDouble marginRight) {
|
||||
this.marginLeft = marginLeft;
|
||||
this.marginRight = marginRight;
|
||||
//this.text = StringUtils.showComparatorCharacters(StringUtils.manageBackslash(text));
|
||||
this.text = StringUtils.showComparatorCharacters(CharHidder.unhide(text));
|
||||
// this.text = StringUtils.showComparatorCharacters(StringUtils.manageBackslash(text));
|
||||
this.text = StringUtils.manageUnicodeNotationUplus(StringUtils.manageAmpDiese(StringUtils
|
||||
.showComparatorCharacters(CharHidder.unhide(text))));
|
||||
this.fontConfiguration = style;
|
||||
this.url = url;
|
||||
}
|
||||
|
@ -41,14 +41,18 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
|
||||
public class CommandCreoleMonospaced implements Command {
|
||||
|
||||
public static final String MONOSPACED = "monospaced";
|
||||
|
||||
private final Pattern pattern;
|
||||
private final String monospacedFamily;
|
||||
|
||||
public static Command create() {
|
||||
return new CommandCreoleMonospaced("^(?i)([%g][%g](.*?)[%g][%g])");
|
||||
public static Command create(String monospacedFamily) {
|
||||
return new CommandCreoleMonospaced("^(?i)([%g][%g](.*?)[%g][%g])", monospacedFamily);
|
||||
}
|
||||
|
||||
private CommandCreoleMonospaced(String p) {
|
||||
private CommandCreoleMonospaced(String p, String monospacedFamily) {
|
||||
this.pattern = MyPattern.cmpile(p);
|
||||
this.monospacedFamily = monospacedFamily;
|
||||
}
|
||||
|
||||
public int matchingSize(String line) {
|
||||
@ -65,7 +69,7 @@ public class CommandCreoleMonospaced implements Command {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
||||
final FontConfiguration fc2 = fc1.changeFamily("monospaced");
|
||||
final FontConfiguration fc2 = fc1.changeFamily(monospacedFamily);
|
||||
stripe.setActualFontConfiguration(fc2);
|
||||
stripe.analyzeAndAdd(m.group(2));
|
||||
stripe.setActualFontConfiguration(fc1);
|
||||
|
@ -55,6 +55,9 @@ public class CreoleParser {
|
||||
this.modeSimpleLine = modeSimpleLine;
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
this.skinParam = skinParam;
|
||||
if (skinParam == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.horizontalAlignment = horizontalAlignment;
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,9 @@ public class CreoleStripeSimpleParser {
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
this.modeSimpleLine = modeSimpleLine;
|
||||
this.skinParam = skinParam;
|
||||
if (skinParam == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
final Pattern p4 = MyPattern.cmpile("^--([^-]*)--$");
|
||||
final Matcher m4 = p4.matcher(line);
|
||||
@ -80,15 +83,15 @@ public class CreoleStripeSimpleParser {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (modeSimpleLine == CreoleMode.FULL) {
|
||||
// final Pattern p6 = MyPattern.cmpile("^__([^_]*)__$");
|
||||
// final Matcher m6 = p6.matcher(line);
|
||||
// if (m6.find()) {
|
||||
// this.line = m6.group(1);
|
||||
// this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '_');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// if (modeSimpleLine == CreoleMode.FULL) {
|
||||
// final Pattern p6 = MyPattern.cmpile("^__([^_]*)__$");
|
||||
// final Matcher m6 = p6.matcher(line);
|
||||
// if (m6.find()) {
|
||||
// this.line = m6.group(1);
|
||||
// this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '_');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
final Pattern p7 = MyPattern.cmpile("^\\.\\.([^\\.]*)\\.\\.$");
|
||||
final Matcher m7 = p7.matcher(line);
|
||||
|
@ -97,7 +97,7 @@ public class StripeSimple implements Stripe {
|
||||
this.commands.add(CommandCreoleSpace.create());
|
||||
this.commands.add(CommandCreoleFontFamilyChange.create());
|
||||
this.commands.add(CommandCreoleFontFamilyChange.createEol());
|
||||
this.commands.add(CommandCreoleMonospaced.create());
|
||||
this.commands.add(CommandCreoleMonospaced.create(skinParam.getMonospacedFamily()));
|
||||
this.commands.add(CommandCreoleUrl.create(skinParam));
|
||||
this.commands.add(CommandCreoleSvgAttributeChange.create());
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory {
|
||||
cmds.add(new CommandPackageWithUSymbol());
|
||||
cmds.add(new CommandEndPackage());
|
||||
final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand();
|
||||
cmds.add(factoryNoteCommand.createMultiLine());
|
||||
cmds.add(factoryNoteCommand.createMultiLine(false));
|
||||
|
||||
final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand(new RegexOr(
|
||||
"ENTITY", //
|
||||
@ -100,12 +100,13 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory {
|
||||
cmds.add(new CommandCreateElementMultilines(0));
|
||||
cmds.add(new CommandCreateElementMultilines(1));
|
||||
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine());
|
||||
cmds.add(factoryNoteCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(true));
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(false));
|
||||
cmds.add(factoryNoteCommand.createMultiLine(false));
|
||||
|
||||
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
|
||||
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
|
||||
|
||||
return cmds;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
package net.sourceforge.plantuml.descdiagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
|
||||
@ -49,9 +50,8 @@ import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiagram> {
|
||||
|
||||
@ -87,7 +87,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandCreateElementMultilines extends CommandMultilines2<DescriptionDiagram> {
|
||||
|
||||
@ -86,7 +86,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<Descripti
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("DESC", "as[%s]*[%g](.*)$"));
|
||||
}
|
||||
@ -97,7 +97,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<Descripti
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("DESC", "\\[(.*)$"));
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.descdiagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
@ -46,9 +47,8 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
@ -68,7 +68,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*\\{$"));
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ import java.awt.geom.Rectangle2D;
|
||||
public abstract class AbstractTextBlock implements TextBlock {
|
||||
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException(getClass().toString());
|
||||
throw new UnsupportedOperationException("member=" + member + " " + getClass().toString());
|
||||
}
|
||||
|
||||
}
|
@ -36,8 +36,6 @@ package net.sourceforge.plantuml.graphic;
|
||||
|
||||
public class HtmlColorUtils {
|
||||
|
||||
public static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+";
|
||||
|
||||
public static final HtmlColor BLACK;
|
||||
public static final HtmlColor WHITE;
|
||||
public static final HtmlColor RED_LIGHT;
|
||||
|
93
src/net/sourceforge/plantuml/graphic/color/ColorParser.java
Normal file
93
src/net/sourceforge/plantuml/graphic/color/ColorParser.java
Normal file
@ -0,0 +1,93 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2014, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7946 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic.color;
|
||||
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||
|
||||
public class ColorParser {
|
||||
|
||||
private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+";
|
||||
|
||||
private final RegexLeaf regex;
|
||||
private final String name;
|
||||
|
||||
private ColorParser(String name, RegexLeaf regex) {
|
||||
this.regex = regex;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public HtmlColor getColor(RegexResult arg, IHtmlColorSet set) {
|
||||
return set.getColorIfValid(arg.get("COLOR", 0));
|
||||
}
|
||||
|
||||
public static RegexLeaf exp1() {
|
||||
return simpleColor().regex;
|
||||
}
|
||||
|
||||
public static ColorParser simpleColor() {
|
||||
return new ColorParser("COLOR", new RegexLeaf("COLOR", "(" + COLOR_REGEXP + ")?"));
|
||||
}
|
||||
|
||||
public static RegexLeaf exp2() {
|
||||
return new RegexLeaf("BACKCOLOR", "(" + COLOR_REGEXP + ")?");
|
||||
}
|
||||
|
||||
public static RegexLeaf exp3() {
|
||||
return new RegexLeaf("BACKCOLOR2", "(" + COLOR_REGEXP + ")?");
|
||||
}
|
||||
|
||||
public static RegexLeaf exp4() {
|
||||
return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + "):)?");
|
||||
}
|
||||
|
||||
public static RegexLeaf exp5() {
|
||||
return new RegexLeaf("COLOR", "(?::?(" + COLOR_REGEXP + "))?");
|
||||
}
|
||||
|
||||
public static RegexLeaf exp6() {
|
||||
return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + ")\\|)?");
|
||||
}
|
||||
|
||||
public static RegexLeaf exp7() {
|
||||
return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + "))?");
|
||||
}
|
||||
|
||||
public RegexLeaf getRegex() {
|
||||
return regex;
|
||||
}
|
||||
|
||||
}
|
@ -85,13 +85,14 @@ public class ObjectDiagramFactory extends UmlDiagramFactory {
|
||||
|
||||
cmds.add(new CommandUrl());
|
||||
|
||||
cmds.add(factoryNoteCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine());
|
||||
cmds.add(factoryNoteCommand.createMultiLine(false));
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(true));
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(false));
|
||||
cmds.add(new CommandCreateEntityObjectMultilines());
|
||||
|
||||
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
|
||||
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
|
||||
|
||||
// addCommand(new CommandNoopClass());
|
||||
return cmds;
|
||||
|
@ -47,7 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.objectdiagram.ObjectDiagram;
|
||||
|
||||
public class CommandCreateEntityObject extends SingleLineCommand2<ObjectDiagram> {
|
||||
@ -65,7 +65,7 @@ public class CommandCreateEntityObject extends SingleLineCommand2<ObjectDiagram>
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.objectdiagram.ObjectDiagram;
|
||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
|
||||
@ -67,7 +67,7 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Obje
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*\\{[%s]*$"));
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14020 $
|
||||
* Revision $Revision: 16938 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.preproc;
|
||||
@ -85,29 +85,7 @@ public class Defines {
|
||||
}
|
||||
final String value = Matcher.quoteReplacement(ent.getValue());
|
||||
if (key.contains("(")) {
|
||||
final StringTokenizer st = new StringTokenizer(key, "(),");
|
||||
final String fctName = st.nextToken();
|
||||
String newValue = value;
|
||||
final StringBuilder regex = new StringBuilder("\\b" + fctName + "\\(");
|
||||
int i = 1;
|
||||
|
||||
while (st.hasMoreTokens()) {
|
||||
if (st.hasMoreTokens()) {
|
||||
regex.append("([^,]*?)");
|
||||
} else {
|
||||
regex.append("([^)]*?)");
|
||||
}
|
||||
final String var1 = st.nextToken();
|
||||
final String var2 = "(##" + var1 + "\\b)|(\\b" + var1 + "##)|(\\b" + var1 + "\\b)";
|
||||
newValue = newValue.replaceAll(var2, "\\$" + i);
|
||||
i++;
|
||||
if (st.hasMoreTokens()) {
|
||||
regex.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
regex.append("\\)");
|
||||
line = line.replaceAll(regex.toString(), newValue);
|
||||
line = applyMethod(line, key, value);
|
||||
} else {
|
||||
final String regex = "\\b" + key + "\\b";
|
||||
line = line.replaceAll(regex, value);
|
||||
@ -116,6 +94,28 @@ public class Defines {
|
||||
return Arrays.asList(line.split("\n"));
|
||||
}
|
||||
|
||||
private String applyMethod(String line, final String key, final String value) {
|
||||
final StringTokenizer st = new StringTokenizer(key, "(),");
|
||||
final String fctName = st.nextToken();
|
||||
String newValue = value;
|
||||
final StringBuilder regex = new StringBuilder("\\b" + fctName + "\\(");
|
||||
int i = 1;
|
||||
|
||||
while (st.hasMoreTokens()) {
|
||||
regex.append("(?:(?:\\s*\"([^\"]*)\"\\s*)|(?:\\s*'([^']*)'\\s*)|\\s*([^,]*?)\\s*)");
|
||||
final String var1 = st.nextToken();
|
||||
final String var2 = "(##" + var1 + "\\b)|(\\b" + var1 + "##)|(\\b" + var1 + "\\b)";
|
||||
newValue = newValue.replaceAll(var2, "\\$" + i + "\\$" + (i + 1) + "\\$" + (i + 2));
|
||||
i += 3;
|
||||
if (st.hasMoreTokens()) {
|
||||
regex.append(",");
|
||||
}
|
||||
}
|
||||
regex.append("\\)");
|
||||
line = line.replaceAll(regex.toString(), newValue);
|
||||
return line;
|
||||
}
|
||||
|
||||
public void saveState() {
|
||||
if (savedState.size() > 0) {
|
||||
throw new IllegalStateException();
|
||||
|
@ -38,6 +38,7 @@ import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinSimple;
|
||||
import net.sourceforge.plantuml.SpriteContainer;
|
||||
import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
|
||||
import net.sourceforge.plantuml.salt.element.Element;
|
||||
import net.sourceforge.plantuml.salt.element.WrappedElement;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
@ -65,7 +66,7 @@ public class Dictionary implements SpriteContainer, ISkinSimple {
|
||||
public String getValue(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public double getPadding() {
|
||||
return 0;
|
||||
}
|
||||
@ -74,4 +75,8 @@ public class Dictionary implements SpriteContainer, ISkinSimple {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getMonospacedFamily() {
|
||||
return CommandCreoleMonospaced.MONOSPACED;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,20 +28,20 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16293 $
|
||||
* Revision $Revision: 16932 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
|
||||
public class LifeEvent extends AbstractEvent implements Event {
|
||||
|
||||
private final Participant p;
|
||||
private final LifeEventType type;
|
||||
private final HtmlColor backcolor;
|
||||
private final SymbolContext backcolor;
|
||||
|
||||
public LifeEvent(Participant p, LifeEventType type, HtmlColor backcolor) {
|
||||
public LifeEvent(Participant p, LifeEventType type, SymbolContext backcolor) {
|
||||
this.p = p;
|
||||
this.type = type;
|
||||
this.backcolor = backcolor;
|
||||
@ -60,7 +60,7 @@ public class LifeEvent extends AbstractEvent implements Event {
|
||||
return type;
|
||||
}
|
||||
|
||||
public HtmlColor getSpecificBackColor() {
|
||||
public SymbolContext getSpecificColors() {
|
||||
return backcolor;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16520 $
|
||||
* Revision $Revision: 16937 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -41,6 +41,7 @@ import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
|
||||
public class Participant implements SpecificBackcolorable {
|
||||
|
||||
@ -109,15 +110,15 @@ public class Participant implements SpecificBackcolorable {
|
||||
return initialLife;
|
||||
}
|
||||
|
||||
private HtmlColor liveBackcolor;
|
||||
private SymbolContext liveBackcolors;
|
||||
|
||||
public final void incInitialLife(HtmlColor backcolor) {
|
||||
public final void incInitialLife(SymbolContext colors) {
|
||||
initialLife++;
|
||||
this.liveBackcolor = backcolor;
|
||||
this.liveBackcolors = colors;
|
||||
}
|
||||
|
||||
public HtmlColor getLiveSpecificBackColor() {
|
||||
return liveBackcolor;
|
||||
public SymbolContext getLiveSpecificBackColors() {
|
||||
return liveBackcolors;
|
||||
}
|
||||
|
||||
private HtmlColor specificBackcolor;
|
||||
|
@ -52,6 +52,7 @@ import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker;
|
||||
import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2;
|
||||
import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramTxtMaker;
|
||||
@ -227,10 +228,14 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
private LifeEvent pendingCreate = null;
|
||||
|
||||
public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor) {
|
||||
return activate(p, lifeEventType, backcolor, null);
|
||||
}
|
||||
|
||||
public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor, HtmlColor linecolor) {
|
||||
if (lastDelay != null) {
|
||||
return "You cannot Activate/Deactivate just after a ...";
|
||||
}
|
||||
final LifeEvent lifeEvent = new LifeEvent(p, lifeEventType, backcolor);
|
||||
final LifeEvent lifeEvent = new LifeEvent(p, lifeEventType, new SymbolContext(backcolor, linecolor));
|
||||
events.add(lifeEvent);
|
||||
if (lifeEventType == LifeEventType.CREATE) {
|
||||
pendingCreate = lifeEvent;
|
||||
@ -238,7 +243,7 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
}
|
||||
if (lastEventWithDeactivate == null) {
|
||||
if (lifeEventType == LifeEventType.ACTIVATE) {
|
||||
p.incInitialLife(backcolor);
|
||||
p.incInitialLife(new SymbolContext(backcolor, linecolor));
|
||||
return null;
|
||||
}
|
||||
return "Only activate command can occur before message are send";
|
||||
|
@ -113,9 +113,9 @@ public class SequenceDiagramFactory extends UmlDiagramFactory {
|
||||
final FactorySequenceNoteOnArrowCommand factorySequenceNoteOnArrowCommand = new FactorySequenceNoteOnArrowCommand();
|
||||
cmds.add(factorySequenceNoteOnArrowCommand.createSingleLine());
|
||||
|
||||
cmds.add(factorySequenceNoteCommand.createMultiLine());
|
||||
cmds.add(factorySequenceNoteOverSeveralCommand.createMultiLine());
|
||||
cmds.add(factorySequenceNoteOnArrowCommand.createMultiLine());
|
||||
cmds.add(factorySequenceNoteCommand.createMultiLine(false));
|
||||
cmds.add(factorySequenceNoteOverSeveralCommand.createMultiLine(false));
|
||||
cmds.add(factorySequenceNoteOnArrowCommand.createMultiLine(false));
|
||||
|
||||
cmds.add(new CommandNewpage());
|
||||
cmds.add(new CommandIgnoreNewpage());
|
||||
|
@ -28,24 +28,26 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14726 $
|
||||
* Revision $Revision: 16937 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.sequencediagram.LifeEventType;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
|
||||
public class CommandActivate extends SingleLineCommand<SequenceDiagram> {
|
||||
|
||||
public CommandActivate() {
|
||||
super("(?i)^(activate|deactivate|destroy|create)[%s]+([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*(#\\w+)?$");
|
||||
super(
|
||||
"(?i)^(activate|deactivate|destroy|create)[%s]+([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*(#\\w+)?(?:[%s]+(#\\w+))?$");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,8 +55,9 @@ public class CommandActivate extends SingleLineCommand<SequenceDiagram> {
|
||||
final LifeEventType type = LifeEventType.valueOf(StringUtils.goUpperCase(arg.get(0)));
|
||||
final Participant p = diagram.getOrCreateParticipant(StringUtils
|
||||
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(1)));
|
||||
final String error = diagram.activate(p, type,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get(2)));
|
||||
final HtmlColor backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get(2));
|
||||
final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get(3));
|
||||
final String error = diagram.activate(p, type, backColor, lineColor);
|
||||
if (error == null) {
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -33,11 +33,14 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.sequencediagram.LifeEventType;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageExo;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageExoType;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
@ -46,7 +49,6 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
import net.sourceforge.plantuml.skin.ArrowDecoration;
|
||||
import net.sourceforge.plantuml.skin.ArrowHead;
|
||||
import net.sourceforge.plantuml.skin.ArrowPart;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
|
||||
abstract class CommandExoArrowAny extends SingleLineCommand2<SequenceDiagram> {
|
||||
|
||||
@ -55,23 +57,23 @@ abstract class CommandExoArrowAny extends SingleLineCommand2<SequenceDiagram> {
|
||||
}
|
||||
|
||||
@Override
|
||||
final protected CommandExecutionResult executeArg(SequenceDiagram sequenceDiagram, RegexResult arg2) {
|
||||
final String body = arg2.getLazzy("ARROW_BODYA", 0) + arg2.getLazzy("ARROW_BODYB", 0);
|
||||
final String dressing = arg2.getLazzy("ARROW_DRESSING", 0);
|
||||
final Participant p = sequenceDiagram.getOrCreateParticipant(StringUtils
|
||||
.eventuallyRemoveStartingAndEndingDoubleQuote(arg2.get("PARTICIPANT", 0)));
|
||||
final protected CommandExecutionResult executeArg(SequenceDiagram diagram, RegexResult arg) {
|
||||
final String body = arg.getLazzy("ARROW_BODYA", 0) + arg.getLazzy("ARROW_BODYB", 0);
|
||||
final String dressing = arg.getLazzy("ARROW_DRESSING", 0);
|
||||
final Participant p = diagram.getOrCreateParticipant(StringUtils
|
||||
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0)));
|
||||
|
||||
final boolean sync = dressing.length() == 2;
|
||||
final boolean dotted = body.contains("--");
|
||||
|
||||
final Display labels;
|
||||
if (arg2.get("LABEL", 0) == null) {
|
||||
if (arg.get("LABEL", 0) == null) {
|
||||
labels = Display.create("");
|
||||
} else {
|
||||
labels = Display.getWithNewlines(arg2.get("LABEL", 0));
|
||||
labels = Display.getWithNewlines(arg.get("LABEL", 0));
|
||||
}
|
||||
|
||||
final boolean bothDirection = arg2.get("ARROW_BOTHDRESSING", 0) != null;
|
||||
final boolean bothDirection = arg.get("ARROW_BOTHDRESSING", 0) != null;
|
||||
|
||||
ArrowConfiguration config = bothDirection ? ArrowConfiguration.withDirectionBoth() : ArrowConfiguration
|
||||
.withDirectionNormal();
|
||||
@ -82,43 +84,56 @@ abstract class CommandExoArrowAny extends SingleLineCommand2<SequenceDiagram> {
|
||||
config = config.withHead(ArrowHead.ASYNC);
|
||||
}
|
||||
config = config.withPart(getArrowPart(dressing));
|
||||
config = CommandArrow.applyStyle(arg2.getLazzy("ARROW_STYLE", 0), config);
|
||||
final MessageExoType messageExoType = getMessageExoType(arg2);
|
||||
config = CommandArrow.applyStyle(arg.getLazzy("ARROW_STYLE", 0), config);
|
||||
final MessageExoType messageExoType = getMessageExoType(arg);
|
||||
|
||||
if (messageExoType == MessageExoType.TO_RIGHT || messageExoType == MessageExoType.TO_LEFT) {
|
||||
if (containsSymbolExterior(arg2, "o")) {
|
||||
if (containsSymbolExterior(arg, "o")) {
|
||||
config = config.withDecoration2(ArrowDecoration.CIRCLE);
|
||||
}
|
||||
if (containsSymbol(arg2, "o")) {
|
||||
if (containsSymbol(arg, "o")) {
|
||||
config = config.withDecoration1(ArrowDecoration.CIRCLE);
|
||||
}
|
||||
} else {
|
||||
if (containsSymbolExterior(arg2, "o")) {
|
||||
if (containsSymbolExterior(arg, "o")) {
|
||||
config = config.withDecoration1(ArrowDecoration.CIRCLE);
|
||||
}
|
||||
if (containsSymbol(arg2, "o")) {
|
||||
if (containsSymbol(arg, "o")) {
|
||||
config = config.withDecoration2(ArrowDecoration.CIRCLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (containsSymbolExterior(arg2, "x") || containsSymbol(arg2, "x")) {
|
||||
if (containsSymbolExterior(arg, "x") || containsSymbol(arg, "x")) {
|
||||
config = config.withHead2(ArrowHead.CROSSX);
|
||||
}
|
||||
// if (messageExoType.getDirection() == 1) {
|
||||
// if (containsSymbolExterior(arg2, "x") || containsSymbol(arg2, "x")) {
|
||||
// config = config.withHead2(ArrowHead.CROSSX);
|
||||
// }
|
||||
// } else {
|
||||
// if (containsSymbolExterior(arg2, "x") || containsSymbol(arg2, "x")) {
|
||||
// config = config.withHead2(ArrowHead.CROSSX);
|
||||
// }
|
||||
// }
|
||||
// if (messageExoType.getDirection() == 1) {
|
||||
// if (containsSymbolExterior(arg2, "x") || containsSymbol(arg2, "x")) {
|
||||
// config = config.withHead2(ArrowHead.CROSSX);
|
||||
// }
|
||||
// } else {
|
||||
// if (containsSymbolExterior(arg2, "x") || containsSymbol(arg2, "x")) {
|
||||
// config = config.withHead2(ArrowHead.CROSSX);
|
||||
// }
|
||||
// }
|
||||
|
||||
final String error = sequenceDiagram.addMessage(new MessageExo(p, messageExoType, labels, config,
|
||||
sequenceDiagram.getNextMessageNumber(), isShortArrow(arg2)));
|
||||
final String error = diagram.addMessage(new MessageExo(p, messageExoType, labels, config, diagram
|
||||
.getNextMessageNumber(), isShortArrow(arg)));
|
||||
if (error != null) {
|
||||
return CommandExecutionResult.error(error);
|
||||
}
|
||||
|
||||
final HtmlColor activationColor = diagram.getSkinParam().getIHtmlColorSet()
|
||||
.getColorIfValid(arg.get("LIFECOLOR", 0));
|
||||
|
||||
if (diagram.isAutoactivate() && (config.getHead() == ArrowHead.NORMAL || config.getHead() == ArrowHead.ASYNC)) {
|
||||
if (config.isDotted()) {
|
||||
diagram.activate(p, LifeEventType.DEACTIVATE, null);
|
||||
} else {
|
||||
diagram.activate(p, LifeEventType.ACTIVATE, activationColor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandParticipantA extends CommandParticipant {
|
||||
|
||||
@ -55,7 +55,7 @@ public class CommandParticipantA extends CommandParticipant {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandParticipantA2 extends CommandParticipant {
|
||||
|
||||
@ -56,7 +56,7 @@ public class CommandParticipantA2 extends CommandParticipant {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandParticipantA3 extends CommandParticipant {
|
||||
|
||||
@ -55,7 +55,7 @@ public class CommandParticipantA3 extends CommandParticipant {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandParticipantA4 extends CommandParticipant {
|
||||
|
||||
@ -54,7 +54,7 @@ public class CommandParticipantA4 extends CommandParticipant {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16580 $
|
||||
* Revision $Revision: 16937 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -43,6 +43,7 @@ import net.sourceforge.plantuml.SkinParamBackcolored;
|
||||
import net.sourceforge.plantuml.SkinParamBackcoloredReference;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Delay;
|
||||
import net.sourceforge.plantuml.sequencediagram.Divider;
|
||||
@ -148,7 +149,7 @@ class DrawableSetInitializer {
|
||||
final LivingParticipantBox living = drawableSet.getLivingParticipantBox(p);
|
||||
for (int i = 0; i < p.getInitialLife(); i++) {
|
||||
living.getLifeLine().addSegmentVariation(LifeSegmentVariation.LARGER,
|
||||
freeY2.getFreeY(getFullParticipantRange()), p.getLiveSpecificBackColor());
|
||||
freeY2.getFreeY(getFullParticipantRange()), p.getLiveSpecificBackColors());
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,7 +481,7 @@ class DrawableSetInitializer {
|
||||
pos = message.getPosYstartLevel() + delta1;
|
||||
}
|
||||
final LifeLine line1 = drawableSet.getLivingParticipantBox(lifeEvent.getParticipant()).getLifeLine();
|
||||
line1.addSegmentVariation(LifeSegmentVariation.LARGER, pos, lifeEvent.getSpecificBackColor());
|
||||
line1.addSegmentVariation(LifeSegmentVariation.LARGER, pos, lifeEvent.getSpecificColors());
|
||||
} else if (lifeEvent.getType() == LifeEventType.DESTROY || lifeEvent.getType() == LifeEventType.DEACTIVATE) {
|
||||
double delta = 0;
|
||||
if (OptionFlags.STRICT_SELFMESSAGE_POSITION && message != null && message.isSelfMessage()) {
|
||||
@ -492,7 +493,7 @@ class DrawableSetInitializer {
|
||||
if (message != null) {
|
||||
pos2 = message.getPosYendLevel() - delta;
|
||||
}
|
||||
line.addSegmentVariation(LifeSegmentVariation.SMALLER, pos2, lifeEvent.getSpecificBackColor());
|
||||
line.addSegmentVariation(LifeSegmentVariation.SMALLER, pos2, lifeEvent.getSpecificColors());
|
||||
}
|
||||
|
||||
if (lifeEvent.getType() == LifeEventType.DESTROY) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14860 $
|
||||
* Revision $Revision: 16937 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -39,10 +39,13 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.SkinParamBackcolored;
|
||||
import net.sourceforge.plantuml.SkinParamForceColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
import net.sourceforge.plantuml.skin.Skin;
|
||||
@ -53,13 +56,13 @@ public class LifeLine {
|
||||
|
||||
static class Variation {
|
||||
final private LifeSegmentVariation type;
|
||||
final private HtmlColor backcolor;
|
||||
final private SymbolContext colors;
|
||||
final private double y;
|
||||
|
||||
Variation(LifeSegmentVariation type, double y, HtmlColor backcolor) {
|
||||
Variation(LifeSegmentVariation type, double y, SymbolContext backcolor) {
|
||||
this.type = type;
|
||||
this.y = y;
|
||||
this.backcolor = backcolor;
|
||||
this.colors = backcolor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,7 +85,7 @@ public class LifeLine {
|
||||
this.shadowing = shadowing;
|
||||
}
|
||||
|
||||
public void addSegmentVariation(LifeSegmentVariation type, double y, HtmlColor backcolor) {
|
||||
public void addSegmentVariation(LifeSegmentVariation type, double y, SymbolContext colors) {
|
||||
if (events.size() > 0) {
|
||||
final Variation last = events.get(events.size() - 1);
|
||||
if (y < last.y) {
|
||||
@ -94,7 +97,7 @@ public class LifeLine {
|
||||
// throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
events.add(new Variation(type, y, backcolor));
|
||||
events.add(new Variation(type, y, colors));
|
||||
final int currentLevel = type.apply(stairs.getLastValue());
|
||||
stairs.addStep(y, currentLevel);
|
||||
assert getLevel(y) == stairs.getValue(y);
|
||||
@ -179,10 +182,10 @@ public class LifeLine {
|
||||
if (level == 0) {
|
||||
final double y1 = events.get(i).y;
|
||||
final double y2 = events.get(j).y;
|
||||
return new SegmentColored(y1, y2, events.get(i).backcolor, shadowing);
|
||||
return new SegmentColored(y1, y2, events.get(i).colors, shadowing);
|
||||
}
|
||||
}
|
||||
return new SegmentColored(events.get(i).y, events.get(events.size() - 1).y, events.get(i).backcolor, shadowing);
|
||||
return new SegmentColored(events.get(i).y, events.get(events.size() - 1).y, events.get(i).colors, shadowing);
|
||||
}
|
||||
|
||||
private Collection<SegmentColored> getSegmentsCutted(StringBounder stringBounder, int i) {
|
||||
@ -202,7 +205,12 @@ public class LifeLine {
|
||||
ComponentType type = ComponentType.ALIVE_BOX_CLOSE_OPEN;
|
||||
for (final Iterator<SegmentColored> it = getSegmentsCutted(stringBounder, i).iterator(); it.hasNext();) {
|
||||
final SegmentColored seg = it.next();
|
||||
final ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, seg.getSpecificBackColor());
|
||||
ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, seg.getSpecificBackColor());
|
||||
final HtmlColor specificLineColor = seg.getSpecificLineColor();
|
||||
if (specificLineColor != null) {
|
||||
skinParam2 = new SkinParamForceColor(skinParam2, ColorParam.sequenceLifeLineBorder,
|
||||
specificLineColor);
|
||||
}
|
||||
if (it.hasNext() == false) {
|
||||
type = type == ComponentType.ALIVE_BOX_CLOSE_OPEN ? ComponentType.ALIVE_BOX_CLOSE_CLOSE
|
||||
: ComponentType.ALIVE_BOX_OPEN_CLOSE;
|
||||
@ -238,4 +246,11 @@ public class LifeLine {
|
||||
public final boolean shadowing() {
|
||||
return shadowing;
|
||||
}
|
||||
|
||||
public SymbolContext getColors() {
|
||||
if (events.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return events.get(events.size() - 1).colors;
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,13 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16028 $
|
||||
* Revision $Revision: 16937 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.InGroupable;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
@ -69,7 +70,8 @@ public class LivingParticipantBox implements InGroupable {
|
||||
final double centerX = participantBox.getCenterX(stringBounder);
|
||||
// Log.println("AZERTY " + y + " centerX=" + centerX + " left=" + left + " right=" + right);
|
||||
// Log.println("Attention, null for segment");
|
||||
return new SegmentColored(centerX - left, centerX + right, null, lifeLine.shadowing());
|
||||
final SymbolContext colors = lifeLine.getColors();
|
||||
return new SegmentColored(centerX - left, centerX + right, colors, lifeLine.shadowing());
|
||||
}
|
||||
|
||||
public void drawLineU22(UGraphic ug, double startingY, double endingY, boolean showTail, double myDelta) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14803 $
|
||||
* Revision $Revision: 16934 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -41,6 +41,7 @@ import java.util.Iterator;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.skin.Area;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.SimpleContext2D;
|
||||
@ -50,23 +51,33 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
class SegmentColored {
|
||||
|
||||
final private Segment segment;
|
||||
final private HtmlColor backcolor;
|
||||
final private SymbolContext colors;
|
||||
final private boolean shadowing;
|
||||
final private double pos1Initial;
|
||||
|
||||
SegmentColored(double pos1, double pos2, HtmlColor backcolor, boolean shadowing) {
|
||||
this(new Segment(pos1, pos2), backcolor, shadowing, pos1);
|
||||
SegmentColored(double pos1, double pos2, SymbolContext colors, boolean shadowing) {
|
||||
this(new Segment(pos1, pos2), colors, shadowing, pos1);
|
||||
}
|
||||
|
||||
private SegmentColored(Segment segment, HtmlColor backcolor, boolean shadowing, double pos1Initial) {
|
||||
private SegmentColored(Segment segment, SymbolContext colors, boolean shadowing, double pos1Initial) {
|
||||
this.segment = segment;
|
||||
this.backcolor = backcolor;
|
||||
this.colors = colors;
|
||||
this.shadowing = shadowing;
|
||||
this.pos1Initial = pos1Initial;
|
||||
}
|
||||
|
||||
public HtmlColor getSpecificBackColor() {
|
||||
return backcolor;
|
||||
if (colors == null) {
|
||||
return null;
|
||||
}
|
||||
return colors.getBackColor();
|
||||
}
|
||||
|
||||
public HtmlColor getSpecificLineColor() {
|
||||
if (colors == null) {
|
||||
return null;
|
||||
}
|
||||
return colors.getForeColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,7 +114,7 @@ class SegmentColored {
|
||||
|
||||
public SegmentColored merge(SegmentColored this2) {
|
||||
final Segment merge = this.segment.merge(this2.segment);
|
||||
return new SegmentColored(merge, backcolor, shadowing, merge.getPos1());
|
||||
return new SegmentColored(merge, colors, shadowing, merge.getPos1());
|
||||
}
|
||||
|
||||
public final Segment getSegment() {
|
||||
@ -125,7 +136,7 @@ class SegmentColored {
|
||||
}
|
||||
|
||||
public SegmentColored next() {
|
||||
return new SegmentColored(it.next(), backcolor, shadowing, pos1Initial);
|
||||
return new SegmentColored(it.next(), colors, shadowing, pos1Initial);
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
|
@ -38,7 +38,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.LifeEvent;
|
||||
@ -132,7 +132,7 @@ public class EventsHistory {
|
||||
return false;
|
||||
}
|
||||
|
||||
private HtmlColor getActivateColor(Event event) {
|
||||
private SymbolContext getActivateColor(Event event) {
|
||||
for (Iterator<Event> it = events.iterator(); it.hasNext();) {
|
||||
final Event current = it.next();
|
||||
if (event != current) {
|
||||
@ -143,7 +143,7 @@ public class EventsHistory {
|
||||
if (next instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) next;
|
||||
if (le.isActivate()) {
|
||||
return le.getSpecificBackColor();
|
||||
return le.getSpecificColors();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -33,14 +33,14 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
|
||||
public class IntegerColored {
|
||||
|
||||
private final int value;
|
||||
private final HtmlColor color;
|
||||
private final SymbolContext color;
|
||||
|
||||
public IntegerColored(int value, HtmlColor color) {
|
||||
public IntegerColored(int value, SymbolContext color) {
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class IntegerColored {
|
||||
return value;
|
||||
}
|
||||
|
||||
public HtmlColor getColor() {
|
||||
public SymbolContext getColors() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class LiveBoxes {
|
||||
final IntegerColored integerColored = stairs.getValue(yposition.getValue());
|
||||
final int level = integerColored.getValue();
|
||||
if (pending && level == levelToDraw) {
|
||||
drawer.addStart(yposition.getValue(), integerColored.getColor());
|
||||
drawer.addStart(yposition.getValue(), integerColored.getColors());
|
||||
pending = false;
|
||||
} else if (pending == false && (it.hasNext() == false || level < levelToDraw)) {
|
||||
drawer.doDrawing(ug, yposition);
|
||||
|
@ -41,8 +41,8 @@ import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.SkinParamBackcolored;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.graphic.Segment;
|
||||
import net.sourceforge.plantuml.skin.Area;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
@ -55,7 +55,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
public class LiveBoxesDrawer {
|
||||
|
||||
private double y1;
|
||||
private HtmlColor color;
|
||||
private SymbolContext color;
|
||||
|
||||
private final Component cross;
|
||||
private final Context2D context;
|
||||
@ -80,7 +80,7 @@ public class LiveBoxesDrawer {
|
||||
return compForWidth.getPreferredWidth(stringBounder);
|
||||
}
|
||||
|
||||
public void addStart(double y1, HtmlColor color) {
|
||||
public void addStart(double y1, SymbolContext color) {
|
||||
this.y1 = y1;
|
||||
this.color = color;
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class LiveBoxesDrawer {
|
||||
private void drawInternal(UGraphic ug, StairsPosition yposition, double ya, double yb, ComponentType type) {
|
||||
final double width = getWidth(ug.getStringBounder());
|
||||
final Area area = new Area(width, yb - ya);
|
||||
final ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, color);
|
||||
final ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, color == null ? null : color.getBackColor());
|
||||
final Component comp = skin.createComponent(type, null, skinParam2, null);
|
||||
comp.drawU(ug.apply(new UTranslate(-width / 2, ya)), area, context);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
|
||||
public class Stairs2 {
|
||||
|
||||
@ -52,7 +52,7 @@ public class Stairs2 {
|
||||
return ys.toString() + " " + values;
|
||||
}
|
||||
|
||||
public void addStep(StairsPosition position, int value, HtmlColor color) {
|
||||
public void addStep(StairsPosition position, int value, SymbolContext color) {
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
@ -82,13 +83,14 @@ public enum VisibilityModifier {
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(size + 1, size + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
// final double tx = ug.getTranslateX();
|
||||
// final double ty = ug.getTranslateY();
|
||||
// ug.translate(x, y);F
|
||||
drawInternal(ug, size, foregroundColor, backgoundColor, 0, 0);
|
||||
// ug.setTranslate(tx, ty);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
|
||||
@ -56,16 +55,17 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
public class ComponentRoseDivider extends AbstractTextualComponent {
|
||||
|
||||
// private final int outMargin = 5;
|
||||
private final HtmlColor borderColor;
|
||||
private final HtmlColor background;
|
||||
private final boolean empty;
|
||||
private final boolean withShadow;
|
||||
private final UStroke stroke;
|
||||
|
||||
public ComponentRoseDivider(FontConfiguration font, HtmlColor background, Display stringsToDisplay,
|
||||
ISkinSimple spriteContainer, boolean withShadow, UStroke stroke) {
|
||||
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4,
|
||||
spriteContainer, 0, false, null, null);
|
||||
ISkinSimple spriteContainer, boolean withShadow, UStroke stroke, HtmlColor borderColor) {
|
||||
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, 0, false, null, null);
|
||||
this.background = background;
|
||||
this.borderColor = borderColor;
|
||||
this.empty = stringsToDisplay.get(0).length() == 0;
|
||||
this.withShadow = withShadow;
|
||||
this.stroke = stroke;
|
||||
@ -89,7 +89,7 @@ public class ComponentRoseDivider extends AbstractTextualComponent {
|
||||
|
||||
drawSep(ug.apply(new UTranslate(0, dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth());
|
||||
|
||||
ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
|
||||
ug = ug.apply(new UChangeColor(borderColor));
|
||||
ug = ug.apply(stroke);
|
||||
final URectangle rect = new URectangle(textWidth + deltaX, textHeight);
|
||||
if (withShadow) {
|
||||
@ -119,7 +119,7 @@ public class ComponentRoseDivider extends AbstractTextualComponent {
|
||||
}
|
||||
|
||||
private void drawDoubleLine(UGraphic ug, final double width) {
|
||||
ug = ug.apply(new UStroke(stroke.getThickness() / 2)).apply(new UChangeColor(HtmlColorUtils.BLACK));
|
||||
ug = ug.apply(new UStroke(stroke.getThickness() / 2)).apply(new UChangeColor(borderColor));
|
||||
final ULine line = new ULine(width, 0);
|
||||
ug.apply(new UTranslate(0, -1)).draw(line);
|
||||
ug.apply(new UTranslate(0, 2)).draw(line);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 15981 $
|
||||
* Revision $Revision: 16778 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -227,7 +227,7 @@ public class Rose implements Skin {
|
||||
if (type == ComponentType.DIVIDER) {
|
||||
return new ComponentRoseDivider(getUFont2(param, FontParam.SEQUENCE_DIVIDER), getHtmlColor(param,
|
||||
ColorParam.sequenceDividerBackground), stringsToDisplay, param, deltaShadow(param) > 0, getStroke(
|
||||
param, LineParam.sequenceDividerBorder, 2));
|
||||
param, LineParam.sequenceDividerBorder, 2), getHtmlColor(param, ColorParam.sequenceDividerBorder));
|
||||
}
|
||||
if (type == ComponentType.REFERENCE) {
|
||||
return new ComponentRoseReference(getUFont2(param, FontParam.SEQUENCE_REFERENCE), getSymbolContext(param,
|
||||
|
@ -83,19 +83,20 @@ public class StateDiagramFactory extends UmlDiagramFactory {
|
||||
"ENTITY", new RegexLeaf("[\\p{L}0-9_.]+"), //
|
||||
new RegexLeaf("[%g][^%g]+[%g]") //
|
||||
));
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(true));
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine(false));
|
||||
|
||||
cmds.add(new CommandHideEmptyDescription());
|
||||
|
||||
cmds.add(factoryNoteOnEntityCommand.createSingleLine());
|
||||
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
|
||||
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine());
|
||||
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
|
||||
cmds.add(new CommandUrl());
|
||||
|
||||
final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand();
|
||||
cmds.add(factoryNoteCommand.createSingleLine());
|
||||
cmds.add(factoryNoteCommand.createMultiLine());
|
||||
cmds.add(factoryNoteCommand.createMultiLine(false));
|
||||
|
||||
addCommonCommands(cmds);
|
||||
|
||||
|
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagram;
|
||||
|
||||
public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram> {
|
||||
@ -72,7 +72,7 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), //
|
||||
new RegexLeaf("(?:[%s]*\\{|[%s]+begin)$"));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user