1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-05-31 15:40:48 +00:00

version 8029

This commit is contained in:
Arnaud Roques 2015-08-05 22:17:01 +02:00
parent e7251d394d
commit c5043d5fe3
46 changed files with 636 additions and 347 deletions

View File

@ -54,6 +54,16 @@ public class BlockUml {
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) {
return convert(Arrays.asList(strings));
}
@ -77,7 +87,7 @@ public class BlockUml {
this.data = new ArrayList<CharSequence2>(strings);
}
public String getFilename() {
public String getFileOrDirname() {
if (OptionFlags.getInstance().isWord()) {
return null;
}
@ -97,6 +107,9 @@ public class BlockUml {
return null;
}
}
if (result.startsWith("file://")) {
result = result.substring("file://".length());
}
return result;
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16206 $
* Revision $Revision: 16629 $
*
*/
package net.sourceforge.plantuml;
@ -63,6 +63,7 @@ public enum FontParam {
COMPONENT_STEREOTYPE(14, Font.ITALIC), //
NOTE(13, Font.PLAIN), //
PACKAGE(14, Font.PLAIN), //
PACKAGE_STEREOTYPE(14, Font.ITALIC), //
ACTOR(14, Font.PLAIN), //
ARTIFACT(14, Font.PLAIN), //
CLOUD(14, Font.PLAIN), //

View File

@ -33,12 +33,14 @@
*/
package net.sourceforge.plantuml;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
@ -110,6 +112,53 @@ public class SourceFileReader implements ISourceFileReader {
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 {
Log.info("Reading file: " + file);
@ -117,16 +166,46 @@ public class SourceFileReader implements ISourceFileReader {
final List<GeneratedImage> result = new ArrayList<GeneratedImage>();
for (BlockUml blockUml : builder.getBlockUmls()) {
String newName = blockUml.getFilename();
if (newName == null) {
newName = fileFormatOption.getFileFormat().changeName(file.getName(), cpt++);
String newName = blockUml.getFileOrDirname();
Log.info("name from block=" + newName);
File suggested = null;
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();
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);
OptionFlags.getInstance().logData(file, system);
@ -153,6 +232,10 @@ public class SourceFileReader implements ISourceFileReader {
return Collections.unmodifiableList(result);
}
private boolean endsWithSlashOrAntislash(String newName) {
return newName.endsWith("/") || newName.endsWith("\\");
}
public List<String> getEncodedUrl() throws IOException {
final List<String> result = new ArrayList<String>();
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16549 $
* Revision $Revision: 16613 $
*
*/
package net.sourceforge.plantuml;
@ -251,24 +251,27 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
return imageData;
} catch (UnparsableGraphvizException e) {
e.printStackTrace();
exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion(), e.getDebugData());
exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion());
} catch (Exception e) {
e.printStackTrace();
exportDiagramError(os, e, fileFormatOption, null, null);
exportDiagramError(os, e, fileFormatOption, null);
}
return new ImageDataSimple();
}
private void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat,
String graphvizVersion, String svg) throws IOException {
final UFont font = new UFont("SansSerif", Font.PLAIN, 12);
final List<String> strings = getFailureText(exception, graphvizVersion);
String graphvizVersion) throws IOException {
exportDiagramError2(os, exception, fileFormat, getMetadata(), getFlashData(),
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));
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 BufferedImage im = utils.exportFlashcode(flash);
@ -296,16 +299,13 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
}
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 UmlSource source = getSource();
result.append(source.getPlainString());
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>();
strings.add("An error has occured : " + exception);
final String quote = QuoteUtils.getSomeQuote();
@ -332,6 +332,20 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
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 {
final File f = new File("c:/test.avi");
final int nb = 150;

View File

@ -210,9 +210,10 @@ public class ActivityDiagram3 extends UmlDiagram {
if (Display.isNull(title)) {
return original;
}
final TextBlock text = title.create(new FontConfiguration(getFont(FontParam.TITLE),
getFontColor(FontParam.TITLE, null), getSkinParam().getHyperlinkColor(), getSkinParam()
.useUnderlineForHyperlink()), HorizontalAlignment.CENTER, getSkinParam());
final TextBlock text = title.create(
new FontConfiguration(getFont(FontParam.TITLE), getFontColor(FontParam.TITLE, null), getSkinParam()
.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER,
getSkinParam());
return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER);
}
@ -224,11 +225,11 @@ public class ActivityDiagram3 extends UmlDiagram {
return original;
}
final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration(
getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(),
getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam());
getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(),
getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam());
final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration(
getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(),
getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam());
getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(),
getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam());
return new DecorateTextBlock(original, textHeader, getHeaderAlignment(), textFooter, getFooterAlignment());
}
@ -252,7 +253,10 @@ public class ActivityDiagram3 extends UmlDiagram {
public CommandExecutionResult forkAgain() {
if (current() instanceof InstructionFork) {
((InstructionFork) current()).forkAgain();
final InstructionFork currentFork = (InstructionFork) current();
currentFork.manageOutRendering(nextLinkRenderer());
setNextLinkRendererInternal(null);
currentFork.forkAgain();
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Cannot find fork");
@ -260,7 +264,10 @@ public class ActivityDiagram3 extends UmlDiagram {
public CommandExecutionResult endFork() {
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.error("Cannot find fork");
@ -385,7 +392,8 @@ public class ActivityDiagram3 extends UmlDiagram {
public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor) {
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);
setCurrent(instructionGroup);
}
@ -403,8 +411,8 @@ public class ActivityDiagram3 extends UmlDiagram {
}
private void setNextLink(LinkRendering linkRenderer) {
if (current() instanceof InstructionList) {
final Instruction last = ((InstructionList) current()).getLast();
if (current() instanceof InstructionCollection) {
final Instruction last = ((InstructionCollection) current()).getLast();
if (last instanceof InstructionWhile) {
((InstructionWhile) last).afterEndwhile(linkRenderer);
}
@ -415,6 +423,11 @@ public class ActivityDiagram3 extends UmlDiagram {
private final Rose rose = new Rose();
public void setLabelNextArrow(Display label) {
if (current() instanceof InstructionWhile && ((InstructionWhile) current()).getLast() == null) {
((InstructionWhile) current()).overwriteYes(label);
return;
}
if (nextLinkRenderer() == null) {
final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
this.setNextLink(new LinkRendering(arrowColor));
@ -431,7 +444,10 @@ public class ActivityDiagram3 extends UmlDiagram {
}
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);
return CommandExecutionResult.ok();
}

View File

@ -78,8 +78,8 @@ public class Branch {
return list.kill();
}
public void addNote(Display note, NotePosition position) {
list.addNote(note, position);
public boolean addNote(Display note, NotePosition position) {
return list.addNote(note, position);
}
public final void setInlinkRendering(LinkRendering inlinkRendering) {

View File

@ -49,6 +49,6 @@ public interface Instruction extends Swimable {
public LinkRendering getInLinkRendering();
public void addNote(Display note, NotePosition position);
public boolean addNote(Display note, NotePosition position);
}

View File

@ -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();
}

View File

@ -64,7 +64,7 @@ public class InstructionEnd extends MonoSwimable implements Instruction {
return inlinkRendering;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}

View File

@ -58,7 +58,6 @@ public class InstructionFork implements Instruction {
private InstructionList getLast() {
return forks.get(forks.size() - 1);
}
public void add(Instruction ins) {
getLast().add(ins);
@ -88,10 +87,10 @@ public class InstructionFork implements Instruction {
return inlinkRendering;
}
public void addNote(Display note, NotePosition position) {
getLast().addNote(note, position);
public boolean addNote(Display note, NotePosition position) {
return getLast().addNote(note, position);
}
public Set<Swimlane> getSwimlanes() {
return InstructionList.getSwimlanes2(forks);
}
@ -105,5 +104,11 @@ public class InstructionFork implements Instruction {
return getLast().getSwimlaneOut();
}
public void manageOutRendering(LinkRendering nextLinkRenderer) {
if (nextLinkRenderer == null) {
return;
}
getLast().setOutRendering(nextLinkRenderer);
}
}

View File

@ -65,7 +65,7 @@ public class InstructionGoto extends MonoSwimable implements Instruction {
return null;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}

View File

@ -81,12 +81,12 @@ public class InstructionGroup implements Instruction {
return null;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
if (list.isEmpty()) {
this.headerNote = note;
return;
return true;
}
list.addNote(note, position);
return list.addNote(note, position);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -133,12 +133,13 @@ public class InstructionIf implements Instruction {
return inlinkRendering;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
if (current.isEmpty()) {
this.note = note;
this.position = position;
return true;
} else {
current.addNote(note, position);
return current.addNote(note, position);
}
}

View File

@ -65,7 +65,7 @@ public class InstructionLabel extends MonoSwimable implements Instruction {
return null;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
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 Swimlane defaultSwimlane;
@ -118,8 +118,11 @@ public class InstructionList implements Instruction {
return all.get(all.size() - 1);
}
public void addNote(Display note, NotePosition position) {
getLast().addNote(note, position);
public boolean addNote(Display note, NotePosition position) {
if (getLast() == null) {
return false;
}
return getLast().addNote(note, position);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -82,7 +82,7 @@ public class InstructionPartition implements Instruction {
return list.getInLinkRendering();
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}

View File

@ -102,8 +102,8 @@ public class InstructionRepeat implements Instruction {
return nextLinkRenderer;
}
public void addNote(Display note, NotePosition position) {
repeatList.addNote(note, position);
public boolean addNote(Display note, NotePosition position) {
return repeatList.addNote(note, position);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -91,9 +91,10 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
return inlinkRendering;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
this.note = note;
this.notePosition = position;
return true;
}
}

View File

@ -98,8 +98,8 @@ public class InstructionSplit implements Instruction {
return inlinkRendering;
}
public void addNote(Display note, NotePosition position) {
getLast().addNote(note, position);
public boolean addNote(Display note, NotePosition position) {
return getLast().addNote(note, position);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -61,7 +61,7 @@ public class InstructionStart extends MonoSwimable implements Instruction {
return null;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}

View File

@ -64,7 +64,7 @@ public class InstructionStop extends MonoSwimable implements Instruction {
return inlinkRendering;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}

View File

@ -44,7 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
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 Instruction parent;
@ -52,13 +52,17 @@ public class InstructionWhile implements Instruction {
private final HtmlColor color;
private final Display test;
private final Display yes;
private Display yes;
private Display out = Display.NULL;
private LinkRendering endInlinkRendering;
private LinkRendering afterEndwhile;
private final Swimlane swimlane;
private final ISkinParam skinParam;
public void overwriteYes(Display yes) {
this.yes = yes;
}
public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer,
Display yes, HtmlColor color, ISkinParam skinParam) {
if (test == null) {
@ -117,12 +121,13 @@ public class InstructionWhile implements Instruction {
this.afterEndwhile = linkRenderer;
}
public void addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position) {
if (repeatList.isEmpty()) {
this.note = note;
this.position = position;
return true;
} else {
repeatList.addNote(note, position);
return repeatList.addNote(note, position);
}
}
@ -138,4 +143,9 @@ public class InstructionWhile implements Instruction {
return getSwimlaneIn();
}
public Instruction getLast() {
return repeatList.getLast();
}
}

View File

@ -51,10 +51,12 @@ public class ConnectionCross extends AbstractConnection {
final Swimlane swimlane1 = getFtile1().getSwimlaneOut();
final Swimlane swimlane2 = getFtile2().getSwimlaneIn();
if (swimlane1 == null) {
throw new IllegalStateException("" + getFtile1().getClass());
return;
// throw new IllegalStateException("" + getFtile1().getClass());
}
if (swimlane2 == null) {
throw new IllegalStateException("" + getFtile2().getClass());
return;
// throw new IllegalStateException("" + getFtile2().getClass());
}
conn.drawTranslate(ug, swimlane1.getTranslate(), swimlane2.getTranslate());
}

View File

@ -36,16 +36,22 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.creole.CreoleMode;
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.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.Sprite;
import net.sourceforge.plantuml.ugraphic.UFont;
public class FtileFactoryDelegator implements FtileFactory {
@ -63,6 +69,19 @@ public class FtileFactoryDelegator implements FtileFactory {
}
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) {
final LinkRendering linkRendering = tile.getInLinkRendering();

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileMinWidth extends FtileDecorate {
private final double minWidth;
private FtileGeometry calculateDimensionInternal;
public FtileMinWidth(Ftile tile, double minWidth) {
super(tile);
@ -58,6 +59,13 @@ public class FtileMinWidth extends FtileDecorate {
@Override
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 double left = getPoint2(geo.getLeft(), stringBounder);
if (geo.hasPointOut() == false) {

View File

@ -42,16 +42,16 @@ import java.util.List;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.StringBounderUtils;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.ugraphic.CompressionTransform;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
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.UShape;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -214,6 +214,13 @@ public class Snake implements UShape {
if (mergeable == false || other.mergeable == false) {
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())) {
final UPolygon oneOf = endDecoration == null ? other.endDecoration : endDecoration;
final Snake result = new Snake(color, oneOf);

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -106,16 +105,4 @@ public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator {
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);
}
}

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
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.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -108,9 +110,11 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
private final double x;
private final HtmlColor arrowColor;
private final Display label;
public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor) {
super(ftile1, ftile2);
label = LinkRendering.getDisplay(ftile2.getInLinkRendering());
this.x = x;
this.arrowColor = arrowColor;
}
@ -118,10 +122,13 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
public void drawU(UGraphic ug) {
ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
final Snake s = new Snake(arrowColor, Arrows.asToDown());
s.addPoint(geo.getLeft(), 0);
s.addPoint(geo.getLeft(), geo.getInY());
ug.draw(s);
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
snake.addPoint(geo.getLeft(), 0);
snake.addPoint(geo.getLeft(), geo.getInY());
ug.draw(snake);
}
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 Snake snake = new Snake(arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
final Point2D mp1a = translate1.getTranslated(p1);
final Point2D mp2b = translate2.getTranslated(p2);
final double middle = mp1a.getY() + 4;
@ -147,9 +157,11 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
private final double x;
private final HtmlColor arrowColor;
private final double height;
private final Display label;
public ConnectionOut(Ftile ftile1, Ftile ftile2, double x, HtmlColor arrowColor, double height) {
super(ftile1, ftile2);
label = LinkRendering.getDisplay(ftile1.getOutLinkRendering());
this.x = x;
this.arrowColor = arrowColor;
this.height = height;
@ -161,10 +173,13 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
if (geo.hasPointOut() == false) {
return;
}
final Snake s = new Snake(arrowColor, Arrows.asToDown());
s.addPoint(geo.getLeft(), geo.getOutY());
s.addPoint(geo.getLeft(), height);
ug.draw(s);
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
snake.addPoint(geo.getLeft(), geo.getOutY());
snake.addPoint(geo.getLeft(), height);
ug.draw(snake);
}
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 Snake snake = new Snake(arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
final Point2D mp1a = translate1.getTranslated(p1);
final Point2D mp2b = translate2.getTranslated(p2);
final double middle = mp2b.getY() - 14;

View File

@ -40,7 +40,6 @@ import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.OptionFlags;
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.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.creole.CreoleMode;
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.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -210,16 +204,10 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
private TextBlock getTextBlock(LinkRendering linkRendering) {
// DUP1433
final Display display = LinkRendering.getDisplay(linkRendering);
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);
return getTextBlock(display);
}
private Ftile simpleSwimlanes(List<Ftile> all) {
final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);

View File

@ -109,30 +109,33 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
public CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) {
lines = lines.trimSmart(1);
lines = lines.removeComments();
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
final IEntity entity = executeArg0(diagram, line0);
if (entity == null) {
return CommandExecutionResult.error("No such entity");
}
lines = lines.subExtract(1, 1);
final Url url;
if (lines.size() > 0) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
url = urlBuilder.getUrl(lines.getFirst499().toString());
} else {
url = null;
}
if (url != null) {
lines = lines.subExtract(1, 0);
}
for (CharSequence s : lines) {
if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
diagram.setVisibilityModifierPresent(true);
if (lines.size() > 1) {
lines = lines.subExtract(1, 1);
final Url url;
if (lines.size() > 0) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
url = urlBuilder.getUrl(lines.getFirst499().toString());
} else {
url = null;
}
if (url != null) {
lines = lines.subExtract(1, 0);
}
for (CharSequence s : lines) {
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);
@ -159,8 +162,8 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
if (type2 == LeafType.INTERFACE && entity.getEntityType() != LeafType.INTERFACE) {
typeLink = typeLink.getDashed();
}
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null, system.getLabeldistance(),
system.getLabelangle());
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null,
system.getLabeldistance(), system.getLabelangle());
system.addLink(link);
}
}

View File

@ -40,6 +40,7 @@ import java.util.Iterator;
import java.util.List;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.cucadiagram.Display;
public class BlocLines implements Iterable<CharSequence> {
@ -49,7 +50,7 @@ public class BlocLines implements Iterable<CharSequence> {
private BlocLines(List<? extends CharSequence> lines) {
this.lines = Collections.unmodifiableList(lines);
}
public Display toDisplay() {
return Display.create(lines);
}
@ -57,12 +58,11 @@ public class BlocLines implements Iterable<CharSequence> {
public static BlocLines single(CharSequence single) {
return new BlocLines(Arrays.asList(single));
}
public static BlocLines getWithNewlines(CharSequence s) {
return new BlocLines(StringUtils.getWithNewlines(s));
}
public BlocLines() {
this(new ArrayList<CharSequence>());
}
@ -221,4 +221,26 @@ public class BlocLines implements Iterable<CharSequence> {
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);
}
}

View File

@ -39,8 +39,9 @@ import net.sourceforge.plantuml.core.Diagram;
public class CommandComment extends SingleLineCommand<Diagram> {
public CommandComment() {
super("(?i)^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$");
super(CommandMultilinesComment.COMMENT_SINGLE_LINE);
}
@Override

View File

@ -37,13 +37,17 @@ import net.sourceforge.plantuml.core.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() {
super("(?i)^[%s]*/[%q].*$");
super(COMMENT_MULTILINE_START);
}
@Override
public String getPatternEnd() {
return "(?i)^.*[%q]/[%s]*$";
return COMMENT_MULTILINE_END;
}
public CommandExecutionResult execute(final Diagram diagram, BlocLines lines) {

View File

@ -81,7 +81,8 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
}
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) {
@ -95,13 +96,14 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
}
lines = lines.subExtract(1, 1);
lines = lines.removeComments();
lines = lines.trim(true);
for (CharSequence s : lines) {
assert s.length() > 0;
if (hasStartingQuote(s)) {
continue;
}
// if (hasStartingQuote(s)) {
// continue;
// }
if (s.toString().equals("}")) {
context.pop();
continue;

View File

@ -125,9 +125,9 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
sys = new PSystemError(source, err, null);
} else if (commandControl == CommandControl.OK_PARTIAL) {
final IteratorCounter2 saved = it.cloneMe();
final boolean ok = manageMultiline(it, sys);
if (ok == false) {
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.EXECUTION_ERROR, "Strange Syntax Error?",
final CommandExecutionResult result = manageMultiline2(it, sys);
if (result.isOk() == false) {
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(),
it.currentNum() - 1, saved.next().getLocation()), null);
}
@ -177,14 +177,14 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
throw new IllegalStateException();
}
private boolean manageMultiline(IteratorCounter2 it, AbstractPSystem system) {
private CommandExecutionResult manageMultiline2(IteratorCounter2 it, AbstractPSystem system) {
for (Command cmd : cmds) {
if (isMultilineCommandOk(it.cloneMe(), cmd) != null) {
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) {

View File

@ -37,6 +37,7 @@ public enum DiagramType {
UML, DITAA, DOT, PROJECT, JCCKIT, SALT, TURING, FLOW, CREOLE, JUNGLE, CUTE, UNKNOWN;
static public DiagramType getTypeFromArobaseStart(String s) {
s = s.toLowerCase();
// if (s.startsWith("@startuml2")) {
// return UML2;
// }

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16518 $
* Revision $Revision: 16602 $
*
*/
package net.sourceforge.plantuml.graphic;
@ -104,6 +104,14 @@ public class TextBlockUtils {
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() {
return dummyStringBounder;
}

View File

@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D;
import java.util.List;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
@ -77,7 +78,7 @@ public class LivingSpace {
private final EventsHistory eventsHistory;
private boolean create = false;
private double createY = 0;
private final ParticipantEnglober englober;
public int getLevelAt(Tile tile, EventsHistoryMode mode) {
@ -175,7 +176,14 @@ public class LivingSpace {
ug = ug.apply(new UTranslate(0, -dim.getHeight() / 2));
}
final Area area = new Area(dim);
final Url url = getParticipant().getUrl();
if (url != null) {
ug.startUrl(url);
}
comp.drawU(ug, area, context);
if (url != null) {
ug.closeAction();
}
}
public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) {
@ -195,7 +203,7 @@ public class LivingSpace {
}
return posC;
}
public Real getPosC2(StringBounder stringBounder) {
final double delta = liveBoxes.getMaxPosition(stringBounder);
return getPosC(stringBounder).addFixed(delta);
@ -205,7 +213,7 @@ public class LivingSpace {
if (posD == null) {
this.posD = posB.addFixed(this.getPreferredWidth(stringBounder));
}
//System.err.println("LivingSpace::getPosD "+posD.getCurrentValue());
// System.err.println("LivingSpace::getPosD "+posD.getCurrentValue());
return posD;
}

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
public class MainTile implements Tile, Bordered {
private final double startingY = 8;
private final Real min;
private final Real max;
private final boolean isShowFootbox;
@ -103,7 +104,7 @@ public class MainTile implements Tile, Bordered {
private double drawUInternal(UGraphic ug, boolean trace) {
final StringBounder stringBounder = ug.getStringBounder();
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) {
tile.drawU(ug);
}

View File

@ -290,16 +290,19 @@ public class Cluster implements Moveable {
this.yTitle = y;
}
private static HtmlColor getColor(ColorParam colorParam, ISkinParam skinParam) {
return new Rose().getHtmlColor(skinParam, colorParam);
private static HtmlColor getColor(ColorParam colorParam, ISkinParam skinParam, Stereotype stereotype) {
return new Rose().getHtmlColor(skinParam, colorParam, stereotype);
}
public void drawU(UGraphic ug, DotData dotData, UStroke stroke) {
final Stereotype stereotype = group.getStereotype();
HtmlColor borderColor;
if (dotData.getUmlDiagramType() == UmlDiagramType.STATE) {
borderColor = getColor(ColorParam.stateBorder, dotData.getSkinParam());
borderColor = getColor(ColorParam.stateBorder, dotData.getSkinParam(), stereotype);
} else {
borderColor = getColor(ColorParam.packageBorder, dotData.getSkinParam());
borderColor = getColor(ColorParam.packageBorder, dotData.getSkinParam(), stereotype);
}
final Url url = group.getUrl99();
@ -337,18 +340,17 @@ public class Cluster implements Moveable {
}
if (ztitle != null || zstereo != null) {
final HtmlColor stateBack = getStateBackColor(getBackColor(), dotData.getSkinParam(),
group.getStereotype());
final HtmlColor back = getBackColor(getBackColor(), dotData.getSkinParam(), group.getStereotype());
final ClusterDecoration decoration = new ClusterDecoration(style, group.getUSymbol(), ztitle, zstereo,
stateBack, minX, minY, maxX, maxY, getStroke(dotData.getSkinParam(), group.getStereotype()));
decoration.drawU(ug, borderColor, dotData.getSkinParam().shadowing());
minX, minY, maxX, maxY, getStroke(dotData.getSkinParam(), group.getStereotype()));
decoration.drawU(ug, back, borderColor, dotData.getSkinParam().shadowing());
return;
}
final URectangle rect = new URectangle(maxX - minX, maxY - minY);
if (dotData.getSkinParam().shadowing()) {
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.apply(new UStroke(2)).apply(new UTranslate(minX, minY)).draw(rect);
@ -815,17 +817,17 @@ public class Cluster implements Moveable {
return group == ent;
}
public static HtmlColor getStateBackColor(HtmlColor stateBack, ISkinParam skinParam, Stereotype stereotype) {
if (stateBack == null) {
stateBack = skinParam.getHtmlColor(ColorParam.packageBackground, stereotype, false);
public static HtmlColor getBackColor(HtmlColor backColor, ISkinParam skinParam, Stereotype stereotype) {
if (backColor == null) {
backColor = skinParam.getHtmlColor(ColorParam.packageBackground, stereotype, false);
}
if (stateBack == null) {
stateBack = skinParam.getHtmlColor(ColorParam.background, stereotype, false);
if (backColor == null) {
backColor = skinParam.getHtmlColor(ColorParam.background, stereotype, false);
}
if (stateBack == null /* || stateBack instanceof HtmlColorTransparent */) {
stateBack = new HtmlColorTransparent();
if (backColor == null /* || stateBack instanceof HtmlColorTransparent */) {
backColor = new HtmlColorTransparent();
}
return stateBack;
return backColor;
}
public double checkFolderPosition(Point2D pt, StringBounder stringBounder) {

View File

@ -34,45 +34,31 @@
*/
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.StringBounder;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
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.ULine;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ClusterDecoration {
private final UStroke defaultStroke;// = new UStroke(2);
final private PackageStyle style;
final private USymbol symbol;
final private TextBlock title;
final private TextBlock stereo;
final private HtmlColor stateBack;
final private double minX;
final private double minY;
final private double maxX;
final private double maxY;
public ClusterDecoration(PackageStyle style, USymbol symbol, TextBlock title, TextBlock stereo,
HtmlColor stateBack, double minX, double minY, double maxX, double maxY, UStroke stroke) {
this.symbol = symbol;
this.style = style;
public ClusterDecoration(PackageStyle style, USymbol symbol, TextBlock title, TextBlock stereo, double minX,
double minY, double maxX, double maxY, UStroke stroke) {
this.symbol = guess(symbol, style);
this.stereo = stereo;
this.title = title;
this.stateBack = stateBack;
this.minX = minX;
this.minY = minY;
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) {
final SymbolContext symbolContext = new SymbolContext(stateBack, borderColor).withShadow(shadowing)
.withStroke(defaultStroke);
symbol.asBig(title, stereo, maxX - minX, maxY - minY, symbolContext).drawU(
ug.apply(new UTranslate(minX, minY)));
// ug.getParam().resetStroke();
return;
return symbol;
}
if (style == PackageStyle.NODE) {
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)));
return style.toUSymbol();
}
public final static int marginTitleX1 = 3;
@ -232,4 +83,146 @@ public class ClusterDecoration {
public final static int marginTitleY1 = 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)));
// }
}

View File

@ -95,7 +95,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageCircleEnd;
import net.sourceforge.plantuml.svek.image.EntityImageCircleStart;
import net.sourceforge.plantuml.svek.image.EntityImageClass;
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.EntityImageLollipopInterface;
import net.sourceforge.plantuml.svek.image.EntityImageLollipopInterfaceEye1;
@ -154,7 +154,6 @@ public final class CucaDiagramFileMakerSvek2 {
printGroups(dotData.getRootGroup());
printEntities(getUnpackagedEntities());
for (Link link : dotData.getLinks()) {
if (link.isRemoved()) {
continue;
@ -454,7 +453,7 @@ public final class CucaDiagramFileMakerSvek2 {
return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, HtmlColorUtils.BLACK),
portionShower);
}
return new EntityImageEmptyPackage2(leaf, skinParam);
return new EntityImageEmptyPackage(leaf, skinParam);
}
if (leaf.getEntityType() == LeafType.ASSOCIATION) {
return new EntityImageAssociation(leaf, skinParam);
@ -543,23 +542,25 @@ public final class CucaDiagramFileMakerSvek2 {
private TextBlock getTitleBlock(IGroup g) {
final Display label = g.getDisplay();
final Stereotype stereotype2 = g.getStereotype();
final Stereotype stereotype = g.getStereotype();
if (label == null) {
return TextBlockUtils.empty(0, 0);
}
final FontParam fontParam = g.getTitleFontParam();
return label.create(new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype2, true), dotData
.getSkinParam().getFontHtmlColor(fontParam, stereotype2), dotData.getSkinParam()
.getHyperlinkColor(), dotData.getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, dotData.getSkinParam());
final HtmlColor fontHtmlColor = dotData.getSkinParam().getFontHtmlColor(fontParam, stereotype);
return label.create(new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype, true),
fontHtmlColor, dotData.getSkinParam().getHyperlinkColor(), dotData.getSkinParam()
.useUnderlineForHyperlink()), HorizontalAlignment.CENTER, dotData.getSkinParam());
}
private TextBlock getStereoBlock(IGroup g) {
if (g.getStereotype() == null) {
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) {
return TextBlockUtils.empty(0, 0);
}
@ -568,12 +569,12 @@ public final class CucaDiagramFileMakerSvek2 {
return TextBlockUtils.empty(0, 0);
}
final Stereotype stereotype2 = g.getStereotype();
final FontParam fontParam = FontParam.COMPONENT_STEREOTYPE;
return Display.create(stereos).create(new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype2, false), dotData
.getSkinParam().getFontHtmlColor(fontParam, stereotype2), dotData.getSkinParam()
.getHyperlinkColor(), dotData.getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, dotData.getSkinParam());
final FontParam fontParam = FontParam.PACKAGE_STEREOTYPE;
final HtmlColor fontHtmlColor = dotData.getSkinParam().getFontHtmlColor(fontParam, stereotype);
return Display.create(stereos).create(
new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype, false), fontHtmlColor,
dotData.getSkinParam().getHyperlinkColor(), dotData.getSkinParam().useUnderlineForHyperlink()),
HorizontalAlignment.CENTER, dotData.getSkinParam());
}
}

View File

@ -38,6 +38,7 @@ import java.awt.geom.Dimension2D;
import java.util.EnumSet;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UPath;
@ -59,6 +60,31 @@ public enum PackageStyle {
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) {
if (titleDim == null) {
titleDim = new Dimension2DDouble(0, 0);

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
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.UStroke;
public class EntityImageEmptyPackage2 extends AbstractEntityImage {
public class EntityImageEmptyPackage extends AbstractEntityImage {
final private TextBlock desc;
final private static int MARGIN = 10;
@ -65,14 +64,16 @@ public class EntityImageEmptyPackage2 extends AbstractEntityImage {
final private ISkinParam skinParam;
final private Stereotype stereotype;
public EntityImageEmptyPackage2(ILeaf entity, ISkinParam skinParam) {
public EntityImageEmptyPackage(ILeaf entity, ISkinParam skinParam) {
super(entity, skinParam);
this.skinParam = skinParam;
this.specificBackColor = entity.getSpecificBackColor();
this.stereotype = entity.getStereotype();
this.desc = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.PACKAGE, stereotype),
SkinParamUtils.getFontColor(getSkinParam(), FontParam.PACKAGE, stereotype), getSkinParam()
.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam);
this.desc = entity.getDisplay().create(
new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.PACKAGE, stereotype),
SkinParamUtils.getFontColor(getSkinParam(), FontParam.PACKAGE, stereotype), getSkinParam()
.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()),
HorizontalAlignment.CENTER, skinParam);
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
@ -95,13 +96,13 @@ public class EntityImageEmptyPackage2 extends AbstractEntityImage {
final double widthTotal = dimTotal.getWidth();
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,
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()),
getSkinParam().shadowing());
decoration.drawU(ug, back,
SkinParamUtils.getColor(getSkinParam(), ColorParam.packageBorder, getStereo()), getSkinParam().shadowing());
}
public ShapeType getShapeType() {

View File

@ -189,7 +189,7 @@ public class PSystemVersion extends AbstractPSystem {
int lim = 7;
if (lastversion == -1) {
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("@startuml");
strings.add("checkversion(proxy=myproxy.com,port=8080)");
@ -197,7 +197,7 @@ public class PSystemVersion extends AbstractPSystem {
lim = 9;
} else if (lastversion == 0) {
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 {
strings.add("<b>Last available version for download</b> : " + lastversion);
strings.add(" ");
@ -222,7 +222,7 @@ public class PSystemVersion extends AbstractPSystem {
}
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();
urlConnection.setUseCaches(false);
urlConnection.connect();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16588 $
* Revision $Revision: 16662 $
*
*/
package net.sourceforge.plantuml.version;
@ -39,7 +39,7 @@ import java.util.Date;
public class Version {
public static int version() {
return 8028;
return 8029;
}
public static String versionString() {
@ -63,7 +63,7 @@ public class Version {
}
private static long compileTime() {
return 1436554841134L;
return 1438795496181L;
}
public static String compileTimeString() {