mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
Version 6121
This commit is contained in:
parent
27af4f85f3
commit
2ce0511e80
2
pom.xml
2
pom.xml
@ -36,7 +36,7 @@
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>6085-SNAPSHOT</version>
|
||||
<version>6121-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
|
@ -33,8 +33,14 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@ -92,6 +98,18 @@ public class FileUtils {
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
static public void copyToFile(File src, File dest) throws IOException {
|
||||
if (dest.isDirectory()) {
|
||||
dest = new File(dest, src.getName());
|
||||
}
|
||||
final InputStream fis = new BufferedInputStream(new FileInputStream(src));
|
||||
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(dest));
|
||||
int lu;
|
||||
while ((lu = fis.read()) != -1) {
|
||||
fos.write(lu);
|
||||
}
|
||||
fos.close();
|
||||
fis.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5977 $
|
||||
* Revision $Revision: 6096 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -67,6 +67,7 @@ public class OptionFlags {
|
||||
private String dotExecutable = null;
|
||||
private boolean gui = false;
|
||||
private boolean quiet = false;
|
||||
private boolean checkDotError = false;
|
||||
|
||||
private OptionFlags() {
|
||||
reset();
|
||||
@ -164,4 +165,12 @@ public class OptionFlags {
|
||||
this.quiet = quiet;
|
||||
}
|
||||
|
||||
public final boolean isCheckDotError() {
|
||||
return checkDotError;
|
||||
}
|
||||
|
||||
public final void setCheckDotError(boolean checkDotError) {
|
||||
this.checkDotError = checkDotError;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6060 $
|
||||
* Revision $Revision: 6110 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -329,7 +329,8 @@ public class StringUtils {
|
||||
|
||||
public static String uncommentSource(String source) {
|
||||
final StringReader sr = new StringReader(source);
|
||||
final UncommentReadLine un = new UncommentReadLine(new ReadLineReader(sr));
|
||||
final UncommentReadLine un = new UncommentReadLine(new ReadLineReader(
|
||||
sr));
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
String s = null;
|
||||
try {
|
||||
@ -346,4 +347,18 @@ public class StringUtils {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean isDiagramCacheable(String uml) {
|
||||
uml = uml.toLowerCase();
|
||||
if (uml.startsWith("@startuml\nversion\n")) {
|
||||
return false;
|
||||
}
|
||||
if (uml.startsWith("@startuml\ntestdot\n")) {
|
||||
return false;
|
||||
}
|
||||
if (uml.startsWith("@startuml\nsudoku\n")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5811 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -40,6 +40,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
public abstract class UmlDiagram extends AbstractPSystem implements PSystem {
|
||||
|
||||
private boolean rotation;
|
||||
private boolean hideUnlinkedData;
|
||||
|
||||
private int minwidth = Integer.MAX_VALUE;
|
||||
|
||||
@ -142,4 +143,12 @@ public abstract class UmlDiagram extends AbstractPSystem implements PSystem {
|
||||
return getSkinParam().getDpi();
|
||||
}
|
||||
|
||||
public final boolean isHideUnlinkedData() {
|
||||
return hideUnlinkedData;
|
||||
}
|
||||
|
||||
public final void setHideUnlinkedData(boolean hideUnlinkedData) {
|
||||
this.hideUnlinkedData = hideUnlinkedData;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"),
|
||||
new RegexOr("FIRST", true,
|
||||
new RegexLeaf("STAR", "(\\(\\*\\))"),
|
||||
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"),
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"),
|
||||
new RegexLeaf("BAR", "(?:==+)\\s*([\\p{L}0-9_.]+)\\s*(?:==+)"),
|
||||
new RegexLeaf("QUOTED", "\"([^\"]+)\"(?:\\s+as\\s+([\\p{L}0-9_.]+))?")),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("ARROW", "([=-]+(?:left|right|up|down|le?|ri?|up?|do?)?[=-]*\\>)?"),
|
||||
new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?[=-]*\\>)?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
|
@ -58,20 +58,33 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
}
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), new RegexOr("FIRST", true, new RegexLeaf("STAR", "(\\(\\*\\))"),
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), new RegexLeaf("BAR",
|
||||
"(?:==+)\\s*([\\p{L}0-9_.]+)\\s*(?:==+)"), new RegexLeaf("QUOTED",
|
||||
"\"([^\"]+)\"(?:\\s+as\\s+([\\p{L}0-9_.]+))?")), new RegexLeaf("\\s*"), new RegexLeaf(
|
||||
"STEREOTYPE", "(\\<\\<.*\\>\\>)?"), new RegexLeaf("\\s*"), new RegexLeaf("BACKCOLOR", "(#\\w+)?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("ARROW", "([=-]+(?:left|right|up|down|le?|ri?|up?|do?)?[=-]*\\>)"),
|
||||
new RegexLeaf("\\s*"), new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), new RegexLeaf("\\s*"),
|
||||
new RegexOr("FIRST2", new RegexLeaf("STAR2", "(\\(\\*\\))"), new RegexLeaf("OPENBRACKET2", "(\\{)"),
|
||||
new RegexLeaf("CODE2", "([\\p{L}0-9_.]+)"), new RegexLeaf("BAR2",
|
||||
"(?:==+)\\s*([\\p{L}0-9_.]+)\\s*(?:==+)"), new RegexLeaf("QUOTED2",
|
||||
"\"([^\"]+)\"(?:\\s+as\\s+([\\p{L}0-9_.]+))?")), new RegexLeaf("\\s*"), new RegexLeaf(
|
||||
"STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), new RegexLeaf("\\s*"), new RegexLeaf("BACKCOLOR2",
|
||||
"(#\\w+)?"), new RegexLeaf("$"));
|
||||
return new RegexConcat(
|
||||
new RegexLeaf("^"), //
|
||||
new RegexOr("FIRST", true, //
|
||||
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("BAR", "(?:==+)\\s*([\\p{L}0-9_.]+)\\s*(?:==+)"), //
|
||||
new RegexLeaf("QUOTED", "\"([^\"]+)\"(?:\\s+as\\s+([\\p{L}0-9_.]+))?")), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("BACKCOLOR", "(#\\w+)?"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("ARROW", "([=-]+(?:left|right|up|down|le?|ri?|up?|do?)?[=-]*\\>)"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexOr("FIRST2", //
|
||||
new RegexLeaf("STAR2", "(\\(\\*(top)?\\))"), //
|
||||
new RegexLeaf("OPENBRACKET2", "(\\{)"), //
|
||||
new RegexLeaf("CODE2", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("BAR2", "(?:==+)\\s*([\\p{L}0-9_.]+)\\s*(?:==+)"), //
|
||||
new RegexLeaf("QUOTED2", "\"([^\"]+)\"(?:\\s+as\\s+([\\p{L}0-9_.]+))?")),
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("BACKCOLOR2", "(#\\w+)?"), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,6 +137,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
}
|
||||
if (arg.get("STAR" + suf).get(0) != null) {
|
||||
if (start) {
|
||||
if (arg.get("STAR" + suf).get(1) != null) {
|
||||
system.getStart().setTop(true);
|
||||
}
|
||||
return system.getStart();
|
||||
}
|
||||
return system.getEnd();
|
||||
|
@ -65,7 +65,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"),
|
||||
new RegexOr("FIRST", true,
|
||||
new RegexLeaf("STAR", "(\\(\\*\\))"),
|
||||
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"),
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"),
|
||||
new RegexLeaf("BAR", "(?:==+)\\s*([\\p{L}0-9_.]+)\\s*(?:==+)"),
|
||||
new RegexLeaf("QUOTED", "\"([^\"]+)\"(?:\\s+as\\s+([\\p{L}0-9_.]+))?")),
|
||||
@ -74,7 +74,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("BACKCOLOR", "(#\\w+)?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("ARROW", "([=-]+(?:left|right|up|down|le?|ri?|up?|do?)?[=-]*\\>)"),
|
||||
new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=]))?[=-]*\\>)"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5350 $
|
||||
* Revision $Revision: 6095 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.classdiagram;
|
||||
@ -43,7 +43,7 @@ public abstract class AbstractEntityDiagram extends CucaDiagram {
|
||||
|
||||
abstract public IEntity getOrCreateClass(String code);
|
||||
|
||||
final protected List<String> getDotStrings() {
|
||||
protected List<String> getDotStrings() {
|
||||
// return Arrays.asList("nodesep=.5;", "ranksep=0.8;", "edge [fontsize=11,labelfontsize=11];",
|
||||
// "node [fontsize=11,height=.35,width=.55];");
|
||||
return Arrays.asList("nodesep=.35;", "ranksep=0.8;", "edge [fontsize=11,labelfontsize=11];",
|
||||
|
@ -73,13 +73,13 @@ final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrO
|
||||
new RegexLeaf("FIRST_LABEL", "(?:\"([^\"]+)\")?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexOr(new RegexLeaf("LEFT_TO_RIGHT",
|
||||
"(([-=.]+)(left|right|up|down|le?|ri?|up?|do?)?([-=.]*)(o +|[\\]>*+]|\\|[>\\]])?)"),
|
||||
"(([-=.]+)(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?([-=.]*)(o +|[\\]>*+]|\\|[>\\]])?)"),
|
||||
new RegexLeaf("RIGHT_TO_LEFT",
|
||||
"(( +o|[\\[<*+]|[<\\[]\\|)?([-=.]*)(left|right|up|down|le?|ri?|up?|do?)?([-=.]+))"),
|
||||
new RegexLeaf("NAV_AGREG_OR_COMPO_INV",
|
||||
"(\\<([-=.]*)(left|right|up|down|le?|ri?|up?|do?[-=.]+)?([-=.]+)(o +|\\*))"),
|
||||
new RegexLeaf("NAV_AGREG_OR_COMPO",
|
||||
"(( +o|\\*)([-=.]+)(left|right|up|down|le?|ri?|up?|do?)?([-=.]*)\\>)")),
|
||||
"(( +o|\\*)([-=.]+)(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?([-=.]*)\\>)")),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("SECOND_LABEL", "(?:\"([^\"]+)\")?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6002 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -99,6 +99,8 @@ public abstract class AbstractUmlSystemCommandFactory implements PSystemCommandF
|
||||
addCommand(new CommandScale(system));
|
||||
addCommand(new CommandScaleWidthAndHeight(system));
|
||||
addCommand(new CommandScaleWidthOrHeight(system));
|
||||
addCommand(new CommandHideUnlinked(system));
|
||||
|
||||
}
|
||||
|
||||
protected final void addCommand(Command cmd) {
|
||||
|
@ -58,13 +58,20 @@ public class CommandLinkComponent2 extends SingleLineCommand2<ComponentDiagram>
|
||||
}
|
||||
|
||||
static RegexConcat getRegex() {
|
||||
return new RegexConcat(new RegexLeaf("^"), getRegexGroup("G1"), new RegexLeaf("\\s*"), new RegexOr(
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
getRegexGroup("G1"),//
|
||||
new RegexLeaf("\\s*"),//
|
||||
new RegexOr(
|
||||
//
|
||||
new RegexLeaf("AR_TO_RIGHT",
|
||||
"(([-=.]+)(left|right|up|down|le?|ri?|up?|do?)?([-=.]*?\\.*)([\\]>]|\\|[>\\]])?)"),
|
||||
"(([-=.]+)(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?([-=.]*)([\\]>]|\\|[>\\]])?)"),
|
||||
// "(([-=.]+)(left|right|up|down|le?|ri?|up?|do?)?([-=.]*?\\.*)([\\]>]|\\|[>\\]])?)"),
|
||||
new RegexLeaf("AR_TO_LEFT",
|
||||
"(([\\[<]|[<\\[]\\|)?([-=.]*)(left|right|up|down|le?|ri?|up?|do?)?([-=.]+))")),
|
||||
new RegexLeaf("\\s*"), getRegexGroup("G2"), new RegexLeaf("\\s*"), new RegexLeaf("END",
|
||||
"(?::\\s*([^\"]+))?$"));
|
||||
new RegexLeaf("\\s*"),//
|
||||
getRegexGroup("G2"),//
|
||||
new RegexLeaf("\\s*"),//
|
||||
new RegexLeaf("END", "(?::\\s*([^\"]+))?$"));
|
||||
}
|
||||
|
||||
private static RegexLeaf getRegexGroup(String name) {
|
||||
@ -87,7 +94,6 @@ public class CommandLinkComponent2 extends SingleLineCommand2<ComponentDiagram>
|
||||
final IEntity cl1 = getSystem().getOrCreateClass(g1);
|
||||
final IEntity cl2 = getSystem().getOrCreateClass(g2);
|
||||
|
||||
|
||||
if (arg.get("G1").get(1) != null) {
|
||||
cl1.setStereotype(new Stereotype(arg.get("G1").get(1)));
|
||||
}
|
||||
@ -116,7 +122,6 @@ public class CommandLinkComponent2 extends SingleLineCommand2<ComponentDiagram>
|
||||
link = link.getInv();
|
||||
}
|
||||
|
||||
|
||||
getSystem().addLink(link);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
@ -131,8 +136,6 @@ public class CommandLinkComponent2 extends SingleLineCommand2<ComponentDiagram>
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private CommandExecutionResult executePackageLink(Map<String, RegexPartialMatch> arg) {
|
||||
final String g1 = arg.get("G1").get(0);
|
||||
final String g2 = arg.get("G2").get(0);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5694 $
|
||||
* Revision $Revision: 6121 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -61,9 +61,18 @@ public class Entity implements IEntity {
|
||||
private DrawFile imageFile;
|
||||
private String url;
|
||||
|
||||
private boolean top;
|
||||
|
||||
public final boolean isTop() {
|
||||
return top;
|
||||
}
|
||||
|
||||
public final void setTop(boolean top) {
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public Entity(String code, String display, EntityType type, Group entityPackage) {
|
||||
this("cl" + UniqueSequence.getValue(), code, display, type, entityPackage);
|
||||
|
||||
}
|
||||
|
||||
public Entity(String uid, String code, String display, EntityType type, Group entityPackage) {
|
||||
|
@ -118,6 +118,14 @@ public abstract class EntityUtils {
|
||||
return ent.getImageFile(searched);
|
||||
}
|
||||
|
||||
public boolean isTop() {
|
||||
return ent.isTop();
|
||||
}
|
||||
|
||||
public void setTop(boolean top) {
|
||||
ent.setTop(top);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -64,4 +64,9 @@ public interface IEntity extends Imaged, SpecificBackcolorable {
|
||||
|
||||
public DrawFile getImageFile(File searched) throws IOException;
|
||||
|
||||
public boolean isTop();
|
||||
|
||||
public void setTop(boolean top);
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6005 $
|
||||
* Revision $Revision: 6104 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
@ -90,10 +90,11 @@ abstract class AbstractGraphviz implements Graphviz {
|
||||
return;
|
||||
}
|
||||
final String cmd = getCommandLine();
|
||||
ProcessRunner p = null;
|
||||
try {
|
||||
Log.info("Starting Graphviz process " + cmd);
|
||||
Log.info("DotString size: " + dotString.length());
|
||||
final ProcessRunner p = new ProcessRunner(cmd);
|
||||
p = new ProcessRunner(cmd);
|
||||
p.run(dotString.getBytes(), os);
|
||||
Log.info("Ending process ok");
|
||||
} catch (Throwable e) {
|
||||
@ -105,8 +106,20 @@ abstract class AbstractGraphviz implements Graphviz {
|
||||
Log.error("");
|
||||
} finally {
|
||||
Log.info("Ending Graphviz process");
|
||||
|
||||
}
|
||||
if (OptionFlags.getInstance().isCheckDotError() && p != null && p.getError().length() > 0) {
|
||||
Log.error("GraphViz error stream : " + p.getError());
|
||||
if (OptionFlags.getInstance().isCheckDotError()) {
|
||||
throw new IllegalStateException("Dot error " + p.getError());
|
||||
}
|
||||
}
|
||||
if (OptionFlags.getInstance().isCheckDotError() && p != null && p.getOut().length() > 0) {
|
||||
Log.error("GraphViz out stream : " + p.getOut());
|
||||
if (OptionFlags.getInstance().isCheckDotError()) {
|
||||
throw new IllegalStateException("Dot out " + p.getOut());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean illegalDotExe() {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6035 $
|
||||
* Revision $Revision: 6121 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
@ -99,6 +99,8 @@ final public class DotMaker implements GraphvizMaker {
|
||||
|
||||
private final Set<String> hasAlreadyOneIncommingArrowLenghtOne;
|
||||
|
||||
final private Set<String> rankMin = new HashSet<String>();
|
||||
|
||||
public static void goJunit() {
|
||||
isJunit = true;
|
||||
}
|
||||
@ -123,6 +125,7 @@ final public class DotMaker implements GraphvizMaker {
|
||||
printGroups(sb, null);
|
||||
printEntities(sb, getUnpackagedEntities());
|
||||
printLinks(sb, data.getLinks());
|
||||
printRanking(sb);
|
||||
sb.append("}");
|
||||
|
||||
// System.err.println(sb);
|
||||
@ -132,6 +135,20 @@ final public class DotMaker implements GraphvizMaker {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void printRanking(StringBuilder sb) {
|
||||
if (rankMin.size() == 0) {
|
||||
return;
|
||||
}
|
||||
sb.append("{ rank = min;");
|
||||
for (String id : rankMin) {
|
||||
sb.append(id);
|
||||
sb.append(";");
|
||||
}
|
||||
sb.append("}");
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initPrintWriter(StringBuilder sb) {
|
||||
|
||||
Log.info("Entities = " + data.getEntities().size());
|
||||
@ -891,6 +908,11 @@ final public class DotMaker implements GraphvizMaker {
|
||||
} else {
|
||||
throw new IllegalStateException(type.toString() + " " + data.getUmlDiagramType());
|
||||
}
|
||||
|
||||
if (entity.isTop()) {
|
||||
rankMin.add(entity.getUid());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ColorParam getEndColorParam() {
|
||||
|
@ -80,9 +80,10 @@ public class DrawFile {
|
||||
|
||||
private DrawFile(File fPng, String svg, File fEps) {
|
||||
this(new Unlazy<File>(fPng), new Unlazy<String>(svg), new Unlazy<File>(fEps));
|
||||
if (svg.contains("\\")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
// if (svg.contains("\\")) {
|
||||
// System.err.println("svg="+svg);
|
||||
// throw new IllegalArgumentException();
|
||||
// }
|
||||
}
|
||||
|
||||
public File getPngOrEps(boolean isEps) throws IOException {
|
||||
|
@ -28,11 +28,12 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5650 $
|
||||
* Revision $Revision: 6107 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -53,7 +54,11 @@ public class ProcessRunner {
|
||||
static private int cpt = 0;
|
||||
|
||||
public void run(byte in[], OutputStream redirection) throws IOException, InterruptedException {
|
||||
final Process process = Runtime.getRuntime().exec(cmd);
|
||||
run(in, redirection, null);
|
||||
}
|
||||
|
||||
public void run(byte in[], OutputStream redirection, File dir) throws IOException, InterruptedException {
|
||||
final Process process = Runtime.getRuntime().exec(cmd, null, dir);
|
||||
final ThreadStream errorStream = new ThreadStream(process.getErrorStream(), null);
|
||||
final ThreadStream outStream = new ThreadStream(process.getInputStream(), redirection);
|
||||
errorStream.start();
|
||||
@ -68,7 +73,7 @@ public class ProcessRunner {
|
||||
outStream.join(10000L);
|
||||
this.out = outStream.sb.toString();
|
||||
this.error = errorStream.sb.toString();
|
||||
Log.info("RUN nb = "+(++cpt));
|
||||
Log.info("RUN nb = " + (++cpt));
|
||||
}
|
||||
|
||||
static class ThreadStream extends Thread {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5200 $
|
||||
* Revision $Revision: 6107 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.preproc;
|
||||
@ -39,9 +39,9 @@ import java.util.regex.Pattern;
|
||||
|
||||
class IfManager implements ReadLine {
|
||||
|
||||
protected static final Pattern ifdefPattern = Pattern.compile("^!if(n)?def\\s+([A-Za-z_][A-Za-z_0-9]*)$");
|
||||
protected static final Pattern elsePattern = Pattern.compile("^!else$");
|
||||
protected static final Pattern endifPattern = Pattern.compile("^!endif$");
|
||||
protected static final Pattern ifdefPattern = Pattern.compile("^\\s*!if(n)?def\\s+([A-Za-z_][A-Za-z_0-9]*)$");
|
||||
protected static final Pattern elsePattern = Pattern.compile("^\\s*!else$");
|
||||
protected static final Pattern endifPattern = Pattern.compile("^\\s*!endif$");
|
||||
|
||||
private final Defines defines;
|
||||
private final ReadLine source;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6070 $
|
||||
* Revision $Revision: 6107 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.preproc;
|
||||
@ -41,8 +41,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class Preprocessor implements ReadLine {
|
||||
|
||||
private static final Pattern definePattern = Pattern.compile("^!define\\s+([A-Za-z_][A-Za-z_0-9]*)(?:\\s+(.*))?$");
|
||||
private static final Pattern undefPattern = Pattern.compile("^!undef\\s+([A-Za-z_][A-Za-z_0-9]*)$");
|
||||
private static final Pattern definePattern = Pattern.compile("^\\s*!define\\s+([A-Za-z_][A-Za-z_0-9]*)(?:\\s+(.*))?$");
|
||||
private static final Pattern undefPattern = Pattern.compile("^\\s*!undef\\s+([A-Za-z_][A-Za-z_0-9]*)$");
|
||||
|
||||
private final Defines defines;
|
||||
private final PreprocessorInclude rawSource;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6070 $
|
||||
* Revision $Revision: 6107 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.preproc;
|
||||
@ -45,7 +45,7 @@ import net.sourceforge.plantuml.FileSystem;
|
||||
|
||||
class PreprocessorInclude implements ReadLine {
|
||||
|
||||
private static final Pattern includePattern = Pattern.compile("^!include\\s+\"?([^\"]+)\"?$");
|
||||
private static final Pattern includePattern = Pattern.compile("^\\s*!include\\s+\"?([^\"]+)\"?$");
|
||||
|
||||
private final ReadLine reader2;
|
||||
private int numLine = 0;
|
||||
|
@ -47,4 +47,8 @@ public class Delay implements Event {
|
||||
return text;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,4 +47,9 @@ public class Divider implements Event {
|
||||
return text;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,11 +28,13 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3835 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
|
||||
public interface Event {
|
||||
|
||||
boolean dealWith(Participant someone);
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4321 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -74,4 +74,9 @@ public class GroupingLeaf extends Grouping {
|
||||
}
|
||||
return backColorGeneral;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -73,4 +73,9 @@ public class GroupingStart extends Grouping {
|
||||
return backColorGeneral;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4243 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -59,5 +59,8 @@ public class LifeEvent implements Event {
|
||||
return backcolor;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return this.p == someone;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5923 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -57,4 +57,8 @@ public class Message extends AbstractMessage {
|
||||
return p2;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return someone == p1 || someone == p2;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,4 +57,8 @@ public class MessageExo extends AbstractMessage {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return participant == someone;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3835 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -47,4 +47,9 @@ public class Newpage implements Event {
|
||||
return title;
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4237 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -87,4 +87,7 @@ public class Note implements Event, SpecificBackcolorable {
|
||||
this.specificBackcolor = HtmlColor.getColorIfValid(s);
|
||||
}
|
||||
|
||||
public boolean dealWith(Participant someone) {
|
||||
return p == someone || p2 == someone;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4836 $
|
||||
* Revision $Revision: 6099 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -70,6 +70,11 @@ public class Participant implements SpecificBackcolorable {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getCode();
|
||||
}
|
||||
|
||||
public List<CharSequence> getDisplay() {
|
||||
return Collections.unmodifiableList(display);
|
||||
}
|
||||
|
@ -40,28 +40,13 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
public class ParticipantEnglober {
|
||||
|
||||
final private List<String> title;
|
||||
final private Participant first;
|
||||
final private Participant last;
|
||||
final private HtmlColor boxColor;
|
||||
|
||||
public ParticipantEnglober(Participant first, Participant last, List<String> title, HtmlColor boxColor) {
|
||||
if (first == null || last == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.first = first;
|
||||
this.last = last;
|
||||
public ParticipantEnglober(List<String> title, HtmlColor boxColor) {
|
||||
this.title = title;
|
||||
this.boxColor = boxColor;
|
||||
}
|
||||
|
||||
public final Participant getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
||||
public final Participant getLast() {
|
||||
return last;
|
||||
}
|
||||
|
||||
public final List<String> getTitle() {
|
||||
return title;
|
||||
}
|
||||
@ -70,4 +55,5 @@ public class ParticipantEnglober {
|
||||
return boxColor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -63,7 +63,7 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
|
||||
private final List<Event> events = new ArrayList<Event>();
|
||||
|
||||
private final List<ParticipantEnglober> participantEnglobers = new ArrayList<ParticipantEnglober>();
|
||||
private final Map<Participant, ParticipantEnglober> participantEnglobers2 = new HashMap<Participant, ParticipantEnglober>();
|
||||
|
||||
private Skin skin = new ProtectedSkin(new Rose());
|
||||
|
||||
@ -77,6 +77,7 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
if (result == null) {
|
||||
result = new Participant(ParticipantType.PARTICIPANT, code, display);
|
||||
participants.put(code, result);
|
||||
participantEnglobers2.put(result, participantEnglober);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -96,6 +97,7 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
}
|
||||
final Participant result = new Participant(type, code, display);
|
||||
participants.put(code, result);
|
||||
participantEnglobers2.put(result, participantEnglober);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -266,65 +268,98 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
return UmlDiagramType.SEQUENCE;
|
||||
}
|
||||
|
||||
private Participant boxStart;
|
||||
private List<String> boxStartComment;
|
||||
private HtmlColor boxColor;
|
||||
private boolean boxPending = false;
|
||||
// private Participant boxStart;
|
||||
// private List<String> boxStartComment;
|
||||
// private HtmlColor boxColor;
|
||||
// private boolean boxPending = false;
|
||||
|
||||
private ParticipantEnglober participantEnglober;
|
||||
|
||||
public void boxStart(List<String> comment, HtmlColor color) {
|
||||
if (boxPending) {
|
||||
if (participantEnglober != null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
this.boxStart = getLastParticipant();
|
||||
this.boxStartComment = comment;
|
||||
this.boxColor = color;
|
||||
this.boxPending = true;
|
||||
this.participantEnglober = new ParticipantEnglober(comment, color);
|
||||
}
|
||||
|
||||
public void endBox() {
|
||||
if (boxPending == false) {
|
||||
if (participantEnglober == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final Participant last = getLastParticipant();
|
||||
this.participantEnglobers.add(new ParticipantEnglober(next(boxStart), last, boxStartComment, boxColor));
|
||||
this.boxStart = null;
|
||||
this.boxStartComment = null;
|
||||
this.boxColor = null;
|
||||
this.boxPending = false;
|
||||
this.participantEnglober = null;
|
||||
}
|
||||
|
||||
public boolean isBoxPending() {
|
||||
return boxPending;
|
||||
return participantEnglober != null;
|
||||
}
|
||||
|
||||
private Participant next(Participant p) {
|
||||
if (p == null) {
|
||||
return participants.values().iterator().next();
|
||||
}
|
||||
for (final Iterator<Participant> it = participants.values().iterator(); it.hasNext();) {
|
||||
final Participant current = it.next();
|
||||
if (current == p && it.hasNext()) {
|
||||
return it.next();
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("p=" + p.getCode());
|
||||
}
|
||||
|
||||
private Participant getLastParticipant() {
|
||||
Participant result = null;
|
||||
for (Participant p : participants.values()) {
|
||||
result = p;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public final List<ParticipantEnglober> getParticipantEnglobers() {
|
||||
return Collections.unmodifiableList(participantEnglobers);
|
||||
}
|
||||
// private Participant next(Participant p) {
|
||||
// if (p == null) {
|
||||
// return participants.values().iterator().next();
|
||||
// }
|
||||
// for (final Iterator<Participant> it = participants.values().iterator(); it.hasNext();) {
|
||||
// final Participant current = it.next();
|
||||
// if (current == p && it.hasNext()) {
|
||||
// return it.next();
|
||||
// }
|
||||
// }
|
||||
// throw new IllegalArgumentException("p=" + p.getCode());
|
||||
// }
|
||||
//
|
||||
// private Participant getLastParticipant() {
|
||||
// Participant result = null;
|
||||
// for (Participant p : participants.values()) {
|
||||
// result = p;
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// public final List<ParticipantEnglober> getParticipantEnglobers() {
|
||||
// return Collections.unmodifiableList(participantEnglobers);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getNbImages() {
|
||||
return getSequenceDiagramPngMaker(new FileFormatOption(FileFormat.PNG)).getNbPages();
|
||||
}
|
||||
|
||||
public void removeHiddenParticipants() {
|
||||
for (Participant p : new ArrayList<Participant>(participants.values())) {
|
||||
if (isAlone(p)) {
|
||||
remove(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void remove(Participant p) {
|
||||
final boolean ok = participants.values().remove(p);
|
||||
if (ok==false) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
participantEnglobers2.remove(p);
|
||||
}
|
||||
|
||||
private boolean isAlone(Participant p) {
|
||||
for (Event ev : events) {
|
||||
if (ev.dealWith(p)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void putParticipantInLast(String code) {
|
||||
final Participant p = participants.get(code);
|
||||
if (p == null) {
|
||||
throw new IllegalArgumentException(code);
|
||||
}
|
||||
participants.remove(code);
|
||||
participants.put(code, p);
|
||||
participantEnglobers2.put(p, participantEnglober);
|
||||
}
|
||||
|
||||
public ParticipantEnglober getEnglober(Participant p) {
|
||||
return participantEnglobers2.get(p);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5933 $
|
||||
* Revision $Revision: 6097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -107,4 +107,13 @@ public class SequenceDiagramFactory extends AbstractUmlSystemCommandFactory {
|
||||
return system;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String checkFinalError() {
|
||||
if (system.isHideUnlinkedData()) {
|
||||
system.removeHiddenParticipants();
|
||||
}
|
||||
return super.checkFinalError();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5728 $
|
||||
* Revision $Revision: 6109 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
@ -55,7 +55,8 @@ public class CommandParticipant extends SingleLineCommand<SequenceDiagram> {
|
||||
protected CommandExecutionResult executeArg(List<String> arg) {
|
||||
final String code = arg.get(2);
|
||||
if (getSystem().participants().containsKey(code)) {
|
||||
return CommandExecutionResult.error("Duplicate participant : "+code);
|
||||
getSystem().putParticipantInLast(code);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
List<String> strings = null;
|
||||
|
@ -55,7 +55,8 @@ public class CommandParticipant2 extends SingleLineCommand<SequenceDiagram> {
|
||||
protected CommandExecutionResult executeArg(List<String> arg) {
|
||||
final String code = arg.get(1);
|
||||
if (getSystem().participants().containsKey(code)) {
|
||||
return CommandExecutionResult.error("Duplicate participant : " + code);
|
||||
getSystem().putParticipantInLast(code);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
final List<String> strings = StringUtils.getWithNewlines(arg.get(2));
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5829 $
|
||||
* Revision $Revision: 6113 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -51,6 +51,7 @@ import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.Newpage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober;
|
||||
import net.sourceforge.plantuml.sequencediagram.ParticipantEngloberContexted;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
import net.sourceforge.plantuml.skin.Context2D;
|
||||
@ -63,7 +64,8 @@ class DrawableSet {
|
||||
|
||||
private final Map<Participant, LivingParticipantBox> participants = new LinkedHashMap<Participant, LivingParticipantBox>();
|
||||
private final Map<Event, GraphicalElement> events = new HashMap<Event, GraphicalElement>();
|
||||
private final List<ParticipantEnglober> participantEnglobers = new ArrayList<ParticipantEnglober>();
|
||||
private final Map<Participant, ParticipantEnglober> participantEnglobers2 = new LinkedHashMap<Participant, ParticipantEnglober>();
|
||||
|
||||
private final List<Event> eventsList = new ArrayList<Event>();
|
||||
private final Skin skin;
|
||||
private final ISkinParam skinParam;
|
||||
@ -129,19 +131,41 @@ class DrawableSet {
|
||||
public double getHeadAndEngloberHeight(Participant p, StringBounder stringBounder) {
|
||||
final LivingParticipantBox box = participants.get(p);
|
||||
final double height = box.getParticipantBox().getHeadHeight(stringBounder);
|
||||
final ParticipantEnglober englober = getParticipantEnglober(p);
|
||||
final ParticipantEngloberContexted englober = getParticipantEnglober(p);
|
||||
if (englober == null) {
|
||||
return height;
|
||||
}
|
||||
final Component comp = skin.createComponent(ComponentType.ENGLOBER, skinParam, englober.getTitle());
|
||||
final Component comp = skin.createComponent(ComponentType.ENGLOBER, skinParam, englober
|
||||
.getParticipantEnglober().getTitle());
|
||||
final double heightEnglober = comp.getPreferredHeight(stringBounder);
|
||||
return height + heightEnglober;
|
||||
}
|
||||
|
||||
public List<ParticipantEngloberContexted> getExistingParticipantEnglober2() {
|
||||
final List<ParticipantEngloberContexted> result = new ArrayList<ParticipantEngloberContexted>();
|
||||
ParticipantEngloberContexted pending = null;
|
||||
for (Map.Entry<Participant, ParticipantEnglober> ent : participantEnglobers2.entrySet()) {
|
||||
final ParticipantEnglober englober = ent.getValue();
|
||||
if (englober == null) {
|
||||
pending = null;
|
||||
continue;
|
||||
}
|
||||
assert englober != null;
|
||||
if (pending != null && englober == pending.getParticipantEnglober()) {
|
||||
pending.add(ent.getKey());
|
||||
continue;
|
||||
}
|
||||
pending = new ParticipantEngloberContexted(englober, ent.getKey());
|
||||
result.add(pending);
|
||||
}
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
public double getOffsetForEnglobers(StringBounder stringBounder) {
|
||||
double result = 0;
|
||||
for (ParticipantEnglober englober : participantEnglobers) {
|
||||
final Component comp = skin.createComponent(ComponentType.ENGLOBER, skinParam, englober.getTitle());
|
||||
for (ParticipantEngloberContexted englober : getExistingParticipantEnglober2()) {
|
||||
final Component comp = skin.createComponent(ComponentType.ENGLOBER, skinParam, englober
|
||||
.getParticipantEnglober().getTitle());
|
||||
final double height = comp.getPreferredHeight(stringBounder);
|
||||
if (height > result) {
|
||||
result = height;
|
||||
@ -154,7 +178,7 @@ class DrawableSet {
|
||||
static private final int MARGIN_FOR_ENGLOBERS1 = 2;
|
||||
|
||||
public double getTailHeight(StringBounder stringBounder, boolean showTail) {
|
||||
final double marginForEnglobers = this.participantEnglobers.size() > 0 ? MARGIN_FOR_ENGLOBERS : 0;
|
||||
final double marginForEnglobers = getExistingParticipantEnglober2().size() > 0 ? MARGIN_FOR_ENGLOBERS : 0;
|
||||
|
||||
if (showTail == false) {
|
||||
return 1 + marginForEnglobers;
|
||||
@ -167,7 +191,15 @@ class DrawableSet {
|
||||
return r + marginForEnglobers;
|
||||
}
|
||||
|
||||
public void addParticipant(Participant p, LivingParticipantBox box) {
|
||||
public void addParticipant(Participant p, ParticipantEnglober participantEnglober) {
|
||||
participants.put(p, null);
|
||||
participantEnglobers2.put(p, participantEnglober);
|
||||
}
|
||||
|
||||
public void setLivingParticipantBox(Participant p, LivingParticipantBox box) {
|
||||
if (participants.containsKey(p) == false) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
participants.put(p, box);
|
||||
}
|
||||
|
||||
@ -283,16 +315,17 @@ class DrawableSet {
|
||||
}
|
||||
|
||||
private void drawEnglobers(UGraphic ug, double height, Context2D context) {
|
||||
for (ParticipantEnglober englober : participantEnglobers) {
|
||||
for (ParticipantEngloberContexted englober : getExistingParticipantEnglober2()) {
|
||||
double x1 = getX1(englober);
|
||||
final double x2 = getX2(ug.getStringBounder(), englober);
|
||||
|
||||
final Component comp = getEngloberComponent(englober);
|
||||
final Component comp = getEngloberComponent(englober.getParticipantEnglober());
|
||||
|
||||
final double width = x2 - x1;
|
||||
final double preferedWidth = getEngloberPreferedWidth(ug.getStringBounder(), englober);
|
||||
final double preferedWidth = getEngloberPreferedWidth(ug.getStringBounder(),
|
||||
englober.getParticipantEnglober());
|
||||
if (preferedWidth > width) {
|
||||
if (englober.getFirst() == englober.getLast()) {
|
||||
if (englober.getFirst2() == englober.getLast2()) {
|
||||
x1 -= (preferedWidth - width) / 2;
|
||||
}
|
||||
final Dimension2DDouble dim = new Dimension2DDouble(preferedWidth, height);
|
||||
@ -313,19 +346,19 @@ class DrawableSet {
|
||||
}
|
||||
|
||||
private Component getEngloberComponent(ParticipantEnglober englober) {
|
||||
final ISkinParam s = englober.getBoxColor() == null ? skinParam : new SkinParamBackcolored(skinParam, englober
|
||||
.getBoxColor());
|
||||
final ISkinParam s = englober.getBoxColor() == null ? skinParam : new SkinParamBackcolored(skinParam,
|
||||
englober.getBoxColor());
|
||||
return skin.createComponent(ComponentType.ENGLOBER, s, englober.getTitle());
|
||||
}
|
||||
|
||||
private double getX1(ParticipantEnglober englober) {
|
||||
final Participant first = englober.getFirst();
|
||||
private double getX1(ParticipantEngloberContexted englober) {
|
||||
final Participant first = englober.getFirst2();
|
||||
final ParticipantBox firstBox = participants.get(first).getParticipantBox();
|
||||
return firstBox.getStartingX() + 1;
|
||||
}
|
||||
|
||||
private double getX2(StringBounder stringBounder, ParticipantEnglober englober) {
|
||||
final Participant last = englober.getLast();
|
||||
private double getX2(StringBounder stringBounder, ParticipantEngloberContexted englober) {
|
||||
final Participant last = englober.getLast2();
|
||||
final ParticipantBox lastBox = participants.get(last).getParticipantBox();
|
||||
return lastBox.getMaxX(stringBounder) - 1;
|
||||
}
|
||||
@ -337,32 +370,32 @@ class DrawableSet {
|
||||
line.drawU(ug, getSkin(), skinParam);
|
||||
}
|
||||
|
||||
public void addParticipantEnglober(ParticipantEnglober englober) {
|
||||
participantEnglobers.add(englober);
|
||||
}
|
||||
// public void addParticipantEnglober(ParticipantEnglober englober) {
|
||||
// participantEnglobers.add(englober);
|
||||
// }
|
||||
|
||||
private boolean contains(ParticipantEnglober englober, Participant toTest) {
|
||||
if (toTest == englober.getFirst() || toTest == englober.getLast()) {
|
||||
return true;
|
||||
}
|
||||
boolean inside = false;
|
||||
for (Participant p : participants.keySet()) {
|
||||
if (p == englober.getFirst()) {
|
||||
inside = true;
|
||||
}
|
||||
if (p == toTest) {
|
||||
return inside;
|
||||
}
|
||||
if (p == englober.getLast()) {
|
||||
inside = false;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
// private boolean contains(ParticipantEngloberContexted englober, Participant toTest) {
|
||||
// if (toTest == englober.getFirst2() || toTest == englober.getLast2()) {
|
||||
// return true;
|
||||
// }
|
||||
// boolean inside = false;
|
||||
// for (Participant p : participants.keySet()) {
|
||||
// if (p == englober.getFirst2()) {
|
||||
// inside = true;
|
||||
// }
|
||||
// if (p == toTest) {
|
||||
// return inside;
|
||||
// }
|
||||
// if (p == englober.getLast2()) {
|
||||
// inside = false;
|
||||
// }
|
||||
// }
|
||||
// throw new IllegalArgumentException();
|
||||
// }
|
||||
|
||||
private ParticipantEnglober getParticipantEnglober(Participant p) {
|
||||
for (ParticipantEnglober pe : participantEnglobers) {
|
||||
if (contains(pe, p)) {
|
||||
private ParticipantEngloberContexted getParticipantEnglober(Participant p) {
|
||||
for (ParticipantEngloberContexted pe : getExistingParticipantEnglober2()) {
|
||||
if (pe.contains(p)) {
|
||||
return pe;
|
||||
}
|
||||
}
|
||||
@ -373,8 +406,8 @@ class DrawableSet {
|
||||
this.topStartingY = topStartingY;
|
||||
}
|
||||
|
||||
public final List<ParticipantEnglober> getParticipantEnglobers() {
|
||||
return Collections.unmodifiableList(participantEnglobers);
|
||||
}
|
||||
// public final List<ParticipantEnglober> getParticipantEnglobers() {
|
||||
// return Collections.unmodifiableList(participantEnglobers);
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6046 $
|
||||
* Revision $Revision: 6113 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -57,6 +57,7 @@ import net.sourceforge.plantuml.sequencediagram.Newpage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober;
|
||||
import net.sourceforge.plantuml.sequencediagram.ParticipantEngloberContexted;
|
||||
import net.sourceforge.plantuml.sequencediagram.ParticipantType;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
@ -164,10 +165,11 @@ class DrawableSetInitializer {
|
||||
}
|
||||
|
||||
private void takeParticipantEngloberTitleWidth(StringBounder stringBounder) {
|
||||
for (ParticipantEnglober pe : drawableSet.getParticipantEnglobers()) {
|
||||
final double preferredWidth = drawableSet.getEngloberPreferedWidth(stringBounder, pe);
|
||||
final ParticipantBox first = drawableSet.getLivingParticipantBox(pe.getFirst()).getParticipantBox();
|
||||
final ParticipantBox last = drawableSet.getLivingParticipantBox(pe.getLast()).getParticipantBox();
|
||||
for (ParticipantEngloberContexted pe : drawableSet.getExistingParticipantEnglober2()) {
|
||||
final double preferredWidth = drawableSet.getEngloberPreferedWidth(stringBounder,
|
||||
pe.getParticipantEnglober());
|
||||
final ParticipantBox first = drawableSet.getLivingParticipantBox(pe.getFirst2()).getParticipantBox();
|
||||
final ParticipantBox last = drawableSet.getLivingParticipantBox(pe.getLast2()).getParticipantBox();
|
||||
if (first == last) {
|
||||
final Constraint constraint1 = constraintSet.getConstraintBefore(first);
|
||||
final Constraint constraint2 = constraintSet.getConstraintAfter(last);
|
||||
@ -420,21 +422,21 @@ class DrawableSetInitializer {
|
||||
drawableSet.getSkinParam(), null);
|
||||
|
||||
final LifeLine lifeLine = new LifeLine(box, comp.getPreferredWidth(stringBounder));
|
||||
drawableSet.addParticipant(p, new LivingParticipantBox(box, lifeLine));
|
||||
drawableSet.setLivingParticipantBox(p, new LivingParticipantBox(box, lifeLine));
|
||||
|
||||
this.freeX = box.getMaxX(stringBounder);
|
||||
}
|
||||
|
||||
public void addParticipant(Participant p) {
|
||||
drawableSet.addParticipant(p, null);
|
||||
public void addParticipant(Participant p, ParticipantEnglober participantEnglober) {
|
||||
drawableSet.addParticipant(p, participantEnglober);
|
||||
}
|
||||
|
||||
public void addEvent(Event event) {
|
||||
drawableSet.addEvent(event, null);
|
||||
}
|
||||
|
||||
public void addParticipantEnglober(ParticipantEnglober englober) {
|
||||
drawableSet.addParticipantEnglober(englober);
|
||||
}
|
||||
// public void addParticipantEnglober(ParticipantEnglober englober) {
|
||||
// drawableSet.addParticipantEnglober(englober);
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5872 $
|
||||
* Revision $Revision: 6113 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -103,11 +103,11 @@ public class SequenceDiagramFileMaker implements FileMaker {
|
||||
sequenceDiagram.isShowFootbox(), sequenceDiagram.getAutonewpage());
|
||||
|
||||
for (Participant p : sequenceDiagram.participants().values()) {
|
||||
initializer.addParticipant(p);
|
||||
}
|
||||
for (ParticipantEnglober englober : sequenceDiagram.getParticipantEnglobers()) {
|
||||
initializer.addParticipantEnglober(englober);
|
||||
initializer.addParticipant(p, sequenceDiagram.getEnglober(p));
|
||||
}
|
||||
// for (ParticipantEnglober englober : sequenceDiagram.getParticipantEnglobers()) {
|
||||
// initializer.addParticipantEnglober(englober);
|
||||
// }
|
||||
|
||||
for (Event ev : sequenceDiagram.events()) {
|
||||
initializer.addEvent(ev);
|
||||
|
@ -73,7 +73,7 @@ public class SequenceDiagramTxtMaker implements FileMaker {
|
||||
sequenceDiagram.isShowFootbox(), sequenceDiagram.getAutonewpage());
|
||||
|
||||
for (Participant p : sequenceDiagram.participants().values()) {
|
||||
initializer.addParticipant(p);
|
||||
initializer.addParticipant(p, null);
|
||||
}
|
||||
for (Event ev : sequenceDiagram.events()) {
|
||||
initializer.addEvent(ev);
|
||||
|
@ -89,7 +89,12 @@ abstract class Step1Abstract {
|
||||
return;
|
||||
}
|
||||
assert n.getType() == LifeEventType.ACTIVATE;
|
||||
line.addSegmentVariation(LifeSegmentVariation.LARGER, pos, n.getSpecificBackColor());
|
||||
|
||||
int delta = 0;
|
||||
if (message.isCreate()) {
|
||||
delta += 10;
|
||||
}
|
||||
line.addSegmentVariation(LifeSegmentVariation.LARGER, pos + delta, n.getSpecificBackColor());
|
||||
}
|
||||
|
||||
protected final void afterMessage(StringBounder stringBounder, LifeEvent n, final double pos) {
|
||||
@ -150,7 +155,8 @@ abstract class Step1Abstract {
|
||||
freeY += v;
|
||||
}
|
||||
|
||||
protected final NoteBox createNoteBox(StringBounder stringBounder, Arrow arrow, Component noteComp, NotePosition notePosition) {
|
||||
protected final NoteBox createNoteBox(StringBounder stringBounder, Arrow arrow, Component noteComp,
|
||||
NotePosition notePosition) {
|
||||
final LivingParticipantBox p = arrow.getParticipantAt(stringBounder, notePosition);
|
||||
final NoteBox noteBox = new NoteBox(arrow.getStartingY(), noteComp, p, null, notePosition);
|
||||
|
||||
|
@ -28,11 +28,14 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6085 $
|
||||
* Revision $Revision: 6095 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.statediagram;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.UniqueSequence;
|
||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||
@ -103,4 +106,13 @@ public class StateDiagram extends AbstractEntityDiagram {
|
||||
return UmlDiagramType.STATE;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// final protected List<String> getDotStrings() {
|
||||
// return Arrays.asList("nodesep=1.95;", "ranksep=1.8;", "edge [fontsize=11,labelfontsize=11];",
|
||||
// "node [fontsize=11,height=.35,width=.55];");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class CommandLinkUsecase2 extends SingleLineCommand2<UsecaseDiagram> {
|
||||
getGroup("ENT1"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexOr(
|
||||
new RegexLeaf("LEFT_TO_RIGHT", "(([-=.]+)(left|right|up|down|le?|ri?|up?|do?)?([-=.]*)([\\]>]|\\|[>\\]])?)"),
|
||||
new RegexLeaf("LEFT_TO_RIGHT", "(([-=.]+)(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?([-=.]*)([\\]>]|\\|[>\\]])?)"),
|
||||
new RegexLeaf("RIGHT_TO_LEFT", "(([\\[<]|[<\\[]\\|)?([-=.]*)(left|right|up|down|le?|ri?|up?|do?)?([-=.]+))")),
|
||||
new RegexLeaf("\\s*"),
|
||||
getGroup("ENT2"),
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6086 $
|
||||
* Revision $Revision: 6122 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.version;
|
||||
@ -36,11 +36,11 @@ package net.sourceforge.plantuml.version;
|
||||
public class Version {
|
||||
|
||||
public static int version() {
|
||||
return 6085;
|
||||
return 6121;
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1296252260468L;
|
||||
return 1297683757562L;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user