Skip to content

Commit

Permalink
version 1.2019.13
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudroques committed Dec 10, 2019
1 parent 36c461d commit 275cde1
Show file tree
Hide file tree
Showing 124 changed files with 1,571 additions and 1,035 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2019.13-SNAPSHOT</version>
<version>1.2019.14-SNAPSHOT</version>
<packaging>jar</packaging>

<name>PlantUML</name>
Expand Down
19 changes: 14 additions & 5 deletions src/net/sourceforge/plantuml/FileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ public File getCurrentDir() {
}

public File getFile(String nameOrPath) throws IOException {
final File dir = currentDir.get();
if (dir == null || isAbsolute(nameOrPath)) {
if (isAbsolute(nameOrPath)) {
return new File(nameOrPath).getCanonicalFile();
}
final File filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
if (filecurrent.exists()) {
return filecurrent.getCanonicalFile();
final File dir = currentDir.get();
File filecurrent = null;
if (dir != null) {
filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
if (filecurrent.exists()) {
return filecurrent.getCanonicalFile();

}
}
for (File d : getPath("plantuml.include.path", true)) {
if (d.isDirectory()) {
Expand All @@ -92,6 +96,11 @@ public File getFile(String nameOrPath) throws IOException {
}
}
}
if (dir == null) {
assert filecurrent == null;
return new File(nameOrPath).getCanonicalFile();
}
assert filecurrent != null;
return filecurrent;
}

Expand Down
6 changes: 4 additions & 2 deletions src/net/sourceforge/plantuml/ISkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.style.Style;
Expand Down Expand Up @@ -182,10 +183,11 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir
public void muteStyle(Style modifiedStyle);

public Collection<String> getAllSpriteNames();

public String getDefaultSkin();

public void setDefaultSkin(String newSkin);

public ActorStyle getActorStyle();

}
14 changes: 11 additions & 3 deletions src/net/sourceforge/plantuml/SkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.sprite.Sprite;
Expand Down Expand Up @@ -101,7 +102,7 @@ private SkinParam(UmlDiagramType type) {
}
if (type == UmlDiagramType.SEQUENCE) {
// skin = "debug.skin";
//USE_STYLE2.set(true);
// USE_STYLE2.set(true);
}
// if (type == UmlDiagramType.ACTIVITY) {
// // skin = "debug.skin";
Expand Down Expand Up @@ -1046,7 +1047,7 @@ public String getSvgLinkTarget() {
}
return value;
}

