Skip to content

Commit

Permalink
version 1.2019.11
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudroques committed Sep 22, 2019
1 parent 90372b9 commit c4397fa
Show file tree
Hide file tree
Showing 63 changed files with 862 additions and 170 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.11-SNAPSHOT</version>
<version>1.2019.12-SNAPSHOT</version>
<packaging>jar</packaging>

<name>PlantUML</name>
Expand Down
8 changes: 8 additions & 0 deletions skin/plantuml.skin
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,41 @@ delay {

participant {
LineThickness 1.5
HorizontalAlignment center
}

actor {
LineThickness 2.0
HorizontalAlignment center
}

boundary {
LineThickness 2.0
HorizontalAlignment center
}

control {
LineThickness 2.0
HorizontalAlignment center
}

entity {
LineThickness 2.0
HorizontalAlignment center
}

queue {
LineThickness 2.0
HorizontalAlignment center
}

database {
HorizontalAlignment center
}

collections {
LineThickness 1.5
HorizontalAlignment center
}

swimlane {
Expand Down
6 changes: 6 additions & 0 deletions skin/strictuml.skin
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root {
Shadowing 0.0
}
element {
Shadowing 0.0
}
25 changes: 21 additions & 4 deletions src/net/sourceforge/plantuml/SkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import java.awt.Font;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -47,6 +48,8 @@
import java.util.Set;
import java.util.TreeSet;

import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
Expand Down Expand Up @@ -96,10 +99,10 @@ private SkinParam(UmlDiagramType type) {
if (type == UmlDiagramType.WBS) {
USE_STYLE2.set(true);
}
// if (type == UmlDiagramType.SEQUENCE) {
// // skin = "debug.skin";
// USE_STYLE2.set(true);
// }
if (type == UmlDiagramType.SEQUENCE) {
// skin = "debug.skin";
//USE_STYLE2.set(true);
}
// if (type == UmlDiagramType.ACTIVITY) {
// // skin = "debug.skin";
// USE_STYLE2.set(true);
Expand Down Expand Up @@ -182,6 +185,20 @@ public void setParam(String key, String value) {
}
}
}
if ("style".equalsIgnoreCase(key) && "strictuml".equalsIgnoreCase(value)) {
if (USE_STYLES()) {
final InputStream internalIs = StyleLoader.class.getResourceAsStream("/skin/strictuml.skin");
final StyleBuilder styleBuilder = this.getCurrentStyleBuilder();
try {
final BlocLines lines = BlocLines.load(internalIs, null);
for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) {
this.muteStyle(modifiedStyle);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

public static SkinParam create(UmlDiagramType type) {
Expand Down
4 changes: 4 additions & 0 deletions src/net/sourceforge/plantuml/SourceStringReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public SourceStringReader(Defines defines, String source, List<String> config) {
this(defines, source, "UTF-8", config);
}

public SourceStringReader(Defines defines, String source) {
this(defines, source, "UTF-8", Collections.<String> emptyList());
}

public SourceStringReader(String source, File newCurrentDir) {
this(Defines.createEmpty(), source, "UTF-8", Collections.<String> emptyList(), newCurrentDir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ static IRegex getRegexConcat() {
RegexLeaf.end());
}

@Override
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) {
lines = lines.trim(false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static IRegex getRegexConcat() {
RegexLeaf.end());
}

@Override
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ static IRegex getRegexConcat() {
RegexLeaf.end());
}

@Override
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}

@Override
public String getPatternEnd() {
return "(?i)^end[%s]?note$";
}

@Override
protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) {
// final List<? extends CharSequence> in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1));
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}

@Override
protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) {
lines = lines.trimSmart(1);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
Expand Down
11 changes: 6 additions & 5 deletions src/net/sourceforge/plantuml/command/CommandFooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ static IRegex getRegexConcat() {
@Override
protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
final String align = arg.get("POSITION", 0);
HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER;
if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.FOOTER.getStyleDefinition()
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER);
if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.FOOTER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment();
}
diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)),
HorizontalAlignment.fromString(align, defaultAlign));
diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha);


return CommandExecutionResult.ok();
}
}
9 changes: 4 additions & 5 deletions src/net/sourceforge/plantuml/command/CommandHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ static IRegex getRegexConcat() {
@Override
protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
final String align = arg.get("POSITION", 0);
HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT;
if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.HEADER.getStyleDefinition()
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT);
if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.HEADER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment();
}
diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)),
HorizontalAlignment.fromString(align, defaultAlign));
diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha);
return CommandExecutionResult.ok();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lin
lines = lines.subExtract(1, 1);
final Display strings = lines.toDisplay();
if (strings.size() > 0) {
HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER;
if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.FOOTER.getStyleDefinition()
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER);
if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.FOOTER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment();
}
diagram.getFooter().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign));
diagram.getFooter().putDisplay(strings, ha);
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Empty footer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lin
lines = lines.subExtract(1, 1);
final Display strings = lines.toDisplay();
if (strings.size() > 0) {
HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT;
if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.HEADER.getStyleDefinition()
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT);
if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.HEADER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment();
}
diagram.getHeader().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign));
diagram.getHeader().putDisplay(strings, ha);
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Empty header");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ final protected void addCommonCommands1(List<Command> cmds) {
}

