mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 8029
This commit is contained in:
parent
e7251d394d
commit
c5043d5fe3
@ -54,6 +54,16 @@ public class BlockUml {
|
|||||||
this(convert(strings), 0);
|
this(convert(strings), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFlashData() {
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (CharSequence2 line : data) {
|
||||||
|
sb.append(line);
|
||||||
|
sb.append('\r');
|
||||||
|
sb.append('\n');
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public static List<CharSequence2> convert(String... strings) {
|
public static List<CharSequence2> convert(String... strings) {
|
||||||
return convert(Arrays.asList(strings));
|
return convert(Arrays.asList(strings));
|
||||||
}
|
}
|
||||||
@ -77,7 +87,7 @@ public class BlockUml {
|
|||||||
this.data = new ArrayList<CharSequence2>(strings);
|
this.data = new ArrayList<CharSequence2>(strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFilename() {
|
public String getFileOrDirname() {
|
||||||
if (OptionFlags.getInstance().isWord()) {
|
if (OptionFlags.getInstance().isWord()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -97,6 +107,9 @@ public class BlockUml {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (result.startsWith("file://")) {
|
||||||
|
result = result.substring("file://".length());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 16206 $
|
* Revision $Revision: 16629 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml;
|
package net.sourceforge.plantuml;
|
||||||
@ -63,6 +63,7 @@ public enum FontParam {
|
|||||||
COMPONENT_STEREOTYPE(14, Font.ITALIC), //
|
COMPONENT_STEREOTYPE(14, Font.ITALIC), //
|
||||||
NOTE(13, Font.PLAIN), //
|
NOTE(13, Font.PLAIN), //
|
||||||
PACKAGE(14, Font.PLAIN), //
|
PACKAGE(14, Font.PLAIN), //
|
||||||
|
PACKAGE_STEREOTYPE(14, Font.ITALIC), //
|
||||||
ACTOR(14, Font.PLAIN), //
|
ACTOR(14, Font.PLAIN), //
|
||||||
ARTIFACT(14, Font.PLAIN), //
|
ARTIFACT(14, Font.PLAIN), //
|
||||||
CLOUD(14, Font.PLAIN), //
|
CLOUD(14, Font.PLAIN), //
|
||||||
|
@ -33,12 +33,14 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml;
|
package net.sourceforge.plantuml;
|
||||||
|
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@ -110,6 +112,53 @@ public class SourceFileReader implements ISourceFileReader {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private File getDirIfDirectory(String newName) {
|
||||||
|
Log.info("Checking=" + newName);
|
||||||
|
if (endsWithSlashOrAntislash(newName)) {
|
||||||
|
Log.info("It ends with / so it looks like a directory");
|
||||||
|
newName = newName.substring(0, newName.length() - 1);
|
||||||
|
File f = new File(newName);
|
||||||
|
Log.info("f=" + f);
|
||||||
|
if (f.isAbsolute() == false) {
|
||||||
|
Log.info("It's relative, so let's change it");
|
||||||
|
f = new File(outputDirectory, newName);
|
||||||
|
Log.info("f=" + f);
|
||||||
|
}
|
||||||
|
if (f.exists() == false) {
|
||||||
|
Log.info("It does not exist: let's create it");
|
||||||
|
try {
|
||||||
|
f.mkdirs();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.info("Error " + e);
|
||||||
|
}
|
||||||
|
if (f.exists() && f.isDirectory()) {
|
||||||
|
Log.info("Creation ok");
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
Log.info("We cannot create it");
|
||||||
|
} else if (f.isDirectory() == false) {
|
||||||
|
Log.info("It exists, but is not a directory: we ignore it");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
|
||||||
|
}
|
||||||
|
File f = new File(newName);
|
||||||
|
Log.info("f=" + f);
|
||||||
|
if (f.isAbsolute() == false) {
|
||||||
|
Log.info("Relative, so let's change it");
|
||||||
|
f = new File(outputDirectory, newName);
|
||||||
|
Log.info("f=" + f);
|
||||||
|
}
|
||||||
|
if (f.exists() && f.isDirectory()) {
|
||||||
|
Log.info("It's an existing directory");
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
Log.info("It's not a directory");
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public List<GeneratedImage> getGeneratedImages() throws IOException {
|
public List<GeneratedImage> getGeneratedImages() throws IOException {
|
||||||
Log.info("Reading file: " + file);
|
Log.info("Reading file: " + file);
|
||||||
|
|
||||||
@ -117,16 +166,46 @@ public class SourceFileReader implements ISourceFileReader {
|
|||||||
final List<GeneratedImage> result = new ArrayList<GeneratedImage>();
|
final List<GeneratedImage> result = new ArrayList<GeneratedImage>();
|
||||||
|
|
||||||
for (BlockUml blockUml : builder.getBlockUmls()) {
|
for (BlockUml blockUml : builder.getBlockUmls()) {
|
||||||
String newName = blockUml.getFilename();
|
String newName = blockUml.getFileOrDirname();
|
||||||
|
Log.info("name from block=" + newName);
|
||||||
if (newName == null) {
|
File suggested = null;
|
||||||
newName = fileFormatOption.getFileFormat().changeName(file.getName(), cpt++);
|
if (newName != null) {
|
||||||
|
final File dir = getDirIfDirectory(newName);
|
||||||
|
if (dir == null) {
|
||||||
|
Log.info(newName + " is not taken as a directory");
|
||||||
|
suggested = new File(outputDirectory, newName);
|
||||||
|
} else {
|
||||||
|
Log.info("We are going to create files in directory " + dir);
|
||||||
|
newName = fileFormatOption.getFileFormat().changeName(file.getName(), cpt++);
|
||||||
|
suggested = new File(dir, newName);
|
||||||
|
}
|
||||||
|
Log.info("We are going to put data in " + suggested);
|
||||||
|
}
|
||||||
|
if (suggested == null) {
|
||||||
|
newName = fileFormatOption.getFileFormat().changeName(file.getName(), cpt++);
|
||||||
|
suggested = new File(outputDirectory, newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
final File suggested = new File(outputDirectory, newName);
|
|
||||||
suggested.getParentFile().mkdirs();
|
suggested.getParentFile().mkdirs();
|
||||||
|
|
||||||
final Diagram system = blockUml.getDiagram();
|
final Diagram system;
|
||||||
|
try {
|
||||||
|
system = blockUml.getDiagram();
|
||||||
|
} catch (Throwable t) {
|
||||||
|
final GeneratedImage image = new GeneratedImage(suggested, "Crash Error", blockUml);
|
||||||
|
OutputStream os = null;
|
||||||
|
try {
|
||||||
|
os = new BufferedOutputStream(new FileOutputStream(suggested));
|
||||||
|
UmlDiagram.exportDiagramError2(os, t, fileFormatOption, null, blockUml.getFlashData(),
|
||||||
|
UmlDiagram.getFailureText2(t));
|
||||||
|
} finally {
|
||||||
|
if (os != null) {
|
||||||
|
os.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Collections.singletonList(image);
|
||||||
|
}
|
||||||
|
|
||||||
final List<File> exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption);
|
final List<File> exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption);
|
||||||
OptionFlags.getInstance().logData(file, system);
|
OptionFlags.getInstance().logData(file, system);
|
||||||
|
|
||||||
@ -153,6 +232,10 @@ public class SourceFileReader implements ISourceFileReader {
|
|||||||
return Collections.unmodifiableList(result);
|
return Collections.unmodifiableList(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean endsWithSlashOrAntislash(String newName) {
|
||||||
|
return newName.endsWith("/") || newName.endsWith("\\");
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getEncodedUrl() throws IOException {
|
public List<String> getEncodedUrl() throws IOException {
|
||||||
final List<String> result = new ArrayList<String>();
|
final List<String> result = new ArrayList<String>();
|
||||||
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder();
|
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder();
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 16549 $
|
* Revision $Revision: 16613 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml;
|
package net.sourceforge.plantuml;
|
||||||
@ -251,24 +251,27 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
|||||||
return imageData;
|
return imageData;
|
||||||
} catch (UnparsableGraphvizException e) {
|
} catch (UnparsableGraphvizException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion(), e.getDebugData());
|
exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
exportDiagramError(os, e, fileFormatOption, null, null);
|
exportDiagramError(os, e, fileFormatOption, null);
|
||||||
}
|
}
|
||||||
return new ImageDataSimple();
|
return new ImageDataSimple();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat,
|
private void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat,
|
||||||
String graphvizVersion, String svg) throws IOException {
|
String graphvizVersion) throws IOException {
|
||||||
final UFont font = new UFont("SansSerif", Font.PLAIN, 12);
|
exportDiagramError2(os, exception, fileFormat, getMetadata(), getFlashData(),
|
||||||
final List<String> strings = getFailureText(exception, graphvizVersion);
|
getFailureText1(exception, graphvizVersion));
|
||||||
|
}
|
||||||
|
|
||||||
final String flash = getFlashData();
|
public static void exportDiagramError2(OutputStream os, Throwable exception, FileFormatOption fileFormat,
|
||||||
|
String metadata, String flash, List<String> strings) throws IOException {
|
||||||
|
final UFont font = new UFont("SansSerif", Font.PLAIN, 12);
|
||||||
strings.addAll(CommandExecutionResult.getStackTrace(exception));
|
strings.addAll(CommandExecutionResult.getStackTrace(exception));
|
||||||
|
|
||||||
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE,
|
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE,
|
||||||
getMetadata(), null, 0, 0, null, getSkinParam().handwritten());
|
metadata, null, 0, 0, null, false);
|
||||||
|
|
||||||
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
|
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
|
||||||
final BufferedImage im = utils.exportFlashcode(flash);
|
final BufferedImage im = utils.exportFlashcode(flash);
|
||||||
@ -296,16 +299,13 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getFlashData() {
|
private String getFlashData() {
|
||||||
// for (Map.Entry<Object, Object> ent : System.getProperties().entrySet()) {
|
|
||||||
// System.err.println("p1=" + ent.getKey() + " " + ent.getValue());
|
|
||||||
// }
|
|
||||||
final StringBuilder result = new StringBuilder();
|
final StringBuilder result = new StringBuilder();
|
||||||
final UmlSource source = getSource();
|
final UmlSource source = getSource();
|
||||||
result.append(source.getPlainString());
|
result.append(source.getPlainString());
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getFailureText(Throwable exception, String graphvizVersion) {
|
static private List<String> getFailureText1(Throwable exception, String graphvizVersion) {
|
||||||
final List<String> strings = new ArrayList<String>();
|
final List<String> strings = new ArrayList<String>();
|
||||||
strings.add("An error has occured : " + exception);
|
strings.add("An error has occured : " + exception);
|
||||||
final String quote = QuoteUtils.getSomeQuote();
|
final String quote = QuoteUtils.getSomeQuote();
|
||||||
@ -332,6 +332,20 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
|||||||
return strings;
|
return strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<String> getFailureText2(Throwable exception) {
|
||||||
|
final List<String> strings = new ArrayList<String>();
|
||||||
|
strings.add("An error has occured : " + exception);
|
||||||
|
final String quote = QuoteUtils.getSomeQuote();
|
||||||
|
strings.add("<i>" + quote);
|
||||||
|
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 can try to turn arround this issue by simplifing your diagram.");
|
||||||
|
strings.add(" ");
|
||||||
|
return strings;
|
||||||
|
}
|
||||||
|
|
||||||
private void exportDiagramInternalMjpeg(OutputStream os) throws IOException {
|
private void exportDiagramInternalMjpeg(OutputStream os) throws IOException {
|
||||||
final File f = new File("c:/test.avi");
|
final File f = new File("c:/test.avi");
|
||||||
final int nb = 150;
|
final int nb = 150;
|
||||||
|
@ -210,9 +210,10 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
if (Display.isNull(title)) {
|
if (Display.isNull(title)) {
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
final TextBlock text = title.create(new FontConfiguration(getFont(FontParam.TITLE),
|
final TextBlock text = title.create(
|
||||||
getFontColor(FontParam.TITLE, null), getSkinParam().getHyperlinkColor(), getSkinParam()
|
new FontConfiguration(getFont(FontParam.TITLE), getFontColor(FontParam.TITLE, null), getSkinParam()
|
||||||
.useUnderlineForHyperlink()), HorizontalAlignment.CENTER, getSkinParam());
|
.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER,
|
||||||
|
getSkinParam());
|
||||||
|
|
||||||
return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER);
|
return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER);
|
||||||
}
|
}
|
||||||
@ -224,11 +225,11 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration(
|
final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration(
|
||||||
getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(),
|
getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(),
|
||||||
getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam());
|
getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam());
|
||||||
final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration(
|
final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration(
|
||||||
getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(),
|
getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(),
|
||||||
getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam());
|
getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam());
|
||||||
|
|
||||||
return new DecorateTextBlock(original, textHeader, getHeaderAlignment(), textFooter, getFooterAlignment());
|
return new DecorateTextBlock(original, textHeader, getHeaderAlignment(), textFooter, getFooterAlignment());
|
||||||
}
|
}
|
||||||
@ -252,7 +253,10 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
|
|
||||||
public CommandExecutionResult forkAgain() {
|
public CommandExecutionResult forkAgain() {
|
||||||
if (current() instanceof InstructionFork) {
|
if (current() instanceof InstructionFork) {
|
||||||
((InstructionFork) current()).forkAgain();
|
final InstructionFork currentFork = (InstructionFork) current();
|
||||||
|
currentFork.manageOutRendering(nextLinkRenderer());
|
||||||
|
setNextLinkRendererInternal(null);
|
||||||
|
currentFork.forkAgain();
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
return CommandExecutionResult.error("Cannot find fork");
|
return CommandExecutionResult.error("Cannot find fork");
|
||||||
@ -260,7 +264,10 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
|
|
||||||
public CommandExecutionResult endFork() {
|
public CommandExecutionResult endFork() {
|
||||||
if (current() instanceof InstructionFork) {
|
if (current() instanceof InstructionFork) {
|
||||||
setCurrent(((InstructionFork) current()).getParent());
|
final InstructionFork currentFork = (InstructionFork) current();
|
||||||
|
currentFork.manageOutRendering(nextLinkRenderer());
|
||||||
|
setNextLinkRendererInternal(null);
|
||||||
|
setCurrent(currentFork.getParent());
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
return CommandExecutionResult.error("Cannot find fork");
|
return CommandExecutionResult.error("Cannot find fork");
|
||||||
@ -385,7 +392,8 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
|
|
||||||
public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor) {
|
public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor) {
|
||||||
manageSwimlaneStrategy();
|
manageSwimlaneStrategy();
|
||||||
final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor, swinlanes.getCurrentSwimlane());
|
final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor,
|
||||||
|
swinlanes.getCurrentSwimlane());
|
||||||
current().add(instructionGroup);
|
current().add(instructionGroup);
|
||||||
setCurrent(instructionGroup);
|
setCurrent(instructionGroup);
|
||||||
}
|
}
|
||||||
@ -403,8 +411,8 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setNextLink(LinkRendering linkRenderer) {
|
private void setNextLink(LinkRendering linkRenderer) {
|
||||||
if (current() instanceof InstructionList) {
|
if (current() instanceof InstructionCollection) {
|
||||||
final Instruction last = ((InstructionList) current()).getLast();
|
final Instruction last = ((InstructionCollection) current()).getLast();
|
||||||
if (last instanceof InstructionWhile) {
|
if (last instanceof InstructionWhile) {
|
||||||
((InstructionWhile) last).afterEndwhile(linkRenderer);
|
((InstructionWhile) last).afterEndwhile(linkRenderer);
|
||||||
}
|
}
|
||||||
@ -415,6 +423,11 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
private final Rose rose = new Rose();
|
private final Rose rose = new Rose();
|
||||||
|
|
||||||
public void setLabelNextArrow(Display label) {
|
public void setLabelNextArrow(Display label) {
|
||||||
|
if (current() instanceof InstructionWhile && ((InstructionWhile) current()).getLast() == null) {
|
||||||
|
((InstructionWhile) current()).overwriteYes(label);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (nextLinkRenderer() == null) {
|
if (nextLinkRenderer() == null) {
|
||||||
final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
|
final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
|
||||||
this.setNextLink(new LinkRendering(arrowColor));
|
this.setNextLink(new LinkRendering(arrowColor));
|
||||||
@ -431,7 +444,10 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CommandExecutionResult addNote(Display note, NotePosition position) {
|
public CommandExecutionResult addNote(Display note, NotePosition position) {
|
||||||
current().addNote(note, position);
|
final boolean ok = current().addNote(note, position);
|
||||||
|
if (ok == false) {
|
||||||
|
return CommandExecutionResult.error("Cannot add note here");
|
||||||
|
}
|
||||||
manageHasUrl(note);
|
manageHasUrl(note);
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,8 @@ public class Branch {
|
|||||||
return list.kill();
|
return list.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
list.addNote(note, position);
|
return list.addNote(note, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setInlinkRendering(LinkRendering inlinkRendering) {
|
public final void setInlinkRendering(LinkRendering inlinkRendering) {
|
||||||
|
@ -49,6 +49,6 @@ public interface Instruction extends Swimable {
|
|||||||
|
|
||||||
public LinkRendering getInLinkRendering();
|
public LinkRendering getInLinkRendering();
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position);
|
public boolean addNote(Display note, NotePosition position);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2014, Arnaud Roques
|
||||||
|
*
|
||||||
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
|
*
|
||||||
|
* 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: 9786 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.activitydiagram3;
|
||||||
|
|
||||||
|
public interface InstructionCollection extends Instruction {
|
||||||
|
|
||||||
|
public Instruction getLast();
|
||||||
|
|
||||||
|
}
|
@ -64,7 +64,7 @@ public class InstructionEnd extends MonoSwimable implements Instruction {
|
|||||||
return inlinkRendering;
|
return inlinkRendering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ public class InstructionFork implements Instruction {
|
|||||||
private InstructionList getLast() {
|
private InstructionList getLast() {
|
||||||
return forks.get(forks.size() - 1);
|
return forks.get(forks.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void add(Instruction ins) {
|
public void add(Instruction ins) {
|
||||||
getLast().add(ins);
|
getLast().add(ins);
|
||||||
@ -88,10 +87,10 @@ public class InstructionFork implements Instruction {
|
|||||||
return inlinkRendering;
|
return inlinkRendering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
getLast().addNote(note, position);
|
return getLast().addNote(note, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
public Set<Swimlane> getSwimlanes() {
|
||||||
return InstructionList.getSwimlanes2(forks);
|
return InstructionList.getSwimlanes2(forks);
|
||||||
}
|
}
|
||||||
@ -105,5 +104,11 @@ public class InstructionFork implements Instruction {
|
|||||||
return getLast().getSwimlaneOut();
|
return getLast().getSwimlaneOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void manageOutRendering(LinkRendering nextLinkRenderer) {
|
||||||
|
if (nextLinkRenderer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getLast().setOutRendering(nextLinkRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class InstructionGoto extends MonoSwimable implements Instruction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,12 +81,12 @@ public class InstructionGroup implements Instruction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
this.headerNote = note;
|
this.headerNote = note;
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
list.addNote(note, position);
|
return list.addNote(note, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
public Set<Swimlane> getSwimlanes() {
|
||||||
|
@ -133,12 +133,13 @@ public class InstructionIf implements Instruction {
|
|||||||
return inlinkRendering;
|
return inlinkRendering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
if (current.isEmpty()) {
|
if (current.isEmpty()) {
|
||||||
this.note = note;
|
this.note = note;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
current.addNote(note, position);
|
return current.addNote(note, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class InstructionLabel extends MonoSwimable implements Instruction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||||
|
|
||||||
public class InstructionList implements Instruction {
|
public class InstructionList implements Instruction, InstructionCollection {
|
||||||
|
|
||||||
private final List<Instruction> all = new ArrayList<Instruction>();
|
private final List<Instruction> all = new ArrayList<Instruction>();
|
||||||
private final Swimlane defaultSwimlane;
|
private final Swimlane defaultSwimlane;
|
||||||
@ -118,8 +118,11 @@ public class InstructionList implements Instruction {
|
|||||||
return all.get(all.size() - 1);
|
return all.get(all.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
getLast().addNote(note, position);
|
if (getLast() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getLast().addNote(note, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
public Set<Swimlane> getSwimlanes() {
|
||||||
|
@ -82,7 +82,7 @@ public class InstructionPartition implements Instruction {
|
|||||||
return list.getInLinkRendering();
|
return list.getInLinkRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ public class InstructionRepeat implements Instruction {
|
|||||||
return nextLinkRenderer;
|
return nextLinkRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
repeatList.addNote(note, position);
|
return repeatList.addNote(note, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
public Set<Swimlane> getSwimlanes() {
|
||||||
|
@ -91,9 +91,10 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
|
|||||||
return inlinkRendering;
|
return inlinkRendering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
this.note = note;
|
this.note = note;
|
||||||
this.notePosition = position;
|
this.notePosition = position;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -98,8 +98,8 @@ public class InstructionSplit implements Instruction {
|
|||||||
return inlinkRendering;
|
return inlinkRendering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
getLast().addNote(note, position);
|
return getLast().addNote(note, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
public Set<Swimlane> getSwimlanes() {
|
||||||
|
@ -61,7 +61,7 @@ public class InstructionStart extends MonoSwimable implements Instruction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class InstructionStop extends MonoSwimable implements Instruction {
|
|||||||
return inlinkRendering;
|
return inlinkRendering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||||
|
|
||||||
public class InstructionWhile implements Instruction {
|
public class InstructionWhile implements Instruction, InstructionCollection {
|
||||||
|
|
||||||
private final InstructionList repeatList = new InstructionList();
|
private final InstructionList repeatList = new InstructionList();
|
||||||
private final Instruction parent;
|
private final Instruction parent;
|
||||||
@ -52,13 +52,17 @@ public class InstructionWhile implements Instruction {
|
|||||||
private final HtmlColor color;
|
private final HtmlColor color;
|
||||||
|
|
||||||
private final Display test;
|
private final Display test;
|
||||||
private final Display yes;
|
private Display yes;
|
||||||
private Display out = Display.NULL;
|
private Display out = Display.NULL;
|
||||||
private LinkRendering endInlinkRendering;
|
private LinkRendering endInlinkRendering;
|
||||||
private LinkRendering afterEndwhile;
|
private LinkRendering afterEndwhile;
|
||||||
private final Swimlane swimlane;
|
private final Swimlane swimlane;
|
||||||
private final ISkinParam skinParam;
|
private final ISkinParam skinParam;
|
||||||
|
|
||||||
|
public void overwriteYes(Display yes) {
|
||||||
|
this.yes = yes;
|
||||||
|
}
|
||||||
|
|
||||||
public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer,
|
public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer,
|
||||||
Display yes, HtmlColor color, ISkinParam skinParam) {
|
Display yes, HtmlColor color, ISkinParam skinParam) {
|
||||||
if (test == null) {
|
if (test == null) {
|
||||||
@ -117,12 +121,13 @@ public class InstructionWhile implements Instruction {
|
|||||||
this.afterEndwhile = linkRenderer;
|
this.afterEndwhile = linkRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNote(Display note, NotePosition position) {
|
public boolean addNote(Display note, NotePosition position) {
|
||||||
if (repeatList.isEmpty()) {
|
if (repeatList.isEmpty()) {
|
||||||
this.note = note;
|
this.note = note;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
repeatList.addNote(note, position);
|
return repeatList.addNote(note, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,4 +143,9 @@ public class InstructionWhile implements Instruction {
|
|||||||
return getSwimlaneIn();
|
return getSwimlaneIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Instruction getLast() {
|
||||||
|
return repeatList.getLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,12 @@ public class ConnectionCross extends AbstractConnection {
|
|||||||
final Swimlane swimlane1 = getFtile1().getSwimlaneOut();
|
final Swimlane swimlane1 = getFtile1().getSwimlaneOut();
|
||||||
final Swimlane swimlane2 = getFtile2().getSwimlaneIn();
|
final Swimlane swimlane2 = getFtile2().getSwimlaneIn();
|
||||||
if (swimlane1 == null) {
|
if (swimlane1 == null) {
|
||||||
throw new IllegalStateException("" + getFtile1().getClass());
|
return;
|
||||||
|
// throw new IllegalStateException("" + getFtile1().getClass());
|
||||||
}
|
}
|
||||||
if (swimlane2 == null) {
|
if (swimlane2 == null) {
|
||||||
throw new IllegalStateException("" + getFtile2().getClass());
|
return;
|
||||||
|
// throw new IllegalStateException("" + getFtile2().getClass());
|
||||||
}
|
}
|
||||||
conn.drawTranslate(ug, swimlane1.getTranslate(), swimlane2.getTranslate());
|
conn.drawTranslate(ug, swimlane1.getTranslate(), swimlane2.getTranslate());
|
||||||
}
|
}
|
||||||
|
@ -36,16 +36,22 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ColorParam;
|
import net.sourceforge.plantuml.ColorParam;
|
||||||
|
import net.sourceforge.plantuml.FontParam;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||||
|
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
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.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
|
|
||||||
public class FtileFactoryDelegator implements FtileFactory {
|
public class FtileFactoryDelegator implements FtileFactory {
|
||||||
|
|
||||||
@ -63,6 +69,19 @@ public class FtileFactoryDelegator implements FtileFactory {
|
|||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final TextBlock getTextBlock(Display display) {
|
||||||
|
if (Display.isNull(display)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final ISkinParam skinParam = getSkinParam();
|
||||||
|
final UFont font = skinParam.getFont(FontParam.ACTIVITY_ARROW, null, false);
|
||||||
|
final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
|
||||||
|
final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
|
||||||
|
skinParam.useUnderlineForHyperlink());
|
||||||
|
return display.create(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.SIMPLE_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Display getInLinkRenderingDisplay(Ftile tile) {
|
protected Display getInLinkRenderingDisplay(Ftile tile) {
|
||||||
final LinkRendering linkRendering = tile.getInLinkRendering();
|
final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||||
|
@ -44,6 +44,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|||||||
public class FtileMinWidth extends FtileDecorate {
|
public class FtileMinWidth extends FtileDecorate {
|
||||||
|
|
||||||
private final double minWidth;
|
private final double minWidth;
|
||||||
|
private FtileGeometry calculateDimensionInternal;
|
||||||
|
|
||||||
public FtileMinWidth(Ftile tile, double minWidth) {
|
public FtileMinWidth(Ftile tile, double minWidth) {
|
||||||
super(tile);
|
super(tile);
|
||||||
@ -58,6 +59,13 @@ public class FtileMinWidth extends FtileDecorate {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||||
|
if (calculateDimensionInternal == null) {
|
||||||
|
calculateDimensionInternal = calculateDimensionSlow(stringBounder);
|
||||||
|
}
|
||||||
|
return calculateDimensionInternal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FtileGeometry calculateDimensionSlow(StringBounder stringBounder) {
|
||||||
final FtileGeometry geo = super.calculateDimension(stringBounder);
|
final FtileGeometry geo = super.calculateDimension(stringBounder);
|
||||||
final double left = getPoint2(geo.getLeft(), stringBounder);
|
final double left = getPoint2(geo.getLeft(), stringBounder);
|
||||||
if (geo.hasPointOut() == false) {
|
if (geo.hasPointOut() == false) {
|
||||||
|
@ -42,16 +42,16 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.Direction;
|
import net.sourceforge.plantuml.Direction;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
import net.sourceforge.plantuml.ugraphic.CompressionTransform;
|
import net.sourceforge.plantuml.ugraphic.CompressionTransform;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
@ -214,6 +214,13 @@ public class Snake implements UShape {
|
|||||||
if (mergeable == false || other.mergeable == false) {
|
if (mergeable == false || other.mergeable == false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (TextBlockUtils.isEmpty(other.textBlock) == false) {
|
||||||
|
return null;
|
||||||
|
// System.err.println("merge other.textBlock="+other.textBlock+" "+other.textBlock.calculateDimension(TextBlockUtils.getDummyStringBounder()));
|
||||||
|
}
|
||||||
|
// if (other.textBlock != null) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
if (same(this.getLast(), other.getFirst())) {
|
if (same(this.getLast(), other.getFirst())) {
|
||||||
final UPolygon oneOf = endDecoration == null ? other.endDecoration : endDecoration;
|
final UPolygon oneOf = endDecoration == null ? other.endDecoration : endDecoration;
|
||||||
final Snake result = new Snake(color, oneOf);
|
final Snake result = new Snake(color, oneOf);
|
||||||
|
@ -50,7 +50,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
|||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
|
||||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
@ -106,16 +105,4 @@ public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator {
|
|||||||
|
|
||||||
private final Rose rose = new Rose();
|
private final Rose rose = new Rose();
|
||||||
|
|
||||||
private TextBlock getTextBlock(Display display) {
|
|
||||||
// DUP1433
|
|
||||||
if (Display.isNull(display)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final ISkinParam skinParam = getSkinParam();
|
|
||||||
final UFont font = skinParam.getFont(FontParam.ACTIVITY_ARROW, null, false);
|
|
||||||
final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
|
|
||||||
final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
|
|
||||||
skinParam.useUnderlineForHyperlink());
|
|
||||||
return display.create(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.SIMPLE_LINE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ColorParam;
|
import net.sourceforge.plantuml.ColorParam;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
@ -55,6 +56,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
@ -108,9 +110,11 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
|
|||||||
|
|
||||||
private final double x;
|
private final double x;
|
||||||
private final HtmlColor arrowColor;
|
private final HtmlColor arrowColor;
|
||||||
|
private final Display label;
|
||||||
|
|
||||||
public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor) {
|
public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor) {
|
||||||
super(ftile1, ftile2);
|
super(ftile1, ftile2);
|
||||||
|
label = LinkRendering.getDisplay(ftile2.getInLinkRendering());
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.arrowColor = arrowColor;
|
this.arrowColor = arrowColor;
|
||||||
}
|
}
|
||||||
@ -118,10 +122,13 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
|
|||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
ug = ug.apply(new UTranslate(x, 0));
|
ug = ug.apply(new UTranslate(x, 0));
|
||||||
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
|
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
|
||||||
final Snake s = new Snake(arrowColor, Arrows.asToDown());
|
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
|
||||||
s.addPoint(geo.getLeft(), 0);
|
if (Display.isNull(label) == false) {
|
||||||
s.addPoint(geo.getLeft(), geo.getInY());
|
snake.setLabel(getTextBlock(label));
|
||||||
ug.draw(s);
|
}
|
||||||
|
snake.addPoint(geo.getLeft(), 0);
|
||||||
|
snake.addPoint(geo.getLeft(), geo.getInY());
|
||||||
|
ug.draw(snake);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||||
@ -131,6 +138,9 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
|
|||||||
final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());
|
final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());
|
||||||
|
|
||||||
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
|
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
|
||||||
|
if (Display.isNull(label) == false) {
|
||||||
|
snake.setLabel(getTextBlock(label));
|
||||||
|
}
|
||||||
final Point2D mp1a = translate1.getTranslated(p1);
|
final Point2D mp1a = translate1.getTranslated(p1);
|
||||||
final Point2D mp2b = translate2.getTranslated(p2);
|
final Point2D mp2b = translate2.getTranslated(p2);
|
||||||
final double middle = mp1a.getY() + 4;
|
final double middle = mp1a.getY() + 4;
|
||||||
@ -147,9 +157,11 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
|
|||||||
private final double x;
|
private final double x;
|
||||||
private final HtmlColor arrowColor;
|
private final HtmlColor arrowColor;
|
||||||
private final double height;
|
private final double height;
|
||||||
|
private final Display label;
|
||||||
|
|
||||||
public ConnectionOut(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor, double height) {
|
public ConnectionOut(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor, double height) {
|
||||||
super(ftile1, ftile2);
|
super(ftile1, ftile2);
|
||||||
|
label = LinkRendering.getDisplay(ftile1.getOutLinkRendering());
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.arrowColor = arrowColor;
|
this.arrowColor = arrowColor;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
@ -161,10 +173,13 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
|
|||||||
if (geo.hasPointOut() == false) {
|
if (geo.hasPointOut() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Snake s = new Snake(arrowColor, Arrows.asToDown());
|
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
|
||||||
s.addPoint(geo.getLeft(), geo.getOutY());
|
if (Display.isNull(label) == false) {
|
||||||
s.addPoint(geo.getLeft(), height);
|
snake.setLabel(getTextBlock(label));
|
||||||
ug.draw(s);
|
}
|
||||||
|
snake.addPoint(geo.getLeft(), geo.getOutY());
|
||||||
|
snake.addPoint(geo.getLeft(), height);
|
||||||
|
ug.draw(snake);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||||
@ -177,6 +192,9 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
|
|||||||
final Point2D p2 = new Point2D.Double(geo.getLeft(), height);
|
final Point2D p2 = new Point2D.Double(geo.getLeft(), height);
|
||||||
|
|
||||||
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
|
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
|
||||||
|
if (Display.isNull(label) == false) {
|
||||||
|
snake.setLabel(getTextBlock(label));
|
||||||
|
}
|
||||||
final Point2D mp1a = translate1.getTranslated(p1);
|
final Point2D mp1a = translate1.getTranslated(p1);
|
||||||
final Point2D mp2b = translate2.getTranslated(p2);
|
final Point2D mp2b = translate2.getTranslated(p2);
|
||||||
final double middle = mp2b.getY() - 14;
|
final double middle = mp2b.getY() - 14;
|
||||||
|
@ -40,7 +40,6 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ColorParam;
|
import net.sourceforge.plantuml.ColorParam;
|
||||||
import net.sourceforge.plantuml.FontParam;
|
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
import net.sourceforge.plantuml.OptionFlags;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||||
@ -58,17 +57,12 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMarged;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
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.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
|
||||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
|
|
||||||
@ -210,16 +204,10 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
|
|||||||
private TextBlock getTextBlock(LinkRendering linkRendering) {
|
private TextBlock getTextBlock(LinkRendering linkRendering) {
|
||||||
// DUP1433
|
// DUP1433
|
||||||
final Display display = LinkRendering.getDisplay(linkRendering);
|
final Display display = LinkRendering.getDisplay(linkRendering);
|
||||||
if (Display.isNull(display)) {
|
return getTextBlock(display);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final ISkinParam skinParam = getSkinParam();
|
|
||||||
final UFont font = skinParam.getFont(FontParam.ACTIVITY_ARROW, null, false);
|
|
||||||
final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
|
|
||||||
final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
|
|
||||||
skinParam.useUnderlineForHyperlink());
|
|
||||||
return display.create(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.SIMPLE_LINE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Ftile simpleSwimlanes(List<Ftile> all) {
|
private Ftile simpleSwimlanes(List<Ftile> all) {
|
||||||
final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
|
final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
|
||||||
|
@ -109,30 +109,33 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
|
|
||||||
public CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) {
|
public CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) {
|
||||||
lines = lines.trimSmart(1);
|
lines = lines.trimSmart(1);
|
||||||
|
lines = lines.removeComments();
|
||||||
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
|
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
|
||||||
final IEntity entity = executeArg0(diagram, line0);
|
final IEntity entity = executeArg0(diagram, line0);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return CommandExecutionResult.error("No such entity");
|
return CommandExecutionResult.error("No such entity");
|
||||||
}
|
}
|
||||||
lines = lines.subExtract(1, 1);
|
if (lines.size() > 1) {
|
||||||
final Url url;
|
lines = lines.subExtract(1, 1);
|
||||||
if (lines.size() > 0) {
|
final Url url;
|
||||||
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
|
if (lines.size() > 0) {
|
||||||
url = urlBuilder.getUrl(lines.getFirst499().toString());
|
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
|
||||||
} else {
|
url = urlBuilder.getUrl(lines.getFirst499().toString());
|
||||||
url = null;
|
} else {
|
||||||
}
|
url = null;
|
||||||
if (url != null) {
|
}
|
||||||
lines = lines.subExtract(1, 0);
|
if (url != null) {
|
||||||
}
|
lines = lines.subExtract(1, 0);
|
||||||
for (CharSequence s : lines) {
|
}
|
||||||
if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
|
for (CharSequence s : lines) {
|
||||||
diagram.setVisibilityModifierPresent(true);
|
if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
|
||||||
|
diagram.setVisibilityModifierPresent(true);
|
||||||
|
}
|
||||||
|
entity.getBodier().addFieldOrMethod(s.toString());
|
||||||
|
}
|
||||||
|
if (url != null) {
|
||||||
|
entity.addUrl(url);
|
||||||
}
|
}
|
||||||
entity.getBodier().addFieldOrMethod(s.toString());
|
|
||||||
}
|
|
||||||
if (url != null) {
|
|
||||||
entity.addUrl(url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
manageExtends("EXTENDS", diagram, line0, entity);
|
manageExtends("EXTENDS", diagram, line0, entity);
|
||||||
@ -159,8 +162,8 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
if (type2 == LeafType.INTERFACE && entity.getEntityType() != LeafType.INTERFACE) {
|
if (type2 == LeafType.INTERFACE && entity.getEntityType() != LeafType.INTERFACE) {
|
||||||
typeLink = typeLink.getDashed();
|
typeLink = typeLink.getDashed();
|
||||||
}
|
}
|
||||||
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null, system.getLabeldistance(),
|
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null,
|
||||||
system.getLabelangle());
|
system.getLabeldistance(), system.getLabelangle());
|
||||||
system.addLink(link);
|
system.addLink(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
|
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
|
|
||||||
public class BlocLines implements Iterable<CharSequence> {
|
public class BlocLines implements Iterable<CharSequence> {
|
||||||
@ -49,7 +50,7 @@ public class BlocLines implements Iterable<CharSequence> {
|
|||||||
private BlocLines(List<? extends CharSequence> lines) {
|
private BlocLines(List<? extends CharSequence> lines) {
|
||||||
this.lines = Collections.unmodifiableList(lines);
|
this.lines = Collections.unmodifiableList(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display toDisplay() {
|
public Display toDisplay() {
|
||||||
return Display.create(lines);
|
return Display.create(lines);
|
||||||
}
|
}
|
||||||
@ -57,12 +58,11 @@ public class BlocLines implements Iterable<CharSequence> {
|
|||||||
public static BlocLines single(CharSequence single) {
|
public static BlocLines single(CharSequence single) {
|
||||||
return new BlocLines(Arrays.asList(single));
|
return new BlocLines(Arrays.asList(single));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlocLines getWithNewlines(CharSequence s) {
|
public static BlocLines getWithNewlines(CharSequence s) {
|
||||||
return new BlocLines(StringUtils.getWithNewlines(s));
|
return new BlocLines(StringUtils.getWithNewlines(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BlocLines() {
|
public BlocLines() {
|
||||||
this(new ArrayList<CharSequence>());
|
this(new ArrayList<CharSequence>());
|
||||||
}
|
}
|
||||||
@ -221,4 +221,26 @@ public class BlocLines implements Iterable<CharSequence> {
|
|||||||
return lines.iterator();
|
return lines.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlocLines removeComments() {
|
||||||
|
final List<CharSequence> copy = new ArrayList<CharSequence>();
|
||||||
|
boolean inComment = false;
|
||||||
|
for (CharSequence cs : lines) {
|
||||||
|
if (inComment == false && MyPattern.mtches(cs, CommandMultilinesComment.COMMENT_SINGLE_LINE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (inComment == false && MyPattern.mtches(cs, CommandMultilinesComment.COMMENT_MULTILINE_START)) {
|
||||||
|
inComment = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (inComment && MyPattern.mtches(cs, CommandMultilinesComment.COMMENT_MULTILINE_END)) {
|
||||||
|
inComment = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (inComment == false) {
|
||||||
|
copy.add(cs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new BlocLines(copy);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,9 @@ import net.sourceforge.plantuml.core.Diagram;
|
|||||||
|
|
||||||
public class CommandComment extends SingleLineCommand<Diagram> {
|
public class CommandComment extends SingleLineCommand<Diagram> {
|
||||||
|
|
||||||
|
|
||||||
public CommandComment() {
|
public CommandComment() {
|
||||||
super("(?i)^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$");
|
super(CommandMultilinesComment.COMMENT_SINGLE_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,13 +37,17 @@ import net.sourceforge.plantuml.core.Diagram;
|
|||||||
|
|
||||||
public class CommandMultilinesComment extends CommandMultilines<Diagram> {
|
public class CommandMultilinesComment extends CommandMultilines<Diagram> {
|
||||||
|
|
||||||
|
public static final String COMMENT_MULTILINE_END = "(?i)^.*[%q]/[%s]*$";
|
||||||
|
public static final String COMMENT_MULTILINE_START = "(?i)^[%s]*/[%q].*$";
|
||||||
|
public static final String COMMENT_SINGLE_LINE = "(?i)^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$";
|
||||||
|
|
||||||
public CommandMultilinesComment() {
|
public CommandMultilinesComment() {
|
||||||
super("(?i)^[%s]*/[%q].*$");
|
super(COMMENT_MULTILINE_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPatternEnd() {
|
public String getPatternEnd() {
|
||||||
return "(?i)^.*[%q]/[%s]*$";
|
return COMMENT_MULTILINE_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandExecutionResult execute(final Diagram diagram, BlocLines lines) {
|
public CommandExecutionResult execute(final Diagram diagram, BlocLines lines) {
|
||||||
|
@ -81,7 +81,8 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasStartingQuote(CharSequence line) {
|
private boolean hasStartingQuote(CharSequence line) {
|
||||||
return MyPattern.mtches(line, "[%s]*[%q].*");
|
// return MyPattern.mtches(line, "[%s]*[%q].*");
|
||||||
|
return MyPattern.mtches(line, CommandMultilinesComment.COMMENT_SINGLE_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandExecutionResult execute(UmlDiagram diagram, BlocLines lines) {
|
public CommandExecutionResult execute(UmlDiagram diagram, BlocLines lines) {
|
||||||
@ -95,13 +96,14 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
|
|||||||
}
|
}
|
||||||
|
|
||||||
lines = lines.subExtract(1, 1);
|
lines = lines.subExtract(1, 1);
|
||||||
|
lines = lines.removeComments();
|
||||||
lines = lines.trim(true);
|
lines = lines.trim(true);
|
||||||
|
|
||||||
for (CharSequence s : lines) {
|
for (CharSequence s : lines) {
|
||||||
assert s.length() > 0;
|
assert s.length() > 0;
|
||||||
if (hasStartingQuote(s)) {
|
// if (hasStartingQuote(s)) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
if (s.toString().equals("}")) {
|
if (s.toString().equals("}")) {
|
||||||
context.pop();
|
context.pop();
|
||||||
continue;
|
continue;
|
||||||
|
@ -125,9 +125,9 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
|||||||
sys = new PSystemError(source, err, null);
|
sys = new PSystemError(source, err, null);
|
||||||
} else if (commandControl == CommandControl.OK_PARTIAL) {
|
} else if (commandControl == CommandControl.OK_PARTIAL) {
|
||||||
final IteratorCounter2 saved = it.cloneMe();
|
final IteratorCounter2 saved = it.cloneMe();
|
||||||
final boolean ok = manageMultiline(it, sys);
|
final CommandExecutionResult result = manageMultiline2(it, sys);
|
||||||
if (ok == false) {
|
if (result.isOk() == false) {
|
||||||
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.EXECUTION_ERROR, "Strange Syntax Error?",
|
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(),
|
||||||
it.currentNum() - 1, saved.next().getLocation()), null);
|
it.currentNum() - 1, saved.next().getLocation()), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -177,14 +177,14 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
|||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean manageMultiline(IteratorCounter2 it, AbstractPSystem system) {
|
private CommandExecutionResult manageMultiline2(IteratorCounter2 it, AbstractPSystem system) {
|
||||||
for (Command cmd : cmds) {
|
for (Command cmd : cmds) {
|
||||||
if (isMultilineCommandOk(it.cloneMe(), cmd) != null) {
|
if (isMultilineCommandOk(it.cloneMe(), cmd) != null) {
|
||||||
final BlocLines lines = isMultilineCommandOk(it, cmd);
|
final BlocLines lines = isMultilineCommandOk(it, cmd);
|
||||||
return cmd.execute(system, lines).isOk();
|
return cmd.execute(system, lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlocLines isMultilineCommandOk(IteratorCounter2 it, Command cmd) {
|
private BlocLines isMultilineCommandOk(IteratorCounter2 it, Command cmd) {
|
||||||
|
@ -37,6 +37,7 @@ public enum DiagramType {
|
|||||||
UML, DITAA, DOT, PROJECT, JCCKIT, SALT, TURING, FLOW, CREOLE, JUNGLE, CUTE, UNKNOWN;
|
UML, DITAA, DOT, PROJECT, JCCKIT, SALT, TURING, FLOW, CREOLE, JUNGLE, CUTE, UNKNOWN;
|
||||||
|
|
||||||
static public DiagramType getTypeFromArobaseStart(String s) {
|
static public DiagramType getTypeFromArobaseStart(String s) {
|
||||||
|
s = s.toLowerCase();
|
||||||
// if (s.startsWith("@startuml2")) {
|
// if (s.startsWith("@startuml2")) {
|
||||||
// return UML2;
|
// return UML2;
|
||||||
// }
|
// }
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 16518 $
|
* Revision $Revision: 16602 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.graphic;
|
package net.sourceforge.plantuml.graphic;
|
||||||
@ -104,6 +104,14 @@ public class TextBlockUtils {
|
|||||||
dummyStringBounder = StringBounderUtils.asStringBounder(gg);
|
dummyStringBounder = StringBounderUtils.asStringBounder(gg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isEmpty(TextBlock text) {
|
||||||
|
if (text == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final Dimension2D dim = text.calculateDimension(dummyStringBounder);
|
||||||
|
return dim.getHeight() == 0 && dim.getWidth() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static StringBounder getDummyStringBounder() {
|
public static StringBounder getDummyStringBounder() {
|
||||||
return dummyStringBounder;
|
return dummyStringBounder;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||||
@ -77,7 +78,7 @@ public class LivingSpace {
|
|||||||
private final EventsHistory eventsHistory;
|
private final EventsHistory eventsHistory;
|
||||||
private boolean create = false;
|
private boolean create = false;
|
||||||
private double createY = 0;
|
private double createY = 0;
|
||||||
|
|
||||||
private final ParticipantEnglober englober;
|
private final ParticipantEnglober englober;
|
||||||
|
|
||||||
public int getLevelAt(Tile tile, EventsHistoryMode mode) {
|
public int getLevelAt(Tile tile, EventsHistoryMode mode) {
|
||||||
@ -175,7 +176,14 @@ public class LivingSpace {
|
|||||||
ug = ug.apply(new UTranslate(0, -dim.getHeight() / 2));
|
ug = ug.apply(new UTranslate(0, -dim.getHeight() / 2));
|
||||||
}
|
}
|
||||||
final Area area = new Area(dim);
|
final Area area = new Area(dim);
|
||||||
|
final Url url = getParticipant().getUrl();
|
||||||
|
if (url != null) {
|
||||||
|
ug.startUrl(url);
|
||||||
|
}
|
||||||
comp.drawU(ug, area, context);
|
comp.drawU(ug, area, context);
|
||||||
|
if (url != null) {
|
||||||
|
ug.closeAction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) {
|
public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) {
|
||||||
@ -195,7 +203,7 @@ public class LivingSpace {
|
|||||||
}
|
}
|
||||||
return posC;
|
return posC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Real getPosC2(StringBounder stringBounder) {
|
public Real getPosC2(StringBounder stringBounder) {
|
||||||
final double delta = liveBoxes.getMaxPosition(stringBounder);
|
final double delta = liveBoxes.getMaxPosition(stringBounder);
|
||||||
return getPosC(stringBounder).addFixed(delta);
|
return getPosC(stringBounder).addFixed(delta);
|
||||||
@ -205,7 +213,7 @@ public class LivingSpace {
|
|||||||
if (posD == null) {
|
if (posD == null) {
|
||||||
this.posD = posB.addFixed(this.getPreferredWidth(stringBounder));
|
this.posD = posB.addFixed(this.getPreferredWidth(stringBounder));
|
||||||
}
|
}
|
||||||
//System.err.println("LivingSpace::getPosD "+posD.getCurrentValue());
|
// System.err.println("LivingSpace::getPosD "+posD.getCurrentValue());
|
||||||
return posD;
|
return posD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|||||||
|
|
||||||
public class MainTile implements Tile, Bordered {
|
public class MainTile implements Tile, Bordered {
|
||||||
|
|
||||||
|
private final double startingY = 8;
|
||||||
private final Real min;
|
private final Real min;
|
||||||
private final Real max;
|
private final Real max;
|
||||||
private final boolean isShowFootbox;
|
private final boolean isShowFootbox;
|
||||||
@ -103,7 +104,7 @@ public class MainTile implements Tile, Bordered {
|
|||||||
private double drawUInternal(UGraphic ug, boolean trace) {
|
private double drawUInternal(UGraphic ug, boolean trace) {
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
final List<YPositionedTile> positionedTiles = new ArrayList<YPositionedTile>();
|
final List<YPositionedTile> positionedTiles = new ArrayList<YPositionedTile>();
|
||||||
final double y = GroupingTile.fillPositionelTiles(stringBounder, 0, tiles, positionedTiles);
|
final double y = GroupingTile.fillPositionelTiles(stringBounder, startingY, tiles, positionedTiles);
|
||||||
for (YPositionedTile tile : positionedTiles) {
|
for (YPositionedTile tile : positionedTiles) {
|
||||||
tile.drawU(ug);
|
tile.drawU(ug);
|
||||||
}
|
}
|
||||||
|
@ -290,16 +290,19 @@ public class Cluster implements Moveable {
|
|||||||
this.yTitle = y;
|
this.yTitle = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HtmlColor getColor(ColorParam colorParam, ISkinParam skinParam) {
|
private static HtmlColor getColor(ColorParam colorParam, ISkinParam skinParam, Stereotype stereotype) {
|
||||||
return new Rose().getHtmlColor(skinParam, colorParam);
|
return new Rose().getHtmlColor(skinParam, colorParam, stereotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug, DotData dotData, UStroke stroke) {
|
public void drawU(UGraphic ug, DotData dotData, UStroke stroke) {
|
||||||
|
|
||||||
|
final Stereotype stereotype = group.getStereotype();
|
||||||
|
|
||||||
HtmlColor borderColor;
|
HtmlColor borderColor;
|
||||||
if (dotData.getUmlDiagramType() == UmlDiagramType.STATE) {
|
if (dotData.getUmlDiagramType() == UmlDiagramType.STATE) {
|
||||||
borderColor = getColor(ColorParam.stateBorder, dotData.getSkinParam());
|
borderColor = getColor(ColorParam.stateBorder, dotData.getSkinParam(), stereotype);
|
||||||
} else {
|
} else {
|
||||||
borderColor = getColor(ColorParam.packageBorder, dotData.getSkinParam());
|
borderColor = getColor(ColorParam.packageBorder, dotData.getSkinParam(), stereotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Url url = group.getUrl99();
|
final Url url = group.getUrl99();
|
||||||
@ -337,18 +340,17 @@ public class Cluster implements Moveable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ztitle != null || zstereo != null) {
|
if (ztitle != null || zstereo != null) {
|
||||||
final HtmlColor stateBack = getStateBackColor(getBackColor(), dotData.getSkinParam(),
|
final HtmlColor back = getBackColor(getBackColor(), dotData.getSkinParam(), group.getStereotype());
|
||||||
group.getStereotype());
|
|
||||||
final ClusterDecoration decoration = new ClusterDecoration(style, group.getUSymbol(), ztitle, zstereo,
|
final ClusterDecoration decoration = new ClusterDecoration(style, group.getUSymbol(), ztitle, zstereo,
|
||||||
stateBack, minX, minY, maxX, maxY, getStroke(dotData.getSkinParam(), group.getStereotype()));
|
minX, minY, maxX, maxY, getStroke(dotData.getSkinParam(), group.getStereotype()));
|
||||||
decoration.drawU(ug, borderColor, dotData.getSkinParam().shadowing());
|
decoration.drawU(ug, back, borderColor, dotData.getSkinParam().shadowing());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final URectangle rect = new URectangle(maxX - minX, maxY - minY);
|
final URectangle rect = new URectangle(maxX - minX, maxY - minY);
|
||||||
if (dotData.getSkinParam().shadowing()) {
|
if (dotData.getSkinParam().shadowing()) {
|
||||||
rect.setDeltaShadow(3.0);
|
rect.setDeltaShadow(3.0);
|
||||||
}
|
}
|
||||||
final HtmlColor stateBack = getStateBackColor(getBackColor(), dotData.getSkinParam(), group.getStereotype());
|
final HtmlColor stateBack = getBackColor(getBackColor(), dotData.getSkinParam(), group.getStereotype());
|
||||||
ug = ug.apply(new UChangeBackColor(stateBack)).apply(new UChangeColor(borderColor));
|
ug = ug.apply(new UChangeBackColor(stateBack)).apply(new UChangeColor(borderColor));
|
||||||
ug.apply(new UStroke(2)).apply(new UTranslate(minX, minY)).draw(rect);
|
ug.apply(new UStroke(2)).apply(new UTranslate(minX, minY)).draw(rect);
|
||||||
|
|
||||||
@ -815,17 +817,17 @@ public class Cluster implements Moveable {
|
|||||||
return group == ent;
|
return group == ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HtmlColor getStateBackColor(HtmlColor stateBack, ISkinParam skinParam, Stereotype stereotype) {
|
public static HtmlColor getBackColor(HtmlColor backColor, ISkinParam skinParam, Stereotype stereotype) {
|
||||||
if (stateBack == null) {
|
if (backColor == null) {
|
||||||
stateBack = skinParam.getHtmlColor(ColorParam.packageBackground, stereotype, false);
|
backColor = skinParam.getHtmlColor(ColorParam.packageBackground, stereotype, false);
|
||||||
}
|
}
|
||||||
if (stateBack == null) {
|
if (backColor == null) {
|
||||||
stateBack = skinParam.getHtmlColor(ColorParam.background, stereotype, false);
|
backColor = skinParam.getHtmlColor(ColorParam.background, stereotype, false);
|
||||||
}
|
}
|
||||||
if (stateBack == null /* || stateBack instanceof HtmlColorTransparent */) {
|
if (backColor == null /* || stateBack instanceof HtmlColorTransparent */) {
|
||||||
stateBack = new HtmlColorTransparent();
|
backColor = new HtmlColorTransparent();
|
||||||
}
|
}
|
||||||
return stateBack;
|
return backColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double checkFolderPosition(Point2D pt, StringBounder stringBounder) {
|
public double checkFolderPosition(Point2D pt, StringBounder stringBounder) {
|
||||||
|
@ -34,45 +34,31 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.svek;
|
package net.sourceforge.plantuml.svek;
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
||||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
|
|
||||||
public class ClusterDecoration {
|
public class ClusterDecoration {
|
||||||
|
|
||||||
private final UStroke defaultStroke;// = new UStroke(2);
|
private final UStroke defaultStroke;// = new UStroke(2);
|
||||||
final private PackageStyle style;
|
|
||||||
final private USymbol symbol;
|
final private USymbol symbol;
|
||||||
final private TextBlock title;
|
final private TextBlock title;
|
||||||
final private TextBlock stereo;
|
final private TextBlock stereo;
|
||||||
final private HtmlColor stateBack;
|
|
||||||
|
|
||||||
final private double minX;
|
final private double minX;
|
||||||
final private double minY;
|
final private double minY;
|
||||||
final private double maxX;
|
final private double maxX;
|
||||||
final private double maxY;
|
final private double maxY;
|
||||||
|
|
||||||
public ClusterDecoration(PackageStyle style, USymbol symbol, TextBlock title, TextBlock stereo,
|
public ClusterDecoration(PackageStyle style, USymbol symbol, TextBlock title, TextBlock stereo, double minX,
|
||||||
HtmlColor stateBack, double minX, double minY, double maxX, double maxY, UStroke stroke) {
|
double minY, double maxX, double maxY, UStroke stroke) {
|
||||||
this.symbol = symbol;
|
this.symbol = guess(symbol, style);
|
||||||
this.style = style;
|
|
||||||
this.stereo = stereo;
|
this.stereo = stereo;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.stateBack = stateBack;
|
|
||||||
this.minX = minX;
|
this.minX = minX;
|
||||||
this.minY = minY;
|
this.minY = minY;
|
||||||
this.maxX = maxX;
|
this.maxX = maxX;
|
||||||
@ -83,146 +69,11 @@ public class ClusterDecoration {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
private static USymbol guess(USymbol symbol, PackageStyle style) {
|
||||||
if (symbol != null) {
|
if (symbol != null) {
|
||||||
final SymbolContext symbolContext = new SymbolContext(stateBack, borderColor).withShadow(shadowing)
|
return symbol;
|
||||||
.withStroke(defaultStroke);
|
|
||||||
symbol.asBig(title, stereo, maxX - minX, maxY - minY, symbolContext).drawU(
|
|
||||||
ug.apply(new UTranslate(minX, minY)));
|
|
||||||
// ug.getParam().resetStroke();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (style == PackageStyle.NODE) {
|
return style.toUSymbol();
|
||||||
drawWithTitleNode(ug, borderColor, shadowing);
|
|
||||||
} else if (style == PackageStyle.CARD) {
|
|
||||||
drawWithTitleCard(ug, borderColor, shadowing);
|
|
||||||
} else if (style == PackageStyle.DATABASE) {
|
|
||||||
drawWithTitleDatabase(ug, borderColor, shadowing);
|
|
||||||
} else if (style == PackageStyle.CLOUD) {
|
|
||||||
drawWithTitleCloud(ug, borderColor, shadowing);
|
|
||||||
} else if (style == PackageStyle.FRAME) {
|
|
||||||
drawWithTitleFrame(ug, borderColor, shadowing);
|
|
||||||
} else if (style == PackageStyle.RECT) {
|
|
||||||
drawWithTitleRect(ug, borderColor, shadowing);
|
|
||||||
} else {
|
|
||||||
drawWithTitleFolder(ug, borderColor, shadowing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cloud
|
|
||||||
private void drawWithTitleCloud(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
|
||||||
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
|
||||||
final double width = maxX - minX;
|
|
||||||
final double height = maxY - minY;
|
|
||||||
ug = ug.apply(new UChangeBackColor(stateBack)).apply(new UChangeColor(borderColor));
|
|
||||||
ug = ug.apply(defaultStroke);
|
|
||||||
PackageStyle.CLOUD.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle,
|
|
||||||
shadowing);
|
|
||||||
ug = ug.apply(new UStroke());
|
|
||||||
title.drawU(ug.apply(new UTranslate(minX + (width - dimTitle.getWidth()) / 2, minY + 10)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Database
|
|
||||||
private void drawWithTitleDatabase(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
|
||||||
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
|
||||||
final double width = maxX - minX;
|
|
||||||
final double height = maxY - minY;
|
|
||||||
ug = ug.apply(defaultStroke);
|
|
||||||
ug = ug.apply(new UChangeBackColor(stateBack)).apply(new UChangeColor(borderColor));
|
|
||||||
PackageStyle.DATABASE.drawU(ug.apply(new UTranslate(minX, minY - 10)),
|
|
||||||
new Dimension2DDouble(width, height + 10), dimTitle, shadowing);
|
|
||||||
ug = ug.apply(new UStroke());
|
|
||||||
title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + 10)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Corner
|
|
||||||
private void drawWithTitleFrame(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
|
||||||
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
|
||||||
final double width = maxX - minX;
|
|
||||||
final double height = maxY - minY;
|
|
||||||
ug = ug.apply(new UChangeBackColor(stateBack)).apply(new UChangeColor(borderColor));
|
|
||||||
ug = ug.apply(defaultStroke);
|
|
||||||
PackageStyle.FRAME.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle,
|
|
||||||
shadowing);
|
|
||||||
ug = ug.apply(new UStroke());
|
|
||||||
title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Card
|
|
||||||
private void drawWithTitleCard(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
|
||||||
final double width = maxX - minX;
|
|
||||||
final double height = maxY - minY;
|
|
||||||
final SymbolContext ctx = new SymbolContext(stateBack, borderColor).withStroke(defaultStroke).withShadow(
|
|
||||||
shadowing);
|
|
||||||
USymbol.CARD.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU(
|
|
||||||
ug.apply(new UTranslate(minX, minY)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Node
|
|
||||||
private void drawWithTitleNode(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
|
||||||
final double width = maxX - minX;
|
|
||||||
final double height = maxY - minY;
|
|
||||||
final SymbolContext ctx = new SymbolContext(stateBack, borderColor).withStroke(defaultStroke).withShadow(
|
|
||||||
shadowing);
|
|
||||||
USymbol.NODE.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU(
|
|
||||||
ug.apply(new UTranslate(minX, minY)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Folder
|
|
||||||
private UPolygon getSpecificFrontierForFolder(StringBounder stringBounder) {
|
|
||||||
final double width = maxX - minX;
|
|
||||||
final double height = maxY - minY;
|
|
||||||
final Dimension2D dimTitle = title.calculateDimension(stringBounder);
|
|
||||||
final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
|
|
||||||
final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
|
|
||||||
final UPolygon shape = new UPolygon();
|
|
||||||
shape.addPoint(0, 0);
|
|
||||||
shape.addPoint(wtitle, 0);
|
|
||||||
shape.addPoint(wtitle + marginTitleX3, htitle);
|
|
||||||
shape.addPoint(width, htitle);
|
|
||||||
shape.addPoint(width, height);
|
|
||||||
shape.addPoint(0, height);
|
|
||||||
shape.addPoint(0, 0);
|
|
||||||
return shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawWithTitleFolder(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
|
||||||
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
|
||||||
final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
|
|
||||||
final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
|
|
||||||
final UPolygon shape = getSpecificFrontierForFolder(ug.getStringBounder());
|
|
||||||
if (shadowing) {
|
|
||||||
shape.setDeltaShadow(3.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ug = ug.apply(new UChangeBackColor(stateBack)).apply(new UChangeColor(borderColor));
|
|
||||||
ug = ug.apply(defaultStroke);
|
|
||||||
ug.apply(new UTranslate(minX, minY)).draw(shape);
|
|
||||||
ug.apply(new UTranslate(minX, minY + htitle)).draw(new ULine(wtitle + marginTitleX3, 0));
|
|
||||||
ug = ug.apply(new UStroke());
|
|
||||||
title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + marginTitleY1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rect
|
|
||||||
private void drawWithTitleRect(UGraphic ug, HtmlColor borderColor, boolean shadowing) {
|
|
||||||
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
|
||||||
final double width = maxX - minX;
|
|
||||||
final double height = maxY - minY;
|
|
||||||
final URectangle shape = new URectangle(width, height);
|
|
||||||
if (shadowing) {
|
|
||||||
shape.setDeltaShadow(3.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ug = ug.apply(new UChangeBackColor(stateBack)).apply(new UChangeColor(borderColor));
|
|
||||||
ug = ug.apply(defaultStroke);
|
|
||||||
|
|
||||||
ug.apply(new UTranslate(minX, minY)).draw(shape);
|
|
||||||
ug = ug.apply(new UStroke());
|
|
||||||
final double deltax = width - dimTitle.getWidth();
|
|
||||||
title.drawU(ug.apply(new UTranslate(minX + deltax / 2, minY + 5)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static int marginTitleX1 = 3;
|
public final static int marginTitleX1 = 3;
|
||||||
@ -232,4 +83,146 @@ public class ClusterDecoration {
|
|||||||
public final static int marginTitleY1 = 3;
|
public final static int marginTitleY1 = 3;
|
||||||
public final static int marginTitleY2 = 3;
|
public final static int marginTitleY2 = 3;
|
||||||
|
|
||||||
|
public void drawU(UGraphic ug, HtmlColor backColor, HtmlColor borderColor, boolean shadowing) {
|
||||||
|
final SymbolContext biColor = new SymbolContext(backColor, borderColor);
|
||||||
|
if (symbol == null) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
final SymbolContext symbolContext = biColor.withShadow(shadowing).withStroke(defaultStroke);
|
||||||
|
symbol.asBig(title, stereo, maxX - minX, maxY - minY, symbolContext)
|
||||||
|
.drawU(ug.apply(new UTranslate(minX, minY)));
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if (style == PackageStyle.NODE) {
|
||||||
|
// drawWithTitleNode(ug, biColor, shadowing);
|
||||||
|
// } else if (style == PackageStyle.CARD) {
|
||||||
|
// drawWithTitleCard(ug, biColor, shadowing);
|
||||||
|
// } else if (style == PackageStyle.DATABASE) {
|
||||||
|
// drawWithTitleDatabase(ug, biColor, shadowing);
|
||||||
|
// } else if (style == PackageStyle.CLOUD) {
|
||||||
|
// drawWithTitleCloud(ug, biColor, shadowing);
|
||||||
|
// } else if (style == PackageStyle.FRAME) {
|
||||||
|
// drawWithTitleFrame(ug, biColor, shadowing);
|
||||||
|
// } else if (style == PackageStyle.RECT) {
|
||||||
|
// drawWithTitleRect(ug, biColor, shadowing);
|
||||||
|
// } else {
|
||||||
|
// throw new UnsupportedOperationException();
|
||||||
|
// // drawWithTitleFolder(ug, biColor, shadowing);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Cloud
|
||||||
|
// private void drawWithTitleCloud(UGraphic ug, SymbolContext biColor, boolean shadowing) {
|
||||||
|
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
||||||
|
// final double width = maxX - minX;
|
||||||
|
// final double height = maxY - minY;
|
||||||
|
// ug = biColor.applyColors(ug);
|
||||||
|
// ug = ug.apply(defaultStroke);
|
||||||
|
// PackageStyle.CLOUD.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle,
|
||||||
|
// shadowing);
|
||||||
|
// ug = ug.apply(new UStroke());
|
||||||
|
// title.drawU(ug.apply(new UTranslate(minX + (width - dimTitle.getWidth()) / 2, minY + 10)));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Database
|
||||||
|
// private void drawWithTitleDatabase(UGraphic ug, SymbolContext biColor, boolean shadowing) {
|
||||||
|
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
||||||
|
// final double width = maxX - minX;
|
||||||
|
// final double height = maxY - minY;
|
||||||
|
// ug = ug.apply(defaultStroke);
|
||||||
|
// ug = biColor.applyColors(ug);
|
||||||
|
// PackageStyle.DATABASE.drawU(ug.apply(new UTranslate(minX, minY - 10)),
|
||||||
|
// new Dimension2DDouble(width, height + 10), dimTitle, shadowing);
|
||||||
|
// ug = ug.apply(new UStroke());
|
||||||
|
// title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + 10)));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Corner
|
||||||
|
// private void drawWithTitleFrame(UGraphic ug, SymbolContext biColor, boolean shadowing) {
|
||||||
|
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
||||||
|
// final double width = maxX - minX;
|
||||||
|
// final double height = maxY - minY;
|
||||||
|
// ug = biColor.applyColors(ug);
|
||||||
|
// ug = ug.apply(defaultStroke);
|
||||||
|
// PackageStyle.FRAME.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle,
|
||||||
|
// shadowing);
|
||||||
|
// ug = ug.apply(new UStroke());
|
||||||
|
// title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY)));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Card
|
||||||
|
// private void drawWithTitleCard(UGraphic ug, SymbolContext biColor, boolean shadowing) {
|
||||||
|
// final double width = maxX - minX;
|
||||||
|
// final double height = maxY - minY;
|
||||||
|
// final SymbolContext ctx = biColor.withStroke(defaultStroke).withShadow(shadowing);
|
||||||
|
// USymbol.CARD.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU(
|
||||||
|
// ug.apply(new UTranslate(minX, minY)));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Node
|
||||||
|
// private void drawWithTitleNode(UGraphic ug, SymbolContext biColor, boolean shadowing) {
|
||||||
|
// final double width = maxX - minX;
|
||||||
|
// final double height = maxY - minY;
|
||||||
|
// final SymbolContext ctx = biColor.withStroke(defaultStroke).withShadow(shadowing);
|
||||||
|
// USymbol.NODE.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU(
|
||||||
|
// ug.apply(new UTranslate(minX, minY)));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Folder
|
||||||
|
// private UPolygon getSpecificFrontierForFolder(StringBounder stringBounder) {
|
||||||
|
// final double width = maxX - minX;
|
||||||
|
// final double height = maxY - minY;
|
||||||
|
// final Dimension2D dimTitle = title.calculateDimension(stringBounder);
|
||||||
|
// final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
|
||||||
|
// final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
|
||||||
|
// final UPolygon shape = new UPolygon();
|
||||||
|
// shape.addPoint(0, 0);
|
||||||
|
// shape.addPoint(wtitle, 0);
|
||||||
|
// shape.addPoint(wtitle + marginTitleX3, htitle);
|
||||||
|
// shape.addPoint(width, htitle);
|
||||||
|
// shape.addPoint(width, height);
|
||||||
|
// shape.addPoint(0, height);
|
||||||
|
// shape.addPoint(0, 0);
|
||||||
|
// return shape;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void drawWithTitleFolder(UGraphic ug, SymbolContext biColor, boolean shadowing) {
|
||||||
|
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
||||||
|
// final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
|
||||||
|
// final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
|
||||||
|
// final UPolygon shape = getSpecificFrontierForFolder(ug.getStringBounder());
|
||||||
|
// if (shadowing) {
|
||||||
|
// shape.setDeltaShadow(3.0);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ug = biColor.applyColors(ug);
|
||||||
|
// ug = ug.apply(defaultStroke);
|
||||||
|
// ug.apply(new UTranslate(minX, minY)).draw(shape);
|
||||||
|
// ug.apply(new UTranslate(minX, minY + htitle)).draw(new ULine(wtitle + marginTitleX3, 0));
|
||||||
|
// ug = ug.apply(new UStroke());
|
||||||
|
// title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + marginTitleY1)));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Rect
|
||||||
|
// private void drawWithTitleRect(UGraphic ug, SymbolContext biColor, boolean shadowing) {
|
||||||
|
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
||||||
|
// final double width = maxX - minX;
|
||||||
|
// final double height = maxY - minY;
|
||||||
|
// final URectangle shape = new URectangle(width, height);
|
||||||
|
// if (shadowing) {
|
||||||
|
// shape.setDeltaShadow(3.0);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ug = biColor.applyColors(ug);
|
||||||
|
// ug = ug.apply(defaultStroke);
|
||||||
|
//
|
||||||
|
// ug.apply(new UTranslate(minX, minY)).draw(shape);
|
||||||
|
// ug = ug.apply(new UStroke());
|
||||||
|
// final double deltax = width - dimTitle.getWidth();
|
||||||
|
// title.drawU(ug.apply(new UTranslate(minX + deltax / 2, minY + 5)));
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageCircleEnd;
|
|||||||
import net.sourceforge.plantuml.svek.image.EntityImageCircleStart;
|
import net.sourceforge.plantuml.svek.image.EntityImageCircleStart;
|
||||||
import net.sourceforge.plantuml.svek.image.EntityImageClass;
|
import net.sourceforge.plantuml.svek.image.EntityImageClass;
|
||||||
import net.sourceforge.plantuml.svek.image.EntityImageDescription;
|
import net.sourceforge.plantuml.svek.image.EntityImageDescription;
|
||||||
import net.sourceforge.plantuml.svek.image.EntityImageEmptyPackage2;
|
import net.sourceforge.plantuml.svek.image.EntityImageEmptyPackage;
|
||||||
import net.sourceforge.plantuml.svek.image.EntityImageGroup;
|
import net.sourceforge.plantuml.svek.image.EntityImageGroup;
|
||||||
import net.sourceforge.plantuml.svek.image.EntityImageLollipopInterface;
|
import net.sourceforge.plantuml.svek.image.EntityImageLollipopInterface;
|
||||||
import net.sourceforge.plantuml.svek.image.EntityImageLollipopInterfaceEye1;
|
import net.sourceforge.plantuml.svek.image.EntityImageLollipopInterfaceEye1;
|
||||||
@ -154,7 +154,6 @@ public final class CucaDiagramFileMakerSvek2 {
|
|||||||
printGroups(dotData.getRootGroup());
|
printGroups(dotData.getRootGroup());
|
||||||
printEntities(getUnpackagedEntities());
|
printEntities(getUnpackagedEntities());
|
||||||
|
|
||||||
|
|
||||||
for (Link link : dotData.getLinks()) {
|
for (Link link : dotData.getLinks()) {
|
||||||
if (link.isRemoved()) {
|
if (link.isRemoved()) {
|
||||||
continue;
|
continue;
|
||||||
@ -454,7 +453,7 @@ public final class CucaDiagramFileMakerSvek2 {
|
|||||||
return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, HtmlColorUtils.BLACK),
|
return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, HtmlColorUtils.BLACK),
|
||||||
portionShower);
|
portionShower);
|
||||||
}
|
}
|
||||||
return new EntityImageEmptyPackage2(leaf, skinParam);
|
return new EntityImageEmptyPackage(leaf, skinParam);
|
||||||
}
|
}
|
||||||
if (leaf.getEntityType() == LeafType.ASSOCIATION) {
|
if (leaf.getEntityType() == LeafType.ASSOCIATION) {
|
||||||
return new EntityImageAssociation(leaf, skinParam);
|
return new EntityImageAssociation(leaf, skinParam);
|
||||||
@ -543,23 +542,25 @@ public final class CucaDiagramFileMakerSvek2 {
|
|||||||
|
|
||||||
private TextBlock getTitleBlock(IGroup g) {
|
private TextBlock getTitleBlock(IGroup g) {
|
||||||
final Display label = g.getDisplay();
|
final Display label = g.getDisplay();
|
||||||
final Stereotype stereotype2 = g.getStereotype();
|
final Stereotype stereotype = g.getStereotype();
|
||||||
|
|
||||||
if (label == null) {
|
if (label == null) {
|
||||||
return TextBlockUtils.empty(0, 0);
|
return TextBlockUtils.empty(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
final FontParam fontParam = g.getTitleFontParam();
|
final FontParam fontParam = g.getTitleFontParam();
|
||||||
return label.create(new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype2, true), dotData
|
final HtmlColor fontHtmlColor = dotData.getSkinParam().getFontHtmlColor(fontParam, stereotype);
|
||||||
.getSkinParam().getFontHtmlColor(fontParam, stereotype2), dotData.getSkinParam()
|
return label.create(new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype, true),
|
||||||
.getHyperlinkColor(), dotData.getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, dotData.getSkinParam());
|
fontHtmlColor, dotData.getSkinParam().getHyperlinkColor(), dotData.getSkinParam()
|
||||||
|
.useUnderlineForHyperlink()), HorizontalAlignment.CENTER, dotData.getSkinParam());
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextBlock getStereoBlock(IGroup g) {
|
private TextBlock getStereoBlock(IGroup g) {
|
||||||
if (g.getStereotype() == null) {
|
if (g.getStereotype() == null) {
|
||||||
return TextBlockUtils.empty(0, 0);
|
return TextBlockUtils.empty(0, 0);
|
||||||
}
|
}
|
||||||
final List<String> stereos = g.getStereotype().getLabels(dotData.getSkinParam().useGuillemet());
|
final Stereotype stereotype = g.getStereotype();
|
||||||
|
final List<String> stereos = stereotype.getLabels(dotData.getSkinParam().useGuillemet());
|
||||||
if (stereos == null) {
|
if (stereos == null) {
|
||||||
return TextBlockUtils.empty(0, 0);
|
return TextBlockUtils.empty(0, 0);
|
||||||
}
|
}
|
||||||
@ -568,12 +569,12 @@ public final class CucaDiagramFileMakerSvek2 {
|
|||||||
return TextBlockUtils.empty(0, 0);
|
return TextBlockUtils.empty(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Stereotype stereotype2 = g.getStereotype();
|
final FontParam fontParam = FontParam.PACKAGE_STEREOTYPE;
|
||||||
|
final HtmlColor fontHtmlColor = dotData.getSkinParam().getFontHtmlColor(fontParam, stereotype);
|
||||||
final FontParam fontParam = FontParam.COMPONENT_STEREOTYPE;
|
return Display.create(stereos).create(
|
||||||
return Display.create(stereos).create(new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype2, false), dotData
|
new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype, false), fontHtmlColor,
|
||||||
.getSkinParam().getFontHtmlColor(fontParam, stereotype2), dotData.getSkinParam()
|
dotData.getSkinParam().getHyperlinkColor(), dotData.getSkinParam().useUnderlineForHyperlink()),
|
||||||
.getHyperlinkColor(), dotData.getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, dotData.getSkinParam());
|
HorizontalAlignment.CENTER, dotData.getSkinParam());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import java.awt.geom.Dimension2D;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||||
@ -59,6 +60,31 @@ public enum PackageStyle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public USymbol toUSymbol() {
|
||||||
|
if (this == NODE) {
|
||||||
|
return USymbol.NODE;
|
||||||
|
}
|
||||||
|
if (this == CARD) {
|
||||||
|
return USymbol.CARD;
|
||||||
|
}
|
||||||
|
if (this == DATABASE) {
|
||||||
|
return USymbol.DATABASE;
|
||||||
|
}
|
||||||
|
if (this == CLOUD) {
|
||||||
|
return USymbol.CLOUD;
|
||||||
|
}
|
||||||
|
if (this == FRAME) {
|
||||||
|
return USymbol.FRAME;
|
||||||
|
}
|
||||||
|
if (this == RECT) {
|
||||||
|
return USymbol.RECTANGLE;
|
||||||
|
}
|
||||||
|
if (this == FOLDER) {
|
||||||
|
return USymbol.FOLDER;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug, Dimension2D dim, Dimension2D titleDim, boolean shadowing) {
|
public void drawU(UGraphic ug, Dimension2D dim, Dimension2D titleDim, boolean shadowing) {
|
||||||
if (titleDim == null) {
|
if (titleDim == null) {
|
||||||
titleDim = new Dimension2DDouble(0, 0);
|
titleDim = new Dimension2DDouble(0, 0);
|
||||||
|
@ -41,7 +41,6 @@ import net.sourceforge.plantuml.FontParam;
|
|||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.LineParam;
|
import net.sourceforge.plantuml.LineParam;
|
||||||
import net.sourceforge.plantuml.SkinParamUtils;
|
import net.sourceforge.plantuml.SkinParamUtils;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
@ -57,7 +56,7 @@ import net.sourceforge.plantuml.svek.ShapeType;
|
|||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
|
|
||||||
public class EntityImageEmptyPackage2 extends AbstractEntityImage {
|
public class EntityImageEmptyPackage extends AbstractEntityImage {
|
||||||
|
|
||||||
final private TextBlock desc;
|
final private TextBlock desc;
|
||||||
final private static int MARGIN = 10;
|
final private static int MARGIN = 10;
|
||||||
@ -65,14 +64,16 @@ public class EntityImageEmptyPackage2 extends AbstractEntityImage {
|
|||||||
final private ISkinParam skinParam;
|
final private ISkinParam skinParam;
|
||||||
final private Stereotype stereotype;
|
final private Stereotype stereotype;
|
||||||
|
|
||||||
public EntityImageEmptyPackage2(ILeaf entity, ISkinParam skinParam) {
|
public EntityImageEmptyPackage(ILeaf entity, ISkinParam skinParam) {
|
||||||
super(entity, skinParam);
|
super(entity, skinParam);
|
||||||
this.skinParam = skinParam;
|
this.skinParam = skinParam;
|
||||||
this.specificBackColor = entity.getSpecificBackColor();
|
this.specificBackColor = entity.getSpecificBackColor();
|
||||||
this.stereotype = entity.getStereotype();
|
this.stereotype = entity.getStereotype();
|
||||||
this.desc = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.PACKAGE, stereotype),
|
this.desc = entity.getDisplay().create(
|
||||||
SkinParamUtils.getFontColor(getSkinParam(), FontParam.PACKAGE, stereotype), getSkinParam()
|
new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.PACKAGE, stereotype),
|
||||||
.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam);
|
SkinParamUtils.getFontColor(getSkinParam(), FontParam.PACKAGE, stereotype), getSkinParam()
|
||||||
|
.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()),
|
||||||
|
HorizontalAlignment.CENTER, skinParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||||
@ -95,13 +96,13 @@ public class EntityImageEmptyPackage2 extends AbstractEntityImage {
|
|||||||
final double widthTotal = dimTotal.getWidth();
|
final double widthTotal = dimTotal.getWidth();
|
||||||
final double heightTotal = dimTotal.getHeight();
|
final double heightTotal = dimTotal.getHeight();
|
||||||
|
|
||||||
final HtmlColor stateBack = Cluster.getStateBackColor(specificBackColor, skinParam, stereotype);
|
final HtmlColor back = Cluster.getBackColor(specificBackColor, skinParam, stereotype);
|
||||||
|
|
||||||
final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().getPackageStyle(), null, desc,
|
final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().getPackageStyle(), null, desc,
|
||||||
TextBlockUtils.empty(0, 0), stateBack, 0, 0, widthTotal, heightTotal, getStroke());
|
TextBlockUtils.empty(0, 0), 0, 0, widthTotal, heightTotal, getStroke());
|
||||||
|
|
||||||
decoration.drawU(ug, SkinParamUtils.getColor(getSkinParam(), ColorParam.packageBorder, getStereo()),
|
decoration.drawU(ug, back,
|
||||||
getSkinParam().shadowing());
|
SkinParamUtils.getColor(getSkinParam(), ColorParam.packageBorder, getStereo()), getSkinParam().shadowing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShapeType getShapeType() {
|
public ShapeType getShapeType() {
|
@ -189,7 +189,7 @@ public class PSystemVersion extends AbstractPSystem {
|
|||||||
int lim = 7;
|
int lim = 7;
|
||||||
if (lastversion == -1) {
|
if (lastversion == -1) {
|
||||||
strings.add("<b><color:red>Error</b>");
|
strings.add("<b><color:red>Error</b>");
|
||||||
strings.add("<color:red>Cannot connect to http://plantuml.sourceforge.net/</b>");
|
strings.add("<color:red>Cannot connect to http://plantuml.com/</b>");
|
||||||
strings.add("Maybe you should set your proxy ?");
|
strings.add("Maybe you should set your proxy ?");
|
||||||
strings.add("@startuml");
|
strings.add("@startuml");
|
||||||
strings.add("checkversion(proxy=myproxy.com,port=8080)");
|
strings.add("checkversion(proxy=myproxy.com,port=8080)");
|
||||||
@ -197,7 +197,7 @@ public class PSystemVersion extends AbstractPSystem {
|
|||||||
lim = 9;
|
lim = 9;
|
||||||
} else if (lastversion == 0) {
|
} else if (lastversion == 0) {
|
||||||
strings.add("<b><color:red>Error</b>");
|
strings.add("<b><color:red>Error</b>");
|
||||||
strings.add("Cannot retrieve last version from http://plantuml.sourceforge.net/</b>");
|
strings.add("Cannot retrieve last version from http://plantuml.com/</b>");
|
||||||
} else {
|
} else {
|
||||||
strings.add("<b>Last available version for download</b> : " + lastversion);
|
strings.add("<b>Last available version for download</b> : " + lastversion);
|
||||||
strings.add(" ");
|
strings.add(" ");
|
||||||
@ -222,7 +222,7 @@ public class PSystemVersion extends AbstractPSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final URL url = new URL("http://plantuml.sourceforge.net/download.html");
|
final URL url = new URL("http://plantuml.com/download.html");
|
||||||
final HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
|
final HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
|
||||||
urlConnection.setUseCaches(false);
|
urlConnection.setUseCaches(false);
|
||||||
urlConnection.connect();
|
urlConnection.connect();
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 16588 $
|
* Revision $Revision: 16662 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.version;
|
package net.sourceforge.plantuml.version;
|
||||||
@ -39,7 +39,7 @@ import java.util.Date;
|
|||||||
public class Version {
|
public class Version {
|
||||||
|
|
||||||
public static int version() {
|
public static int version() {
|
||||||
return 8028;
|
return 8029;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String versionString() {
|
public static String versionString() {
|
||||||
@ -63,7 +63,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static long compileTime() {
|
private static long compileTime() {
|
||||||
return 1436554841134L;
|
return 1438795496181L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String compileTimeString() {
|
public static String compileTimeString() {
|
||||||
|
Loading…
Reference in New Issue
Block a user