public String getPreserveAspectRatio() {
final String value = getValue("preserveaspectratio");
if (value == null) {
Expand All @@ -1055,7 +1056,6 @@ public String getPreserveAspectRatio() {
return value;
}


public String getMonospacedFamily() {
final String value = getValue("defaultMonospacedFontName");
if (value == null) {
Expand Down Expand Up @@ -1207,4 +1207,12 @@ public Padder getSequenceDiagramPadder() {
.withBorderColor(border).withRoundCorner(roundCorner);
}

public ActorStyle getActorStyle() {
final String value = getValue("actorstyle");
if ("awesome".equalsIgnoreCase(value)) {
return ActorStyle.AWESOME;
}
return ActorStyle.STICKMAN;
}

}
6 changes: 5 additions & 1 deletion src/net/sourceforge/plantuml/SkinParamDelegator.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.sprite.Sprite;
Expand Down Expand Up @@ -234,7 +235,7 @@ public boolean handwritten() {
public String getSvgLinkTarget() {
return skinParam.getSvgLinkTarget();
}

public String getPreserveAspectRatio() {
return skinParam.getPreserveAspectRatio();
}
Expand Down Expand Up @@ -359,5 +360,8 @@ public void setDefaultSkin(String newFileName) {
skinParam.setDefaultSkin(newFileName);
}

public ActorStyle getActorStyle() {
return skinParam.getActorStyle();
}

}
2 changes: 1 addition & 1 deletion src/net/sourceforge/plantuml/SourceStringReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public String getCMapData(int numImage, FileFormatOption fileFormatOption) throw
}

private void noStartumlFound(OutputStream os, FileFormatOption fileFormatOption, long seed) throws IOException {
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml found"),
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"),
fileFormatOption.isUseRedForError());
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, error.getBackcolor(), null,
null, 0, 0, null, false);
Expand Down
3 changes: 3 additions & 0 deletions src/net/sourceforge/plantuml/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ public static Direction getQueueDirection(String s) {
// }

public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s, String format) {
if (s == null) {
return null;
}
if (format.contains("\"") && s.length() > 1 && isDoubleQuote(s.charAt(0))
&& isDoubleQuote(s.charAt(s.length() - 1))) {
return s.substring(1, s.length() - 1);
Expand Down
56 changes: 31 additions & 25 deletions src/net/sourceforge/plantuml/UrlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,6 @@ public UrlBuilder(String topurl, ModeUrl mode) {
this.mode = mode;
}

// private static String multilineTooltip(String label) {
// final Pattern2 p = MyPattern.cmpile("(?i)^(" + URL_PATTERN + ")?(.*)$");
// final Matcher2 m = p.matcher(label);
// if (m.matches() == false) {
// return label;
// }
// String gr1 = m.group(1);
// if (gr1 == null) {
// return label;
// }
// final String gr2 = m.group(m.groupCount());
// gr1 = gr1.replaceAll("\\\\n", BackSlash.BS_N);
// return gr1 + gr2;
// }

public Url getUrl(String s) {
final Pattern2 p;
if (mode == ModeUrl.STRICT) {
Expand All @@ -100,18 +85,18 @@ public Url getUrl(String s) {
if (m.matches() == false) {
return null;
}
// String url = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m.group(1));
// if (url.startsWith("http:") == false && url.startsWith("https:") == false) {
// // final String top = getSystem().getSkinParam().getValue("topurl");
// if (topurl != null) {
// url = topurl + url;
// }
// }

final String quotedPart = m.group(1);
final String full = m.group(2);
final int openBracket = full.indexOf('{');
final int closeBracket = full.lastIndexOf('}');
final String fullpp = m.group(2).replaceAll("\\{scale=([0-9.]+)\\}", "\uE000scale=$1\uE001");

final int openBracket = openBracketBeforeSpace(fullpp);
final int closeBracket;
if (openBracket == -1) {
closeBracket = -1;
} else {
closeBracket = fullpp.lastIndexOf('}');
}
final String full = fullpp.replace('\uE000', '{').replace('\uE001', '}');
if (quotedPart == null) {
if (openBracket != -1 && closeBracket != -1) {
return new Url(withTopUrl(full.substring(0, openBracket)),
Expand All @@ -130,6 +115,27 @@ public Url getUrl(String s) {
return new Url(withTopUrl(quotedPart), null, null);
}

// private int openBracketBeforeSpace(final String full) {
// return full.indexOf('{');
// }

private int openBracketBeforeSpace(final String full) {
// final int firstSpace = full.indexOf(' ');
final int result = full.indexOf('{');
// if (result != -1 && full.substring(result).startsWith("{scale")) {
// return -1;
// }
// if (firstSpace == -1 || result == -1) {
// return result;
// }
// assert firstSpace >= 0;
// assert result >= 0;
// if (result > firstSpace + 1) {
// return -1;
// }
return result;
}

private String withTopUrl(String url) {
if (url.startsWith("http:") == false && url.startsWith("https:") == false && topurl != null) {
return topurl + url;
Expand Down
54 changes: 35 additions & 19 deletions src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.USymbol;
Expand All @@ -61,34 +62,40 @@ public class ActivityDiagram extends CucaDiagram {

public ActivityDiagram(ISkinSimple skinParam) {
super(skinParam);
setNamespaceSeparator(null);
}

public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
return getOrCreateLeafDefault(code, type, symbol);
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
checkNotNull(ident);
// final Ident idNewLong = buildLeafIdent(id);
return getOrCreateLeafDefault(ident, code, type, symbol);
}

private String getAutoBranch() {
return "#" + UniqueSequence.getValue();
}

public IEntity getOrCreate(Code code, Display display, LeafType type) {
public IEntity getOrCreate(Ident idNewLong, Code code, Display display, LeafType type) {
final IEntity result;
// final Ident idNewLong = buildLeafIdent(id);
if (leafExist(code)) {
result = getOrCreateLeafDefault(code, type, null);
result = getOrCreateLeafDefault(idNewLong, code, type, null);
if (result.getLeafType() != type) {
// throw new IllegalArgumentException("Already known: " + code + " " + result.getType() + " " + type);
return null;
}
} else {
result = createLeaf(code, display, type, null);
result = createLeaf(idNewLong, code, display, type, null);
}
updateLasts(result);
return result;
}

public void startIf(Code optionalCode) {
final IEntity br = createLeaf(optionalCode == null ? Code.of(getAutoBranch()) : optionalCode,
Display.create(""), LeafType.BRANCH, null);
public void startIf(String optionalCodeString) {
final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString;
final Ident idNewLong = buildLeafIdent(idShort);
final IEntity br = createLeaf(idNewLong, buildCode(idShort), Display.create(""),
LeafType.BRANCH, null);
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
}

Expand All @@ -97,12 +104,14 @@ public void endif() {
}

public ILeaf getStart() {
return (ILeaf) getOrCreate(Code.of("start"), Display.getWithNewlines("start"), LeafType.CIRCLE_START);
return (ILeaf) getOrCreate(buildLeafIdent("start"), buildCode("start"),
Display.getWithNewlines("start"), LeafType.CIRCLE_START);
}

public ILeaf getEnd(String suppId) {
final Code code = suppId == null ? Code.of("end") : Code.of("end$" + suppId);
return (ILeaf) getOrCreate(code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
final String tmp = suppId == null ? "end" : "end$" + suppId;
final Code code = buildCode(tmp);
return (ILeaf) getOrCreate(buildLeafIdent(tmp), code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
}

private void updateLasts(final IEntity result) {
Expand All @@ -116,14 +125,17 @@ private void updateLasts(final IEntity result) {
}

@Override
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
final ILeaf result = super.createLeaf(code, display, type, symbol);
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
checkNotNull(idNewLong);
final ILeaf result = super.createLeaf(idNewLong, code, display, type, symbol);
updateLasts(result);
return result;
}

public IEntity createNote(Code code, Display display) {
return super.createLeaf(code, display, LeafType.NOTE, null);
public IEntity createNote(Ident idNewLong, Code code, Display display) {
checkNotNull(idNewLong);
// final Ident idNewLong = buildLeafIdent(id);
return super.createLeaf(idNewLong, code, display, LeafType.NOTE, null);
}

final protected List<String> getDotStrings() {
Expand Down Expand Up @@ -159,8 +171,10 @@ public final void setLastEntityConsulted(IEntity lastEntityConsulted) {

public IEntity createInnerActivity() {
// Log.println("createInnerActivity A");
final Code code = Code.of("##" + UniqueSequence.getValue());
gotoGroup2(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
final String idShort = "##" + UniqueSequence.getValue();
final Code code = buildCode(idShort);
final Ident idNewLong = buildLeafIdent(idShort);
gotoGroup(idNewLong, code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
NamespaceStrategy.SINGLE);
final IEntity g = getCurrentGroup();
// g.setRankdir(Rankdir.LEFT_TO_RIGHT);
Expand All @@ -177,12 +191,14 @@ public void concurrentActivity(String name) {
endGroup();
// Log.println("endgroup");
}
final String idShort = "##" + UniqueSequence.getValue();
// Log.println("concurrentActivity A name=" + name+" "+getCurrentGroup());
final Code code = Code.of("##" + UniqueSequence.getValue());
final Code code = buildCode(idShort);
if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) {
throw new IllegalStateException("type=" + getCurrentGroup().getGroupType());
}
gotoGroup2(code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(),
final Ident idNewLong = buildLeafIdent(idShort);
gotoGroup(idNewLong, code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(),
NamespaceStrategy.SINGLE);
lastEntityConsulted = null;
lastEntityBrancheConsulted = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Link;
Expand Down Expand Up @@ -107,7 +106,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocatio
ifCode = null;
ifLabel = arg.get("IF2", 0);
}
diagram.startIf(Code.of(ifCode));
diagram.startIf(ifCode);

int lenght = 2;

Expand Down
Loading

0 comments on commit 275cde1

Please sign in to comment.