final protected void addCommonCommands2(List<Command> cmds) {
cmds.add(new CommandListSprite());
// cmds.add(new CommandListSprite());
cmds.add(new CommandNope());
cmds.add(new CommandPragma());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private IRegex getRegexConcatMultiLine() {
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("POSITION", "(right|left)"), //
new RegexLeaf("POSITION", "(right|left|bottom|top)"), //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //
RegexLeaf.spaceZeroOrMore(), //
Expand All @@ -90,7 +90,7 @@ private IRegex getRegexConcatSingleLine() {
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("POSITION", "(right|left)"), //
new RegexLeaf("POSITION", "(right|left|bottom|top)"), //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //
RegexLeaf.spaceZeroOrMore(), //
Expand Down
3 changes: 2 additions & 1 deletion src/net/sourceforge/plantuml/creole/AbstractAtom.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
*/
package net.sourceforge.plantuml.creole;

import java.util.Arrays;
import java.util.List;

import net.sourceforge.plantuml.graphic.StringBounder;

public abstract class AbstractAtom implements Atom {

public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
throw new UnsupportedOperationException(getClass().toString());
return Arrays.asList((Atom) this);
}

}
4 changes: 3 additions & 1 deletion src/net/sourceforge/plantuml/creole/AtomImg.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Arrays;
import java.util.List;

import javax.imageio.ImageIO;

Expand All @@ -69,7 +71,7 @@ public class AtomImg extends AbstractAtom implements Atom {
private final BufferedImage image;
private final double scale;
private final Url url;

private AtomImg(BufferedImage image, double scale, Url url) {
this.image = image;
this.scale = scale;
Expand Down
5 changes: 0 additions & 5 deletions src/net/sourceforge/plantuml/creole/AtomSprite.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ public class AtomSprite extends AbstractAtom implements Atom {
private final Url url;
private final HtmlColor color;

@Override
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
return Arrays.asList((Atom) this);
}

public AtomSprite(HtmlColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) {
this.scale = scale;
this.sprite = sprite;
Expand Down
19 changes: 6 additions & 13 deletions src/net/sourceforge/plantuml/creole/AtomText.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ public double getDouble(StringBounder stringBounder) {
public static Atom create(String text, FontConfiguration fontConfiguration) {
return new AtomText(text, fontConfiguration, null, ZERO, ZERO);
}

// public static AtomText createHeading(String text, FontConfiguration fontConfiguration, int order) {
// fontConfiguration = FOO(fontConfiguration, order);
// return new AtomText(text, fontConfiguration, null, ZERO, ZERO);
// }


public static Atom createUrl(Url url, FontConfiguration fontConfiguration, ISkinSimple skinSimple) {
fontConfiguration = fontConfiguration.hyperlink();
Expand Down Expand Up @@ -149,19 +155,6 @@ private static Atom createAtomText(final String text, Url url, FontConfiguration
return new AtomHorizontalTexts(result);
}

public static AtomText createHeading(String text, FontConfiguration fontConfiguration, int order) {
if (order == 0) {
fontConfiguration = fontConfiguration.bigger(4).bold();
} else if (order == 1) {
fontConfiguration = fontConfiguration.bigger(2).bold();
} else if (order == 2) {
fontConfiguration = fontConfiguration.bigger(1).bold();
} else {
fontConfiguration = fontConfiguration.italic();
}
return new AtomText(text, fontConfiguration, null, ZERO, ZERO);
}

public static Atom createListNumber(final FontConfiguration fontConfiguration, final int order, int localNumber) {
final DelayedDouble left = new DelayedDouble() {
public double getDouble(StringBounder stringBounder) {
Expand Down
6 changes: 0 additions & 6 deletions src/net/sourceforge/plantuml/creole/AtomTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ public class AtomTree extends AbstractAtom implements Atom {
private final Map<Atom, Integer> levels = new HashMap<Atom, Integer>();
private final double margin = 2;

@Override
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
return Arrays.asList((Atom) this);
}


public AtomTree(HtmlColor lineColor) {
this.lineColor = lineColor;
}
Expand Down
8 changes: 0 additions & 8 deletions src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) {
final UrlBuilder urlBuilder = new UrlBuilder(skinParam.getValue("topurl"), ModeUrl.STRICT);
final Url url = urlBuilder.getUrl(m.group(1));
stripe.addUrl(url);

// final int size = Integer.parseInt(m.group(2));
// final FontConfiguration fc1 = stripe.getActualFontConfiguration();
// final FontConfiguration fc2 = fc1.changeSize(size);
// // final FontConfiguration fc2 = new AddStyle(style, null).apply(fc1);
// stripe.setActualFontConfiguration(fc2);
// stripe.analyzeAndAdd("AZERTY");
// stripe.setActualFontConfiguration(fc1);
return line.substring(m.group(1).length());
}
}
5 changes: 0 additions & 5 deletions src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ public class CreoleHorizontalLine extends AbstractAtom implements Atom {
private final char style;
private final ISkinSimple skinParam;

@Override
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
return Arrays.asList((Atom) this);
}

public static CreoleHorizontalLine create(FontConfiguration fontConfiguration, String line, char style,
ISkinSimple skinParam) {
return new CreoleHorizontalLine(fontConfiguration, line, style, skinParam);
Expand Down
Loading

0 comments on commit c4397fa

Please sign in to comment.