mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 1.2019.6
This commit is contained in:
parent
511dbb8096
commit
99041c5ccb
2
pom.xml
2
pom.xml
@ -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>
|
||||
|
@ -99,7 +99,7 @@ public class AnnotatedWorker {
|
||||
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() {
|
||||
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.code.Transcoder;
|
||||
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;
|
||||
@ -57,6 +58,7 @@ import net.sourceforge.plantuml.version.Version;
|
||||
public class BlockUml {
|
||||
|
||||
private final List<StringLocated> data;
|
||||
private List<StringLocated> debug;
|
||||
private Diagram system;
|
||||
private final Defines localDefines;
|
||||
private final ISkinSimple skinParam;
|
||||
@ -96,6 +98,9 @@ public class BlockUml {
|
||||
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;
|
||||
@ -104,7 +109,12 @@ public class BlockUml {
|
||||
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);
|
||||
}
|
||||
@ -139,7 +149,11 @@ public class BlockUml {
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -57,18 +57,20 @@ import net.sourceforge.plantuml.utils.StartUtils;
|
||||
|
||||
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));
|
||||
@ -159,4 +161,8 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
|
||||
return importedFiles;
|
||||
}
|
||||
|
||||
public final String getCharset() {
|
||||
return charset;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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),
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
@ -62,12 +59,12 @@ public class ErrorUml {
|
||||
|
||||
@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() {
|
||||
@ -86,16 +83,4 @@ public class ErrorUml {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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), //
|
||||
@ -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), //
|
||||
|
@ -38,6 +38,7 @@ package net.sourceforge.plantuml;
|
||||
import java.io.File;
|
||||
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.error.PSystemError;
|
||||
|
||||
public class GeneratedImageImpl implements GeneratedImage {
|
||||
|
||||
@ -68,7 +69,7 @@ public class GeneratedImageImpl implements GeneratedImage {
|
||||
public int lineErrorRaw() {
|
||||
final Diagram system = blockUml.getDiagram();
|
||||
if (system instanceof PSystemError) {
|
||||
return ((PSystemError) system).getHigherErrorPosition2().getPosition();
|
||||
return ((PSystemError) system).getLineLocation().getPosition();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ public interface ISkinParam extends ISkinSimple {
|
||||
|
||||
public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue);
|
||||
|
||||
public HorizontalAlignment getStereotypeAlignment();
|
||||
|
||||
public int getCircledCharacterRadius();
|
||||
|
||||
public char getCircledCharacter(Stereotype stereotype);
|
||||
|
@ -55,6 +55,7 @@ public enum LineParam {
|
||||
titleBorder,
|
||||
diagramBorder,
|
||||
rectangleBorder,
|
||||
archimateBorder,
|
||||
componentBorder,
|
||||
cardBorder,
|
||||
agentBorder,
|
||||
|
@ -63,6 +63,8 @@ import net.sourceforge.plantuml.eggs.PSystemColorsFactory;
|
||||
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;
|
||||
@ -100,15 +102,15 @@ public class PSystemBuilder {
|
||||
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();
|
||||
@ -126,7 +128,7 @@ public class PSystemBuilder {
|
||||
errors.add((PSystemError) sys);
|
||||
}
|
||||
|
||||
final PSystemError err = PSystemError.merge(errors);
|
||||
final PSystemError err = PSystemErrorUtils.merge(errors);
|
||||
result = err;
|
||||
return err;
|
||||
} finally {
|
||||
|
@ -44,6 +44,7 @@ import java.util.List;
|
||||
|
||||
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 {
|
||||
|
@ -550,6 +550,15 @@ public class SkinParam implements ISkinParam {
|
||||
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;
|
||||
|
@ -318,4 +318,9 @@ public class SkinParamDelegator implements ISkinParam {
|
||||
return skinParam.values();
|
||||
}
|
||||
|
||||
public HorizontalAlignment getStereotypeAlignment() {
|
||||
return skinParam.getStereotypeAlignment();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ import java.util.List;
|
||||
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 {
|
||||
|
@ -38,6 +38,7 @@ package net.sourceforge.plantuml;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.error.PSystemError;
|
||||
|
||||
public class StdrptPipe0 implements Stdrpt {
|
||||
|
||||
@ -45,7 +46,7 @@ public class StdrptPipe0 implements Stdrpt {
|
||||
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());
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import java.io.PrintStream;
|
||||
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 {
|
||||
|
||||
@ -58,7 +59,7 @@ public class StdrptV1 implements Stdrpt {
|
||||
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());
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
}
|
||||
|
||||
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);
|
||||
@ -279,7 +279,7 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
|
||||
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();
|
||||
|
@ -155,15 +155,6 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
|
||||
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() {
|
||||
|
@ -52,10 +52,14 @@ public class InstructionSplit implements Instruction {
|
||||
private final List<InstructionList> splits = new ArrayList<InstructionList>();
|
||||
private final Instruction parent;
|
||||
private final LinkRendering inlinkRendering;
|
||||
private final Swimlane swimlaneIn;
|
||||
private Swimlane swimlaneOut;
|
||||
|
||||
public InstructionSplit(Instruction parent, LinkRendering inlinkRendering) {
|
||||
public InstructionSplit(Instruction parent, LinkRendering inlinkRendering, Swimlane swimlane) {
|
||||
this.parent = parent;
|
||||
this.splits.add(new InstructionList());
|
||||
this.swimlaneIn = swimlane;
|
||||
|
||||
this.splits.add(new InstructionList(swimlane));
|
||||
this.inlinkRendering = inlinkRendering;
|
||||
if (inlinkRendering == null) {
|
||||
throw new IllegalArgumentException();
|
||||
@ -71,7 +75,6 @@ public class InstructionSplit implements Instruction {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private InstructionList getLast() {
|
||||
return splits.get(splits.size() - 1);
|
||||
}
|
||||
@ -96,14 +99,15 @@ public class InstructionSplit implements Instruction {
|
||||
if (inlinkRendering != null) {
|
||||
getLast().setOutRendering(inlinkRendering);
|
||||
}
|
||||
final InstructionList list = new InstructionList();
|
||||
final InstructionList list = new InstructionList(swimlaneIn);
|
||||
this.splits.add(list);
|
||||
}
|
||||
|
||||
public void endSplit(LinkRendering inlinkRendering) {
|
||||
public void endSplit(LinkRendering inlinkRendering, Swimlane endSwimlane) {
|
||||
if (inlinkRendering != null) {
|
||||
getLast().setOutRendering(inlinkRendering);
|
||||
}
|
||||
this.swimlaneOut = endSwimlane;
|
||||
|
||||
}
|
||||
|
||||
@ -128,7 +132,8 @@ public class InstructionSplit implements Instruction {
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return getLast().getSwimlaneOut();
|
||||
return swimlaneOut;
|
||||
// return getLast().getSwimlaneOut();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,8 +43,6 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
|
||||
public class CommandCase extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
|
@ -48,6 +48,44 @@ public class FtileGeometry extends Dimension2D {
|
||||
private final double inY;
|
||||
private final double outY;
|
||||
|
||||
public Point2D getPointA() {
|
||||
return new Point2D.Double(left, inY);
|
||||
}
|
||||
|
||||
public Point2D getPointIn() {
|
||||
return new Point2D.Double(left, inY);
|
||||
}
|
||||
|
||||
public Point2D getPointB() {
|
||||
if (outY == Double.MIN_NORMAL) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return new Point2D.Double(width, (inY + outY) / 2);
|
||||
}
|
||||
|
||||
public Point2D getPointC() {
|
||||
if (outY == Double.MIN_NORMAL) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return new Point2D.Double(left, outY);
|
||||
}
|
||||
|
||||
public Point2D getPointD() {
|
||||
if (outY == Double.MIN_NORMAL) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return new Point2D.Double(0, (inY + outY) / 2);
|
||||
}
|
||||
|
||||
public Point2D getPointOut() {
|
||||
if (outY == Double.MIN_NORMAL) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return new Point2D.Double(left, outY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public FtileGeometry(Dimension2D dim, double left, double inY) {
|
||||
this(dim.getWidth(), dim.getHeight(), left, inY);
|
||||
}
|
||||
@ -86,17 +124,6 @@ public class FtileGeometry extends Dimension2D {
|
||||
return outY != Double.MIN_NORMAL;
|
||||
}
|
||||
|
||||
public Point2D getPointIn() {
|
||||
return new Point2D.Double(left, inY);
|
||||
}
|
||||
|
||||
public Point2D getPointOut() {
|
||||
if (outY == Double.MIN_NORMAL) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return new Point2D.Double(left, outY);
|
||||
}
|
||||
|
||||
public FtileGeometry withoutPointOut() {
|
||||
return new FtileGeometry(width, height, left, inY);
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ public class Snake implements UShape {
|
||||
this.worm.setIgnoreForCompression(ignoreForCompression);
|
||||
}
|
||||
|
||||
|
||||
public Snake transformX(CompressionTransform compressionTransform) {
|
||||
final Snake result = new Snake(startDecoration, horizontalAlignment, color, endDecoration);
|
||||
result.textBlock = this.textBlock;
|
||||
@ -206,14 +205,19 @@ public class Snake implements UShape {
|
||||
final Dimension2D dim = textBlock.calculateDimension(stringBounder);
|
||||
double x = Math.max(pt1.getX(), pt2.getX()) + 4;
|
||||
final boolean zigzag = worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD");
|
||||
double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
|
||||
if (horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
|
||||
final Point2D pt3 = worm.get(2);
|
||||
x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2;
|
||||
} else if (horizontalAlignment == HorizontalAlignment.RIGHT && zigzag) {
|
||||
// final Point2D pt3 = worm.get(2);
|
||||
x = Math.max(pt1.getX(), pt2.getX()) - dim.getWidth() - 4;
|
||||
} else if (worm.getDirectionsCode().equals("RD")) {
|
||||
x = Math.max(pt1.getX(), pt2.getX());
|
||||
y = (pt1.getY() + worm.get(2).getY()) / 2 - dim.getHeight() / 2;
|
||||
} else if (worm.getDirectionsCode().equals("LD")) {
|
||||
x = Math.min(pt1.getX(), pt2.getX());
|
||||
y = (pt1.getY() + worm.get(2).getY()) / 2 - dim.getHeight() / 2;
|
||||
}
|
||||
final double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
|
||||
return new Point2D.Double(x, y);
|
||||
}
|
||||
|
||||
|
@ -206,6 +206,12 @@ public class Worm implements Iterable<Point2D.Double> {
|
||||
}
|
||||
|
||||
public void addPoint(double x, double y) {
|
||||
if (points.size() > 0) {
|
||||
final Point2D last = getLast();
|
||||
if (last.getX() == x && last.getY() == y) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.points.add(new Point2D.Double(x, y));
|
||||
}
|
||||
|
||||
|
@ -40,10 +40,8 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
|
||||
@ -51,20 +49,17 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchNude;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithDiamonds;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
|
||||
public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
||||
|
||||
@ -93,7 +88,8 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
||||
// fcArrow, topInlinkRendering, afterEndwhile, fcTest);
|
||||
|
||||
// return createNude(swimlane, branches);
|
||||
return createWithDiamonds(swimlane, branches, labelTest);
|
||||
// return createWithDiamonds(swimlane, branches, labelTest);
|
||||
return createWithLinks(swimlane, branches, labelTest);
|
||||
}
|
||||
|
||||
private Ftile createNude(Swimlane swimlane, List<Branch> branches) {
|
||||
@ -111,7 +107,27 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
||||
}
|
||||
final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
|
||||
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
|
||||
return new FtileSwitchWithDiamonds(ftiles, swimlane, diamond1, diamond2, getStringBounder());
|
||||
|
||||
return new FtileSwitchWithDiamonds(ftiles, branches, swimlane, diamond1, diamond2, getStringBounder());
|
||||
}
|
||||
|
||||
private Ftile createWithLinks(Swimlane swimlane, List<Branch> branches, Display labelTest) {
|
||||
final List<Ftile> ftiles = new ArrayList<Ftile>();
|
||||
for (Branch branch : branches) {
|
||||
ftiles.add(new FtileMinWidth(branch.getFtile(), 30));
|
||||
}
|
||||
final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
|
||||
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
|
||||
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam());
|
||||
if (ftiles.size() == 1) {
|
||||
final FtileSwitchWithOneLink result = new FtileSwitchWithOneLink(ftiles, branches, swimlane, diamond1,
|
||||
diamond2, getStringBounder(), arrowColor);
|
||||
return result.addLinks();
|
||||
}
|
||||
final FtileSwitchWithManyLinks result = new FtileSwitchWithManyLinks(ftiles, branches, swimlane, diamond1,
|
||||
diamond2, getStringBounder(), arrowColor);
|
||||
return result.addLinks();
|
||||
|
||||
}
|
||||
|
||||
private Ftile getDiamond1(Swimlane swimlane, Branch branch0, Display test) {
|
||||
|
@ -209,7 +209,7 @@ public class FtileGroup extends AbstractFtile {
|
||||
.withShadow(skinParam().shadowing(null)).withStroke(stroke).withCorner(roundCorner, 0);
|
||||
|
||||
type.asBig(name, inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false),
|
||||
TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext).drawU(ug);
|
||||
TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext, skinParam().getStereotypeAlignment()).drawU(ug);
|
||||
|
||||
final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder);
|
||||
headerNote.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimHeaderNote.getWidth() - 10,
|
||||
|
@ -593,13 +593,22 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
for (Ftile couple : couples) {
|
||||
result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder));
|
||||
}
|
||||
final FtileGeometry dimTile2 = tile2.calculateDimension(stringBounder);
|
||||
Dimension2D dimTile2 = tile2.calculateDimension(stringBounder);
|
||||
dimTile2 = Dimension2DDouble.delta(dimTile2, 0, getDiamondsHeight(stringBounder) / 2);
|
||||
result = Dimension2DDouble.mergeLR(result, dimTile2);
|
||||
result = Dimension2DDouble.delta(result, xSeparation * couples.size(), 100);
|
||||
|
||||
return new FtileGeometry(result, result.getWidth() / 2, 0);
|
||||
}
|
||||
|
||||
private double getDiamondsHeight(StringBounder stringBounder) {
|
||||
double height = 0;
|
||||
for (Ftile diamond : diamonds) {
|
||||
height = Math.max(height, diamond.calculateDimension(stringBounder).getHeight());
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
|
@ -70,6 +70,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||
@ -118,8 +119,8 @@ class FtileWhile extends AbstractFtile {
|
||||
ConditionStyle conditionStyle, FontConfiguration fcTest, Instruction specialOut) {
|
||||
|
||||
final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
||||
final TextBlock testTb = test.create(fcTest,
|
||||
whileBlock.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam());
|
||||
final TextBlock testTb = test.isWhite() ? TextBlockUtils.empty(0, 0) : test.create(fcTest, whileBlock
|
||||
.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam());
|
||||
final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
||||
|
||||
final Ftile diamond1;
|
||||
|
@ -119,18 +119,15 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final double diamondWidth = dimDiamond1.getWidth();
|
||||
final double x;
|
||||
final Point2D pt;
|
||||
if (getFtile2() == tile1) {
|
||||
x = 0;
|
||||
pt = dimDiamond1.getPointD();
|
||||
} else if (getFtile2() == tile2) {
|
||||
x = diamondWidth;
|
||||
pt = dimDiamond1.getPointB();
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
|
||||
return getTranslateDiamond1(stringBounder)
|
||||
.getTranslated(new Point2D.Double(x, dimDiamond1.getInY() + half));
|
||||
return getTranslateDiamond1(stringBounder).getTranslated(pt);
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
@ -214,18 +211,16 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
}
|
||||
|
||||
private Point2D getP2(StringBounder stringBounder) {
|
||||
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final double diamondWidth = dimDiamond2.getWidth();
|
||||
final double x;
|
||||
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final Point2D pt;
|
||||
if (getFtile1() == tile1) {
|
||||
x = 0;
|
||||
pt = dimDiamond2.getPointD();
|
||||
} else if (getFtile1() == tile2) {
|
||||
x = diamondWidth;
|
||||
pt = dimDiamond2.getPointB();
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return getTranslateDiamond2(stringBounder)
|
||||
.getTranslated(new Point2D.Double(x, dimDiamond2.getHeight() / 2));
|
||||
return getTranslateDiamond2(stringBounder).getTranslated(pt);
|
||||
}
|
||||
|
||||
private UTranslate translate(StringBounder stringBounder) {
|
||||
|
@ -36,7 +36,6 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@ -91,12 +90,12 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
|
||||
@Override
|
||||
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||
if (tiles.contains(child)) {
|
||||
return getTranslate1(child, stringBounder);
|
||||
return getTranslateNude(child, stringBounder);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private UTranslate getTranslate1(Ftile tile, StringBounder stringBounder) {
|
||||
protected UTranslate getTranslateNude(Ftile tile, StringBounder stringBounder) {
|
||||
double x1 = 0;
|
||||
for (Ftile candidate : tiles) {
|
||||
final FtileGeometry dim1 = candidate.calculateDimension(stringBounder);
|
||||
@ -111,7 +110,7 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
for (Ftile tile : tiles) {
|
||||
ug.apply(getTranslate1(tile, stringBounder)).draw(tile);
|
||||
ug.apply(getTranslateNude(tile, stringBounder)).draw(tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,18 +35,21 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UChange;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
@ -54,10 +57,12 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
|
||||
protected final Ftile diamond1;
|
||||
protected final Ftile diamond2;
|
||||
protected final List<Branch> branches;
|
||||
|
||||
public FtileSwitchWithDiamonds(List<Ftile> tiles, Swimlane in, Ftile diamond1, Ftile diamond2,
|
||||
StringBounder stringBounder) {
|
||||
public FtileSwitchWithDiamonds(List<Ftile> tiles, List<Branch> branches, Swimlane in, Ftile diamond1,
|
||||
Ftile diamond2, StringBounder stringBounder) {
|
||||
super(tiles, in);
|
||||
this.branches = branches;
|
||||
this.diamond1 = diamond1;
|
||||
this.diamond2 = diamond2;
|
||||
}
|
||||
@ -96,11 +101,11 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
|
||||
super.drawU(ug.apply(getUTranslateMain(stringBounder)));
|
||||
super.drawU(ug.apply(getTranslateMain(stringBounder)));
|
||||
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
|
||||
}
|
||||
|
||||
private UChange getUTranslateMain(StringBounder stringBounder) {
|
||||
protected UTranslate getTranslateMain(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder));
|
||||
}
|
||||
@ -121,4 +126,15 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
return new UTranslate(x2, y2);
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
|
||||
return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
|
||||
}
|
||||
|
||||
protected TextBlock getLabelPositive(Branch branch) {
|
||||
final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
return branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,280 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
|
||||
private final Rainbow arrowColor;
|
||||
private final double margin = 10;
|
||||
|
||||
public FtileSwitchWithManyLinks(List<Ftile> tiles, List<Branch> branches, Swimlane in, Ftile diamond1,
|
||||
Ftile diamond2, StringBounder stringBounder, Rainbow arrowColor) {
|
||||
super(tiles, branches, in, diamond1, diamond2, stringBounder);
|
||||
this.arrowColor = arrowColor;
|
||||
}
|
||||
|
||||
class ConnectionHorizontalThenVertical extends AbstractConnection {
|
||||
|
||||
private final Branch branch;
|
||||
|
||||
public ConnectionHorizontalThenVertical(Ftile tile, Branch branch) {
|
||||
super(diamond1, tile);
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(getLabelPositive(branch));
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final Point2D pt;
|
||||
if (getFtile2() == tiles.get(0)) {
|
||||
pt = dimDiamond1.getPointD();
|
||||
} else if (getFtile2() == tiles.get(tiles.size() - 1)) {
|
||||
pt = dimDiamond1.getPointB();
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return getTranslateDiamond1(stringBounder).getTranslated(pt);
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile2(), stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ConnectionVerticalThenHorizontal extends AbstractConnection {
|
||||
|
||||
public ConnectionVerticalThenHorizontal(Ftile tile) {
|
||||
super(tile, diamond2);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, arrow);
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile1(), stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
private Point2D getP2(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final Point2D pt;
|
||||
if (getFtile1() == tiles.get(0)) {
|
||||
pt = dimDiamond2.getPointD();
|
||||
} else if (getFtile1() == tiles.get(tiles.size() - 1)) {
|
||||
pt = dimDiamond2.getPointB();
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return getTranslateDiamond2(stringBounder).getTranslated(pt);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
|
||||
return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
|
||||
|
||||
}
|
||||
|
||||
class ConnectionVerticalTop extends AbstractConnection {
|
||||
|
||||
private final Branch branch;
|
||||
|
||||
public ConnectionVerticalTop(Ftile tile, Branch branch) {
|
||||
super(diamond1, tile);
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final UTranslate translateDiamond1 = getTranslateDiamond1(stringBounder);
|
||||
final Point2D p1b = translateDiamond1.getTranslated(dimDiamond1.getPointB());
|
||||
final Point2D p1c = translateDiamond1.getTranslated(dimDiamond1.getPointC());
|
||||
final Point2D p1d = translateDiamond1.getTranslated(dimDiamond1.getPointD());
|
||||
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(getLabelPositive(branch));
|
||||
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
|
||||
snake.addPoint(x2, p1d.getY());
|
||||
snake.addPoint(x2, y2);
|
||||
} else {
|
||||
final double x1 = p1c.getX();
|
||||
final double y1 = p1c.getY();
|
||||
|
||||
final double ym = (y1 * 2 + y2) / 3;
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, ym);
|
||||
snake.addPoint(x2, ym);
|
||||
snake.addPoint(x2, y2);
|
||||
}
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile2(), stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ConnectionVerticalBottom extends AbstractConnection {
|
||||
|
||||
public ConnectionVerticalBottom(Ftile tile) {
|
||||
super(tile, diamond2);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final UTranslate translateDiamond2 = getTranslateDiamond2(stringBounder);
|
||||
final Point2D p2a = translateDiamond2.getTranslated(dimDiamond2.getPointA());
|
||||
final Point2D p2b = translateDiamond2.getTranslated(dimDiamond2.getPointB());
|
||||
final Point2D p2d = translateDiamond2.getTranslated(dimDiamond2.getPointD());
|
||||
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final UTranslate translateDiamond1 = getTranslateDiamond1(stringBounder);
|
||||
final Point2D p1b = translateDiamond1.getTranslated(dimDiamond1.getPointB());
|
||||
final Point2D p1c = translateDiamond1.getTranslated(dimDiamond1.getPointC());
|
||||
final Point2D p1d = translateDiamond1.getTranslated(dimDiamond1.getPointD());
|
||||
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2a.getX();
|
||||
final double y2 = p2a.getY();
|
||||
|
||||
final double ym = (y1 + y2) / 2;
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
|
||||
if (x1 < p1d.getX() - margin || x1 > p1b.getX() + margin) {
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, p2d.getY());
|
||||
} else {
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, ym);
|
||||
snake.addPoint(x2, ym);
|
||||
snake.addPoint(x2, y2);
|
||||
}
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile1(), stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Ftile addLinks() {
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
conns.add(new ConnectionHorizontalThenVertical(tiles.get(0), branches.get(0)));
|
||||
conns.add(new ConnectionHorizontalThenVertical(tiles.get(tiles.size() - 1), branches.get(tiles.size() - 1)));
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(0)));
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(tiles.size() - 1)));
|
||||
for (int i = 1; i < tiles.size() - 1; i++) {
|
||||
conns.add(new ConnectionVerticalTop(tiles.get(i), branches.get(i)));
|
||||
conns.add(new ConnectionVerticalBottom(tiles.get(i)));
|
||||
}
|
||||
|
||||
return FtileUtils.addConnection(this, conns);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
|
||||
|
||||
private final Rainbow arrowColor;
|
||||
|
||||
public FtileSwitchWithOneLink(List<Ftile> tiles, List<Branch> branches, Swimlane in, Ftile diamond1,
|
||||
Ftile diamond2, StringBounder stringBounder, Rainbow arrowColor) {
|
||||
super(tiles, branches, in, diamond1, diamond2, stringBounder);
|
||||
this.arrowColor = arrowColor;
|
||||
}
|
||||
|
||||
class ConnectionVerticalTop extends AbstractConnection {
|
||||
|
||||
private final Branch branch;
|
||||
|
||||
public ConnectionVerticalTop(Ftile tile, Branch branch) {
|
||||
super(diamond1, tile);
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(getLabelPositive(branch));
|
||||
// snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return getTranslateDiamond1(stringBounder).getTranslated(dimDiamond1.getPointC());
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile2(), stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
}
|
||||
|
||||
class ConnectionVerticalBottom extends AbstractConnection {
|
||||
|
||||
public ConnectionVerticalBottom(Ftile tile) {
|
||||
super(tile, diamond2);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
// snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile1(), stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
private Point2D getP2(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
return getTranslateDiamond2(stringBounder).getTranslated(dimDiamond2.getPointA());
|
||||
}
|
||||
}
|
||||
|
||||
public Ftile addLinks() {
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
conns.add(new ConnectionVerticalTop(tiles.get(0), branches.get(0)));
|
||||
conns.add(new ConnectionVerticalBottom(tiles.get(0)));
|
||||
|
||||
return FtileUtils.addConnection(this, conns);
|
||||
}
|
||||
|
||||
}
|
@ -48,7 +48,6 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.BackSlash;
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.LineLocationImpl;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
|
||||
|
@ -35,14 +35,17 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.ErrorUmlType;
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.PSystemError;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.api.PSystemFactory;
|
||||
import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.error.PSystemError;
|
||||
import net.sourceforge.plantuml.error.PSystemErrorUtils;
|
||||
|
||||
public abstract class PSystemAbstractFactory implements PSystemFactory {
|
||||
|
||||
@ -53,17 +56,20 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
final protected AbstractPSystem buildEmptyError(UmlSource source, LineLocation lineLocation) {
|
||||
final protected PSystemError buildEmptyError(UmlSource source, LineLocation lineLocation,
|
||||
List<StringLocated> trace) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, EMPTY_DESCRIPTION, /* 1, */lineLocation);
|
||||
final PSystemError result = new PSystemError(source, err, null);
|
||||
// final AbstractPSystemError result = PSystemErrorUtils.buildV1(source, err, null);
|
||||
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
|
||||
result.setSource(source);
|
||||
return result;
|
||||
}
|
||||
|
||||
final protected PSystemError buildExecutionError(UmlSource source, String stringError, LineLocation lineLocation) {
|
||||
final protected PSystemError buildExecutionError(UmlSource source, String stringError,
|
||||
LineLocation lineLocation, List<StringLocated> trace) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, stringError, /* 1, */
|
||||
lineLocation);
|
||||
final PSystemError result = new PSystemError(source, err, null);
|
||||
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
|
||||
result.setSource(source);
|
||||
return result;
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ package net.sourceforge.plantuml.command;
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.ErrorUmlType;
|
||||
import net.sourceforge.plantuml.PSystemError;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.error.PSystemErrorUtils;
|
||||
import net.sourceforge.plantuml.utils.StartUtils;
|
||||
import net.sourceforge.plantuml.version.IteratorCounter2;
|
||||
|
||||
@ -80,7 +80,7 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
|
||||
first = false;
|
||||
if (StartUtils.isArobaseEndDiagram(s.getString())) {
|
||||
if (source.getTotalLineCount() == 2 && source.isStartDef() == false) {
|
||||
return buildEmptyError(source, s.getLocation());
|
||||
return buildEmptyError(source, s.getLocation(), it.getTrace());
|
||||
}
|
||||
if (system != null) {
|
||||
system.setSource(source);
|
||||
@ -90,7 +90,8 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
|
||||
system = executeLine(system, s.getString());
|
||||
if (system == null) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", s.getLocation());
|
||||
return new PSystemError(source, err, null);
|
||||
// return PSystemErrorUtils.buildV1(source, err, null);
|
||||
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
|
||||
}
|
||||
}
|
||||
if (system != null) {
|
||||
|
@ -38,11 +38,12 @@ package net.sourceforge.plantuml.command;
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.ErrorUmlType;
|
||||
import net.sourceforge.plantuml.PSystemError;
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.error.PSystemErrorUtils;
|
||||
import net.sourceforge.plantuml.utils.StartUtils;
|
||||
import net.sourceforge.plantuml.version.IteratorCounter2;
|
||||
|
||||
@ -61,7 +62,8 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
|
||||
}
|
||||
final IteratorCounter2 it = source.iterator2();
|
||||
if (source.isEmpty()) {
|
||||
return buildEmptyError(source, it.peek().getLocation());
|
||||
final LineLocation location = it.next().getLocation();
|
||||
return buildEmptyError(source, location, it.getTrace());
|
||||
}
|
||||
|
||||
final StringLocated startLine = it.next();
|
||||
@ -70,17 +72,17 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
|
||||
}
|
||||
|
||||
if (it.hasNext() == false) {
|
||||
return buildEmptyError(source, startLine.getLocation());
|
||||
return buildEmptyError(source, startLine.getLocation(), it.getTrace());
|
||||
}
|
||||
final StringLocated s = it.next();
|
||||
if (StartUtils.isArobaseEndDiagram(s.getString())) {
|
||||
return buildEmptyError(source, s.getLocation());
|
||||
return buildEmptyError(source, s.getLocation(), it.getTrace());
|
||||
}
|
||||
final AbstractPSystem sys = executeLine(s.getString());
|
||||
if (sys == null) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?",
|
||||
/* it.currentNum() - 1, */s.getLocation());
|
||||
return new PSystemError(source, err, null);
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", s.getLocation());
|
||||
// return PSystemErrorUtils.buildV1(source, err, null);
|
||||
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
|
||||
}
|
||||
sys.setSource(source);
|
||||
return sys;
|
||||
|
@ -36,11 +36,11 @@
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.PSystemError;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.error.PSystemError;
|
||||
|
||||
public abstract class SingleLineCommand2<S extends Diagram> implements Command<S> {
|
||||
|
||||
|
@ -43,7 +43,7 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.ErrorUmlType;
|
||||
import net.sourceforge.plantuml.PSystemError;
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByGender;
|
||||
@ -51,6 +51,8 @@ import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByVisibility
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.error.PSystemError;
|
||||
import net.sourceforge.plantuml.error.PSystemErrorUtils;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandSkin;
|
||||
import net.sourceforge.plantuml.utils.StartUtils;
|
||||
import net.sourceforge.plantuml.version.IteratorCounter2;
|
||||
@ -76,7 +78,8 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
||||
}
|
||||
|
||||
if (source.isEmpty()) {
|
||||
return buildEmptyError(source, startLine.getLocation());
|
||||
it.next();
|
||||
return buildEmptyError(source, startLine.getLocation(), it.getTrace());
|
||||
}
|
||||
AbstractPSystem sys = createEmptyDiagram();
|
||||
|
||||
@ -87,10 +90,12 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
||||
}
|
||||
final String err = sys.checkFinalError();
|
||||
if (err != null) {
|
||||
return buildExecutionError(source, err, it.peek().getLocation());
|
||||
final LineLocation location = it.next().getLocation();
|
||||
return buildExecutionError(source, err, location, it.getTrace());
|
||||
}
|
||||
if (source.getTotalLineCount() == 2) {
|
||||
return buildEmptyError(source, it.peek().getLocation());
|
||||
final LineLocation location = it.next().getLocation();
|
||||
return buildEmptyError(source, location, it.getTrace());
|
||||
}
|
||||
sys.makeDiagramReady();
|
||||
if (sys.isOk() == false) {
|
||||
@ -113,14 +118,15 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
||||
final Step step = getCandidate(it);
|
||||
if (step == null) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", it.peek().getLocation());
|
||||
return new PSystemError(source, err, null);
|
||||
it.next();
|
||||
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
|
||||
}
|
||||
|
||||
final CommandExecutionResult result = sys.executeCommand(step.command, step.blocLines);
|
||||
if (result.isOk() == false) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(),
|
||||
((StringLocated) step.blocLines.getFirst499()).getLocation());
|
||||
sys = new PSystemError(source, err, result.getDebugLines());
|
||||
sys = PSystemErrorUtils.buildV2(source, err, result.getDebugLines(), it.getTrace());
|
||||
}
|
||||
if (result.getNewDiagram() != null) {
|
||||
sys = result.getNewDiagram();
|
||||
|
@ -35,6 +35,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.command.note.sequence;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
@ -51,6 +53,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
@ -65,7 +68,11 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
return new RegexConcat( //
|
||||
new RegexLeaf("^"), //
|
||||
new RegexLeaf("VMERGE", "(/)?[%s]*"), //
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), //
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("over[%s]+"), //
|
||||
new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), //
|
||||
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
|
||||
color().getRegex(), //
|
||||
@ -78,7 +85,11 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
return new RegexConcat( //
|
||||
new RegexLeaf("^"), //
|
||||
new RegexLeaf("VMERGE", "(/)?[%s]*"), //
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), //
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("over[%s]+"), //
|
||||
new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), //
|
||||
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
|
||||
color().getRegex(), //
|
||||
@ -92,12 +103,12 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
return ColorParser.simpleColor(ColorType.BACK);
|
||||
}
|
||||
|
||||
|
||||
public Command<SequenceDiagram> createSingleLine() {
|
||||
return new SingleLineCommand2<SequenceDiagram>(getRegexConcatSingleLine()) {
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location, RegexResult arg) {
|
||||
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
|
||||
RegexResult arg) {
|
||||
final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0));
|
||||
|
||||
return executeInternal(system, arg, strings);
|
||||
@ -135,9 +146,16 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
final boolean tryMerge = line0.get("VMERGE", 0) != null;
|
||||
final Display display = diagram.manageVariable(lines.toDisplay());
|
||||
final Note note = new Note(p1, p2, display);
|
||||
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
|
||||
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
|
||||
final String stereotypeString = line0.get("STEREO", 0);
|
||||
if (stereotypeString != null) {
|
||||
final Stereotype stereotype = new Stereotype(stereotypeString);
|
||||
colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE,
|
||||
ColorParam.noteBackground, ColorParam.noteBorder);
|
||||
}
|
||||
note.setColors(colors);
|
||||
// note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
|
||||
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
|
||||
note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
|
||||
if (line0.get("URL", 0) != null) {
|
||||
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
|
||||
|
@ -36,6 +36,6 @@
|
||||
package net.sourceforge.plantuml.creole;
|
||||
|
||||
public enum CreoleMode {
|
||||
FULL, SIMPLE_LINE;
|
||||
FULL, SIMPLE_LINE, NO_CREOLE;
|
||||
|
||||
}
|
||||
|
@ -452,8 +452,8 @@ public class Display implements Iterable<CharSequence> {
|
||||
}
|
||||
|
||||
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer, CreoleMode modeSimpleLine) {
|
||||
return create(fontConfiguration, horizontalAlignment, spriteContainer, LineBreakStrategy.NONE, modeSimpleLine,
|
||||
ISkinSimple spriteContainer, CreoleMode creoleMode) {
|
||||
return create(fontConfiguration, horizontalAlignment, spriteContainer, LineBreakStrategy.NONE, creoleMode,
|
||||
null, null);
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ public class Display implements Iterable<CharSequence> {
|
||||
}
|
||||
|
||||
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode modeSimpleLine,
|
||||
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode,
|
||||
UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||
if (maxMessageSize == null) {
|
||||
throw new IllegalArgumentException();
|
||||
@ -492,12 +492,12 @@ public class Display implements Iterable<CharSequence> {
|
||||
}
|
||||
}
|
||||
|
||||
return getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, modeSimpleLine);
|
||||
return getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, creoleMode);
|
||||
}
|
||||
|
||||
private TextBlock getCreole(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode modeSimpleLine) {
|
||||
final Sheet sheet = new CreoleParser(fontConfiguration, horizontalAlignment, spriteContainer, modeSimpleLine)
|
||||
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode) {
|
||||
final Sheet sheet = new CreoleParser(fontConfiguration, horizontalAlignment, spriteContainer, creoleMode)
|
||||
.createSheet(this);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, spriteContainer == null ? 0
|
||||
: spriteContainer.getPadding());
|
||||
|
@ -245,6 +245,9 @@ public class Stereotype implements CharSequence {
|
||||
if (isWithOOSymbol()) {
|
||||
return null;
|
||||
}
|
||||
if (spriteName != null && spriteName.startsWith("archimate/")) {
|
||||
return guillemet.manageGuillemet("<<" + spriteName.substring("archimate/".length()) + ">>");
|
||||
}
|
||||
return guillemet.manageGuillemet(label);
|
||||
}
|
||||
|
||||
|
@ -132,33 +132,31 @@ public class GraphvizUtils {
|
||||
if (local != null) {
|
||||
return local;
|
||||
}
|
||||
final String env = System.getProperty("PLANTUML_LIMIT_SIZE");
|
||||
final String env = getenv("PLANTUML_LIMIT_SIZE");
|
||||
if (StringUtils.isNotEmpty(env) && env.matches("\\d+")) {
|
||||
return Integer.parseInt(env);
|
||||
}
|
||||
final String getenv = System.getenv("PLANTUML_LIMIT_SIZE");
|
||||
if (StringUtils.isNotEmpty(getenv) && getenv.matches("\\d+")) {
|
||||
return Integer.parseInt(getenv);
|
||||
}
|
||||
return 4096;
|
||||
}
|
||||
|
||||
public static String getenvDefaultConfigFilename() {
|
||||
final String env = System.getProperty("PLANTUML_DEFAULT_CONFIG_FILENAME");
|
||||
if (StringUtils.isNotEmpty(env)) {
|
||||
return env;
|
||||
}
|
||||
return System.getenv("PLANTUML_DEFAULT_CONFIG_FILENAME");
|
||||
return getenv("PLANTUML_DEFAULT_CONFIG_FILENAME");
|
||||
}
|
||||
|
||||
public static String getenvLogData() {
|
||||
final String env = System.getProperty("PLANTUML_LOGDATA");
|
||||
return getenv("PLANTUML_LOGDATA");
|
||||
}
|
||||
|
||||
public static String getenv(String name) {
|
||||
final String env = System.getProperty(name);
|
||||
if (StringUtils.isNotEmpty(env)) {
|
||||
return env;
|
||||
}
|
||||
return System.getenv("PLANTUML_LOGDATA");
|
||||
return System.getenv(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static String dotVersion = null;
|
||||
|
||||
public static String dotVersion() throws IOException, InterruptedException {
|
||||
|
@ -51,6 +51,7 @@ public class Dedications {
|
||||
addNormal("Write your own dedication!", "dedication");
|
||||
addNormal("linux_china", "linux_china");
|
||||
addNormal("ARKBAN", "arkban");
|
||||
addNormal("Boundaries allow discipline to create true strength", "boundaries");
|
||||
addCrypted("0", "pOhci6rKgPXw32AeYXhOpSY0suoauHq5VUSwFqHLHsLYgSO6WaJ7BW5vtHBAoU6ePbcW7d8Flx99MWjPSKQTDm00");
|
||||
addCrypted("1", "LTxN3hdnhSJ515qcA7IQ841axt4GXfUd3n2wgNirYCdLnyX2360Gv1OEOnJ1-gwFzRW5B3HAqLBkR6Ge0WW_Z000");
|
||||
}
|
||||
|
BIN
src/net/sourceforge/plantuml/dedication/boundaries.png
Normal file
BIN
src/net/sourceforge/plantuml/dedication/boundaries.png
Normal file
Binary file not shown.
@ -101,7 +101,7 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
|
||||
final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw));
|
||||
final String icon = arg.getLazzy("STEREOTYPE", 0);
|
||||
|
||||
final IEntity entity = diagram.getOrCreateLeaf(code, LeafType.DESCRIPTION, USymbol.RECTANGLE);
|
||||
final IEntity entity = diagram.getOrCreateLeaf(code, LeafType.DESCRIPTION, USymbol.ARCHIMATE);
|
||||
|
||||
final String displayRaw = arg.getLazzy("DISPLAY", 0);
|
||||
|
||||
@ -112,7 +112,7 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
|
||||
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
||||
|
||||
entity.setDisplay(Display.getWithNewlines(display));
|
||||
entity.setUSymbol(USymbol.RECTANGLE);
|
||||
entity.setUSymbol(USymbol.ARCHIMATE);
|
||||
if (icon != null) {
|
||||
entity.setStereotype(new Stereotype("<<$archimate/" + icon + ">>", diagram.getSkinParam()
|
||||
.getCircledCharacterRadius(), diagram.getSkinParam().getFont(null, false,
|
||||
@ -124,5 +124,4 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,22 +71,23 @@ public class PSystemDonors extends AbstractPSystem {
|
||||
private static final int COLS = 6;
|
||||
private static final int FREE_LINES = 6;
|
||||
|
||||
public static final String DONORS = "6nC90AmEEBmtNeGqQuvtvvyfOnYjY14ipnEA4uiuxGR47-3Ujh6l87u5mINjNXY1P6bpXlCCebWGDPxr"
|
||||
+ "KuTjRlPNQ4jzbOnnKnDcmWH88JoNxPv-tYvLP9GWfehjjqnexsy_BjGXhHM2At1JEVztQO1veO0qJgTu"
|
||||
+ "29S3r7yAbjuekTPi_jATxOLcRJPqN81ADTfOiwDOi-L3HEbheJ6HsMkCWcoRQyUUKV8enbSYnLeRMs2L"
|
||||
+ "anOKQcCunITQ3_zH2sZIcbr3UhQ0OXaf6itRlZRs7PoVmQ0HmgnqnA3iKEBGNM2iKD-e8KnAi20tYcbi"
|
||||
+ "9END4pL2EA32B_oZ92bd3raPPTY0CDi31Qn-JH28PrD12MTxNWCAzs2BXWPBTMvPwIxt3yDJeImQhWKT"
|
||||
+ "PWvoWLG0UHDq8P-hprpIk8rDCSEBxiPuzKr2tcJd-UFDWxxfj34mVkuUcYdBSg3QUaZXbEiOlpewvAU6"
|
||||
+ "ZEpzfexOPWdX-MqkJFlI0fqVG2-rXednD-UNXMI8Z2breQVEwPDzYa1vPIaiUXLJNWlzeilLRI2UHmyM"
|
||||
+ "s5HVvrfPmGvTcTWDVK8hdCCwN-1K3VNFGwwwZa_1DM6tUzkKCsbpgVX_wvPc9ka1EcYYZT3L4YDFtxIg"
|
||||
+ "5vCXWfT17uRS0d83gY-JH-Lb-P3usXzGU4iYWIfjpcY_KPanNt9OH7ZXlJDLF01cDubyGLWyI0_YEe7U"
|
||||
+ "XYgRwB2xVa-Jac7JniovKIgMkmvZL3wcavMBxjLSu2iDmx9i3ktMVi1Hm0FOQLvr5dUj0fosz9vOB8qd"
|
||||
+ "6KZNCAS6qdvKsVUq9TsNEaPcMM_nhYxnRcu7VnwwV63V5YqmhNGTiY0qRngHKxSuprE3wczFo0PjJRFE"
|
||||
+ "3ivL8KAWc1cN0VUx9YigEO8m6Svmw7a2mgPrNh7A3UvUcCwrpixKjKHOprnz3DIG7tKsO5IwJgG07-Uz"
|
||||
+ "W6V0eyJ-SDuhenxgsn1sBQ1431DifCBOHWYhXCqPP4Jlbvvvd-1zNjfZeTx6DpkVSIX-RA8xnWs0LcSq"
|
||||
+ "4xgl6v29qCXNgPSy9ax0pxZzXdemws3ZR_IqOXp4bf8Oe0he9_mI7DJEMpIDzHPzRcljRTdvywyvCicf"
|
||||
+ "sDUnMX0z1q7-goYearYEAkz6Vb_ulC9Y8ICWri4ELruQlH1WM13Iibogjdj6uKmfbfkfdJ9AVQZmVv9B"
|
||||
+ "4CJbZIWlDc6LqQS4gxMtUbAvRLz-n-4j1u__4rMUYUJIbSL8bWjXYlCqtiT89QnR8Go-3fy0";
|
||||
public static final String DONORS = "6qq90AmER5DS9tl8vfhbtlpPbKCCAM84o_E4uZ2mYAUx0V47kBTjx2k8Nq5mIRiNHY1PcfrHNOSGbmZ6"
|
||||
+ "UZUdwEgVdbcBbJybk-gCEFN2l32zqB1XCybzPh80tdwg32d1lpLJ_WZwmrDMI5HRTZHHjDaZL_zlEeNa"
|
||||
+ "eI8CGxCL7YMZ4Mf_89AnPgUQmzsFQjsrwk8kA7HReSPqYZY6gyBS4Xz5LlOApDboYPUh5efRQHnxGSMj"
|
||||
+ "cF0IAQwsiGGkEQY9IaqEPxWXzVKVzGRQRAwmKikzeBYs8KcjV__OEGvmVWw3IXY7MB21COSAX_a4FKMz"
|
||||
+ "4OEnYqGJfPuCOnCndpmnm8GNcjZ0FyeYfaTfPaz76yRXaL30vTTm0d5KLLHeTl0ne7YKMdIicAwBuqwp"
|
||||
+ "-lhGUqeQYuQRm8A31Mc2L01v4tJ2dn5hV5MvjztGm2lEpZhRPY6lyl3oyUP6tzwuir2-xnwUwUEweTgY"
|
||||
+ "bBcDxwszvoqWTolrMl5FEMAPQ-9skNegqFBh1V8Fe9VcHCNwcPU7XUOGzpRiYxZF-PsF8G9ZnMcmsBiO"
|
||||
+ "wZNfoIv_iuaipo0Bl8IVYutCn1Q-Sl4mw9TQyJoYyuMGPMNvkEXeMNjCj2PkrhrzikU8kPh_VpTzX9ca"
|
||||
+ "4tGoHMtgceXIPkrUjIU35C7JG6-6t0Ho1whJzIfE7nVvptf0z5P51gAqEUFzGd51RMWpn1nOwqA96y3y"
|
||||
+ "Af5E6AUJj4HQ0-XjkBA8j6NQy-xAsRvYpBrCSc6xQpHMn0TooBEQtJq56saObx9PEgBzW3s1Hx6pN7Ms"
|
||||
+ "m5e5EExflUlDLF-9WNgL9oKXhKUKnp7ygsR34gMoQ9kyMShVC_t6duUkBzZJeaDCAxqEMGog5ur8fNyP"
|
||||
+ "_Mv5wUyWPMDUya7Um5TqJ0DXolWKSBjvCgMABHYxThh3mXOWtERYYbK1SFT2TIujAxUmAMRTS_KnK2b-"
|
||||
+ "Z4zWgCmBpmhiEEy5EWCzIgoFvhtIvscvDmLR2oXJBGGBQQAShHGKvMkHZ5ZhqdFG1dZxou8BzDQUet6a"
|
||||
+ "G_5h8ReZRG2qPb6DqEUw0Pa8bN95l-PZOGJyxQ-ltODH1n__EePFnK6yf2G6f0BQqOtpe7wwferWlKMV"
|
||||
+ "Vz-sgu_Wpx_cqH2dQhltjmRHwo38Vu62S3fNp-0mAlDdu0FZT2KzeDJ1IgsyD7eQO4GGqhAUI_kSaHuP"
|
||||
+ "K-NsrI9th0yL_sqhnWdAUCFAYqM2eiMIitoxMYPL8FRrEnQd73B-JrHv9f9BLqv68XGxEyIPZVVHXk7c"
|
||||
+ "c-36JCSL0crVVxURrQaokv2Srt0WCW00";
|
||||
|
||||
@Override
|
||||
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
|
||||
|
@ -32,7 +32,7 @@
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
package net.sourceforge.plantuml.error;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.Dimension2D;
|
||||
@ -42,18 +42,26 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.BackSlash;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.FileImageData;
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.api.ImageDataAbstract;
|
||||
import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||
import net.sourceforge.plantuml.asciiart.UmlCharArea;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.eggs.PSystemWelcome;
|
||||
import net.sourceforge.plantuml.flashcode.FlashCodeFactory;
|
||||
@ -69,6 +77,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.InnerStrategy;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockRaw;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
@ -83,53 +92,109 @@ import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt;
|
||||
import net.sourceforge.plantuml.version.LicenseInfo;
|
||||
import net.sourceforge.plantuml.version.PSystemVersion;
|
||||
|
||||
public class PSystemError extends AbstractPSystem {
|
||||
public abstract class PSystemError extends AbstractPSystem {
|
||||
|
||||
private final LineLocation higherErrorPosition;
|
||||
private final List<ErrorUml> printedErrors;
|
||||
private final List<String> debugLines = new ArrayList<String>();
|
||||
protected List<StringLocated> trace;
|
||||
protected ErrorUml singleError;
|
||||
|
||||
public PSystemError(UmlSource source, ErrorUml singleError, List<String> debugLines) {
|
||||
this(source, Collections.singletonList(singleError), debugLines);
|
||||
final protected StringLocated getLastLine() {
|
||||
return trace.get(trace.size() - 1);
|
||||
}
|
||||
|
||||
private PSystemError(UmlSource source, List<ErrorUml> all, List<String> debugLines) {
|
||||
this.setSource(source);
|
||||
final public LineLocation getLineLocation() {
|
||||
return getLastLine().getLocation();
|
||||
}
|
||||
|
||||
final LineLocation execution = getHigherErrorPosition2(ErrorUmlType.EXECUTION_ERROR, all);
|
||||
final LineLocation syntax = getHigherErrorPosition2(ErrorUmlType.SYNTAX_ERROR, all);
|
||||
final public Collection<ErrorUml> getErrorsUml() {
|
||||
return Collections.singleton(singleError);
|
||||
}
|
||||
|
||||
if (execution == null && syntax == null) {
|
||||
throw new IllegalStateException();
|
||||
final public String getWarningOrError() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(getDescription());
|
||||
sb.append(BackSlash.CHAR_NEWLINE);
|
||||
for (CharSequence t : getTitle().getDisplay()) {
|
||||
sb.append(t);
|
||||
sb.append(BackSlash.CHAR_NEWLINE);
|
||||
}
|
||||
sb.append(BackSlash.CHAR_NEWLINE);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
if (execution != null && (syntax == null || execution.compareTo(syntax) >= 0)) {
|
||||
higherErrorPosition = execution;
|
||||
printedErrors = getErrorsAt2(execution, ErrorUmlType.EXECUTION_ERROR, all);
|
||||
private TextBlockBackcolored getGraphicalFormatted() {
|
||||
final FontConfiguration fc0 = GraphicStrings.sansSerif14(HtmlColorUtils.BLACK).bold();
|
||||
final FontConfiguration fc1 = GraphicStrings.sansSerif14(HtmlColorUtils.MY_GREEN).bold();
|
||||
final FontConfiguration fc2 = GraphicStrings.sansSerif14(HtmlColorUtils.RED).bold();
|
||||
|
||||
final List<String> fullBody = getTextFullBody();
|
||||
final TextBlock result0 = TextBlockUtils.addBackcolor(
|
||||
TextBlockUtils.withMargin(new TextBlockRaw(getTextFromStack(), fc0), 1, 1, 1, 4),
|
||||
HtmlColorUtils.MY_GREEN);
|
||||
final TextBlock result1 = new TextBlockRaw(allButLast(fullBody), fc1);
|
||||
final TextBlock result2 = new TextBlockRaw(onlyLast(fullBody), fc1.wave(HtmlColorUtils.RED));
|
||||
final TextBlock result3 = new TextBlockRaw(getTextError(), fc2);
|
||||
TextBlock result = result0;
|
||||
result = TextBlockUtils.mergeTB(result, result1, HorizontalAlignment.LEFT);
|
||||
result = TextBlockUtils.mergeTB(result, result2, HorizontalAlignment.LEFT);
|
||||
result = TextBlockUtils.mergeTB(result, result3, HorizontalAlignment.LEFT);
|
||||
result = TextBlockUtils.withMargin(result, 5, 5);
|
||||
return TextBlockUtils.addBackcolor(result, HtmlColorUtils.BLACK);
|
||||
}
|
||||
|
||||
private List<String> getPureAsciiFormatted() {
|
||||
final List<String> result = getTextFromStack();
|
||||
result.addAll(getTextFullBody());
|
||||
result.add("^^^^^");
|
||||
result.addAll(getTextError());
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> getTextFromStack() {
|
||||
LineLocation lineLocation = getLineLocation();
|
||||
final List<String> result = new ArrayList<String>();
|
||||
if (lineLocation != null) {
|
||||
append(result, lineLocation);
|
||||
while (lineLocation.getParent() != null) {
|
||||
lineLocation = lineLocation.getParent();
|
||||
append(result, lineLocation);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> getTextFullBody() {
|
||||
final List<String> result = new ArrayList<String>();
|
||||
result.add(" ");
|
||||
final int traceSize = trace.size();
|
||||
if (traceSize > 40) {
|
||||
for (StringLocated s : trace.subList(0, 5)) {
|
||||
addToResult(result, s);
|
||||
}
|
||||
result.add("...");
|
||||
final int skipped = traceSize - 5 - 20;
|
||||
result.add("... ( skipping " + skipped + " lines )");
|
||||
result.add("...");
|
||||
for (StringLocated s : trace.subList(traceSize - 20, traceSize)) {
|
||||
addToResult(result, s);
|
||||
}
|
||||
} else {
|
||||
// assert syntax.compareTo(execution) > 0;
|
||||
higherErrorPosition = syntax;
|
||||
printedErrors = getErrorsAt2(syntax, ErrorUmlType.SYNTAX_ERROR, all);
|
||||
for (StringLocated s : trace) {
|
||||
addToResult(result, s);
|
||||
}
|
||||
}
|
||||
|
||||
if (debugLines != null) {
|
||||
this.debugLines.addAll(debugLines);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getSuggestColor(boolean useRed) {
|
||||
if (useRed) {
|
||||
return "black";
|
||||
private void addToResult(final List<String> result, StringLocated s) {
|
||||
String tmp = s.getString();
|
||||
if (tmp.length() > 120) {
|
||||
tmp = tmp.substring(0, 120) + " ...";
|
||||
}
|
||||
return "white";
|
||||
result.add(tmp);
|
||||
}
|
||||
|
||||
private String getRed(boolean useRed) {
|
||||
if (useRed) {
|
||||
return "#CD0A0A";
|
||||
}
|
||||
return "red";
|
||||
private List<String> getTextError() {
|
||||
return Arrays.asList(" " + singleError.getError());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,13 +203,13 @@ public class PSystemError extends AbstractPSystem {
|
||||
if (fileFormat.getFileFormat() == FileFormat.ATXT || fileFormat.getFileFormat() == FileFormat.UTXT) {
|
||||
final UGraphicTxt ugt = new UGraphicTxt();
|
||||
final UmlCharArea area = ugt.getCharArea();
|
||||
area.drawStringsLR(getTextStrings(), 0, 0);
|
||||
area.drawStringsLR(getPureAsciiFormatted(), 0, 0);
|
||||
area.print(new PrintStream(os));
|
||||
return new ImageDataSimple(1, 1);
|
||||
|
||||
}
|
||||
final boolean useRed = fileFormat.isUseRedForError();
|
||||
final TextBlockBackcolored result = GraphicStrings.createForError(getHtmlStrings(useRed), useRed);
|
||||
// final boolean useRed = fileFormat.isUseRedForError();
|
||||
final TextBlockBackcolored result = getGraphicalFormatted();
|
||||
|
||||
TextBlock udrawable;
|
||||
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(),
|
||||
@ -156,11 +221,11 @@ public class PSystemError extends AbstractPSystem {
|
||||
}
|
||||
final int min = (int) (System.currentTimeMillis() / 60000L) % 60;
|
||||
// udrawable = addMessageAdopt(udrawable);
|
||||
if (min == 1 && LicenseInfo.retrieveNamedOrDistributorQuickIsValid() == false) {
|
||||
if (min == 1 || min == 8) {
|
||||
udrawable = addMessagePatreon(udrawable);
|
||||
} else if (min == 15 && LicenseInfo.retrieveNamedOrDistributorQuickIsValid() == false) {
|
||||
} else if (min == 15) {
|
||||
udrawable = addMessageLiberapay(udrawable);
|
||||
} else if (min == 30 && LicenseInfo.retrieveNamedOrDistributorQuickIsValid() == false) {
|
||||
} else if (min == 30) {
|
||||
udrawable = addMessageDedication(udrawable);
|
||||
} else if (getSource().containsIgnoreCase("arecibo")) {
|
||||
udrawable = addMessageArecibo(udrawable);
|
||||
@ -171,6 +236,31 @@ public class PSystemError extends AbstractPSystem {
|
||||
return imageData;
|
||||
}
|
||||
|
||||
private void append(List<String> result, LineLocation lineLocation) {
|
||||
if (lineLocation.getDescription() != null) {
|
||||
result.add("[From " + lineLocation.getDescription() + " (line " + (lineLocation.getPosition() + 1) + ") ]");
|
||||
}
|
||||
}
|
||||
|
||||
// private String getRed(boolean useRed) {
|
||||
// if (useRed) {
|
||||
// return "#CD0A0A";
|
||||
// }
|
||||
// return "red";
|
||||
// }
|
||||
//
|
||||
final public DiagramDescription getDescription() {
|
||||
return new DiagramDescription("(Error)");
|
||||
}
|
||||
|
||||
private List<String> allButLast(List<String> full) {
|
||||
return full.subList(0, full.size() - 1);
|
||||
}
|
||||
|
||||
private List<String> onlyLast(List<String> full) {
|
||||
return full.subList(full.size() - 1, full.size());
|
||||
}
|
||||
|
||||
private TextBlockBackcolored getWelcome() throws IOException {
|
||||
return new PSystemWelcome(GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT).getGraphicStrings();
|
||||
}
|
||||
@ -181,6 +271,9 @@ public class PSystemError extends AbstractPSystem {
|
||||
}
|
||||
|
||||
private TextBlock addMessageLiberapay(final TextBlock source) throws IOException {
|
||||
if (LicenseInfo.retrieveNamedOrDistributorQuickIsValid()) {
|
||||
return source;
|
||||
}
|
||||
final TextBlock message = getMessageLiberapay();
|
||||
TextBlock result = TextBlockUtils.mergeTB(message, source, HorizontalAlignment.LEFT);
|
||||
result = TextBlockUtils.mergeTB(result, message, HorizontalAlignment.LEFT);
|
||||
@ -188,6 +281,9 @@ public class PSystemError extends AbstractPSystem {
|
||||
}
|
||||
|
||||
private TextBlock addMessagePatreon(final TextBlock source) throws IOException {
|
||||
if (LicenseInfo.retrieveNamedOrDistributorQuickIsValid()) {
|
||||
return source;
|
||||
}
|
||||
final TextBlock message = getMessagePatreon();
|
||||
TextBlock result = TextBlockUtils.mergeTB(message, source, HorizontalAlignment.LEFT);
|
||||
result = TextBlockUtils.mergeTB(result, message, HorizontalAlignment.LEFT);
|
||||
@ -195,12 +291,18 @@ public class PSystemError extends AbstractPSystem {
|
||||
}
|
||||
|
||||
private TextBlock addMessageDedication(final TextBlock source) throws IOException {
|
||||
if (LicenseInfo.retrieveNamedOrDistributorQuickIsValid()) {
|
||||
return source;
|
||||
}
|
||||
final TextBlock message = getMessageDedication();
|
||||
TextBlock result = TextBlockUtils.mergeTB(message, source, HorizontalAlignment.LEFT);
|
||||
return result;
|
||||
}
|
||||
|
||||
private TextBlock addMessageAdopt(final TextBlock source) throws IOException {
|
||||
if (LicenseInfo.retrieveNamedOrDistributorQuickIsValid()) {
|
||||
return source;
|
||||
}
|
||||
final TextBlock message = getMessageAdopt();
|
||||
TextBlock result = TextBlockUtils.mergeTB(message, source, HorizontalAlignment.LEFT);
|
||||
return result;
|
||||
@ -341,6 +443,10 @@ public class PSystemError extends AbstractPSystem {
|
||||
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return trace.size();
|
||||
}
|
||||
|
||||
private BufferedImage smaller(BufferedImage im) {
|
||||
if (im == null) {
|
||||
return null;
|
||||
@ -349,241 +455,4 @@ public class PSystemError extends AbstractPSystem {
|
||||
return im.getSubimage(nb, nb, im.getWidth() - 2 * nb, im.getHeight() - 2 * nb);
|
||||
}
|
||||
|
||||
private List<String> getTextStrings() {
|
||||
final List<String> result = new ArrayList<String>(getStack());
|
||||
if (result.size() > 0) {
|
||||
result.add(" ");
|
||||
}
|
||||
|
||||
for (String s : getPartialCode()) {
|
||||
result.add(s);
|
||||
}
|
||||
final String errorLine = getSource().getLine(higherErrorPosition);
|
||||
final String err = StringUtils.hideComparatorCharacters(errorLine);
|
||||
if (StringUtils.isNotEmpty(err)) {
|
||||
result.add(err);
|
||||
}
|
||||
final StringBuilder underscore = new StringBuilder();
|
||||
for (int i = 0; i < errorLine.length(); i++) {
|
||||
underscore.append("^");
|
||||
}
|
||||
result.add(underscore.toString());
|
||||
final Collection<String> textErrors = new LinkedHashSet<String>();
|
||||
for (ErrorUml er : printedErrors) {
|
||||
textErrors.add(er.getError());
|
||||
}
|
||||
for (String er : textErrors) {
|
||||
result.add(" " + er);
|
||||
}
|
||||
boolean first = true;
|
||||
for (String s : getSuggest()) {
|
||||
if (first) {
|
||||
result.add(" " + s);
|
||||
} else {
|
||||
result.add(s);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
result.addAll(this.debugLines);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> getStack() {
|
||||
LineLocation lineLocation = getLineLocation();
|
||||
final List<String> result = new ArrayList<String>();
|
||||
if (lineLocation != null) {
|
||||
append(result, lineLocation);
|
||||
while (lineLocation.getParent() != null) {
|
||||
lineLocation = lineLocation.getParent();
|
||||
append(result, lineLocation);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public LineLocation getLineLocation() {
|
||||
for (ErrorUml err : printedErrors) {
|
||||
if (err.getLineLocation() != null) {
|
||||
return err.getLineLocation();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void append(List<String> result, LineLocation lineLocation) {
|
||||
if (lineLocation.getDescription() != null) {
|
||||
result.add("[From " + lineLocation.getDescription() + " (line " + (lineLocation.getPosition() + 1) + ") ]");
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getPartialCode() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (Iterator<StringLocated> it = getSource().iterator2(); it.hasNext();) {
|
||||
final StringLocated s = it.next();
|
||||
final String tmp = s.getString();
|
||||
result.add(tmp);
|
||||
final LineLocation location = s.getLocation();
|
||||
if (location.getDescription().equals(higherErrorPosition.getDescription())
|
||||
&& location.compareTo(higherErrorPosition) >= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
final int limit = 5;
|
||||
if (result.size() > limit) {
|
||||
final int skip = result.size() - limit + 1;
|
||||
final String skipMessage;
|
||||
if (skip == 1) {
|
||||
skipMessage = "... (skipping 1 line) ...";
|
||||
} else {
|
||||
skipMessage = "... (skipping " + skip + " lines) ...";
|
||||
}
|
||||
result = new ArrayList<String>(result.subList(skip, result.size()));
|
||||
result.add(0, skipMessage);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private List<String> getHtmlStrings(boolean useRed) {
|
||||
final List<String> htmlStrings = new ArrayList<String>(getStack());
|
||||
if (htmlStrings.size() > 0) {
|
||||
htmlStrings.add("----");
|
||||
}
|
||||
|
||||
final List<String> partialCode = getPartialCode();
|
||||
for (String s : partialCode) {
|
||||
htmlStrings.add(StringUtils.hideComparatorCharacters(s));
|
||||
}
|
||||
if (partialCode.size() > 0) {
|
||||
final int idx = htmlStrings.size() - 1;
|
||||
final String last = htmlStrings.get(idx);
|
||||
htmlStrings.set(idx, "<w:" + getRed(useRed) + ">" + last + "</w>");
|
||||
}
|
||||
|
||||
final Collection<String> textErrors = new LinkedHashSet<String>();
|
||||
for (ErrorUml er : printedErrors) {
|
||||
textErrors.add(er.getError());
|
||||
}
|
||||
for (String er : textErrors) {
|
||||
htmlStrings.add(" <color:" + getRed(useRed) + ">" + er + "</color>");
|
||||
}
|
||||
boolean first = true;
|
||||
for (String s : getSuggest()) {
|
||||
if (first) {
|
||||
htmlStrings.add(" <color:" + getSuggestColor(useRed) + "><i>" + s + "</i></color>");
|
||||
} else {
|
||||
htmlStrings.add("<color:" + getSuggestColor(useRed) + ">" + StringUtils.hideComparatorCharacters(s)
|
||||
+ "</color>");
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
htmlStrings.addAll(this.debugLines);
|
||||
|
||||
return htmlStrings;
|
||||
}
|
||||
|
||||
private List<String> getSuggest() {
|
||||
boolean suggested = false;
|
||||
for (ErrorUml er : printedErrors) {
|
||||
if (er.hasSuggest()) {
|
||||
suggested = true;
|
||||
}
|
||||
}
|
||||
if (suggested == false) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final List<String> result = new ArrayList<String>();
|
||||
result.add("Did you mean:");
|
||||
for (ErrorUml er : printedErrors) {
|
||||
if (er.hasSuggest()) {
|
||||
result.add(er.getSuggest().getSuggestedLine());
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(result);
|
||||
|
||||
}
|
||||
|
||||
private Collection<ErrorUml> getErrors(ErrorUmlType type, List<ErrorUml> all) {
|
||||
final Collection<ErrorUml> result = new LinkedHashSet<ErrorUml>();
|
||||
for (ErrorUml error : all) {
|
||||
if (error.getType() == type) {
|
||||
result.add(error);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private LineLocation getHigherErrorPosition2(ErrorUmlType type, List<ErrorUml> all) {
|
||||
LineLocation max = null;
|
||||
for (ErrorUml error : getErrors(type, all)) {
|
||||
if (max == null || error.getLineLocation().compareTo(max) > 0) {
|
||||
max = error.getLineLocation();
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
private List<ErrorUml> getErrorsAt2(LineLocation position, ErrorUmlType type, List<ErrorUml> all) {
|
||||
final List<ErrorUml> result = new ArrayList<ErrorUml>();
|
||||
for (ErrorUml error : getErrors(type, all)) {
|
||||
if (error.getLineLocation().compareTo(position) == 0 && StringUtils.isNotEmpty(error.getError())) {
|
||||
result.add(error);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public DiagramDescription getDescription() {
|
||||
return new DiagramDescription("(Error)");
|
||||
}
|
||||
|
||||
public final LineLocation getHigherErrorPosition2() {
|
||||
return higherErrorPosition;
|
||||
}
|
||||
|
||||
public final Collection<ErrorUml> getErrorsUml() {
|
||||
return Collections.unmodifiableCollection(printedErrors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWarningOrError() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(getDescription());
|
||||
sb.append(BackSlash.CHAR_NEWLINE);
|
||||
for (CharSequence t : getTitle().getDisplay()) {
|
||||
sb.append(t);
|
||||
sb.append(BackSlash.CHAR_NEWLINE);
|
||||
}
|
||||
sb.append(BackSlash.CHAR_NEWLINE);
|
||||
for (String s : getSuggest()) {
|
||||
sb.append(s);
|
||||
sb.append(BackSlash.CHAR_NEWLINE);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static PSystemError merge(Collection<PSystemError> ps) {
|
||||
UmlSource source = null;
|
||||
final List<ErrorUml> errors = new ArrayList<ErrorUml>();
|
||||
final List<String> debugs = new ArrayList<String>();
|
||||
for (PSystemError system : ps) {
|
||||
if (system == null) {
|
||||
continue;
|
||||
}
|
||||
if (system.getSource() != null && source == null) {
|
||||
source = system.getSource();
|
||||
}
|
||||
errors.addAll(system.getErrorsUml());
|
||||
debugs.addAll(system.debugLines);
|
||||
if (system.debugLines.size() > 0) {
|
||||
debugs.add("-");
|
||||
}
|
||||
}
|
||||
if (source == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return new PSystemError(source, errors, debugs);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.error;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.ErrorUmlType;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
|
||||
public class PSystemErrorPreprocessor extends PSystemError {
|
||||
|
||||
public PSystemErrorPreprocessor(List<StringLocated> input, List<StringLocated> trace) {
|
||||
final DiagramType type = DiagramType.getTypeFromArobaseStart(input.get(0).getString());
|
||||
this.setSource(new UmlSource(input, type == DiagramType.UML));
|
||||
this.trace = trace;
|
||||
this.singleError = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, getLastLine().getPreprocessorError(), getLastLine()
|
||||
.getLocation());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
106
src/net/sourceforge/plantuml/error/PSystemErrorUtils.java
Normal file
106
src/net/sourceforge/plantuml/error/PSystemErrorUtils.java
Normal file
@ -0,0 +1,106 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.error;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
|
||||
public class PSystemErrorUtils {
|
||||
|
||||
// public static AbstractPSystemError buildV1(UmlSource source, ErrorUml singleError, List<String> debugLines) {
|
||||
// return new PSystemErrorV1(source, singleError, debugLines);
|
||||
// }
|
||||
|
||||
public static PSystemError buildV2(UmlSource source, ErrorUml singleError, List<String> debugLines,
|
||||
List<StringLocated> list) {
|
||||
// return new PSystemErrorV1(source, singleError, debugLines);
|
||||
return new PSystemErrorV2(source, list, singleError);
|
||||
}
|
||||
|
||||
public static PSystemError merge(Collection<PSystemError> ps) {
|
||||
UmlSource source = null;
|
||||
final List<ErrorUml> errors = new ArrayList<ErrorUml>();
|
||||
// final List<String> debugs = new ArrayList<String>();
|
||||
final List<PSystemErrorV2> errorsV2 = new ArrayList<PSystemErrorV2>();
|
||||
for (PSystemError system : ps) {
|
||||
if (system == null) {
|
||||
continue;
|
||||
}
|
||||
if (system.getSource() != null && source == null) {
|
||||
source = system.getSource();
|
||||
}
|
||||
errors.addAll(system.getErrorsUml());
|
||||
// if (system instanceof PSystemErrorV1) {
|
||||
// debugs.addAll(((PSystemErrorV1) system).debugLines);
|
||||
// if (((PSystemErrorV1) system).debugLines.size() > 0) {
|
||||
// debugs.add("-");
|
||||
// }
|
||||
// }
|
||||
if (system instanceof PSystemErrorV2) {
|
||||
errorsV2.add((PSystemErrorV2) system);
|
||||
}
|
||||
}
|
||||
if (source == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (errorsV2.size() > 0) {
|
||||
return mergeV2(errorsV2);
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
// return new PSystemErrorV1(source, errors, debugs);
|
||||
}
|
||||
|
||||
private static PSystemErrorV2 mergeV2(List<PSystemErrorV2> errorsV2) {
|
||||
PSystemErrorV2 result = null;
|
||||
for (PSystemErrorV2 err : errorsV2) {
|
||||
if (result == null || result.size() < err.size()) {
|
||||
result = err;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean isDiagramError(Class<? extends Diagram> type) {
|
||||
return PSystemError.class.isAssignableFrom(type);
|
||||
// return type == PSystemErrorV1.class;
|
||||
}
|
||||
|
||||
}
|
@ -31,11 +31,22 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
package net.sourceforge.plantuml.error;
|
||||
|
||||
public enum SuggestEngineStatus {
|
||||
SYNTAX_OK, CANNOT_CORRECT, ONE_SUGGESTION
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
|
||||
public class PSystemErrorV2 extends PSystemError {
|
||||
|
||||
public PSystemErrorV2(UmlSource source, List<StringLocated> trace, ErrorUml singleError) {
|
||||
this.setSource(source);
|
||||
this.trace = trace;
|
||||
this.singleError = singleError;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -44,12 +44,12 @@ import javax.imageio.ImageIO;
|
||||
|
||||
public class IconLoader {
|
||||
|
||||
private static final int NUMBER_OF_ICONS = 27;
|
||||
private static final int NUMBER_OF_ICONS = 29;
|
||||
|
||||
private final static Map<String, BufferedImage> all = new ConcurrentHashMap<String, BufferedImage>();
|
||||
|
||||
public static BufferedImage getRandom() {
|
||||
// return addTransparent(getIcon("sprite026.png"));
|
||||
// return addTransparent(getIcon("sprite028.png"));
|
||||
return addTransparent(getIcon(getSomeQuote()));
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
src/net/sourceforge/plantuml/fun/sprite027.png
Normal file
BIN
src/net/sourceforge/plantuml/fun/sprite027.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 400 B |
BIN
src/net/sourceforge/plantuml/fun/sprite028.png
Normal file
BIN
src/net/sourceforge/plantuml/fun/sprite028.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -222,6 +222,10 @@ public class FontConfiguration {
|
||||
return add(FontStyle.UNDERLINE);
|
||||
}
|
||||
|
||||
public FontConfiguration wave(HtmlColor color) {
|
||||
return add(FontStyle.WAVE).changeExtendedColor(color);
|
||||
}
|
||||
|
||||
public FontConfiguration hyperlink() {
|
||||
if (useUnderlineForHyperlink) {
|
||||
return add(FontStyle.UNDERLINE).withHyperlink();
|
||||
|
@ -41,6 +41,7 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.svek.IEntityImage;
|
||||
import net.sourceforge.plantuml.svek.Margins;
|
||||
@ -58,13 +59,9 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage {
|
||||
|
||||
private final HtmlColor background;
|
||||
|
||||
private final UFont font;
|
||||
private final static HtmlColor hyperlinkColor = HtmlColorUtils.BLUE;
|
||||
|
||||
private final HtmlColor maincolor;
|
||||
|
||||
private final HtmlColor hyperlinkColor = HtmlColorUtils.BLUE;
|
||||
|
||||
private final boolean useUnderlineForHyperlink = true;
|
||||
private final static boolean useUnderlineForHyperlink = true;
|
||||
|
||||
private final List<String> strings;
|
||||
|
||||
@ -72,63 +69,87 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage {
|
||||
|
||||
private final GraphicPosition position;
|
||||
|
||||
private final FontConfiguration fontConfiguration;
|
||||
|
||||
public static IEntityImage createForError(List<String> strings, boolean useRed) {
|
||||
return new GraphicStrings(strings, sansSerif14(getForeColor(useRed)).bold(), getBackColor(useRed), null, null,
|
||||
CreoleMode.NO_CREOLE);
|
||||
}
|
||||
|
||||
private static HtmlColor getForeColor(boolean useRed) {
|
||||
if (useRed) {
|
||||
return new GraphicStrings(strings, UFont.sansSerif(14).bold(), HtmlColorUtils.BLACK,
|
||||
HtmlColorUtils.RED_LIGHT, null, null);
|
||||
return HtmlColorUtils.BLACK;
|
||||
}
|
||||
return new GraphicStrings(strings, UFont.sansSerif(14).bold(), HtmlColorSet.getInstance().getColorIfValid(
|
||||
"#33FF02"), HtmlColorUtils.BLACK, null, null);
|
||||
return HtmlColorUtils.MY_GREEN;
|
||||
}
|
||||
|
||||
private static HtmlColor getBackColor(boolean useRed) {
|
||||
if (useRed) {
|
||||
return HtmlColorUtils.RED_LIGHT;
|
||||
}
|
||||
return HtmlColorUtils.BLACK;
|
||||
}
|
||||
|
||||
public static TextBlockBackcolored createGreenOnBlackMonospaced(List<String> strings) {
|
||||
return new GraphicStrings(strings, monospaced14(), HtmlColorUtils.GREEN, HtmlColorUtils.BLACK, null, null);
|
||||
return new GraphicStrings(strings, monospaced14(HtmlColorUtils.GREEN), HtmlColorUtils.BLACK, null, null,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
public static TextBlockBackcolored createBlackOnWhite(List<String> strings) {
|
||||
return new GraphicStrings(strings, sansSerif12(), HtmlColorUtils.BLACK, HtmlColorUtils.WHITE, null, null);
|
||||
return new GraphicStrings(strings, sansSerif12(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, null, null,
|
||||
CreoleMode.FULL);
|
||||
}
|
||||
|
||||
public static TextBlockBackcolored createBlackOnWhiteMonospaced(List<String> strings) {
|
||||
return new GraphicStrings(strings, monospaced14(), HtmlColorUtils.BLACK, HtmlColorUtils.WHITE, null, null);
|
||||
return new GraphicStrings(strings, monospaced14(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, null, null,
|
||||
CreoleMode.FULL);
|
||||
}
|
||||
|
||||
public static TextBlockBackcolored createBlackOnWhite(List<String> strings, BufferedImage image,
|
||||
GraphicPosition position) {
|
||||
return new GraphicStrings(strings, sansSerif12(), HtmlColorUtils.BLACK, HtmlColorUtils.WHITE, image, position);
|
||||
return new GraphicStrings(strings, sansSerif12(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, image, position,
|
||||
CreoleMode.FULL);
|
||||
}
|
||||
|
||||
private static UFont sansSerif12() {
|
||||
return UFont.sansSerif(12);
|
||||
private static FontConfiguration sansSerif12(HtmlColor color) {
|
||||
return new FontConfiguration(UFont.sansSerif(12), color, hyperlinkColor, useUnderlineForHyperlink);
|
||||
}
|
||||
|
||||
private static UFont monospaced14() {
|
||||
return UFont.monospaced(14);
|
||||
public static FontConfiguration sansSerif14(HtmlColor color) {
|
||||
return new FontConfiguration(UFont.sansSerif(14), color, hyperlinkColor, useUnderlineForHyperlink);
|
||||
}
|
||||
|
||||
private GraphicStrings(List<String> strings, UFont font, HtmlColor maincolor, HtmlColor background,
|
||||
BufferedImage image, GraphicPosition position) {
|
||||
private static FontConfiguration monospaced14(HtmlColor color) {
|
||||
return new FontConfiguration(UFont.monospaced(14), color, hyperlinkColor, useUnderlineForHyperlink);
|
||||
}
|
||||
|
||||
private final CreoleMode mode;
|
||||
|
||||
private GraphicStrings(List<String> strings, FontConfiguration fontConfiguration, HtmlColor background,
|
||||
BufferedImage image, GraphicPosition position, CreoleMode mode) {
|
||||
this.strings = strings;
|
||||
this.font = font;
|
||||
this.maincolor = maincolor;
|
||||
this.background = background;
|
||||
this.image = image;
|
||||
this.position = position;
|
||||
this.mode = mode;
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
|
||||
}
|
||||
|
||||
private TextBlock getTextBlock() {
|
||||
TextBlock result = null;
|
||||
result = Display.create(strings).create(
|
||||
new FontConfiguration(font, maincolor, hyperlinkColor, useUnderlineForHyperlink),
|
||||
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
// result = DateEventUtils.addEvent(result, green);
|
||||
return result;
|
||||
final Display display = Display.create(strings);
|
||||
if (mode == CreoleMode.NO_CREOLE) {
|
||||
return new TextBlockRaw(strings, fontConfiguration);
|
||||
|
||||
} else {
|
||||
return display.create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug = ug.apply(new UTranslate(margin, margin));
|
||||
final Dimension2D size = calculateDimensionInternal(ug.getStringBounder());
|
||||
getTextBlock().drawU(ug.apply(new UChangeColor(maincolor)));
|
||||
getTextBlock().drawU(ug.apply(new UChangeColor(fontConfiguration.getColor())));
|
||||
|
||||
if (image != null) {
|
||||
if (position == GraphicPosition.BOTTOM) {
|
||||
@ -181,5 +202,4 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public class HtmlColorUtils {
|
||||
public static final HtmlColor LIGHT_GRAY;
|
||||
public static final HtmlColor MY_YELLOW;
|
||||
public static final HtmlColor MY_RED;
|
||||
public static final HtmlColor MY_GREEN;
|
||||
|
||||
public static final HtmlColor COL_C82930;
|
||||
public static final HtmlColor COL_F24D5C;
|
||||
@ -86,6 +87,7 @@ public class HtmlColorUtils {
|
||||
LIGHT_GRAY = set.getColorIfValid("#C0C0C0");
|
||||
MY_YELLOW = set.getColorIfValid("#FEFECE");
|
||||
MY_RED = set.getColorIfValid("#A80036");
|
||||
MY_GREEN = set.getColorIfValid("#33FF02");
|
||||
|
||||
COL_C82930 = set.getColorIfValid("#C82930");
|
||||
COL_F24D5C = set.getColorIfValid("#F24D5C");
|
||||
|
@ -304,7 +304,16 @@ public class QuoteUtils {
|
||||
"Dhnaq ibhf rgrf rzorgrf, rzoebhvyyrm gbhg", "Gurer nva'g ab phevat jung'f jebat jvgu gung guvat",
|
||||
"Vs lbh cevpx hf, qb jr abg oyrrq?", "V qvq lbhe wbo bapr - V jnf tbbq ng vg.",
|
||||
"Vyf cbheenvrag snver har fryrpgvba nh fgnaqneq...", "Gung'f ab jnl gb gerng n sevraq.",
|
||||
"Ubjrire ornhgvshy gur fgengrtl, lbh fubhyq bppnfvbanyyl ybbx ng gur erfhygf");
|
||||
"Ubjrire ornhgvshy gur fgengrtl, lbh fubhyq bppnfvbanyyl ybbx ng gur erfhygf",
|
||||
"Qba'g svk vg vs vg'f abg oebxra",
|
||||
"Fhqqrayl V'z gnxvat fhttrfgvbaf sebz fbzr fgebat-nez zna jvgu na VD bs zvahf 50.",
|
||||
"Fur ehvaf rirelguvat fur'f va. Fur ehvaf guvatf fur'f abg rira va.",
|
||||
"Byvir, V guvax lbh fubhyq xabj guvf: lbh'er n ubeevoyr npgerff.",
|
||||
"Lbh'er yngr! Qb lbh unir ab pbaprcg bs gvzr ?",
|
||||
"P'zba zna, yrg'f qb fbzrguvat gung ernyyl pbbxf.",
|
||||
"Nh sbaq, znvagranag, yrf qvcybzngrf ceraqenvrag cyhgbg yr cnf fhe yrf ubzzrf q'npgvba.",
|
||||
"Whfg zragnyyl gubhtu... ner lbh bxnl ?", "Jr xabj fur'f bxnl orpnhfr fur'f oybaq",
|
||||
"Gh oyhssrf Znegbav");
|
||||
|
||||
private QuoteUtils() {
|
||||
}
|
||||
|
@ -51,7 +51,24 @@ class SingleLine extends AbstractTextBlock implements Line {
|
||||
private final List<TextBlock> blocs = new ArrayList<TextBlock>();
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
|
||||
public SingleLine(String text, FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
public static SingleLine withSomeHtmlTag(String text, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer) {
|
||||
return new SingleLine(text, fontConfiguration, horizontalAlignment, spriteContainer);
|
||||
}
|
||||
|
||||
public static SingleLine rawText(String text, FontConfiguration fontConfiguration) {
|
||||
return new SingleLine(text, fontConfiguration);
|
||||
}
|
||||
|
||||
private SingleLine(String text, FontConfiguration fontConfiguration) {
|
||||
if (text.length() == 0) {
|
||||
text = " ";
|
||||
}
|
||||
this.horizontalAlignment = HorizontalAlignment.LEFT;
|
||||
this.blocs.add(new TileText(text, fontConfiguration, null));
|
||||
}
|
||||
|
||||
private SingleLine(String text, FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
SpriteContainer spriteContainer) {
|
||||
if (text.length() == 0) {
|
||||
text = " ";
|
||||
@ -139,4 +156,5 @@ class SingleLine extends AbstractTextBlock implements Line {
|
||||
public HorizontalAlignment getHorizontalAlignment() {
|
||||
return horizontalAlignment;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,6 +97,10 @@ public class SkinParameter {
|
||||
ColorParam.rectangleBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE, LineParam.rectangleBorder,
|
||||
CornerParam.rectangle);
|
||||
|
||||
public static final SkinParameter ARCHIMATE = new SkinParameter("ARCHIMATE", ColorParam.archimateBackground,
|
||||
ColorParam.archimateBorder, FontParam.ARCHIMATE, FontParam.ARCHIMATE_STEREOTYPE, LineParam.archimateBorder,
|
||||
CornerParam.archimate);
|
||||
|
||||
public static final SkinParameter COLLECTIONS = new SkinParameter("COLLECTIONS", ColorParam.collectionsBackground,
|
||||
ColorParam.collectionsBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE);
|
||||
|
||||
|
95
src/net/sourceforge/plantuml/graphic/TextBlockRaw.java
Normal file
95
src/net/sourceforge/plantuml/graphic/TextBlockRaw.java
Normal file
@ -0,0 +1,95 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class TextBlockRaw extends AbstractTextBlock implements TextBlock {
|
||||
|
||||
private List<Line> lines2;
|
||||
|
||||
private final List<String> strings;
|
||||
private final FontConfiguration fontConfiguration;
|
||||
|
||||
public TextBlockRaw(List<String> strings, FontConfiguration fontConfiguration) {
|
||||
this.strings = strings;
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
}
|
||||
|
||||
private List<Line> getLines(StringBounder stringBounder) {
|
||||
if (lines2 == null) {
|
||||
if (stringBounder == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
this.lines2 = new ArrayList<Line>();
|
||||
for (String s : strings) {
|
||||
lines2.add(SingleLine.rawText(s, fontConfiguration));
|
||||
}
|
||||
}
|
||||
return lines2;
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return getTextDimension(stringBounder);
|
||||
}
|
||||
|
||||
protected final Dimension2D getTextDimension(StringBounder stringBounder) {
|
||||
double width = 0;
|
||||
double height = 0;
|
||||
for (Line line : getLines(stringBounder)) {
|
||||
final Dimension2D size2D = line.calculateDimension(stringBounder);
|
||||
height += size2D.getHeight();
|
||||
width = Math.max(width, size2D.getWidth());
|
||||
}
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
double y = 0;
|
||||
|
||||
for (Line line : getLines(ug.getStringBounder())) {
|
||||
line.drawU(ug.apply(new UTranslate(0, y)));
|
||||
y += line.calculateDimension(ug.getStringBounder()).getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -145,15 +145,15 @@ public class TextBlockSimple extends AbstractTextBlock implements TextBlock {
|
||||
if (s.length() == 0 || MyPattern.mtches(s, "^[%s]*$ ")) {
|
||||
return;
|
||||
}
|
||||
lines2.add(new SingleLine(s, fontConfiguration, horizontalAlignment, spriteContainer));
|
||||
lines2.add(SingleLine.withSomeHtmlTag(s, fontConfiguration, horizontalAlignment, spriteContainer));
|
||||
}
|
||||
|
||||
private void addSingleLine(String s) {
|
||||
lines2.add(new SingleLine(s, fontConfiguration, horizontalAlignment, spriteContainer));
|
||||
lines2.add(SingleLine.withSomeHtmlTag(s, fontConfiguration, horizontalAlignment, spriteContainer));
|
||||
}
|
||||
|
||||
private double getTextWidth(StringBounder stringBounder, String s) {
|
||||
final Line line = new SingleLine(s, fontConfiguration, horizontalAlignment, spriteContainer);
|
||||
final Line line = SingleLine.withSomeHtmlTag(s, fontConfiguration, horizontalAlignment, spriteContainer);
|
||||
return line.calculateDimension(stringBounder).getWidth();
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ public class TextBlockSimple extends AbstractTextBlock implements TextBlock {
|
||||
assert s.getLabel(Guillemet.DOUBLE_COMPARATOR) != null;
|
||||
final List<SingleLine> result = new ArrayList<SingleLine>();
|
||||
for (String st : s.getLabels(spriteContainer.guillemet())) {
|
||||
result.add(new SingleLine(st, fontConfiguration, horizontalAlignment, spriteContainer));
|
||||
result.add(SingleLine.withSomeHtmlTag(st, fontConfiguration, horizontalAlignment, spriteContainer));
|
||||
}
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
@ -124,6 +124,11 @@ public class TextBlockUtils {
|
||||
return new TextBlockVertical2(b1, b2, horizontalAlignment);
|
||||
}
|
||||
|
||||
// public static TextBlockBackcolored mergeColoredTB(TextBlockBackcolored b1, TextBlockBackcolored b2,
|
||||
// HorizontalAlignment horizontalAlignment) {
|
||||
// return addBackcolor(mergeTB(b1, b2, horizontalAlignment), b1.getBackcolor());
|
||||
// }
|
||||
|
||||
public static MinMax getMinMax(TextBlock tb, StringBounder stringBounder) {
|
||||
final LimitFinder limitFinder = new LimitFinder(stringBounder, false);
|
||||
tb.drawU(limitFinder);
|
||||
|
@ -58,14 +58,16 @@ public abstract class USymbol {
|
||||
public final static USymbol ARTIFACT = record("ARTIFACT", SkinParameter.ARTIFACT, new USymbolArtifact());
|
||||
public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE, new USymbolFolder(
|
||||
SkinParameter.PACKAGE, true));
|
||||
public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER, new USymbolFolder(SkinParameter.FOLDER, false));
|
||||
public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER, new USymbolFolder(SkinParameter.FOLDER,
|
||||
false));
|
||||
public final static USymbol FILE = record("FILE", SkinParameter.FILE, new USymbolFile());
|
||||
public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE, new USymbolRect(
|
||||
SkinParameter.RECTANGLE, HorizontalAlignment.CENTER));
|
||||
SkinParameter.RECTANGLE));
|
||||
public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE, new USymbolRect(
|
||||
SkinParameter.ARCHIMATE));
|
||||
public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS, new USymbolCollections(
|
||||
SkinParameter.RECTANGLE, HorizontalAlignment.CENTER));
|
||||
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT,
|
||||
HorizontalAlignment.CENTER));
|
||||
SkinParameter.RECTANGLE));
|
||||
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT));
|
||||
public final static USymbol ACTOR = record("ACTOR", SkinParameter.ACTOR, new USymbolActor());
|
||||
public final static USymbol USECASE = null;
|
||||
public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1());
|
||||
@ -81,9 +83,9 @@ public abstract class USymbol {
|
||||
|
||||
abstract public SkinParameter getSkinParameter();
|
||||
|
||||
public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
return this;
|
||||
}
|
||||
// public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public FontParam getFontParam() {
|
||||
return getSkinParameter().getFontParam();
|
||||
@ -124,10 +126,11 @@ public abstract class USymbol {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public abstract TextBlock asSmall(TextBlock name, TextBlock label, TextBlock stereotype, SymbolContext symbolContext);
|
||||
public abstract TextBlock asSmall(TextBlock name, TextBlock label, TextBlock stereotype,
|
||||
SymbolContext symbolContext, HorizontalAlignment stereoAlignment);
|
||||
|
||||
public abstract TextBlock asBig(TextBlock label, HorizontalAlignment labelAlignment, TextBlock stereotype,
|
||||
double width, double height, SymbolContext symbolContext);
|
||||
double width, double height, SymbolContext symbolContext, HorizontalAlignment stereoAlignment);
|
||||
|
||||
static class Margin {
|
||||
private final double x1;
|
||||
|
@ -95,7 +95,7 @@ class USymbolArtifact extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -119,7 +119,7 @@ class USymbolArtifact extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -73,7 +73,7 @@ class USymbolCard extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -96,7 +96,7 @@ class USymbolCard extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -216,7 +216,7 @@ class USymbolCloud extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -239,7 +239,7 @@ class USymbolCloud extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -47,17 +47,17 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
class USymbolCollections extends USymbol {
|
||||
|
||||
private final SkinParameter skinParameter;
|
||||
private final HorizontalAlignment stereotypeAlignement;
|
||||
// private final HorizontalAlignment stereotypeAlignement;
|
||||
|
||||
public USymbolCollections(SkinParameter skinParameter, HorizontalAlignment stereotypeAlignement) {
|
||||
public USymbolCollections(SkinParameter skinParameter) {
|
||||
this.skinParameter = skinParameter;
|
||||
this.stereotypeAlignement = stereotypeAlignement;
|
||||
// this.stereotypeAlignement = stereotypeAlignement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
return new USymbolCollections(skinParameter, alignment);
|
||||
}
|
||||
// @Override
|
||||
// public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
// return new USymbolCollections(skinParameter, alignment);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public SkinParameter getSkinParameter() {
|
||||
@ -85,7 +85,7 @@ class USymbolCollections extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -95,7 +95,7 @@ class USymbolCollections extends USymbol {
|
||||
drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
final Margin margin = getMargin();
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereotypeAlignement);
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
|
||||
tb.drawU(ug.apply(new UTranslate(margin.getX1() - getDeltaCollection() / 2, margin.getY1()
|
||||
- getDeltaCollection() / 2)));
|
||||
}
|
||||
@ -110,7 +110,7 @@ class USymbolCollections extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
@ -120,7 +120,7 @@ class USymbolCollections extends USymbol {
|
||||
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
|
||||
final double posStereoX;
|
||||
final double posStereoY;
|
||||
if (stereotypeAlignement == HorizontalAlignment.RIGHT) {
|
||||
if (stereoAlignment == HorizontalAlignment.RIGHT) {
|
||||
posStereoX = width - dimStereo.getWidth() - getMargin().getX1() / 2;
|
||||
posStereoY = getMargin().getY1() / 2;
|
||||
} else {
|
||||
|
@ -75,7 +75,7 @@ class USymbolComponent1 extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -100,7 +100,7 @@ class USymbolComponent1 extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class USymbolComponent2 extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -104,7 +104,7 @@ class USymbolComponent2 extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -114,7 +114,7 @@ class USymbolDatabase extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -137,7 +137,7 @@ class USymbolDatabase extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -105,7 +105,7 @@ class USymbolFile extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -129,7 +129,7 @@ class USymbolFile extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -134,7 +134,7 @@ public class USymbolFolder extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(final TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@ -167,7 +167,7 @@ public class USymbolFolder extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -98,7 +98,7 @@ class USymbolFrame extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -122,7 +122,7 @@ class USymbolFrame extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -48,11 +48,22 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolNode extends USymbol {
|
||||
|
||||
// private final HorizontalAlignment stereotypeAlignement;
|
||||
|
||||
@Override
|
||||
public SkinParameter getSkinParameter() {
|
||||
return SkinParameter.NODE;
|
||||
}
|
||||
|
||||
// public USymbolNode(HorizontalAlignment stereotypeAlignement) {
|
||||
// this.stereotypeAlignement = stereotypeAlignement;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
// return new USymbolNode(alignment);
|
||||
// }
|
||||
|
||||
private void drawNode(UGraphic ug, double width, double height, boolean shadowing) {
|
||||
final UPolygon shape = new UPolygon();
|
||||
shape.addPoint(0, 10);
|
||||
@ -111,7 +122,7 @@ class USymbolNode extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -119,7 +130,7 @@ class USymbolNode extends USymbol {
|
||||
ug = symbolContext.apply(ug);
|
||||
drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
|
||||
final Margin margin = getMargin();
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
|
||||
final UGraphic ug2 = new MyUGraphicNode(ug, dim.getWidth());
|
||||
tb.drawU(ug2.apply(new UTranslate(margin.getX1(), margin.getY1())));
|
||||
}
|
||||
@ -134,7 +145,7 @@ class USymbolNode extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -144,8 +155,15 @@ class USymbolNode extends USymbol {
|
||||
ug = ug.apply(new UTranslate(-4, 11));
|
||||
|
||||
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
|
||||
final double posStereo = (width - dimStereo.getWidth()) / 2;
|
||||
stereotype.drawU(ug.apply(new UTranslate(posStereo, 2)));
|
||||
final double posStereoX;
|
||||
final double posStereoY = 2;
|
||||
if (stereoAlignment == HorizontalAlignment.RIGHT) {
|
||||
posStereoX = width - dimStereo.getWidth() - getMargin().getX1();
|
||||
} else {
|
||||
posStereoX = (width - dimStereo.getWidth()) / 2;
|
||||
|
||||
}
|
||||
stereotype.drawU(ug.apply(new UTranslate(posStereoX, posStereoY)));
|
||||
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
||||
final double posTitle = (width - dimTitle.getWidth()) / 2;
|
||||
title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight())));
|
||||
|
@ -129,7 +129,7 @@ class USymbolQueue extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -153,7 +153,7 @@ class USymbolQueue extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -49,17 +49,17 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
class USymbolRect extends USymbol {
|
||||
|
||||
private final SkinParameter skinParameter;
|
||||
private final HorizontalAlignment stereotypeAlignement;
|
||||
// private final HorizontalAlignment stereotypeAlignement;
|
||||
|
||||
public USymbolRect(SkinParameter skinParameter, HorizontalAlignment stereotypeAlignement) {
|
||||
public USymbolRect(SkinParameter skinParameter) {
|
||||
this.skinParameter = skinParameter;
|
||||
this.stereotypeAlignement = stereotypeAlignement;
|
||||
// this.stereotypeAlignement = stereotypeAlignement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
return new USymbolRect(skinParameter, alignment);
|
||||
}
|
||||
// @Override
|
||||
// public USymbol withStereoAlignment(HorizontalAlignment alignment) {
|
||||
// return new USymbolRect(skinParameter, alignment);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public SkinParameter getSkinParameter() {
|
||||
@ -96,7 +96,7 @@ class USymbolRect extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -106,7 +106,7 @@ class USymbolRect extends USymbol {
|
||||
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner(), symbolContext.getDiagonalCorner());
|
||||
final Margin margin = getMargin();
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereotypeAlignement);
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
|
||||
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ class USymbolRect extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
@ -130,7 +130,7 @@ class USymbolRect extends USymbol {
|
||||
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
|
||||
final double posStereoX;
|
||||
final double posStereoY;
|
||||
if (stereotypeAlignement == HorizontalAlignment.RIGHT) {
|
||||
if (stereoAlignment == HorizontalAlignment.RIGHT) {
|
||||
posStereoX = width - dimStereo.getWidth() - getMargin().getX1() / 2;
|
||||
posStereoY = getMargin().getY1() / 2;
|
||||
} else {
|
||||
|
@ -45,7 +45,7 @@ abstract class USymbolSimpleAbstract extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
if (stereotype == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@ -83,7 +83,7 @@ abstract class USymbolSimpleAbstract extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class USymbolStack extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -115,7 +115,7 @@ class USymbolStack extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class USymbolStorage extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -88,7 +88,7 @@ class USymbolStorage extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -49,13 +49,13 @@ class USymbolTogether extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return TextBlockUtils.empty(10, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext) {
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -69,7 +69,7 @@ public class GTileNode extends AbstractTextBlock implements GTile {
|
||||
final SheetBlock1 sheetBlock1 = getTextBlock(display);
|
||||
|
||||
final SymbolContext symbolContext = new SymbolContext(HtmlColorUtils.MY_YELLOW, HtmlColorUtils.BLACK);
|
||||
tb = USymbol.RECTANGLE.asSmall(null, sheetBlock1, TextBlockUtils.empty(0, 0), symbolContext);
|
||||
tb = USymbol.RECTANGLE.asSmall(null, sheetBlock1, TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER);
|
||||
}
|
||||
|
||||
public static SheetBlock1 getTextBlock(final Display display) {
|
||||
|
@ -90,9 +90,8 @@ public class MindMapDiagram extends UmlDiagram {
|
||||
final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100);
|
||||
final ISkinParam skinParam = getSkinParam();
|
||||
final ImageBuilder imageBuilder = new ImageBuilder(skinParam.getColorMapper(), dpiFactor,
|
||||
skinParam.getBackgroundColor(),
|
||||
fileFormatOption.isWithMetadata() ? getMetadata() : null,
|
||||
"", 10, 10, null, skinParam.handwritten());
|
||||
skinParam.getBackgroundColor(), fileFormatOption.isWithMetadata() ? getMetadata() : null, "", 10, 10,
|
||||
null, skinParam.handwritten());
|
||||
TextBlock result = getTextBlock();
|
||||
|
||||
result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result);
|
||||
|
@ -88,7 +88,7 @@ public class DiagElement {
|
||||
ColorParam.activityBorder.getDefaultValue()).withShadow(true);
|
||||
final TextBlock desc = toTextBlock(description);
|
||||
final TextBlock box = shape
|
||||
.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), symbolContext);
|
||||
.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER);
|
||||
return new LinkedElement(ad1, box, ad2, mainNetwork, this);
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class EvalBoolean {
|
||||
}
|
||||
|
||||
private boolean isIdentifier() {
|
||||
return ch == '_' || Character.isLetterOrDigit(ch);
|
||||
return ch == '_' || ch == '$' || Character.isLetterOrDigit(ch);
|
||||
}
|
||||
|
||||
public boolean eval() {
|
||||
|
@ -194,4 +194,8 @@ public class FileWithSuffix {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public String toStringDebug() {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
|
93
src/net/sourceforge/plantuml/preproc/Sub2.java
Normal file
93
src/net/sourceforge/plantuml/preproc/Sub2.java
Normal file
@ -0,0 +1,93 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.preproc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterStartsub;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TLineType;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
|
||||
public class Sub2 {
|
||||
|
||||
private final String name;
|
||||
private final List<StringLocated> lines = new ArrayList<StringLocated>();
|
||||
|
||||
public Sub2(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void add(StringLocated s) {
|
||||
this.lines.add(s);
|
||||
}
|
||||
|
||||
public final List<StringLocated> lines() {
|
||||
return Collections.unmodifiableList(lines);
|
||||
}
|
||||
|
||||
public static Sub2 fromFile(ReadLine reader, String blocname, TContext context, TMemory memory) throws IOException,
|
||||
EaterException {
|
||||
Sub2 result = null;
|
||||
StringLocated s = null;
|
||||
while ((s = reader.readLine()) != null) {
|
||||
final TLineType type = TLineType.getFromLine(s.getStringTrimmed());
|
||||
if (type == TLineType.STARTSUB) {
|
||||
final EaterStartsub eater = new EaterStartsub(s.getStringTrimmed());
|
||||
eater.execute(context, memory);
|
||||
if (eater.getSubname().equals(blocname)) {
|
||||
result = new Sub2(blocname);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (type == TLineType.ENDSUB && result != null) {
|
||||
reader.close();
|
||||
return result;
|
||||
}
|
||||
if (result != null) {
|
||||
result.add(s);
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -35,7 +35,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.preproc;
|
||||
|
||||
interface Truth {
|
||||
public interface Truth {
|
||||
public boolean isTrue(String name);
|
||||
|
||||
}
|
||||
|
@ -48,13 +48,11 @@ public class UncommentReadLine extends ReadLineInstrumented implements ReadLine
|
||||
private static final Pattern2 unpause = MyPattern.cmpile(StartUtils.PAUSE_PATTERN);
|
||||
|
||||
private final ReadLine raw;
|
||||
// private final Pattern2 start;
|
||||
private String headerToRemove;
|
||||
private boolean paused;
|
||||
|
||||
public UncommentReadLine(ReadLine source) {
|
||||
this.raw = source;
|
||||
// this.start = MyPattern.cmpile(StartUtils.START_PATTERN);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,10 +68,6 @@ public class UncommentReadLine extends ReadLineInstrumented implements ReadLine
|
||||
return null;
|
||||
}
|
||||
|
||||
// final Matcher m = start.matcher(result);
|
||||
// if (m.find()) {
|
||||
// headerToRemove = m.group(1);
|
||||
// }
|
||||
final String tmp = StartUtils.beforeStartUml(result.getString());
|
||||
if (tmp != null) {
|
||||
headerToRemove = tmp;
|
||||
|
@ -72,12 +72,12 @@ public class Preprocessor implements ReadLineNumbered {
|
||||
defines.saveState();
|
||||
}
|
||||
final ReadFilterAnd filtersV2 = new ReadFilterAnd();
|
||||
filtersV2.add(new ReadLineQuoteComment());
|
||||
filtersV2.add(new SubPreprocessor(charset, definitionsContainer));
|
||||
filtersV2.add(new ReadLineQuoteComment(true));
|
||||
filtersV2.add(new ReadLineAddConfig(config));
|
||||
this.sourceV2 = filtersV2.applyFilter(reader);
|
||||
|
||||
final ReadFilterAnd filters = new ReadFilterAnd();
|
||||
filters.add(new ReadLineQuoteComment());
|
||||
filters.add(new ReadLineQuoteComment(false));
|
||||
include = new PreprocessorInclude(config, charset, defines, definitionsContainer, importedFiles,
|
||||
filesUsedGlobal);
|
||||
filters.add(new ReadLineAddConfig(config));
|
||||
|
@ -69,6 +69,7 @@ import net.sourceforge.plantuml.preproc.ReadLineSimple;
|
||||
import net.sourceforge.plantuml.preproc.ReadLineSingle;
|
||||
import net.sourceforge.plantuml.preproc.StartDiagramExtractReader;
|
||||
import net.sourceforge.plantuml.preproc.Stdlib;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.utils.StartUtils;
|
||||
|
||||
public class PreprocessorInclude implements ReadFilter {
|
||||
@ -336,7 +337,7 @@ public class PreprocessorInclude implements ReadFilter {
|
||||
}
|
||||
}
|
||||
|
||||
public static ReadLine getReaderIncludeUrl(final URL url, StringLocated s, String suf, String charset) {
|
||||
private static ReadLine getReaderIncludeUrl(final URL url, StringLocated s, String suf, String charset) {
|
||||
try {
|
||||
if (StartDiagramExtractReader.containsStartDiagram(url, s, charset)) {
|
||||
return StartDiagramExtractReader.build(url, s, suf, charset);
|
||||
@ -355,6 +356,25 @@ public class PreprocessorInclude implements ReadFilter {
|
||||
|
||||
}
|
||||
|
||||
public static ReadLine getReaderIncludeUrl2(final URL url, StringLocated s, String suf, String charset) throws EaterException {
|
||||
try {
|
||||
if (StartDiagramExtractReader.containsStartDiagram(url, s, charset)) {
|
||||
return StartDiagramExtractReader.build(url, s, suf, charset);
|
||||
}
|
||||
final InputStream is = url.openStream();
|
||||
if (charset == null) {
|
||||
Log.info("Using default charset");
|
||||
return ReadLineReader.create(new InputStreamReader(is), url.toString(), s.getLocation());
|
||||
}
|
||||
Log.info("Using charset " + charset);
|
||||
return ReadLineReader.create(new InputStreamReader(is, charset), url.toString(), s.getLocation());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new EaterException("Cannot open URL");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Set<FileWithSuffix> getFilesUsedGlobal() {
|
||||
return filesUsedGlobal;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
package net.sourceforge.plantuml.preproc2;
|
||||
|
||||
public enum PreprocessorIncludeStrategy {
|
||||
ONCE, MANY;
|
||||
ONCE, MANY, DEFAULT;
|
||||
|
||||
public static PreprocessorIncludeStrategy fromString(String group) {
|
||||
if ("once".equalsIgnoreCase(group)) {
|
||||
|
@ -45,5 +45,7 @@ public interface PreprocessorModeSet {
|
||||
|
||||
public ImportedFiles getImportedFiles();
|
||||
|
||||
public String getCharset();
|
||||
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class ReadLineAddConfig implements ReadFilter {
|
||||
}
|
||||
result = raw.readLine();
|
||||
if (result != null && StartUtils.isArobaseStartDiagram(result.getString()) && config.size() > 0) {
|
||||
inserted = new ReadLineQuoteComment().applyFilter(new ReadLineList(config, result.getLocation()));
|
||||
inserted = new ReadLineQuoteComment(false).applyFilter(new ReadLineList(config, result.getLocation()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -42,7 +42,17 @@ import net.sourceforge.plantuml.preproc.ReadLine;
|
||||
|
||||
public class ReadLineQuoteComment implements ReadFilter {
|
||||
|
||||
private final boolean ignoreMe;
|
||||
|
||||
public ReadLineQuoteComment(boolean ignoreMe) {
|
||||
this.ignoreMe = ignoreMe;
|
||||
}
|
||||
|
||||
public ReadLine applyFilter(final ReadLine source) {
|
||||
if (ignoreMe) {
|
||||
return source;
|
||||
}
|
||||
|
||||
return new ReadLine() {
|
||||
|
||||
public void close() throws IOException {
|
||||
|
@ -178,7 +178,7 @@ public class SubPreprocessor implements ReadFilter {
|
||||
}
|
||||
|
||||
private ReadLine getReaderIncludeWithoutComment(StringLocated s, final File f) {
|
||||
return new ReadLineQuoteComment().applyFilter(getReaderIncludeRaw(s, f));
|
||||
return new ReadLineQuoteComment(false).applyFilter(getReaderIncludeRaw(s, f));
|
||||
}
|
||||
|
||||
private ReadLine getReaderIncludeRaw(StringLocated s, final File f) {
|
||||
|
@ -209,11 +209,20 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
if (circleAtStart) {
|
||||
config = config.withDecoration1(ArrowDecoration.CIRCLE);
|
||||
}
|
||||
if (dressing1.contains("x")) {
|
||||
config = config.withHead2(ArrowHead.CROSSX);
|
||||
}
|
||||
if (dressing2.contains("x")) {
|
||||
config = config.withHead2(ArrowHead.CROSSX);
|
||||
if (reverseDefine) {
|
||||
if (dressing1.contains("x")) {
|
||||
config = config.withHead2(ArrowHead.CROSSX);
|
||||
}
|
||||
if (dressing2.contains("x")) {
|
||||
config = config.withHead1(ArrowHead.CROSSX);
|
||||
}
|
||||
} else {
|
||||
if (dressing1.contains("x")) {
|
||||
config = config.withHead1(ArrowHead.CROSSX);
|
||||
}
|
||||
if (dressing2.contains("x")) {
|
||||
config = config.withHead2(ArrowHead.CROSSX);
|
||||
}
|
||||
}
|
||||
if (reverseDefine) {
|
||||
config = config.reverseDefine();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user