mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 02:49:06 +00:00
version 8039
This commit is contained in:
parent
de562c2660
commit
092b0a79bd
14
build.xml
14
build.xml
@ -20,7 +20,7 @@
|
||||
<target name="compile">
|
||||
<delete dir="build" />
|
||||
<mkdir dir="build" />
|
||||
<javac target="1.6" srcdir="src" destdir="build" />
|
||||
<javac target="1.6" srcdir="src" destdir="build" debug="on" />
|
||||
<copy file="src/net/sourceforge/plantuml/version/logo.png"
|
||||
todir="build/net/sourceforge/plantuml/version" />
|
||||
<copy file="src/net/sourceforge/plantuml/version/favicon.png"
|
||||
@ -41,6 +41,16 @@
|
||||
<include name="*.png" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="build/sprites/archimate">
|
||||
<fileset dir="src/sprites/archimate">
|
||||
<include name="*.png" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="build/net/sourceforge/plantuml/dedication">
|
||||
<fileset dir="src/net/sourceforge/plantuml/dedication">
|
||||
<include name="*.png" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="compile">
|
||||
@ -49,6 +59,8 @@
|
||||
<jar jarfile="plantuml.jar" basedir="build">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="net.sourceforge.plantuml.Run" />
|
||||
<attribute name="SplashScreen-Image" value="net/sourceforge/plantuml/version/logo.png" />
|
||||
<attribute name="Class-Path" value="batik-all-1.7.jar fop.jar" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<delete dir="build" />
|
||||
|
8
pom.xml
8
pom.xml
@ -35,7 +35,7 @@
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>8025-SNAPSHOT</version>
|
||||
<version>8040-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
@ -111,10 +111,12 @@
|
||||
<resource>
|
||||
<directory>${project.basedir}/src</directory>
|
||||
<includes>
|
||||
<include>net/sourceforge/plantuml/version/logo.png</include>
|
||||
<include>net/sourceforge/plantuml/version/favicon.png</include>
|
||||
<include>net/sourceforge/plantuml/version/*.png</include>
|
||||
<include>net/sourceforge/plantuml/openiconic/data/*.txt</include>
|
||||
<include>net/sourceforge/plantuml/openiconic/data/*.svg</include>
|
||||
<include>net/sourceforge/plantuml/fun/*.png</include>
|
||||
<include>sprite/archimate/*.png</include>
|
||||
<include>net/sourceforge/plantuml/dedication/*.png</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 19510 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -105,6 +105,7 @@ public enum ColorParam {
|
||||
sequenceDividerBorder(HtmlColorUtils.BLACK, ColorType.LINE),
|
||||
sequenceLifeLineBackground(HtmlColorUtils.WHITE, true, ColorType.BACK),
|
||||
sequenceLifeLineBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
|
||||
sequenceNewpageSeparator(HtmlColorUtils.BLACK, ColorType.LINE),
|
||||
sequenceArrow(HtmlColorUtils.MY_RED),
|
||||
sequenceBoxBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
|
||||
sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK),
|
||||
|
@ -42,7 +42,7 @@ import java.io.File;
|
||||
*
|
||||
*/
|
||||
public enum FileFormat {
|
||||
PNG, SVG, EPS, EPS_TEXT, ATXT, UTXT, XMI_STANDARD, XMI_STAR, XMI_ARGO,
|
||||
PNG, SVG, EPS, EPS_TEXT, ATXT, UTXT, XMI_STANDARD, XMI_STAR, XMI_ARGO, SCXML,
|
||||
PDF, MJPEG, ANIMATED_GIF, HTML, HTML5, VDX, LATEX, LATEX_NO_PREAMBLE, BASE64;
|
||||
|
||||
/**
|
||||
|
@ -124,7 +124,12 @@ public class NewpagedDiagram extends AbstractPSystem {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(d.getWarningOrError());
|
||||
if (d.getWarningOrError() != null) {
|
||||
sb.append(d.getWarningOrError());
|
||||
}
|
||||
}
|
||||
if (sb.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19396 $
|
||||
* Revision $Revision: 19543 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -96,6 +96,8 @@ public class Option {
|
||||
setFileFormat(FileFormat.SVG);
|
||||
} else if (s.equalsIgnoreCase("-thtml") || s.equalsIgnoreCase("-html")) {
|
||||
setFileFormat(FileFormat.HTML);
|
||||
} else if (s.equalsIgnoreCase("-tscxml") || s.equalsIgnoreCase("-scxml")) {
|
||||
setFileFormat(FileFormat.SCXML);
|
||||
} else if (s.equalsIgnoreCase("-txmi") || s.equalsIgnoreCase("-xmi")) {
|
||||
setFileFormat(FileFormat.XMI_STANDARD);
|
||||
} else if (s.equalsIgnoreCase("-txmi:argo") || s.equalsIgnoreCase("-xmi:argo")) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19254 $
|
||||
* Revision $Revision: 19604 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -75,7 +75,8 @@ public class OptionPrint {
|
||||
System.out.println(" -tpdf\t\tTo generate images using PDF format");
|
||||
System.out.println(" -tvdx\t\tTo generate images using VDX format");
|
||||
System.out.println(" -txmi\t\tTo generate XMI file for class diagram");
|
||||
System.out.println(" -thtml\t\tTo generate HTML files for class diagram");
|
||||
System.out.println(" -tscxml\t\tTo generate SCXML file for state diagram");
|
||||
System.out.println(" -thtml\t\tTo generate HTML file for class diagram");
|
||||
System.out.println(" -ttxt\t\tTo generate images with ASCII art");
|
||||
System.out.println(" -tutxt\t\tTo generate images with ASCII art using Unicode characters");
|
||||
System.out.println(" -tlatex\t\tTo generate images using LaTeX/Tikz format");
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.core.DiagramType;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.creole.PSystemCreoleFactory;
|
||||
import net.sourceforge.plantuml.cute.PSystemCuteFactory;
|
||||
import net.sourceforge.plantuml.dedication.PSystemDedicationFactory;
|
||||
import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory;
|
||||
import net.sourceforge.plantuml.directdot.PSystemDotFactory;
|
||||
import net.sourceforge.plantuml.ditaa.PSystemDitaaFactory;
|
||||
@ -159,6 +160,7 @@ public class PSystemBuilder {
|
||||
factories.add(new FlowDiagramFactory());
|
||||
factories.add(new PSystemTreeFactory(DiagramType.JUNGLE));
|
||||
factories.add(new PSystemCuteFactory(DiagramType.CUTE));
|
||||
factories.add(new PSystemDedicationFactory());
|
||||
return factories;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 19602 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -60,6 +60,22 @@ public class SignatureUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSignatureSha512(String s) {
|
||||
try {
|
||||
final AsciiEncoder coder = new AsciiEncoder();
|
||||
final MessageDigest msgDigest = MessageDigest.getInstance("SHA-512");
|
||||
msgDigest.update(s.getBytes("UTF-8"));
|
||||
final byte[] digest = msgDigest.digest();
|
||||
return coder.encode(digest);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
throw new UnsupportedOperationException(e);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
throw new UnsupportedOperationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSignatureWithoutImgSrc(String s) {
|
||||
s = getSignature(purge(s));
|
||||
return s;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19398 $
|
||||
* Revision $Revision: 19591 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -306,8 +306,8 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann
|
||||
strings.add(" - a bug in PlantUML");
|
||||
strings.add(" - a problem in GraphViz");
|
||||
strings.add(" ");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> to solve this issue.");
|
||||
strings.add("You can try to turn arround this issue by simplifing your diagram.");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> or");
|
||||
strings.add("post to <b>http://plantuml.com/qa</b> to solve this issue.");
|
||||
strings.add(" ");
|
||||
return strings;
|
||||
}
|
||||
@ -320,7 +320,8 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann
|
||||
strings.add(" ");
|
||||
strings.add("PlantUML (" + Version.versionString() + ") has crashed.");
|
||||
strings.add(" ");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> to solve this issue.");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> or");
|
||||
strings.add("post to <b>http://plantuml.com/qa</b> to solve this issue.");
|
||||
strings.add("You can try to turn arround this issue by simplifing your diagram.");
|
||||
strings.add(" ");
|
||||
return strings;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19396 $
|
||||
* Revision $Revision: 19543 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ant;
|
||||
@ -282,6 +282,9 @@ public class PlantUmlTask extends Task {
|
||||
}
|
||||
|
||||
public void setFormat(String s) {
|
||||
if ("scxml".equalsIgnoreCase(s)) {
|
||||
option.setFileFormat(FileFormat.SCXML);
|
||||
}
|
||||
if ("xmi".equalsIgnoreCase(s)) {
|
||||
option.setFileFormat(FileFormat.XMI_STANDARD);
|
||||
}
|
||||
|
@ -105,6 +105,9 @@ public class ComponentTextArrow extends AbstractComponentText {
|
||||
charArea.drawChar('>', width - 1, yarrow);
|
||||
} else if (config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE) {
|
||||
charArea.drawChar('<', 1, yarrow);
|
||||
} else if (config.getArrowDirection() == ArrowDirection.BOTH_DIRECTION) {
|
||||
charArea.drawChar('>', width - 1, yarrow);
|
||||
charArea.drawChar('<', 1, yarrow);
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -36,15 +36,14 @@ package net.sourceforge.plantuml.asciiart;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.Area;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
import net.sourceforge.plantuml.skin.Context2D;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
|
||||
public class ComponentTextNote extends AbstractComponentText {
|
||||
|
||||
@ -64,10 +63,18 @@ public class ComponentTextNote extends AbstractComponentText {
|
||||
final int width = (int) dimensionToUse.getWidth() - 1;
|
||||
final int height = (int) dimensionToUse.getHeight();
|
||||
charArea.fillRect(' ', 2, 1, width - 3, height - 2);
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawNoteSimpleUnicode(2, 0, width - 2, height);
|
||||
} else {
|
||||
charArea.drawNoteSimple(2, 0, width - 2, height);
|
||||
if (type == ComponentType.NOTE) {
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawNoteSimpleUnicode(2, 0, width - 2, height);
|
||||
} else {
|
||||
charArea.drawNoteSimple(2, 0, width - 2, height);
|
||||
}
|
||||
} else if (type == ComponentType.NOTE_BOX) {
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawBoxSimpleUnicode(2, 0, width - 2, height);
|
||||
} else {
|
||||
charArea.drawBoxSimple(2, 0, width - 2, height);
|
||||
}
|
||||
}
|
||||
charArea.drawStringsLR(stringsToDisplay.as(), 3, 1);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 19529 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.asciiart;
|
||||
@ -60,7 +60,9 @@ public class TextSkin implements Skin {
|
||||
return new ComponentTextActor(type, stringsToDisplay, fileFormat);
|
||||
}
|
||||
if (type.isArrow()
|
||||
&& ((config.getArrowDirection() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) || (config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE))) {
|
||||
&& (config.getArrowDirection() == ArrowDirection.LEFT_TO_RIGHT_NORMAL
|
||||
|| config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE || config
|
||||
.getArrowDirection() == ArrowDirection.BOTH_DIRECTION)) {
|
||||
return new ComponentTextArrow(type, config, stringsToDisplay, fileFormat, param.maxAsciiMessageLength());
|
||||
}
|
||||
if (type.isArrow() && config.isSelfArrow()) {
|
||||
@ -87,7 +89,7 @@ public class TextSkin implements Skin {
|
||||
if (type == ComponentType.ALIVE_BOX_OPEN_OPEN) {
|
||||
return new ComponentTextActiveLine(fileFormat);
|
||||
}
|
||||
if (type == ComponentType.NOTE) {
|
||||
if (type == ComponentType.NOTE || type == ComponentType.NOTE_BOX) {
|
||||
return new ComponentTextNote(type, stringsToDisplay, fileFormat);
|
||||
}
|
||||
if (type == ComponentType.DIVIDER) {
|
||||
|
@ -56,7 +56,7 @@ public class ProtectedCommand<S extends Diagram> implements Command<S> {
|
||||
} catch (Throwable t) {
|
||||
Log.error("Error " + t);
|
||||
t.printStackTrace();
|
||||
String msg = "You should send a mail to plantuml@gmail.com with this log (V" + Version.versionString()
|
||||
String msg = "You should send a mail to plantuml@gmail.com or post to http://plantuml.com/qa with this log (V" + Version.versionString()
|
||||
+ ")";
|
||||
Log.error(msg);
|
||||
msg += " " + t.toString();
|
||||
|
@ -51,19 +51,24 @@ import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
|
||||
public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
|
||||
|
||||
private RegexConcat getRegexConcatMultiLine() {
|
||||
return new RegexConcat(new RegexLeaf("^[%s]*note[%s]+"), //
|
||||
return new RegexConcat(new RegexLeaf("^[%s]*"), //
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
|
||||
new RegexLeaf("[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left)[%s]*"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
private RegexConcat getRegexConcatSingleLine() {
|
||||
return new RegexConcat(new RegexLeaf("^[%s]*note[%s]+"), //
|
||||
return new RegexConcat(new RegexLeaf("^[%s]*"), //
|
||||
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
|
||||
new RegexLeaf("[%s]+"), //
|
||||
new RegexLeaf("POSITION", "(right|left)[%s]*"), //
|
||||
ColorParser.exp1(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
@ -116,7 +121,8 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
|
||||
lines = lines.subExtract(1, 0);
|
||||
}
|
||||
|
||||
((AbstractMessage) m).setNote(lines.toDisplay(), position, line0.get("COLOR", 0), url);
|
||||
final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0));
|
||||
((AbstractMessage) m).setNote(lines.toDisplay(), position, style, line0.get("COLOR", 0), url);
|
||||
}
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19243 $
|
||||
* Revision $Revision: 19540 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -56,10 +56,12 @@ import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.jdot.CucaDiagramFileMakerJDot;
|
||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagram;
|
||||
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
|
||||
import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker;
|
||||
import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
|
||||
|
||||
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower {
|
||||
|
||||
@ -288,6 +290,11 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
maker.createFiles(suggestedFile);
|
||||
}
|
||||
|
||||
private void createFilesScxml(OutputStream suggestedFile) throws IOException {
|
||||
final StateDiagramScxmlMaker maker = new StateDiagramScxmlMaker((StateDiagram) this);
|
||||
maker.createFiles(suggestedFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
|
||||
throws IOException {
|
||||
@ -307,6 +314,11 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
return new ImageDataSimple();
|
||||
}
|
||||
|
||||
if (fileFormat == FileFormat.SCXML) {
|
||||
createFilesScxml(os);
|
||||
return new ImageDataSimple();
|
||||
}
|
||||
|
||||
if (getUmlDiagramType() == UmlDiagramType.COMPOSITE) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
102
src/net/sourceforge/plantuml/dedication/DecoderInputStream.java
Normal file
102
src/net/sourceforge/plantuml/dedication/DecoderInputStream.java
Normal file
@ -0,0 +1,102 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4041 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.dedication;
|
||||
|
||||
import java.io.FilterInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Random;
|
||||
|
||||
public class DecoderInputStream extends FilterInputStream {
|
||||
|
||||
private final byte key[];
|
||||
private int idx;
|
||||
private final Random rnd;
|
||||
|
||||
public DecoderInputStream(InputStream source, byte key[]) {
|
||||
super(source);
|
||||
this.key = key;
|
||||
this.rnd = new Random(getSeed());
|
||||
}
|
||||
|
||||
private long getSeed() {
|
||||
long result = 17;
|
||||
for (byte b : key) {
|
||||
result = result * 37 + b;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private byte getNextByte() {
|
||||
for (int i = 0; i < nextKey(); i++) {
|
||||
rnd.nextInt();
|
||||
}
|
||||
return (byte) rnd.nextInt();
|
||||
}
|
||||
|
||||
private int nextKey() {
|
||||
final int result = key[idx];
|
||||
idx++;
|
||||
if (idx >= key.length) {
|
||||
idx = 0;
|
||||
}
|
||||
if (result < 0) {
|
||||
return result + 256;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int b = super.read();
|
||||
if (b == -1) {
|
||||
return -1;
|
||||
}
|
||||
b = b ^ getNextByte();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
final int nb = super.read(b, off, len);
|
||||
if (nb == -1) {
|
||||
return nb;
|
||||
}
|
||||
for (int i = 0; i < nb; i++) {
|
||||
b[i + off] = (byte) (b[i + off] ^ getNextByte());
|
||||
}
|
||||
return nb;
|
||||
}
|
||||
|
||||
}
|
84
src/net/sourceforge/plantuml/dedication/Dedication.java
Normal file
84
src/net/sourceforge/plantuml/dedication/Dedication.java
Normal file
@ -0,0 +1,84 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4041 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.dedication;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.stream.ImageInputStream;
|
||||
|
||||
import net.sourceforge.plantuml.webp.VP8Decoder;
|
||||
|
||||
public class Dedication {
|
||||
|
||||
private final String signature;
|
||||
|
||||
public Dedication(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public byte[] getKey(String keepLetter) {
|
||||
try {
|
||||
return keepLetter.getBytes("UTF8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private InputStream getInputStream(String keepLetter) {
|
||||
final byte[] key = getKey(keepLetter);
|
||||
final InputStream tmp = PSystemDedication.class.getResourceAsStream(getSignature() + ".png");
|
||||
return new DecoderInputStream(tmp, key);
|
||||
}
|
||||
|
||||
public BufferedImage getBufferedImage(String keepLetter) {
|
||||
try {
|
||||
final InputStream is = getInputStream(keepLetter);
|
||||
final ImageInputStream iis = ImageIO.createImageInputStream(is);
|
||||
final VP8Decoder vp8Decoder = new VP8Decoder();
|
||||
vp8Decoder.decodeFrame(iis, false);
|
||||
iis.close();
|
||||
return vp8Decoder.getFrame().getBufferedImage();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
78
src/net/sourceforge/plantuml/dedication/Dedications.java
Normal file
78
src/net/sourceforge/plantuml/dedication/Dedications.java
Normal file
@ -0,0 +1,78 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4041 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.dedication;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.SignatureUtils;
|
||||
|
||||
public class Dedications {
|
||||
|
||||
private static final Map<String, Dedication> all = new HashMap<String, Dedication>();
|
||||
|
||||
static {
|
||||
addNormal("Write your own dedication!");
|
||||
addCrypted("RyHcSMMTGTW-ZlDelq18AwlwfbZZdfo-Yo0ketavjyFxRAFoKx1mAI032reWO3p4Mog-AV6jFqjXfi8G6pKo7G00");
|
||||
}
|
||||
|
||||
private static void addNormal(String sentence) {
|
||||
final String signature = SignatureUtils.getSignatureSha512(keepLetter(sentence));
|
||||
addCrypted(signature);
|
||||
}
|
||||
|
||||
private static void addCrypted(String signature) {
|
||||
all.put(signature, new Dedication(signature));
|
||||
}
|
||||
|
||||
private Dedications() {
|
||||
}
|
||||
|
||||
public static Dedication get(String line) {
|
||||
final String signature = SignatureUtils.getSignatureSha512(keepLetter(line));
|
||||
return all.get(signature);
|
||||
}
|
||||
|
||||
public static String keepLetter(String s) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
final char c = s.charAt(i);
|
||||
if (Character.isLetter(c)) {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString().toUpperCase();
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
@ -0,0 +1,80 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4041 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.dedication;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
|
||||
public class PSystemDedication extends AbstractPSystem {
|
||||
|
||||
private final Dedication dedication;
|
||||
private final String keepLetter;
|
||||
|
||||
public PSystemDedication(Dedication dedication, String keepLetter) {
|
||||
this.dedication = dedication;
|
||||
this.keepLetter = keepLetter;
|
||||
}
|
||||
|
||||
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
|
||||
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE,
|
||||
getMetadata(), null, 0, 0, null, false);
|
||||
imageBuilder.setUDrawable(new UDrawable() {
|
||||
public void drawU(UGraphic ug) {
|
||||
final BufferedImage bufferedImage = dedication.getBufferedImage(keepLetter);
|
||||
if (bufferedImage != null) {
|
||||
ug.draw(new UImage(bufferedImage));
|
||||
}
|
||||
}
|
||||
});
|
||||
return imageBuilder.writeImageTOBEMOVED(fileFormat, os);
|
||||
}
|
||||
|
||||
public DiagramDescription getDescription() {
|
||||
return new DiagramDescriptionImpl("(Dedication)", getClass());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.dedication;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.command.PSystemSingleLineFactory;
|
||||
|
||||
public class PSystemDedicationFactory extends PSystemSingleLineFactory {
|
||||
|
||||
@Override
|
||||
protected AbstractPSystem executeLine(String line) {
|
||||
final Dedication dedication = Dedications.get(line);
|
||||
if (dedication != null) {
|
||||
return new PSystemDedication(dedication, Dedications.keepLetter(line));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
@ -60,7 +60,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
|
||||
|
||||
private static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("SYMBOL", "(package|rectangle|node|artifact|folder|frame|cloud|database|storage|component|card)"), //
|
||||
new RegexLeaf("SYMBOL", "(package|rectangle|node|artifact|folder|frame|cloud|database|storage|component|card|together)"), //
|
||||
new RegexLeaf("[%s]+"), //
|
||||
new RegexLeaf("NAME", "([%g][^%g]+[%g]|[^#%s{}]*)"), //
|
||||
new RegexLeaf("AS", "(?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"), //
|
||||
|
@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
|
||||
|
||||
public class PSystemDonors extends AbstractPSystem {
|
||||
|
||||
public static final String DONORS = "UDfTKakMqp0GtFSfjFQ3GtXY2Cz9PkOvm69s7RidLgAeZIG7xBEnusAq0uxaz4hz-bTLgjna_uCSl58Wft8Rs6giuIjbCVW2Muwfyv3FetY0jOib6c1F1_H1erNFt5h8RSDEhPd2IDFp_LqwvdQqiCNaa0rGw3dH1lAucg-mxoE40TOwMuPbA6UKlOTzeAubgrRCdV0hvZlaONDv66K7ApRQgefxJr3s3_Nin49aJZeDkmGrNj9KJkM6Vg5jHCvLgsNh4TqWJAixRNk4vnHz6E75wAiC5Be-2_9xHLluvE-hRG8YeoiKuqK7DwWjjjmWb9FeRotA-gGl8nE_I-8yY4mMW_G9Fi5L_WDFvmKhsopIswIMHKR6NbpG8to9vOPXf-kMZ7f2ROQKWHbJCDu_GYi9xSSIwnyzULNq1uVojIRI_ywdG7MhDWuzHaX74iSc7_XpCfgqg0rVTUgRctE-HVuQeKgyF9rOy3p9T9UuZC-JK4_iqABfFgWt2iYTXqhueclKHay_3PyDkqd-tP_Vnjmy4FrX4g-AkxPtTpcSnPzCq2uP-SGmar2lE7kdqWluVm4JoFai";
|
||||
public static final String DONORS = "UDfTKyjosp0ClEChUDQa7w7OhLlPJZ9Msixa1bk8H9icL99oAtrRR_snGcvbKkP96Bns5wlSPFyVENYXG4xbDh3LU81NokBZCsmuXiv3FhNY7bOkfgY7alReWqQhdhYnaDkAdLenXO76p_TtgPZAqS86aqKsm59FWJQGnz5yWRAB47fOwMp-B4CneUmyb87QXgnQCBV2Rpdj8G_hyrqhErYmqLRjkFC4HNUNpuuiHAQWrR1DKECv3MLLRkWNsahaN3HQfjReUc6wkz6sDJobwCC0pqPVf66f3oT1Vije2n_zRRHDG6HqWULmri7rQeCDLmZ5AFfRWp8-gSl8n7F9E_KYayKWTO9FS1N_mDDfnifMi_3QgMMGaRPd5_G0dsEwOjZgGqD6FQ8sVSh032aOx--X5OJsGu677nrvjUps3kMq9jB_niT0XqQj7NgCa6eInoO7_3aQJKhKcYywzStLELyZVusmIxmyhfZnF4ftcxYCJwDGZ-pGecaVr1i5vDR3JlYYgzHQZvU6JuRTAF_spszZhXw8_Z29LyLTcvkx74xYZoPevenyOfXHg1USlBFJC_YvqQf4hEI_SZMfxsHhSWzgcxz-ANFu2z-Q0eS0";
|
||||
|
||||
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
|
||||
final GraphicStrings result = getGraphicStrings();
|
||||
|
@ -155,7 +155,7 @@ public class QuoteUtils {
|
||||
"There is something down there! Something not us.", //
|
||||
"I saw a glimpse of my future and everything's changed for me now.", //
|
||||
"In space no one can hear you scream", //
|
||||
"I can't lie to you about your chances, but... you have my sympathies.", //
|
||||
"I can't lie to you about your chances, but... you have my sympathies.", //
|
||||
"There is an explanation for this, you know.", //
|
||||
"Bishop: I'm afraid I have some bad news.", //
|
||||
"Do me a favour. Disconnect me. I could be reworked, but I'll never be top of the line again.", //
|
||||
@ -167,14 +167,14 @@ public class QuoteUtils {
|
||||
"United we stand", //
|
||||
"We shall never surrender", //
|
||||
"Absolute honesty isn't always the most diplomatic nor the safest form of communication with emotional beings.", //
|
||||
"Humor: seventy-five percent. [Confirmed] Self destruct sequence in T minus 10, 9... " //
|
||||
// It's... complicated.
|
||||
// Do not open until 1985
|
||||
// I still mess up but I'll just start again
|
||||
// I won't give up, no I won't give in; Till I reach the end; And then I'll start again
|
||||
// I wanna try even though I could fail
|
||||
// Sometimes we come last but we did our best
|
||||
);
|
||||
"Humor: seventy-five percent. [Confirmed] Self destruct sequence in T minus 10, 9... ", //
|
||||
"It's... complicated.", //
|
||||
"Do not open until 1985", //
|
||||
"I still mess up but I'll just start again", //
|
||||
"I won't give up, no I won't give in; Till I reach the end; And then I'll start again", //
|
||||
"I wanna try even though I could fail", //
|
||||
"Sometimes we come last but we did our best");
|
||||
|
||||
private QuoteUtils() {
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ public abstract class USymbol {
|
||||
public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2));
|
||||
public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface());
|
||||
public final static USymbol QUEUE = record("QUEUE", SkinParameter.QUEUE, new USymbolQueue());
|
||||
public final static USymbol TOGETHER = record("TOGETHER", SkinParameter.QUEUE, new USymbolTogether());
|
||||
|
||||
abstract public SkinParameter getSkinParameter();
|
||||
|
||||
|
66
src/net/sourceforge/plantuml/graphic/USymbolTogether.java
Normal file
66
src/net/sourceforge/plantuml/graphic/USymbolTogether.java
Normal file
@ -0,0 +1,66 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 8066 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
class USymbolTogether extends USymbol {
|
||||
|
||||
@Override
|
||||
public SkinParameter getSkinParameter() {
|
||||
return SkinParameter.STORAGE;
|
||||
}
|
||||
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height,
|
||||
final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -58,6 +58,8 @@ import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
@ -294,7 +296,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
final String height = "" + (shape.getHeight() / 72);
|
||||
agsafeset(node, new CString("width"), new CString(width), new CString(""));
|
||||
agsafeset(node, new CString("height"), new CString(height), new CString(""));
|
||||
System.err.println("NODE " + leaf.getUid() + " " + width + " " + height);
|
||||
// System.err.println("NODE " + leaf.getUid() + " " + width + " " + height);
|
||||
nodes.put(leaf, node);
|
||||
}
|
||||
|
||||
@ -370,8 +372,20 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
|
||||
}
|
||||
|
||||
private static final Lock lock = new ReentrantLock();
|
||||
|
||||
public ImageData createFile(OutputStream os, List<String> dotStrings, FileFormatOption fileFormatOption)
|
||||
throws IOException {
|
||||
lock.lock();
|
||||
try {
|
||||
return createFileLocked(os, dotStrings, fileFormatOption);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private ImageData createFileLocked(OutputStream os, List<String> dotStrings, FileFormatOption fileFormatOption)
|
||||
throws IOException {
|
||||
|
||||
for (ILeaf leaf : diagram.getLeafsvalues()) {
|
||||
printEntityNew(leaf);
|
||||
@ -399,9 +413,9 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
// }
|
||||
//
|
||||
for (Link link : diagram.getLinks()) {
|
||||
System.err.println("link=" + link);
|
||||
// System.err.println("link=" + link);
|
||||
final Agedge_s e = createEdge(g, link);
|
||||
System.err.println("Agedge_s=" + e);
|
||||
// System.err.println("Agedge_s=" + e);
|
||||
if (e != null) {
|
||||
edges.put(link, e);
|
||||
}
|
||||
@ -510,8 +524,8 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
// if (/* pragma.horizontalLineBetweenDifferentPackageAllowed() || */link.isInvis() || length != 1) {
|
||||
agsafeset(e, new CString("minlen"), new CString("" + (length - 1)), new CString(""));
|
||||
// }
|
||||
System.err.print("EDGE " + link.getEntity1().getUid() + "->" + link.getEntity2().getUid() + " minlen="
|
||||
+ (length - 1) + " ");
|
||||
// System.err.print("EDGE " + link.getEntity1().getUid() + "->" + link.getEntity2().getUid() + " minlen="
|
||||
// + (length - 1) + " ");
|
||||
|
||||
final TextBlock label = getLabel(link);
|
||||
if (TextBlockUtils.isEmpty(label) == false) {
|
||||
@ -520,9 +534,9 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
final CString hackDim = Macro.createHackInitDimensionFromLabel((int) dimLabel.getWidth(),
|
||||
(int) dimLabel.getHeight());
|
||||
agsafeset(e, new CString("label"), hackDim, new CString(""));
|
||||
System.err.print(" label=" + hackDim.getContent());
|
||||
// System.err.print("label=" + hackDim.getContent());
|
||||
}
|
||||
System.err.println();
|
||||
// System.err.println();
|
||||
return e;
|
||||
}
|
||||
|
||||
@ -537,7 +551,8 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
strings.add(" ");
|
||||
strings.add("Sorry, the subproject Smetana is not finished yet...");
|
||||
strings.add(" ");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> to solve this issue.");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> or");
|
||||
strings.add("post to <b>http://plantuml.com/qa</b> to solve this issue.");
|
||||
strings.add(" ");
|
||||
return strings;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ public abstract class AbstractMessage implements EventWithDeactivate {
|
||||
private NotePosition notePosition;
|
||||
private HtmlColor noteBackColor;
|
||||
private Url urlNote;
|
||||
private NoteStyle noteStyle;
|
||||
private final Url url;
|
||||
private final String messageNumber;
|
||||
private boolean parallel = false;
|
||||
@ -137,7 +138,7 @@ public abstract class AbstractMessage implements EventWithDeactivate {
|
||||
public final Display getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public final Display getLabelNumbered() {
|
||||
if (getMessageNumber() == null) {
|
||||
return getLabel();
|
||||
@ -148,7 +149,6 @@ public abstract class AbstractMessage implements EventWithDeactivate {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public final ArrowConfiguration getArrowConfiguration() {
|
||||
return arrowConfiguration;
|
||||
}
|
||||
@ -156,15 +156,20 @@ public abstract class AbstractMessage implements EventWithDeactivate {
|
||||
public final Display getNote() {
|
||||
return notes == null ? notes : notes;
|
||||
}
|
||||
|
||||
public final NoteStyle getNoteStyle() {
|
||||
return noteStyle;
|
||||
}
|
||||
|
||||
public final Url getUrlNote() {
|
||||
return urlNote;
|
||||
}
|
||||
|
||||
public final void setNote(Display strings, NotePosition notePosition, String backcolor, Url url) {
|
||||
public final void setNote(Display strings, NotePosition notePosition, NoteStyle noteStyle, String backcolor, Url url) {
|
||||
if (notePosition != NotePosition.LEFT && notePosition != NotePosition.RIGHT) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.noteStyle = noteStyle;
|
||||
this.notes = strings;
|
||||
this.urlNote = url;
|
||||
this.notePosition = overideNotePosition(notePosition);
|
||||
|
@ -33,6 +33,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
|
||||
public enum NoteStyle {
|
||||
|
||||
NORMAL, HEXAGONAL, BOX;
|
||||
@ -45,5 +47,16 @@ public enum NoteStyle {
|
||||
}
|
||||
return NoteStyle.NORMAL;
|
||||
}
|
||||
|
||||
public ComponentType getNoteComponentType() {
|
||||
if (this == NoteStyle.HEXAGONAL) {
|
||||
return ComponentType.NOTE_HEXAGONAL;
|
||||
}
|
||||
if (this == NoteStyle.BOX) {
|
||||
return ComponentType.NOTE_BOX;
|
||||
}
|
||||
return ComponentType.NOTE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 19528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -434,7 +434,7 @@ class DrawableSetInitializer {
|
||||
}
|
||||
}
|
||||
final ISkinParam skinParam = n.getSkinParamBackcolored(drawableSet.getSkinParam());
|
||||
final ComponentType type = getNoteComponentType(n.getStyle());
|
||||
final ComponentType type = n.getStyle().getNoteComponentType();
|
||||
final NoteBox noteBox = new NoteBox(freeY2.getFreeY(range), drawableSet.getSkin().createComponent(type, null,
|
||||
skinParam, n.getStrings()), p1, p2, n.getPosition(), n.getUrl());
|
||||
return noteBox;
|
||||
@ -456,16 +456,6 @@ class DrawableSetInitializer {
|
||||
freeY2 = freeY2.add(notesBoxes.getPreferredHeight(stringBounder), range);
|
||||
}
|
||||
|
||||
private ComponentType getNoteComponentType(NoteStyle noteStyle) {
|
||||
if (noteStyle == NoteStyle.HEXAGONAL) {
|
||||
return ComponentType.NOTE_HEXAGONAL;
|
||||
}
|
||||
if (noteStyle == NoteStyle.BOX) {
|
||||
return ComponentType.NOTE_BOX;
|
||||
}
|
||||
return ComponentType.NOTE;
|
||||
}
|
||||
|
||||
private void prepareLiveEvent(StringBounder stringBounder, LifeEvent lifeEvent, ParticipantRange range) {
|
||||
final double y = freeY2.getFreeY(range);
|
||||
final AbstractMessage message = lifeEvent.getMessage();
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 19528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -73,7 +73,8 @@ class Step1Message extends Step1Abstract {
|
||||
|
||||
if (message.getNote() != null) {
|
||||
final ISkinParam skinParam = message.getSkinParamNoteBackcolored(drawingSet.getSkinParam());
|
||||
setNote(drawingSet.getSkin().createComponent(ComponentType.NOTE, null, skinParam, message.getNote()));
|
||||
setNote(drawingSet.getSkin().createComponent(message.getNoteStyle().getNoteComponentType(), null,
|
||||
skinParam, message.getNote()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 19510 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -226,7 +226,7 @@ public class Rose implements Skin {
|
||||
return new ComponentRoseDestroy(getHtmlColor(param, ColorParam.sequenceLifeLineBorder));
|
||||
}
|
||||
if (type == ComponentType.NEWPAGE) {
|
||||
return new ComponentRoseNewpage(getFontColor(param, FontParam.SEQUENCE_GROUP));
|
||||
return new ComponentRoseNewpage(getHtmlColor(param, ColorParam.sequenceNewpageSeparator));
|
||||
}
|
||||
if (type == ComponentType.DIVIDER) {
|
||||
return new ComponentRoseDivider(getUFont2(param, FontParam.SEQUENCE_DIVIDER), getHtmlColor(param,
|
||||
|
@ -90,7 +90,8 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage {
|
||||
strings.add("Cannot determine dot version: " + e.toString());
|
||||
}
|
||||
strings.add(" ");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> to solve this issue.");
|
||||
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> or");
|
||||
strings.add("post to <b>http://plantuml.com/qa</b> to solve this issue.");
|
||||
strings.add("You can try to turn arround this issue by simplifing your diagram.");
|
||||
if (flashCode != null) {
|
||||
addDecodeHint(strings);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19271 $
|
||||
* Revision $Revision: 19570 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
@ -69,11 +69,11 @@ public class UImage implements UShape {
|
||||
}
|
||||
|
||||
public double getWidth() {
|
||||
return image.getWidth();
|
||||
return image.getWidth()-1;
|
||||
}
|
||||
|
||||
public double getHeight() {
|
||||
return image.getHeight();
|
||||
return image.getHeight()-1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import java.util.List;
|
||||
|
||||
public enum License {
|
||||
|
||||
GPL, LGPL, APACHE, EPL, MIT;
|
||||
GPL, LGPL, APACHE, EPL, MIT, BSD;
|
||||
|
||||
public static License getCurrent() {
|
||||
return GPL;
|
||||
@ -114,6 +114,48 @@ public enum License {
|
||||
text.add("by the very same license.");
|
||||
}
|
||||
|
||||
private void addBsd(final List<String> text) {
|
||||
text.add("PlantUML is free software; you can redistribute it and/or modify it");
|
||||
text.add("under the terms of the Revised BSD License.");
|
||||
text.add("");
|
||||
text.add("All rights reserved.");
|
||||
text.add("Redistribution and use in source and binary forms, with or without");
|
||||
text.add("modification, are permitted provided that the following conditions are met:");
|
||||
text.add("");
|
||||
text.add("* Redistributions of source code must retain the above copyright");
|
||||
text.add(" notice, this list of conditions and the following disclaimer.");
|
||||
text.add("* Redistributions in binary form must reproduce the above copyright");
|
||||
text.add(" notice, this list of conditions and the following disclaimer in the");
|
||||
text.add(" documentation and/or other materials provided with the distribution.");
|
||||
text.add("* Neither the name of the University of California, Berkeley nor the");
|
||||
text.add(" names of its contributors may be used to endorse or promote products");
|
||||
text.add(" derived from this software without specific prior written permission.");
|
||||
text.add("");
|
||||
text.add("THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY");
|
||||
text.add("EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED");
|
||||
text.add("WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE");
|
||||
text.add("DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY");
|
||||
text.add("DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES");
|
||||
text.add("(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;");
|
||||
text.add("LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND");
|
||||
text.add("ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT");
|
||||
text.add("(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS");
|
||||
text.add("SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
|
||||
text.add("");
|
||||
text.add("Note that images (whatever their format : PNG, SVG...) generated by running PlantUML");
|
||||
text.add("are owned by the author of their corresponding sources code (that is, their");
|
||||
text.add("textual description in PlantUML language). Those images are not covered by");
|
||||
text.add("the Eclipse Public License.");
|
||||
text.add("");
|
||||
text.add("The generated images can then be used without any reference to the Eclipse Public License.");
|
||||
text.add("It is not even necessary to stipulate that they have been generated with PlantUML,");
|
||||
text.add("also this will be appreciate by PlantUML team.");
|
||||
text.add("");
|
||||
text.add("There is an exception : if the textual description in PlantUML language is also covered");
|
||||
text.add("by a license (like the BSD), then the generated images are logically covered");
|
||||
text.add("by the very same license.");
|
||||
}
|
||||
|
||||
private void addApache(final List<String> text) {
|
||||
text.add("PlantUML is free software; you can redistribute it and/or modify it");
|
||||
text.add("under the terms of the Apache Software License.");
|
||||
@ -275,6 +317,32 @@ public enum License {
|
||||
h.add(" * See the License for the specific language governing permissions and");
|
||||
h.add(" * limitations under the License.");
|
||||
h.add(" * ");
|
||||
} else if (this == License.BSD) {
|
||||
h.add(" * Licensed under the Revised BSD License (the Revised Berkeley Software Distribution)");
|
||||
h.add(" * ");
|
||||
h.add(" * Redistribution and use in source and binary forms, with or without");
|
||||
h.add(" * modification, are permitted provided that the following conditions are met:");
|
||||
h.add(" * ");
|
||||
h.add(" * * Redistributions of source code must retain the above copyright");
|
||||
h.add(" * notice, this list of conditions and the following disclaimer.");
|
||||
h.add(" * * Redistributions in binary form must reproduce the above copyright");
|
||||
h.add(" * notice, this list of conditions and the following disclaimer in the");
|
||||
h.add(" * documentation and/or other materials provided with the distribution.");
|
||||
h.add(" * * Neither the name of the University of California, Berkeley nor the");
|
||||
h.add(" * names of its contributors may be used to endorse or promote products");
|
||||
h.add(" * derived from this software without specific prior written permission.");
|
||||
h.add(" * ");
|
||||
h.add(" * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY");
|
||||
h.add(" * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED");
|
||||
h.add(" * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE");
|
||||
h.add(" * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY");
|
||||
h.add(" * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES");
|
||||
h.add(" * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;");
|
||||
h.add(" * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND");
|
||||
h.add(" * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT");
|
||||
h.add(" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS");
|
||||
h.add(" * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
|
||||
h.add(" * ");
|
||||
} else if (this == License.MIT) {
|
||||
h.add(" * Licensed under The MIT License (Massachusetts Institute of Technology License)");
|
||||
h.add(" * ");
|
||||
@ -312,6 +380,8 @@ public enum License {
|
||||
addMit(text);
|
||||
} else if (this == License.EPL) {
|
||||
addEpl(text);
|
||||
} else if (this == License.BSD) {
|
||||
addBsd(text);
|
||||
} else if (this == License.APACHE) {
|
||||
addApache(text);
|
||||
} else if (this == License.LGPL) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19505 $
|
||||
* Revision $Revision: 19609 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.version;
|
||||
@ -39,7 +39,7 @@ import java.util.Date;
|
||||
public class Version {
|
||||
|
||||
public static int version() {
|
||||
return 8038;
|
||||
return 8039;
|
||||
}
|
||||
|
||||
public static String versionString() {
|
||||
@ -63,7 +63,7 @@ public class Version {
|
||||
}
|
||||
|
||||
private static long compileTime() {
|
||||
return 1459789355152L;
|
||||
return 1461342268180L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
@ -0,0 +1,138 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5616 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.xmlsc;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagram;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class ScxmlStateDiagramStandard {
|
||||
|
||||
private final StateDiagram diagram;
|
||||
private final Document document;
|
||||
|
||||
public ScxmlStateDiagramStandard(StateDiagram diagram) throws ParserConfigurationException {
|
||||
this.diagram = diagram;
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
|
||||
final DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
this.document = builder.newDocument();
|
||||
document.setXmlVersion("1.0");
|
||||
document.setXmlStandalone(true);
|
||||
|
||||
final Element scxml = document.createElement("scxml");
|
||||
scxml.setAttribute("xmlns", "http://www.w3.org/2005/07/scxml");
|
||||
scxml.setAttribute("version", "1.0");
|
||||
final String initial = getInitial();
|
||||
if (initial != null) {
|
||||
scxml.setAttribute("initial", initial);
|
||||
}
|
||||
document.appendChild(scxml);
|
||||
|
||||
for (final IEntity ent : diagram.getLeafsvalues()) {
|
||||
scxml.appendChild(createState(ent));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getInitial() {
|
||||
for (final IEntity ent : diagram.getLeafsvalues()) {
|
||||
if (ent.getEntityType() == LeafType.CIRCLE_START) {
|
||||
return getId(ent);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Element createState(IEntity entity) {
|
||||
final Element state = document.createElement("state");
|
||||
state.setAttribute("id", getId(entity));
|
||||
for (final Link link : diagram.getLinks()) {
|
||||
if (link.getEntity1() == entity) {
|
||||
addLink(state, link);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
private void addLink(Element state, Link link) {
|
||||
final Element transition = document.createElement("transition");
|
||||
final Display label = link.getLabel();
|
||||
if (Display.isNull(label) == false) {
|
||||
final String event = label.get(0).toString();
|
||||
transition.setAttribute("event", event);
|
||||
}
|
||||
transition.setAttribute("target", getId(link.getEntity2()));
|
||||
state.appendChild(transition);
|
||||
|
||||
}
|
||||
|
||||
private String getId(IEntity entity) {
|
||||
String result = entity.getDisplay().get(0).toString();
|
||||
result = result.replaceAll("\\*", "");
|
||||
return result;
|
||||
}
|
||||
|
||||
public void transformerXml(OutputStream os) throws TransformerException, ParserConfigurationException {
|
||||
final Source source = new DOMSource(document);
|
||||
|
||||
final Result resultat = new StreamResult(os);
|
||||
|
||||
final TransformerFactory fabrique = TransformerFactory.newInstance();
|
||||
final Transformer transformer = fabrique.newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
||||
transformer.transform(source, resultat);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5079 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.xmlsc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import net.sourceforge.plantuml.Log;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagram;
|
||||
|
||||
public final class StateDiagramScxmlMaker {
|
||||
|
||||
private final StateDiagram diagram;
|
||||
|
||||
public StateDiagramScxmlMaker(StateDiagram diagram) throws IOException {
|
||||
this.diagram = diagram;
|
||||
}
|
||||
|
||||
public void createFiles(OutputStream fos) throws IOException {
|
||||
try {
|
||||
final ScxmlStateDiagramStandard xmi;
|
||||
xmi = new ScxmlStateDiagramStandard(diagram);
|
||||
xmi.transformerXml(fos);
|
||||
} catch (ParserConfigurationException e) {
|
||||
Log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
throw new IOException(e.toString());
|
||||
} catch (TransformerException e) {
|
||||
Log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
throw new IOException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user