Skip to content

Commit

Permalink
version 1.2019.6
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudroques committed May 24, 2019
1 parent 511dbb8 commit 99041c5
Show file tree
Hide file tree
Showing 180 changed files with 3,244 additions and 1,534 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.6-SNAPSHOT</version>
<version>1.2019.7-SNAPSHOT</version>
<packaging>jar</packaging>

<name>PlantUML</name>
Expand Down
2 changes: 1 addition & 1 deletion src/net/sourceforge/plantuml/AnnotatedWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public TextBlock addFrame(final TextBlock original) {
final double width = x1 + Math.max(dimOriginal.getWidth(), dimTitle.getWidth()) + x2;
final double height = dimTitle.getHeight() + y1 + dimOriginal.getHeight() + y2;
final TextBlock result = USymbol.FRAME.asBig(title, HorizontalAlignment.LEFT, TextBlockUtils.empty(0, 0),
width, height, symbolContext);
width, height, symbolContext, skinParam.getStereotypeAlignment());

return new TextBlockBackcolored() {

Expand Down
18 changes: 16 additions & 2 deletions src/net/sourceforge/plantuml/BlockUml.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemErrorPreprocessor;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc2.PreprocessorMode;
import net.sourceforge.plantuml.preproc2.PreprocessorModeSet;
Expand All @@ -57,6 +58,7 @@
public class BlockUml {

private final List<StringLocated> data;
private List<StringLocated> debug;
private Diagram system;
private final Defines localDefines;
private final ISkinSimple skinParam;
Expand Down Expand Up @@ -96,6 +98,9 @@ public static List<StringLocated> convert(List<String> strings) {
return result;
}

private PreprocessorMode pmode = PreprocessorMode.V1_LEGACY;
private boolean preprocessorError;

public BlockUml(List<StringLocated> strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) {
this.localDefines = defines;
this.skinParam = skinParam;
Expand All @@ -104,7 +109,12 @@ public BlockUml(List<StringLocated> strings, Defines defines, ISkinSimple skinPa
throw new IllegalArgumentException();
}
if (mode != null && mode.getPreprocessorMode() == PreprocessorMode.V2_NEW_TIM) {
this.data = new TimLoader(mode.getImportedFiles(), defines).load(strings);
this.pmode = mode.getPreprocessorMode();
final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset());
timLoader.load(strings);
this.data = timLoader.getResult();
this.debug = timLoader.getDebug();
this.preprocessorError = timLoader.isPreprocessorError();
} else {
this.data = new ArrayList<StringLocated>(strings);
}
Expand Down Expand Up @@ -139,7 +149,11 @@ public String getFileOrDirname() {

public Diagram getDiagram() {
if (system == null) {
system = new PSystemBuilder().createPSystem(skinParam, data);
if (preprocessorError) {
system = new PSystemErrorPreprocessor(data, debug);
} else {
system = new PSystemBuilder().createPSystem(skinParam, data);
}
}
return system;
}
Expand Down
8 changes: 7 additions & 1 deletion src/net/sourceforge/plantuml/BlockUmlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,20 @@

public final class BlockUmlBuilder implements DefinitionsContainer {

private PreprocessorMode mode = PreprocessorMode.V1_LEGACY;
private PreprocessorMode mode = PreprocessorMode.V2_NEW_TIM;

private final List<BlockUml> blocks = new ArrayList<BlockUml>();
private Set<FileWithSuffix> usedFiles = new HashSet<FileWithSuffix>();
private final UncommentReadLine reader2;
private final Defines defines;
private final ImportedFiles importedFiles;
private final String charset;

public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader reader, File newCurrentDir,
String desc) throws IOException {
ReadLineNumbered includer = null;
this.defines = defines;
this.charset = charset;
try {
this.reader2 = new UncommentReadLine(new PreprocessorChangeModeReader(ReadLineReader.create(reader, desc),
this));
Expand Down Expand Up @@ -159,4 +161,8 @@ public final ImportedFiles getImportedFiles() {
return importedFiles;
}

public final String getCharset() {
return charset;
}

}
2 changes: 2 additions & 0 deletions src/net/sourceforge/plantuml/ColorParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ public enum ColorParam {
nodeBorder(HtmlColorUtils.BLACK, ColorType.LINE),
rectangleBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
rectangleBorder(HtmlColorUtils.BLACK, ColorType.LINE),
archimateBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
archimateBorder(HtmlColorUtils.BLACK, ColorType.LINE),
cardBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
cardBorder(HtmlColorUtils.BLACK, ColorType.LINE),
agentBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
Expand Down
2 changes: 1 addition & 1 deletion src/net/sourceforge/plantuml/CornerParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
package net.sourceforge.plantuml;

public enum CornerParam {
DEFAULT, diagramBorder, titleBorder, rectangle, component, card, agent;
DEFAULT, diagramBorder, titleBorder, rectangle, archimate, component, card, agent;

public String getRoundKey() {
if (this == DEFAULT) {
Expand Down
19 changes: 2 additions & 17 deletions src/net/sourceforge/plantuml/ErrorUml.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@
*/
package net.sourceforge.plantuml;

import net.sourceforge.plantuml.suggest.SuggestEngineResult;
import net.sourceforge.plantuml.suggest.SuggestEngineStatus;

public class ErrorUml {

private final String error;
private final ErrorUmlType type;
private SuggestEngineResult suggest;
private final LineLocation lineLocation;

public ErrorUml(ErrorUmlType type, String error, LineLocation lineLocation) {
Expand All @@ -62,12 +59,12 @@ public boolean equals(Object obj) {

@Override
public int hashCode() {
return error.hashCode() + type.hashCode() + getPosition() + (suggest == null ? 0 : suggest.hashCode());
return error.hashCode() + type.hashCode() + getPosition();
}

@Override
public String toString() {
return type.toString() + " " + getPosition() + " " + error + " " + suggest;
return type.toString() + " " + getPosition() + " " + error;
}

public final String getError() {
Expand All @@ -86,16 +83,4 @@ public final LineLocation getLineLocation() {
return lineLocation;
}

public final SuggestEngineResult getSuggest() {
return suggest;
}

public final boolean hasSuggest() {
return suggest != null && suggest.getStatus() == SuggestEngineStatus.ONE_SUGGESTION;
}

public void setSuggest(SuggestEngineResult suggest) {
this.suggest = suggest;
}

}
2 changes: 2 additions & 0 deletions src/net/sourceforge/plantuml/FontParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public enum FontParam {
ENTITY(14, Font.PLAIN), //
AGENT(14, Font.PLAIN), //
RECTANGLE(14, Font.PLAIN), //
ARCHIMATE(14, Font.PLAIN), //
CARD(14, Font.PLAIN), //
NODE(14, Font.PLAIN), //
DATABASE(14, Font.PLAIN), //
Expand Down Expand Up @@ -110,6 +111,7 @@ public enum FontParam {
ENTITY_STEREOTYPE(14, Font.ITALIC), //
AGENT_STEREOTYPE(14, Font.ITALIC), //
RECTANGLE_STEREOTYPE(14, Font.ITALIC), //
ARCHIMATE_STEREOTYPE(14, Font.ITALIC), //
CARD_STEREOTYPE(14, Font.ITALIC), //
NODE_STEREOTYPE(14, Font.ITALIC), //
FOLDER_STEREOTYPE(14, Font.ITALIC), //
Expand Down
3 changes: 2 additions & 1 deletion src/net/sourceforge/plantuml/GeneratedImageImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.io.File;

import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemError;

public class GeneratedImageImpl implements GeneratedImage {

Expand Down Expand Up @@ -68,7 +69,7 @@ public String getDescription() {
public int lineErrorRaw() {
final Diagram system = blockUml.getDiagram();
if (system instanceof PSystemError) {
return ((PSystemError) system).getHigherErrorPosition2().getPosition();
return ((PSystemError) system).getLineLocation().getPosition();
}
return -1;
}
Expand Down
2 changes: 2 additions & 0 deletions src/net/sourceforge/plantuml/ISkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir

public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue);

public HorizontalAlignment getStereotypeAlignment();

public int getCircledCharacterRadius();

public char getCircledCharacter(Stereotype stereotype);
Expand Down
1 change: 1 addition & 0 deletions src/net/sourceforge/plantuml/LineParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public enum LineParam {
titleBorder,
diagramBorder,
rectangleBorder,
archimateBorder,
componentBorder,
cardBorder,
agentBorder,
Expand Down
10 changes: 6 additions & 4 deletions src/net/sourceforge/plantuml/PSystemBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
import net.sourceforge.plantuml.eggs.PSystemEggFactory;
import net.sourceforge.plantuml.eggs.PSystemRIPFactory;
import net.sourceforge.plantuml.eggs.PSystemWelcomeFactory;
import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.error.PSystemErrorUtils;
import net.sourceforge.plantuml.flowdiagram.FlowDiagramFactory;
import net.sourceforge.plantuml.font.PSystemListFontsFactory;
import net.sourceforge.plantuml.help.HelpFactory;
Expand Down Expand Up @@ -100,15 +102,15 @@ final public Diagram createPSystem(ISkinSimple skinParam, final List<StringLocat
final DiagramType type = DiagramType.getTypeFromArobaseStart(strings2.get(0).getString());
final UmlSource umlSource = new UmlSource(strings2, type == DiagramType.UML);

// int cpt = 0;
for (StringLocated s : strings2) {
if (s.getPreprocessorError() != null) {
// Dead code : should not append
Log.error("Preprocessor Error: " + s.getPreprocessorError());
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, s.getPreprocessorError(), /* cpt */
s.getLocation());
return new PSystemError(umlSource, err, Collections.<String> emptyList());
// return PSystemErrorUtils.buildV1(umlSource, err, Collections.<String> emptyList());
return PSystemErrorUtils.buildV2(umlSource, err, Collections.<String> emptyList(), strings2);
}
// cpt++;
}

final DiagramType diagramType = umlSource.getDiagramType();
Expand All @@ -126,7 +128,7 @@ final public Diagram createPSystem(ISkinSimple skinParam, final List<StringLocat
errors.add((PSystemError) sys);
}

final PSystemError err = PSystemError.merge(errors);
final PSystemError err = PSystemErrorUtils.merge(errors);
result = err;
return err;
} finally {
Expand Down
1 change: 1 addition & 0 deletions src/net/sourceforge/plantuml/Pipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.preproc.Defines;

public class Pipe {
Expand Down
9 changes: 9 additions & 0 deletions src/net/sourceforge/plantuml/SkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,15 @@ public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultVa
return result;
}

public HorizontalAlignment getStereotypeAlignment() {
final String value = getValue("stereotypealignment");
final HorizontalAlignment result = HorizontalAlignment.fromString(value);
if (result == null) {
return HorizontalAlignment.CENTER;
}
return result;
}

private String getArg(String value, int i) {
if (value == null) {
return null;
Expand Down
5 changes: 5 additions & 0 deletions src/net/sourceforge/plantuml/SkinParamDelegator.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,5 +317,10 @@ public void copyAllFrom(ISkinSimple other) {
public Map<String, String> values() {
return skinParam.values();
}

public HorizontalAlignment getStereotypeAlignment() {
return skinParam.getStereotypeAlignment();
}


}
1 change: 1 addition & 0 deletions src/net/sourceforge/plantuml/SourceFileReaderAbstract.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import java.util.Set;

import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.preproc.FileWithSuffix;

public abstract class SourceFileReaderAbstract {
Expand Down
3 changes: 2 additions & 1 deletion src/net/sourceforge/plantuml/StdrptPipe0.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@
import java.io.PrintStream;

import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemError;

public class StdrptPipe0 implements Stdrpt {

public void printInfo(final PrintStream output, final Diagram sys) {
if (sys instanceof PSystemError) {
final PSystemError err = (PSystemError) sys;
output.println("ERROR");
output.println(err.getHigherErrorPosition2().getPosition());
output.println(err.getLineLocation().getPosition());
for (ErrorUml er : err.getErrorsUml()) {
output.println(er.getError());
}
Expand Down
3 changes: 2 additions & 1 deletion src/net/sourceforge/plantuml/StdrptV1.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.eggs.PSystemWelcome;
import net.sourceforge.plantuml.error.PSystemError;

public class StdrptV1 implements Stdrpt {

Expand All @@ -58,7 +59,7 @@ private void out(final PrintStream output, final PSystemError err) {
output.println("status=NO_DATA");
} else {
output.println("status=ERROR");
output.println("lineNumber=" + err.getHigherErrorPosition2().getPosition());
output.println("lineNumber=" + err.getLineLocation().getPosition());
for (ErrorUml er : err.getErrorsUml()) {
output.println("label=" + er.getError());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public CommandExecutionResult endFork(ForkStyle forkStyle, String label) {
}

public void split() {
final InstructionSplit instructionSplit = new InstructionSplit(current(), nextLinkRenderer());
final InstructionSplit instructionSplit = new InstructionSplit(current(), nextLinkRenderer(), swinlanes.getCurrentSwimlane());
setNextLinkRendererInternal(LinkRendering.none());
current().add(instructionSplit);
setCurrent(instructionSplit);
Expand All @@ -279,7 +279,7 @@ public CommandExecutionResult splitAgain() {

public CommandExecutionResult endSplit() {
if (current() instanceof InstructionSplit) {
((InstructionSplit) current()).endSplit(nextLinkRenderer());
((InstructionSplit) current()).endSplit(nextLinkRenderer(), swinlanes.getCurrentSwimlane());
setNextLinkRendererInternal(LinkRendering.none());
setCurrent(((InstructionSplit) current()).getParent());
return CommandExecutionResult.ok();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,6 @@ public Set<Swimlane> getSwimlanes() {

public Swimlane getSwimlaneIn() {
return defaultSwimlane;
// final Set<Swimlane> swimlanes = getSwimlanes();
// if (swimlanes.size() == 0) {
// return null;
// }
// if (swimlanes.size() == 1) {
// return swimlanes.iterator().next();
// }
// System.err.println("foo1="+getClass());
// return all.get(0).getSwimlaneIn();
}

public Swimlane getSwimlaneOut() {
Expand Down
Loading

0 comments on commit 99041c5

Please sign in to comment.