1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Import version 1.2020.14

This commit is contained in:
Arnaud Roques 2020-06-21 22:31:45 +02:00
parent 5cd6df817e
commit a38685d3ba
64 changed files with 458 additions and 291 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId> <groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId> <artifactId>plantuml</artifactId>
<version>1.2020.14-SNAPSHOT</version> <version>1.2020.15-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>PlantUML</name> <name>PlantUML</name>

View File

@ -41,7 +41,7 @@ public enum ComponentStyle {
UML1, UML2, RECTANGLE; UML1, UML2, RECTANGLE;
public USymbol toSymbol() { public USymbol toUSymbol() {
switch (this) { switch (this) {
case UML1: case UML1:
return USymbol.COMPONENT1; return USymbol.COMPONENT1;

View File

@ -140,7 +140,9 @@ public class EmbeddedDiagram implements CharSequence {
private BufferedImage getImage() throws IOException, InterruptedException { private BufferedImage getImage() throws IOException, InterruptedException {
if (image == null) { if (image == null) {
final boolean sav = SkinParam.USE_STYLES();
image = getImageSlow(); image = getImageSlow();
SkinParam.setBetaStyle(sav);
} }
return image; return image;
} }

View File

@ -38,6 +38,8 @@ package net.sourceforge.plantuml;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -56,6 +58,25 @@ public class FileUtils {
counter = new AtomicInteger(0); counter = new AtomicInteger(0);
} }
static public File createTempFileLegacy(String prefix, String suffix) throws IOException {
if (suffix.startsWith(".") == false) {
throw new IllegalArgumentException();
}
if (prefix == null) {
throw new IllegalArgumentException();
}
final File f;
if (counter == null) {
f = File.createTempFile(prefix, suffix);
} else {
final String name = prefix + counter.addAndGet(1) + suffix;
f = new File(name);
}
Log.info("Creating temporary file: " + f);
f.deleteOnExit();
return f;
}
static public SFile createTempFile(String prefix, String suffix) throws IOException { static public SFile createTempFile(String prefix, String suffix) throws IOException {
if (suffix.startsWith(".") == false) { if (suffix.startsWith(".") == false) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
@ -106,6 +127,12 @@ public class FileUtils {
copyInternal(fis, fos); copyInternal(fis, fos);
} }
static public void copyToStream(File src, OutputStream os) throws IOException {
final InputStream fis = new BufferedInputStream(new FileInputStream(src));
final OutputStream fos = new BufferedOutputStream(os);
copyInternal(fis, fos);
}
static public void copyToStream(InputStream is, OutputStream os) throws IOException { static public void copyToStream(InputStream is, OutputStream os) throws IOException {
final InputStream fis = new BufferedInputStream(is); final InputStream fis = new BufferedInputStream(is);
final OutputStream fos = new BufferedOutputStream(os); final OutputStream fos = new BufferedOutputStream(os);

View File

@ -181,7 +181,7 @@ public enum FontParam {
return new FontConfiguration(skinParam, this, null); return new FontConfiguration(skinParam, this, null);
} }
public StyleSignature getStyleDefinition() { public StyleSignature getStyleDefinition(SName diagramType) {
if (this == FOOTER) { if (this == FOOTER) {
return StyleSignature.of(SName.root, SName.footer); return StyleSignature.of(SName.root, SName.footer);
} }
@ -191,8 +191,15 @@ public enum FontParam {
if (this == TITLE) { if (this == TITLE) {
return StyleSignature.of(SName.root, SName.title); return StyleSignature.of(SName.root, SName.title);
} }
System.err.println("Warning " + this); if (this == CLASS_ATTRIBUTE) {
return null; return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_);
}
if (this == RECTANGLE || this == NODE) {
return StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component);
}
return StyleSignature.of(SName.root, SName.element, diagramType, SName.component);
// System.err.println("Warning " + this);
// throw new UnsupportedOperationException();
} }
} }

View File

@ -96,7 +96,7 @@ public interface ISkinParam extends ISkinSimple {
public boolean shadowing2(Stereotype stereotype, SkinParameter skinParameter); public boolean shadowing2(Stereotype stereotype, SkinParameter skinParameter);
public PackageStyle getPackageStyle(); public PackageStyle packageStyle();
public ComponentStyle componentStyle(); public ComponentStyle componentStyle();
@ -156,7 +156,7 @@ public interface ISkinParam extends ISkinSimple {
public UmlDiagramType getUmlDiagramType(); public UmlDiagramType getUmlDiagramType();
public HColor getHoverPathColor(); public HColor hoverPathColor();
public TikzFontDistortion getTikzFontDistortion(); public TikzFontDistortion getTikzFontDistortion();
@ -176,7 +176,7 @@ public interface ISkinParam extends ISkinSimple {
public boolean isUseVizJs(); public boolean isUseVizJs();
public Padder getSequenceDiagramPadder(); public Padder sequenceDiagramPadder();
public StyleBuilder getCurrentStyleBuilder(); public StyleBuilder getCurrentStyleBuilder();
@ -188,6 +188,6 @@ public interface ISkinParam extends ISkinSimple {
public void setDefaultSkin(String newSkin); public void setDefaultSkin(String newSkin);
public ActorStyle getActorStyle(); public ActorStyle actorStyle();
} }

View File

@ -780,15 +780,6 @@ public class SkinParam implements ISkinParam {
return true; return true;
} }
public PackageStyle getPackageStyle() {
final String value = getValue("packageStyle");
final PackageStyle p = PackageStyle.fromString(value);
if (p == null) {
return PackageStyle.FOLDER;
}
return p;
}
private final Map<String, Sprite> sprites = new HashMap<String, Sprite>(); private final Map<String, Sprite> sprites = new HashMap<String, Sprite>();
public Collection<String> getAllSpriteNames() { public Collection<String> getAllSpriteNames() {
@ -807,16 +798,27 @@ public class SkinParam implements ISkinParam {
return result; return result;
} }
public PackageStyle packageStyle() {
final String value = getValue("packageStyle");
final PackageStyle p = PackageStyle.fromString(value);
if (p == null) {
return PackageStyle.FOLDER;
}
return p;
}
public ComponentStyle componentStyle() { public ComponentStyle componentStyle() {
if (strictUmlStyle()) { if (strictUmlStyle()) {
return ComponentStyle.UML2; return ComponentStyle.UML2;
} }
final String value = getValue("componentstyle"); final String value = getValue("componentstyle");
if ("uml1".equalsIgnoreCase(value))
return ComponentStyle.UML1;
if ("uml2".equalsIgnoreCase(value)) if ("uml2".equalsIgnoreCase(value))
return ComponentStyle.UML2; return ComponentStyle.UML2;
if ("rectangle".equalsIgnoreCase(value)) if ("rectangle".equalsIgnoreCase(value))
return ComponentStyle.RECTANGLE; return ComponentStyle.RECTANGLE;
return ComponentStyle.UML1; return ComponentStyle.UML2;
} }
public boolean stereotypePositionTop() { public boolean stereotypePositionTop() {
@ -1144,7 +1146,7 @@ public class SkinParam implements ISkinParam {
return type; return type;
} }
public HColor getHoverPathColor() { public HColor hoverPathColor() {
final String value = getValue("pathhovercolor"); final String value = getValue("pathhovercolor");
if (value == null) { if (value == null) {
return null; return null;
@ -1219,7 +1221,7 @@ public class SkinParam implements ISkinParam {
return useVizJs; return useVizJs;
} }
public Padder getSequenceDiagramPadder() { public Padder sequenceDiagramPadder() {
final double padding = getAsDouble("SequenceMessagePadding"); final double padding = getAsDouble("SequenceMessagePadding");
final double margin = getAsDouble("SequenceMessageMargin"); final double margin = getAsDouble("SequenceMessageMargin");
final String borderColor = getValue("SequenceMessageBorderColor"); final String borderColor = getValue("SequenceMessageBorderColor");
@ -1234,7 +1236,7 @@ public class SkinParam implements ISkinParam {
.withBorderColor(border).withRoundCorner(roundCorner); .withBorderColor(border).withRoundCorner(roundCorner);
} }
public ActorStyle getActorStyle() { public ActorStyle actorStyle() {
final String value = getValue("actorstyle"); final String value = getValue("actorstyle");
if ("awesome".equalsIgnoreCase(value)) { if ("awesome".equalsIgnoreCase(value)) {
return ActorStyle.AWESOME; return ActorStyle.AWESOME;

View File

@ -124,8 +124,8 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.shadowing2(stereotype, skinParameter); return skinParam.shadowing2(stereotype, skinParameter);
} }
public PackageStyle getPackageStyle() { public PackageStyle packageStyle() {
return skinParam.getPackageStyle(); return skinParam.packageStyle();
} }
public Sprite getSprite(String name) { public Sprite getSprite(String name) {
@ -276,8 +276,8 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getUmlDiagramType(); return skinParam.getUmlDiagramType();
} }
public HColor getHoverPathColor() { public HColor hoverPathColor() {
return skinParam.getHoverPathColor(); return skinParam.hoverPathColor();
} }
public double getPadding(PaddingParam param) { public double getPadding(PaddingParam param) {
@ -336,8 +336,8 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getStereotypeAlignment(); return skinParam.getStereotypeAlignment();
} }
public Padder getSequenceDiagramPadder() { public Padder sequenceDiagramPadder() {
return skinParam.getSequenceDiagramPadder(); return skinParam.sequenceDiagramPadder();
} }
public StyleBuilder getCurrentStyleBuilder() { public StyleBuilder getCurrentStyleBuilder() {
@ -360,8 +360,8 @@ public class SkinParamDelegator implements ISkinParam {
skinParam.setDefaultSkin(newFileName); skinParam.setDefaultSkin(newFileName);
} }
public ActorStyle getActorStyle() { public ActorStyle actorStyle() {
return skinParam.getActorStyle(); return skinParam.actorStyle();
} }
} }

View File

@ -39,9 +39,12 @@ import java.awt.Color;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -77,8 +80,8 @@ import net.sourceforge.plantuml.svek.EmptySvgException;
import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.GraphvizCrash;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.AffineTransformType;
import net.sourceforge.plantuml.ugraphic.PixelImage;
import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.PixelImage;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -183,7 +186,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed)
throws IOException { throws IOException {
final HColor hover = getSkinParam().getHoverPathColor(); final HColor hover = getSkinParam().hoverPathColor();
if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) { if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) {
fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget()); fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget());
} }
@ -337,9 +340,9 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
private Dimension2D lastInfo; private Dimension2D lastInfo;
private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException { private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException {
final SFile svg = FileUtils.createTempFile("pdf", ".svf"); final File svg = FileUtils.createTempFileLegacy("pdf", ".svf");
final SFile pdfFile = FileUtils.createTempFile("pdf", ".pdf"); final File pdfFile = FileUtils.createTempFileLegacy("pdf", ".pdf");
final OutputStream fos = svg.createBufferedOutputStream(); final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg));;
final ImageData result = exportDiagram(fos, index, new FileFormatOption(FileFormat.SVG)); final ImageData result = exportDiagram(fos, index, new FileFormatOption(FileFormat.SVG));
fos.close(); fos.close();
PdfConverter.convert(svg, pdfFile); PdfConverter.convert(svg, pdfFile);

View File

@ -74,7 +74,7 @@ public class LaneDivider extends AbstractTextBlock {
} }
public StyleSignature getDefaultStyleDefinition() { public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.swimlane); return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.swimlane);
} }
private Style getStyle() { private Style getStyle() {

View File

@ -118,7 +118,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
} }
public StyleSignature getDefaultStyleDefinition() { public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.swimlane); return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.swimlane);
} }
public Swimlanes(ISkinParam skinParam, Pragma pragma) { public Swimlanes(ISkinParam skinParam, Pragma pragma) {

View File

@ -178,7 +178,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
if (symbol == null) { if (symbol == null) {
type = LeafType.DESCRIPTION; type = LeafType.DESCRIPTION;
usymbol = diagram.getSkinParam().getActorStyle().getUSymbol(); usymbol = diagram.getSkinParam().actorStyle().toUSymbol();
} else if (symbol.equalsIgnoreCase("port")) { } else if (symbol.equalsIgnoreCase("port")) {
type = LeafType.PORT; type = LeafType.PORT;
usymbol = null; usymbol = null;
@ -190,7 +190,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
usymbol = null; usymbol = null;
} else { } else {
type = LeafType.DESCRIPTION; type = LeafType.DESCRIPTION;
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam()); usymbol = USymbol.fromString(symbol, diagram.getSkinParam());
if (usymbol == null) { if (usymbol == null) {
throw new IllegalStateException(); throw new IllegalStateException();
} }

View File

@ -72,7 +72,7 @@ public class CommandFooter extends SingleLineCommand2<TitledDiagram> {
final String align = arg.get("POSITION", 0); final String align = arg.get("POSITION", 0);
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER);
if (SkinParam.USE_STYLES() && align == null) { if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.FOOTER.getStyleDefinition() ha = FontParam.FOOTER.getStyleDefinition(null)
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment(); .getHorizontalAlignment();
} }

View File

@ -74,7 +74,7 @@ public class CommandHeader extends SingleLineCommand2<TitledDiagram> {
final String align = arg.get("POSITION", 0); final String align = arg.get("POSITION", 0);
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT);
if (SkinParam.USE_STYLES() && align == null) { if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.HEADER.getStyleDefinition() ha = FontParam.HEADER.getStyleDefinition(null)
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment(); .getHorizontalAlignment();
} }

View File

@ -66,7 +66,7 @@ public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
if (strings.size() > 0) { if (strings.size() > 0) {
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER);
if (SkinParam.USE_STYLES() && align == null) { if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.FOOTER.getStyleDefinition() ha = FontParam.FOOTER.getStyleDefinition(null)
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment(); .getHorizontalAlignment();
} }

View File

@ -66,7 +66,7 @@ public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
if (strings.size() > 0) { if (strings.size() > 0) {
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT);
if (SkinParam.USE_STYLES() && align == null) { if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.HEADER.getStyleDefinition() ha = FontParam.HEADER.getStyleDefinition(null)
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment(); .getHorizontalAlignment();
} }

View File

@ -136,7 +136,8 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
// p.setThisIsTogether(); // p.setThisIsTogether();
// } else // } else
if (stereotype != null) { if (stereotype != null) {
final USymbol usymbol = USymbol.getFromString(stereotype, diagram.getSkinParam().getActorStyle()); final USymbol usymbol = USymbol.fromString(stereotype, diagram.getSkinParam().actorStyle(),
diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle());
if (usymbol == null) { if (usymbol == null) {
p.setStereotype(new Stereotype(stereotype)); p.setStereotype(new Stereotype(stereotype));
} else { } else {

View File

@ -219,12 +219,9 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
addTitleCommands(cmds); addTitleCommands(cmds);
addCommonCommands2(cmds); addCommonCommands2(cmds);
addCommonHides(cmds); addCommonHides(cmds);
cmds.add(new CommandStyleMultilinesCSS());
cmds.add(new CommandStyleImport());
} }
final protected void addCommonCommands2(List<Command> cmds) { final protected void addCommonCommands2(List<Command> cmds) {
// cmds.add(new CommandListSprite());
cmds.add(new CommandNope()); cmds.add(new CommandNope());
cmds.add(new CommandPragma()); cmds.add(new CommandPragma());
@ -245,6 +242,10 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
cmds.add(factorySpriteCommand.createMultiLine(false)); cmds.add(factorySpriteCommand.createMultiLine(false));
cmds.add(factorySpriteCommand.createSingleLine()); cmds.add(factorySpriteCommand.createSingleLine());
cmds.add(new CommandSpriteFile()); cmds.add(new CommandSpriteFile());
cmds.add(new CommandStyleMultilinesCSS());
cmds.add(new CommandStyleImport());
} }
final protected void addCommonHides(List<Command> cmds) { final protected void addCommonHides(List<Command> cmds) {

View File

@ -50,6 +50,9 @@ public class Sea {
private final StringBounder stringBounder; private final StringBounder stringBounder;
public Sea(StringBounder stringBounder) { public Sea(StringBounder stringBounder) {
if (stringBounder == null) {
throw new IllegalArgumentException();
}
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
} }

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.SName;
public class BodierImpl implements Bodier { public class BodierImpl implements Bodier {
@ -83,19 +84,10 @@ public class BodierImpl implements Bodier {
} }
public void addFieldOrMethod(String s) { public void addFieldOrMethod(String s) {
// if (leaf == null) {
// throw new IllegalArgumentException();
// }
// Empty cache // Empty cache
methodsToDisplay = null; methodsToDisplay = null;
fieldsToDisplay = null; fieldsToDisplay = null;
rawBody.add(s); rawBody.add(s);
// if (leaf instanceof ILeaf) {
// if (this.leaf != null && this.leaf != leaf) {
// throw new IllegalArgumentException();
// }
// this.leaf = (ILeaf) leaf;
// }
} }
private boolean isBodyEnhanced() { private boolean isBodyEnhanced() {
@ -203,7 +195,8 @@ public class BodierImpl implements Bodier {
final boolean showFields, Stereotype stereotype) { final boolean showFields, Stereotype stereotype) {
if (type.isLikeClass() && isBodyEnhanced()) { if (type.isLikeClass() && isBodyEnhanced()) {
if (showMethods || showFields) { if (showMethods || showFields) {
return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf); return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf,
SName.classDiagram);
} }
return null; return null;
} }
@ -211,7 +204,7 @@ public class BodierImpl implements Bodier {
throw new IllegalStateException(); throw new IllegalStateException();
} }
final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam, final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam,
stereotype, leaf); stereotype, leaf, SName.classDiagram);
if (type == LeafType.OBJECT) { if (type == LeafType.OBJECT) {
if (showFields == false) { if (showFields == false) {
return new TextBlockLineBefore(TextBlockUtils.empty(0, 0)); return new TextBlockLineBefore(TextBlockUtils.empty(0, 0));
@ -222,7 +215,7 @@ public class BodierImpl implements Bodier {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam, final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam,
stereotype, leaf); stereotype, leaf, SName.classDiagram);
if (showFields && showMethods == false) { if (showFields && showMethods == false) {
return fields.asBlockMemberImpl(); return fields.asBlockMemberImpl();
} else if (showMethods && showFields == false) { } else if (showMethods && showFields == false) {

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockVertical2; import net.sourceforge.plantuml.graphic.TextBlockVertical2;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -79,9 +80,11 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
private final ILeaf entity; private final ILeaf entity;
private final boolean inEllipse; private final boolean inEllipse;
private final double minClassWidth; private final double minClassWidth;
private final SName diagramType;
public BodyEnhanced(List<String> rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier, public BodyEnhanced(List<String> rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier,
Stereotype stereotype, ILeaf entity) { Stereotype stereotype, ILeaf entity, SName diagramType) {
this.diagramType = diagramType;
this.rawBody = new ArrayList<CharSequence>(rawBody); this.rawBody = new ArrayList<CharSequence>(rawBody);
this.stereotype = stereotype; this.stereotype = stereotype;
this.fontParam = fontParam; this.fontParam = fontParam;
@ -98,13 +101,16 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
} }
public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align, public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align,
Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity) { Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity,
this(display, fontParam, skinParam, align, stereotype, manageHorizontalLine, manageHorizontalLine, entity, 0); SName diagramType) {
this(display, fontParam, skinParam, align, stereotype, manageHorizontalLine, manageHorizontalLine, entity, 0,
diagramType);
} }
public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align, public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align,
Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity, Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity,
double minClassWidth) { double minClassWidth, SName diagramType) {
this.diagramType = diagramType;
this.minClassWidth = minClassWidth; this.minClassWidth = minClassWidth;
this.entity = entity; this.entity = entity;
this.stereotype = stereotype; this.stereotype = stereotype;
@ -163,17 +169,15 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
} else { } else {
final String s = s2.toString(); final String s = s2.toString();
if (manageHorizontalLine && isBlockSeparator(s)) { if (manageHorizontalLine && isBlockSeparator(s)) {
blocks.add(decorate(stringBounder, blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity), stereotype, entity, diagramType), separator, title));
separator, title));
separator = s.charAt(0); separator = s.charAt(0);
title = getTitle(s, skinParam); title = getTitle(s, skinParam);
members = new ArrayList<Member>(); members = new ArrayList<Member>();
} else if (Parser.isTreeStart(s)) { } else if (Parser.isTreeStart(s)) {
if (members.size() > 0) { if (members.size() > 0) {
blocks.add(decorate(stringBounder, blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity), stereotype, entity, diagramType), separator, title));
separator, title));
} }
members = new ArrayList<Member>(); members = new ArrayList<Member>();
final List<CharSequence> allTree = buildAllTree(s, it); final List<CharSequence> allTree = buildAllTree(s, it);
@ -193,7 +197,8 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
members.add(new Member("", false, false)); members.add(new Member("", false, false));
} }
blocks.add(decorate(stringBounder, blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity), separator, title)); new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity, diagramType),
separator, title));
if (blocks.size() == 1) { if (blocks.size() == 1) {
this.area = blocks.get(0); this.area = blocks.get(0);

View File

@ -41,6 +41,8 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.EmbeddedDiagram; import net.sourceforge.plantuml.EmbeddedDiagram;
@ -313,6 +315,23 @@ public class Display implements Iterable<CharSequence> {
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
} }
public Display underlinedName() {
final Pattern p = Pattern.compile("^([^:]+?)(\\s*:.+)$");
final List<CharSequence> result = new ArrayList<CharSequence>();
for (CharSequence line : displayData) {
if (result.size() == 0) {
final Matcher m = p.matcher(line);
if (m.matches())
result.add("<u>" + m.group(1) + "</u>" + m.group(2));
else
result.add("<u>" + line);
} else {
result.add("<u>" + line);
}
}
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
}
public Display withCreoleMode(CreoleMode mode) { public Display withCreoleMode(CreoleMode mode) {
if (isNull) { if (isNull) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@ -81,30 +81,26 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
private final FontParam fontParam; private final FontParam fontParam;
private final ISkinParam skinParam; private final ISkinParam skinParam;
// private final HColor color;
// private final HColor hyperlinkColor;
// private final boolean useUnderlineForHyperlink;
private final Rose rose = new Rose(); private final Rose rose = new Rose();
private final List<Member> members = new ArrayList<Member>(); private final List<Member> members = new ArrayList<Member>();
private final HorizontalAlignment align; private final HorizontalAlignment align;
private final Stereotype stereotype; private final Stereotype stereotype;
private final ILeaf leaf; private final ILeaf leaf;
private final SName diagramType;
public MethodsOrFieldsArea(List<Member> members, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype, public MethodsOrFieldsArea(List<Member> members, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype,
ILeaf leaf) { ILeaf leaf, SName diagramType) {
this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf); this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf, diagramType);
} }
public MethodsOrFieldsArea(List<Member> members, FontParam fontParam, ISkinParam skinParam, public MethodsOrFieldsArea(List<Member> members, FontParam fontParam, ISkinParam skinParam,
HorizontalAlignment align, Stereotype stereotype, ILeaf leaf) { HorizontalAlignment align, Stereotype stereotype, ILeaf leaf, SName diagramType) {
this.diagramType = diagramType;
this.leaf = leaf; this.leaf = leaf;
this.stereotype = stereotype; this.stereotype = stereotype;
this.align = align; this.align = align;
this.skinParam = skinParam; this.skinParam = skinParam;
this.fontParam = fontParam; this.fontParam = fontParam;
// this.color = rose.getFontColor(skinParam, fontParam);
// this.hyperlinkColor = skinParam.getHyperlinkColor();
// this.useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink();
this.members.addAll(members); this.members.addAll(members);
} }
@ -165,7 +161,9 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
} }
FontConfiguration config; FontConfiguration config;
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
final Style style = StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component) // final Style style = StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component)
// .getMergedStyle(skinParam.getCurrentStyleBuilder());
final Style style = fontParam.getStyleDefinition(diagramType)
.getMergedStyle(skinParam.getCurrentStyleBuilder()); .getMergedStyle(skinParam.getCurrentStyleBuilder());
config = new FontConfiguration(style, skinParam, stereotype, fontParam); config = new FontConfiguration(style, skinParam, stereotype, fontParam);
} else { } else {

View File

@ -145,7 +145,7 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
type = "biddable"; type = "biddable";
} }
} }
USymbol usymbol = USymbol.getFromString(type, diagram.getSkinParam()); USymbol usymbol = USymbol.fromString(type, diagram.getSkinParam());
entity.setUSymbol(usymbol); entity.setUSymbol(usymbol);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -75,14 +75,14 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
if (type == null) { if (type == null) {
String codeString = code.getName(); String codeString = code.getName();
if (codeString.startsWith("[") && codeString.endsWith("]")) { if (codeString.startsWith("[") && codeString.endsWith("]")) {
final USymbol sym = getSkinParam().componentStyle().toSymbol() ; final USymbol sym = getSkinParam().componentStyle().toUSymbol() ;
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, sym); return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, sym);
} }
if (codeString.startsWith(":") && codeString.endsWith(":")) { if (codeString.startsWith(":") && codeString.endsWith(":")) {
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION,
getSkinParam().getActorStyle().getUSymbol()); getSkinParam().actorStyle().toUSymbol());
} }
if (codeString.startsWith("()")) { if (codeString.startsWith("()")) {
codeString = StringUtils.trin(codeString.substring(2)); codeString = StringUtils.trin(codeString.substring(2));
@ -103,7 +103,7 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
for (ILeaf leaf : getLeafsvalues()) { for (ILeaf leaf : getLeafsvalues()) {
final LeafType type = leaf.getLeafType(); final LeafType type = leaf.getLeafType();
final USymbol usymbol = leaf.getUSymbol(); final USymbol usymbol = leaf.getUSymbol();
if (type == LeafType.USECASE || usymbol == getSkinParam().getActorStyle().getUSymbol()) { if (type == LeafType.USECASE || usymbol == getSkinParam().actorStyle().toUSymbol()) {
return true; return true;
} }
} }
@ -114,7 +114,7 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
public void makeDiagramReady() { public void makeDiagramReady() {
super.makeDiagramReady(); super.makeDiagramReady();
final LeafType defaultType = isUsecase() ? LeafType.DESCRIPTION : LeafType.DESCRIPTION; final LeafType defaultType = isUsecase() ? LeafType.DESCRIPTION : LeafType.DESCRIPTION;
final USymbol defaultSymbol = isUsecase() ? getSkinParam().getActorStyle().getUSymbol() : USymbol.INTERFACE; final USymbol defaultSymbol = isUsecase() ? getSkinParam().actorStyle().toUSymbol() : USymbol.INTERFACE;
for (ILeaf leaf : getLeafsvalues()) { for (ILeaf leaf : getLeafsvalues()) {
if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) { if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) {
leaf.muteToType(defaultType, defaultSymbol); leaf.muteToType(defaultType, defaultSymbol);

View File

@ -56,6 +56,7 @@ 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.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
@ -78,7 +79,7 @@ public class EntityImageRequirement extends AbstractEntityImage {
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.REQUIREMENT, skinParam, final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.REQUIREMENT, skinParam,
HorizontalAlignment.CENTER, stereotype, true, false, entity); HorizontalAlignment.CENTER, stereotype, true, false, entity, SName.componentDiagram);
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) {
this.desc = tmp; this.desc = tmp;

View File

@ -178,7 +178,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
if (symbol == null) { if (symbol == null) {
type = LeafType.DESCRIPTION; type = LeafType.DESCRIPTION;
usymbol = diagram.getSkinParam().getActorStyle().getUSymbol(); usymbol = diagram.getSkinParam().actorStyle().toUSymbol();
} else if (symbol.equalsIgnoreCase("portin")) { } else if (symbol.equalsIgnoreCase("portin")) {
type = LeafType.PORTIN; type = LeafType.PORTIN;
usymbol = null; usymbol = null;
@ -196,7 +196,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
usymbol = null; usymbol = null;
} else { } else {
type = LeafType.DESCRIPTION; type = LeafType.DESCRIPTION;
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam()); usymbol = USymbol.fromString(symbol, diagram.getSkinParam());
if (usymbol == null) { if (usymbol == null) {
throw new IllegalStateException(); throw new IllegalStateException();
} }

View File

@ -60,6 +60,8 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class CommandCreateElementMultilines extends CommandMultilines2<AbstractEntityDiagram> { public class CommandCreateElementMultilines extends CommandMultilines2<AbstractEntityDiagram> {
@ -133,7 +135,8 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
type = LeafType.USECASE; type = LeafType.USECASE;
usymbol = null; usymbol = null;
} else { } else {
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().getActorStyle()); usymbol = USymbol.fromString(symbol, diagram.getSkinParam().actorStyle(),
diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle());
if (usymbol == null) { if (usymbol == null) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
@ -179,9 +182,18 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
result.addUrl(url); result.addUrl(url);
} }
result.setSpecificColorTOBEREMOVED(ColorType.BACK, // final HColor backColor =
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",
// 0));
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
result.setColors(colors);
// result.setSpecificColorTOBEREMOVED(ColorType.BACK, backColor);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
} }

View File

@ -155,7 +155,7 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
final USymbol usymbol; final USymbol usymbol;
type = LeafType.DESCRIPTION; type = LeafType.DESCRIPTION;
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam()); usymbol = USymbol.fromString(symbol, diagram.getSkinParam());
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Ident ident = diagram.buildLeafIdent(idShort); final Ident ident = diagram.buildLeafIdent(idShort);

View File

@ -289,9 +289,9 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.USECASE, USymbol.USECASE, pure); return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.USECASE, USymbol.USECASE, pure);
} else if (codeChar == ':') { } else if (codeChar == ':') {
return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION,
diagram.getSkinParam().getActorStyle().getUSymbol(), pure); diagram.getSkinParam().actorStyle().toUSymbol(), pure);
} else if (codeChar == '[') { } else if (codeChar == '[') {
final USymbol sym = diagram.getSkinParam().componentStyle().toSymbol(); final USymbol sym = diagram.getSkinParam().componentStyle().toUSymbol();
return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, sym, pure); return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, sym, pure);
} }

View File

@ -160,7 +160,8 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
if ("together".equalsIgnoreCase(symbol)) { if ("together".equalsIgnoreCase(symbol)) {
p.setThisIsTogether(); p.setThisIsTogether();
} }
p.setUSymbol(USymbol.getFromString(symbol, diagram.getSkinParam().getActorStyle())); p.setUSymbol(USymbol.fromString(symbol, diagram.getSkinParam().actorStyle(),
diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()));
final String stereotype = arg.getLazzy("STEREOTYPE", 0); final String stereotype = arg.getLazzy("STEREOTYPE", 0);
if (stereotype != null) { if (stereotype != null) {
p.setStereotype(new Stereotype(stereotype, false)); p.setStereotype(new Stereotype(stereotype, false));

View File

@ -74,26 +74,26 @@ public class PSystemDonors extends AbstractPSystem {
private static final int COLS = 6; private static final int COLS = 6;
private static final int FREE_LINES = 6; private static final int FREE_LINES = 6;
public static final String DONORS = "6ySB02mFUBXRGOc9nbfsvvsjZ8zbDKqYM9ud58U1HJpT3OW_mBtJutuZ_KLqfNlVD2FQiZN5USOGiI3e" public static final String DONORS = "6xKB02mFkBap0p4nqLYNlhbPJVbOScQJ29Rd2SLXO15FTmFY3t3lzBZVI7yHNUdUDys8jcnDSPunH2m8"
+ "yJIvPjZctXvupCdFe-IxmsY4GPYio__BbYQxT2r0gWmfmRDSR_uPnVYUEsbeodQv4793qY-yxupDizFu" + "UZnDhXcskRS7GbifBu8ZbU02Ka1y6oVdVUp8-_H9bI4bYAMIzTjKJ9zqAHiYuxFU2Ds0pdaRtdV6vjbf"
+ "ujMZ2Te8_1ZOL_zlwf1nUQWAmz1iXJ4O5OrGdJ_q56ijjVR_KOqBfs3VeOeUIuxfrCLrE5JHYCwA5uhL" + "VF7gqGHj17uCxAl_DwULTVUgAin0bzMCcL7H4weOKYCYHVn_LEEoKnlVJNKQI08wTN45DzMfW5SdF0OM"
+ "E0UtZFFHfCMecD0cKefgeuGYEPYXhIRLvyWL6TpyKZz0cwxjcX8v4efzbaXqV-rftt60ziibFtJoGopO" + "QGQtZFDgqcHKJ68JAQ7QA24a1ZEqvQJsEVAB31A_r1leqbfTGo9tGF6OAH9TZ-NsxJjeVhd4Y-0Flc2p"
+ "8h20Ye_i9oXvRSIuoHT1GyjSzCPM7Ldo90E6KkZ2tloXB8wufsJcChIuAN062ehSne78I6hJ0hC3Ym5L" + "m1nAEOelKFpSY97myw2XPHUziLL7bZmfWA4CMjYRFnJ9aTv3ChiCBH81DL0GyZOEI4QXDaquExOOK6KF"
+ "Ug95doOfkZ5kmftFOLcArKR3iy2YW2Nd06ioyZ_e4pxTTtraSioRefQKfqdUozQZSTMzbsipec_wqIHH" + "jkZJ85MN-asuSnsMf_JSQ7WHM0HOS1PGGv3_GI_uZBxobiazDqKj8K-JU5LRZ_gLU2zjCw9l-j4aK3xR"
+ "lhPtoTBZIb4rJ-bizUdpjRf3xfgowl4leqOyUt2tqq8Q5XyfY1-6RXiJbUJFj8M558HhA_qWNUR6AsSl" + "JyrSVkKfMm_fN7cVyw_E3ddNa9MhFumwCda4TpdCfM5-Qu7w4UYsEL59V4zPM4X0kAxK6-awDrwflGZ7"
+ "mZ4RifIjus-nPJNsyYvViJ6nB7SMUFTytMXAXbhAAkGqTBjMPIxjVAAbD3N-B_BeqVc_m9fAita7wJrB" + "R4YfMCTVOijh-X-w8fMDYULqiCXFzzUbfcImXQvCgg4tj2hJhFE9bjHGVt_9ewNpNN1DfTczW_GUQNEU"
+ "vpB_lnjMQiOI3Zesn2pNpGB5ucbIzIusBaBJJAU6t0J83QZk9hVYRdKHVzG7vDvICX65pRO4YVPKSfUB" + "_zzrIpD3SO2EJJ4BkaMW6AocLM-nWGXE2vqVSXCW6r2-J6xvo_9B_54V4BovH20A6v9syET7o4CkN9Y1"
+ "4APZfPjAZ02MJ2dd-XjR4FcgrS7eLaI9HSeYz35CUgRjgx1D-k1ckxanYQCwfNmIVbi8tCEmKYsQsQ5j" + "LTsKOWGmUqevBn911oBKwX1qAwga8sNk-XacFTkMZPbbqWVNxGPZvCTqGd4HVfaBFCAmKYsQzTtQ9dO9"
+ "6tCnNiR7SLvrh_v-bRJjBRodV4ZDAnZ8AoqOOIaveZoEie-4kmOAihXBNXhYUuHr3XwwSy4PB5h6Z3RR" + "hl8wpglkDTglujZUmdlAJMh_aW4_mvmHaN8ZYdrFkoKyr56OnLxoL1VVq-tauA4x5vp1ecNCQBCTCWqA"
+ "8Gj3SZmPP-bN31-Q37lxNJPihurDNi3xghCJmiZ8WzTBacjgSOcRV3DOJWxR08gDnIjs-PcB25LRRYgR" + "Pv9nfZvYzA71y7SKifhT6vjw1U4xOIkucP46pvScrzJa4Wc_xIp7mnQ04dFnYbrHuP92rImxbQjh2PCZ"
+ "wnAcHgmUXGhu7VC9p9LjuSfZlTsru0nO5DN1l3lMM1gtAStR0ghBgOAOTA6CcT8KQNix6NfMfsUf3R3z" + "Lez2XloEzGaibMdXnjFFvgw5PsIFWZgSTyUgexvDQTuMK5rC4wIbXJ9dI9E7hGKoi5QdPwaDiFkb7GlM"
+ "gUuBpZOVLTWqABsjeks63QPFeUaKwHSD8X4IhGgvrAGmm7Tz_4eywEiGupkzR24EaHQI5A02oZaVE9K6" + "DZzPiU9GVDj4suqR54o1wIBS1mqYKIvebEWb9ea1lklZL-h9VHriV7TFAyP1qa8I0rN8rLa_E3KDdbje"
+ "ppsrbFKQ_N-jjTFA-VFlTMI3KtlSyvD2w1a8ujz3WHpX539v6lXwymVW7G6hOfPs2h1oZTppG5A3dNXd" + "6kir-d-ijSEoy-VVwyWcf_Quzrq4qNEG7Fzk2j1HJY22fu6ljtmoUIV1gh58JqhcoZLAJmC92tRIExEe"
+ "5dN_CADp9nRApQX5hzW-LELltww0nNA83IikOccAwLkSidPg19LVzvrlB0voMFYxg38Xawkdh3P6mcVG" + "HuSPhJjUB3SZ5xry-r2LFvrSWOlvu1jMNAJJvBClSTBQeHvKKTjtlh4uo67WxwBAX4okSlNQ60cTGIzE"
+ "YnCT-vgbk7FD116CZai5xdxrMJFDkumvNx6iRZWuyiqH6L9q3osg9MbjFZsmKPpvlPLjIARxNp8Ydrzg" + "QkmsKt6NLGgmO7PS9h3tgy-QQRnap7t7KjtmE91lZiYGOlJGmfgQriQ5m4RfpEyjR4Coe_yBHlIBQgsV"
+ "rlVgeRTJ_Xnf0is_jTJx6LbWcCWuCB2-tEV40pVU2AWBKpl-wMB1bOkk67PvmHRs6_iHMPxmmhPMcGXp" + "U_NGUr9-ZnI1Xczda75691WkaWuCZ9lxd6ZGpJSCyiBKdEXqiVZAHLSCEr-mmdvZFo8B2IziQwQ9iDVH"
+ "dswLeoyByQnsUewr9UzZez7qGQ9IU23R5-lqsOd5iWoFP84KhjbR9ej8w_I6Ixg3S8Z2-VxU1dEilFaH" + "hURKnrmyfnt8CRQGVMmscbx8gmWDP66nJgzEB9HoF90YAPYpjumNaNRI6rpQEu1EKJ3-VxSXd5veVaHc"
+ "cTNcqnk5NDhSYtiG-N1ycgIcNJOxSfCRwuxSRIC1-ge0"; + "bNdrHZ6NS-x5FOXqk3-DnAPTDZEowLsdAt9Z10y0";
/* /*
* Special thanks to our sponsors and donors: * Special thanks to our sponsors and donors:

View File

@ -272,7 +272,10 @@ public class QuoteUtils {
"V qba'g gnxr erfcbafvovyvgl ng nyy", "V qba'g gnxr erfcbafvovyvgl ng nyy",
"Gurer'f n jbeq sbe crbcyr jub guvax rirelbar vf pbafcvevat ntnvafg gurz: creprcgvir", "Gurer'f n jbeq sbe crbcyr jub guvax rirelbar vf pbafcvevat ntnvafg gurz: creprcgvir",
"V'yy yrg gung cnff orpnhfr guvf vf tbbqolr", "V ybir vg jura n cyna pbzrf gbtrgure", "V'yy yrg gung cnff orpnhfr guvf vf tbbqolr", "V ybir vg jura n cyna pbzrf gbtrgure",
"Znxr hf nyy fnsr. Tb onpx gb lbhe ohaxre"); "Znxr hf nyy fnsr. Tb onpx gb lbhe ohaxre", "Gh z'nf qrph, Ongzna", "Gurerfr, p'rfg har pngnfgebcur",
"Vs lbh ner abg rzoneenffrq ol gur svefg irefvba bs lbhe cebqhpg, lbh'ir ynhapurq gbb yngr",
"Zvfgnxrf znqr zl fhpprff: V znxr ehoore renfre", "Ovt Oebgure vf Jngpuvat Lbh.",
"Ab bar'f gnyxvat nobhg yrnivat gur fvatyr znexrg");
private QuoteUtils() { private QuoteUtils() {
} }

View File

@ -140,6 +140,11 @@ public class SkinParameter {
private final LineParam lineParam; private final LineParam lineParam;
private final CornerParam roundParam; private final CornerParam roundParam;
private final SName styleName; private final SName styleName;
@Override
public String toString() {
return name;
}
public SName getStyleName() { public SName getStyleName() {
return styleName; return styleName;

View File

@ -40,12 +40,14 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ComponentStyle;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
public abstract class USymbol { public abstract class USymbol {
@ -111,26 +113,6 @@ public abstract class USymbol {
return getSkinParameter().getColorParamBorder(); return getSkinParameter().getColorParamBorder();
} }
public static USymbol getFromString(String s, ActorStyle actorStyle) {
if (s == null) {
return null;
}
if (s.equalsIgnoreCase("actor")) {
return actorStyle.getUSymbol();
}
final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", "")));
if (result == null) {
if (s.equalsIgnoreCase("component")) {
return COMPONENT2;
}
if (s.equalsIgnoreCase("entity")) {
return ENTITY_DOMAIN;
}
return null;
}
return result;
}
private static USymbol record(String code, SkinParameter skinParameter, USymbol symbol) { private static USymbol record(String code, SkinParameter skinParameter, USymbol symbol) {
all.put(StringUtils.goUpperCase(code), symbol); all.put(StringUtils.goUpperCase(code), symbol);
return symbol; return symbol;
@ -200,7 +182,28 @@ public abstract class USymbol {
}; };
} }
public static USymbol getFromString(String symbol, ISkinParam skinParam) { public static USymbol fromString(String s, ActorStyle actorStyle, ComponentStyle componentStyle,
PackageStyle packageStyle) {
if (s == null) {
return null;
}
if (s.equalsIgnoreCase("package")) {
return packageStyle.toUSymbol();
}
if (s.equalsIgnoreCase("actor")) {
return actorStyle.toUSymbol();
}
if (s.equalsIgnoreCase("component")) {
return componentStyle.toUSymbol();
}
if (s.equalsIgnoreCase("entity")) {
return ENTITY_DOMAIN;
}
final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", "")));
return result;
}
public static USymbol fromString(String symbol, ISkinParam skinParam) {
USymbol usymbol = null; USymbol usymbol = null;
if (symbol.equalsIgnoreCase("artifact")) { if (symbol.equalsIgnoreCase("artifact")) {
usymbol = USymbol.ARTIFACT; usymbol = USymbol.ARTIFACT;
@ -233,9 +236,9 @@ public abstract class USymbol {
} else if (symbol.equalsIgnoreCase("agent")) { } else if (symbol.equalsIgnoreCase("agent")) {
usymbol = USymbol.AGENT; usymbol = USymbol.AGENT;
} else if (symbol.equalsIgnoreCase("actor")) { } else if (symbol.equalsIgnoreCase("actor")) {
usymbol = skinParam.getActorStyle().getUSymbol(); usymbol = skinParam.actorStyle().toUSymbol();
} else if (symbol.equalsIgnoreCase("component")) { } else if (symbol.equalsIgnoreCase("component")) {
usymbol = skinParam.componentStyle().toSymbol(); usymbol = skinParam.componentStyle().toUSymbol();
} else if (symbol.equalsIgnoreCase("boundary")) { } else if (symbol.equalsIgnoreCase("boundary")) {
usymbol = USymbol.BOUNDARY; usymbol = USymbol.BOUNDARY;
} else if (symbol.equalsIgnoreCase("control")) { } else if (symbol.equalsIgnoreCase("control")) {

View File

@ -65,7 +65,7 @@ class USymbolCloud extends USymbol {
private void drawCloud(UGraphic ug, double width, double height, boolean shadowing) { private void drawCloud(UGraphic ug, double width, double height, boolean shadowing) {
final UPath shape = getSpecificFrontierForCloud(width, height); final UPath shape = getSpecificFrontierForCloud(width, height);
if (shadowing) { if (shadowing) {
// shape.setDeltaShadow(3.0); shape.setDeltaShadow(3.0);
} }
ug.apply(UTranslate.dy(0)).draw(shape); ug.apply(UTranslate.dy(0)).draw(shape);
} }

View File

@ -99,9 +99,10 @@ class USymbolComponent1 extends USymbol {
} }
@Override @Override
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, public TextBlock asBig(TextBlock title, HorizontalAlignment labelAlignment, TextBlock stereotype, double width,
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { double height, SymbolContext symbolContext, HorizontalAlignment stereoAlignment) {
throw new UnsupportedOperationException(); return USymbol.COMPONENT2.asBig(title, labelAlignment, stereotype, width, height, symbolContext,
stereoAlignment);
} }
@Override @Override

View File

@ -65,6 +65,11 @@ public class USymbolFolder extends USymbol {
this.showTitle = showTitle; this.showTitle = showTitle;
} }
@Override
public String toString() {
return super.toString() + " " + skinParameter + " " + showTitle;
}
@Override @Override
public SkinParameter getSkinParameter() { public SkinParameter getSkinParameter() {
return skinParameter; return skinParameter;
@ -167,7 +172,8 @@ public class USymbolFolder extends USymbol {
@Override @Override
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { final double width, final double height, final SymbolContext symbolContext,
final HorizontalAlignment stereoAlignment) {
return new AbstractTextBlock() { return new AbstractTextBlock() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {

View File

@ -56,11 +56,6 @@ class USymbolStack extends USymbol {
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) {
final double border = 15; final double border = 15;
final URectangle rect = new URectangle(width - 2 * border, height).rounded(roundCorner);
if (shadowing) {
rect.setDeltaShadow(3.0);
}
ug.apply(new HColorNone()).apply(UTranslate.dx(border)).draw(rect);
final UPath path = new UPath(); final UPath path = new UPath();
if (roundCorner == 0) { if (roundCorner == 0) {
path.moveTo(0, 0); path.moveTo(0, 0);
@ -81,7 +76,12 @@ class USymbolStack extends USymbol {
path.arcTo(new Point2D.Double(width - border + roundCorner / 2, 0), roundCorner / 2, 0, 1); path.arcTo(new Point2D.Double(width - border + roundCorner / 2, 0), roundCorner / 2, 0, 1);
path.lineTo(width, 0); path.lineTo(width, 0);
} }
if (shadowing) {
path.setDeltaShadow(3.0);
}
ug.apply(new HColorNone().bg()).draw(path); ug.apply(new HColorNone().bg()).draw(path);
final URectangle rect = new URectangle(width - 2 * border, height).rounded(roundCorner);
ug.apply(new HColorNone()).apply(UTranslate.dx(border)).draw(rect);
} }
private Margin getMargin() { private Margin getMargin() {

View File

@ -93,6 +93,7 @@ import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.svek.Cluster; import net.sourceforge.plantuml.svek.Cluster;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
@ -236,7 +237,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
attribute = new TextBlockEmpty(); attribute = new TextBlockEmpty();
} else { } else {
attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, diagram.getSkinParam(), attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, diagram.getSkinParam(),
g.getStereotype(), null); g.getStereotype(), null, SName.stateDiagram);
} }
final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder); final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder);
final double attributeHeight = dimAttribute.getHeight(); final double attributeHeight = dimAttribute.getHeight();
@ -427,8 +428,9 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
margin1 = 0; margin1 = 0;
margin2 = 10; margin2 = 10;
} }
final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), diagram.getAnimation(), fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(),
null, scale); ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(),
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, null, scale);
imageBuilder.setUDrawable(new Drawing(null)); imageBuilder.setUDrawable(new Drawing(null));
final Dimension2D dim = imageBuilder.getFinalDimension(stringBounder); final Dimension2D dim = imageBuilder.getFinalDimension(stringBounder);

View File

@ -35,6 +35,7 @@
package net.sourceforge.plantuml.nwdiag; package net.sourceforge.plantuml.nwdiag;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ComponentStyle;
import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -44,6 +45,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
@ -88,8 +90,8 @@ public class DiagElement {
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(), final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
ColorParam.activityBorder.getDefaultValue()).withShadow(3); ColorParam.activityBorder.getDefaultValue()).withShadow(3);
final TextBlock desc = toTextBlock(description); final TextBlock desc = toTextBlock(description);
final TextBlock box = shape.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), final TextBlock box = shape.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), symbolContext,
symbolContext, HorizontalAlignment.CENTER); HorizontalAlignment.CENTER);
return new LinkedElement(ad1, box, ad2, mainNetwork, this); return new LinkedElement(ad1, box, ad2, mainNetwork, this);
} }
@ -110,7 +112,8 @@ public class DiagElement {
} }
public final void setShape(String shapeName) { public final void setShape(String shapeName) {
final USymbol shapeFromString = USymbol.getFromString(shapeName, ActorStyle.STICKMAN); final USymbol shapeFromString = USymbol.fromString(shapeName, ActorStyle.STICKMAN, ComponentStyle.RECTANGLE,
PackageStyle.RECTANGLE);
if (shapeFromString != null) { if (shapeFromString != null) {
this.shape = shapeFromString; this.shape = shapeFromString;
} }

View File

@ -1,66 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.objectdiagram;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.USymbol;
public class ObjectDiagram extends AbstractClassOrObjectDiagram {
public ObjectDiagram(ISkinSimple skinParam) {
super(skinParam);
}
@Override
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
if (type == null) {
type = LeafType.OBJECT;
}
// final Ident idNewLong = buildLeafIdent(id);
return getOrCreateLeafDefault(ident, code, type, symbol);
}
@Override
public UmlDiagramType getUmlDiagramType() {
return UmlDiagramType.OBJECT;
}
}

View File

@ -35,13 +35,12 @@
*/ */
package net.sourceforge.plantuml.pdf; package net.sourceforge.plantuml.pdf;
import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import net.sourceforge.plantuml.security.SFile;
public class PdfConverter { public class PdfConverter {
public static void convert(SFile svgFile, SFile pdfFile) { public static void convert(File svgFile, File pdfFile) {
if (svgFile.exists() == false) { if (svgFile.exists() == false) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.security;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
@ -46,6 +47,13 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@ -120,7 +128,7 @@ public class SURL {
} }
final int port = internal.getPort(); final int port = internal.getPort();
// Using INTERNET profile, port 80 and 443 are ok // Using INTERNET profile, port 80 and 443 are ok
if (port == 80 || port == 443) { if (port == 80 || port == 443 || port == -1) {
return true; return true;
} }
} }
@ -128,10 +136,10 @@ public class SURL {
} }
private boolean pureIP(String full) { private boolean pureIP(String full) {
if (full.matches("^https?://\\d+\\.\\d+\\.\\d+\\.\\d+\\/")) { if (full.matches("^https?://\\d+\\.\\d+\\.\\d+\\.\\d+.*")) {
return false; return true;
} }
return true; return false;
} }
private boolean isInAllowList() { private boolean isInAllowList() {
@ -160,10 +168,27 @@ public class SURL {
return Arrays.asList(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(env).split(";")); return Arrays.asList(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(env).split(";"));
} }
private final static ExecutorService exe = Executors.newCachedThreadPool();
private final static Map<String, Long> badHosts = new ConcurrentHashMap<String, Long>();
// Added by Alain Corbiere // Added by Alain Corbiere
public byte[] getBytes() { public byte[] getBytes() {
if (isUrlOk()) if (isUrlOk() == false) {
try { return null;
}
final String host = internal.getHost();
final Long bad = badHosts.get(host);
if (bad != null) {
final long duration = System.currentTimeMillis() - bad;
if (duration < 1000L * 60) {
// System.err.println("BAD HOST!" + host);
return null;
}
// System.err.println("cleaning " + host);
badHosts.remove(host);
}
final Future<byte[]> result = exe.submit(new Callable<byte[]>() {
public byte[] call() throws IOException {
InputStream input = null; InputStream input = null;
try { try {
final URLConnection connection = internal.openConnection(); final URLConnection connection = internal.openConnection();
@ -184,9 +209,18 @@ public class SURL {
input.close(); input.close();
} }
} }
} catch (Exception e) {
e.printStackTrace();
} }
});
try {
byte data[] = result.get(SecurityUtils.getSecurityProfile().getTimeout(), TimeUnit.MILLISECONDS);
if (data != null) {
return data;
}
} catch (Exception e) {
System.err.println("issue " + host + " " + e);
}
badHosts.put(host, System.currentTimeMillis());
return null; return null;
} }

View File

@ -136,4 +136,24 @@ public enum SecurityProfile {
} }
return "<i>This is completely safe: no access on local files or on distant URL."; return "<i>This is completely safe: no access on local files or on distant URL.";
} }
/**
* Retrieve the timeout for URL.
*/
public long getTimeout() {
switch (this) {
case SANDBOX:
return 1000L;
case ALLOWLIST:
return 1000L * 60 * 5;
case INTERNET:
return 1000L * 10;
case LEGACY:
return 1000L * 60;
case UNSECURE:
return 1000L * 60 * 5;
}
throw new AssertionError();
}
} }

View File

@ -327,7 +327,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
final DisplaySection display = diagram.getFooterOrHeaderTeoz(fontParam).withPage(page + 1, pages.size()); final DisplaySection display = diagram.getFooterOrHeaderTeoz(fontParam).withPage(page + 1, pages.size());
Style style = null; Style style = null;
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
final StyleSignature def = fontParam.getStyleDefinition(); final StyleSignature def = fontParam.getStyleDefinition(null);
style = def.getMergedStyle(skinParam.getCurrentStyleBuilder()); style = def.getMergedStyle(skinParam.getCurrentStyleBuilder());
} }
return new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor, return new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor,

View File

@ -270,7 +270,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
Style style = null; Style style = null;
final ISkinParam skinParam = diagram.getSkinParam(); final ISkinParam skinParam = diagram.getSkinParam();
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
final StyleSignature def = param.getStyleDefinition(); final StyleSignature def = param.getStyleDefinition(null);
style = def.getMergedStyle(skinParam.getCurrentStyleBuilder()); style = def.getMergedStyle(skinParam.getCurrentStyleBuilder());
} }
final PngTitler pngTitler = new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor, final PngTitler pngTitler = new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor,
@ -296,7 +296,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
HorizontalAlignment titleAlignment = HorizontalAlignment.CENTER; HorizontalAlignment titleAlignment = HorizontalAlignment.CENTER;
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
final StyleSignature def = FontParam.TITLE.getStyleDefinition(); final StyleSignature def = FontParam.TITLE.getStyleDefinition(null);
titleAlignment = def.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()) titleAlignment = def.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment(); .getHorizontalAlignment();
} }

View File

@ -43,7 +43,7 @@ public enum ActorStyle {
STICKMAN, AWESOME; STICKMAN, AWESOME;
public USymbol getUSymbol() { public USymbol toUSymbol() {
if (this == STICKMAN) { if (this == STICKMAN) {
return USymbol.ACTOR_STICKMAN; return USymbol.ACTOR_STICKMAN;
} else if (this == AWESOME) { } else if (this == AWESOME) {

View File

@ -78,7 +78,7 @@ public abstract class AbstractComponentRoseArrow extends AbstractTextualComponen
@Override @Override
final protected TextBlock getTextBlock() { final protected TextBlock getTextBlock() {
final Padder padder = getISkinSimple() instanceof ISkinParam ? ((ISkinParam) getISkinSimple()) final Padder padder = getISkinSimple() instanceof ISkinParam ? ((ISkinParam) getISkinSimple())
.getSequenceDiagramPadder() : Padder.NONE; .sequenceDiagramPadder() : Padder.NONE;
return padder.apply(super.getTextBlock()); return padder.apply(super.getTextBlock());
} }

View File

@ -143,13 +143,13 @@ public class Rose {
getStroke(param, LineParam.sequenceLifeLineBorder, 1.5), param.getIHtmlColorSet()); getStroke(param, LineParam.sequenceLifeLineBorder, 1.5), param.getIHtmlColorSet());
} }
if (type == ComponentType.ACTOR_HEAD) { if (type == ComponentType.ACTOR_HEAD) {
return new ComponentRoseActor(param.getActorStyle(), styles == null ? null : styles[0], return new ComponentRoseActor(param.actorStyle(), styles == null ? null : styles[0],
styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder),
getUFont2(param, FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getUFont2(param, FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype,
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); getFontColor(param, FontParam.SEQUENCE_STEREOTYPE));
} }
if (type == ComponentType.ACTOR_TAIL) { if (type == ComponentType.ACTOR_TAIL) {
return new ComponentRoseActor(param.getActorStyle(), styles == null ? null : styles[0], return new ComponentRoseActor(param.actorStyle(), styles == null ? null : styles[0],
styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder),
getUFont2(param, FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getUFont2(param, FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype,
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); getFontColor(param, FontParam.SEQUENCE_STEREOTYPE));

View File

@ -354,7 +354,7 @@ public class Cluster implements Moveable {
} }
PackageStyle packageStyle = group.getPackageStyle(); PackageStyle packageStyle = group.getPackageStyle();
if (packageStyle == null) { if (packageStyle == null) {
packageStyle = skinParam2.getPackageStyle(); packageStyle = skinParam2.packageStyle();
} }
if (border != null) { if (border != null) {
final HColor tmp = skinParam2.getHtmlColor(border, group.getStereotype(), false); final HColor tmp = skinParam2.getHtmlColor(border, group.getStereotype(), false);
@ -512,7 +512,7 @@ public class Cluster implements Moveable {
attribute = new TextBlockEmpty(); attribute = new TextBlockEmpty();
} else { } else {
attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, skinParam, group.getStereotype(), attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, skinParam, group.getStereotype(),
null); null, SName.stateDiagram);
} }
return attribute; return attribute;
} }
@ -836,12 +836,12 @@ public class Cluster implements Moveable {
printCluster1(sb, lines, stringBounder); printCluster1(sb, lines, stringBounder);
final Node added = printCluster2(sb, lines, stringBounder, dotMode, graphvizVersion, type); final Node added = printCluster2(sb, lines, stringBounder, dotMode, graphvizVersion, type);
if (entityPositionsExceptNormal.size() > 0 && added == null) { if (entityPositionsExceptNormal.size() > 0) {
if (hasPort()) { if (hasPort()) {
sb.append(empty() + " [shape=rect,width=.01,height=.01,label="); sb.append(empty() + " [shape=rect,width=.01,height=.01,label=");
sb.append(label); sb.append(label);
sb.append("];"); sb.append("];");
} else { } else if (added == null) {
sb.append(empty() + " [shape=point,width=.01,label=\"\"];"); sb.append(empty() + " [shape=point,width=.01,label=\"\"];");
} }
SvekUtils.println(sb); SvekUtils.println(sb);
@ -874,7 +874,11 @@ public class Cluster implements Moveable {
} }
private String empty() { private String empty() {
return "empty" + color; // return "empty" + color;
// We use the same node with one for thereALinkFromOrToGroup2 as an empty
// because we cannot put a new node in the nested inside of the cluster
// if thereALinkFromOrToGroup2 is enabled.
return getSpecialPointId(group);
} }
public boolean isLabel() { public boolean isLabel() {

View File

@ -631,7 +631,7 @@ public final class GeneralImageBuilder {
attribute = new TextBlockEmpty(); attribute = new TextBlockEmpty();
} else { } else {
attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, dotData.getSkinParam(), attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, dotData.getSkinParam(),
g.getStereotype(), null); g.getStereotype(), null, SName.stateDiagram);
} }
final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder); final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder);
final double attributeHeight = dimAttribute.getHeight(); final double attributeHeight = dimAttribute.getHeight();

View File

@ -85,7 +85,7 @@ public enum PackageStyle {
return USymbol.RECTANGLE; return USymbol.RECTANGLE;
} }
if (this == FOLDER) { if (this == FOLDER) {
return USymbol.FOLDER; return USymbol.PACKAGE;
} }
return null; return null;
} }

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineConfigurable; import net.sourceforge.plantuml.LineConfigurable;
import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.creole.Stencil;
@ -57,6 +58,10 @@ import net.sourceforge.plantuml.graphic.InnerStrategy;
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.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.Margins; import net.sourceforge.plantuml.svek.Margins;
import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.Ports;
@ -133,6 +138,14 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
} }
} }
private Style getStyle() {
return getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder());
}
private StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_);
}
private void drawInternal(UGraphic ug) { private void drawInternal(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimTotal = calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimension(stringBounder);
@ -147,26 +160,38 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
} }
HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE);
HColor headerBackcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.HEADER);
if (classBorder == null) { if (classBorder == null) {
classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder); if (SkinParam.USE_STYLES())
classBorder = getStyle().value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet());
else
classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder);
} }
ug = ug.apply(classBorder);
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
if (backcolor == null) { if (backcolor == null) {
if (leafType == LeafType.ENUM) { if (SkinParam.USE_STYLES())
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.enumBackground, backcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet());
ColorParam.classBackground); else {
} else { if (leafType == LeafType.ENUM) {
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground); backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.enumBackground,
ColorParam.classBackground);
} else {
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground);
}
} }
} }
ug = ug.apply(classBorder);
ug = ug.apply(backcolor.bg()); ug = ug.apply(backcolor.bg());
final UStroke stroke = getStroke(); final UStroke stroke = getStroke();
HColor headerBackcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.HEADER);
if (headerBackcolor == null) { if (headerBackcolor == null) {
headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false); if (SkinParam.USE_STYLES())
headerBackcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet());
else
headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false);
} }
UGraphic ugHeader = ug; UGraphic ugHeader = ug;
if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) { if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) {

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.Guillemet;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPortion;
@ -58,6 +59,8 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.HeaderLayout; import net.sourceforge.plantuml.svek.HeaderLayout;
import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.ShapeType;
@ -78,7 +81,15 @@ public class EntityImageClassHeader extends AbstractEntityImage {
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
final boolean displayGenericWithOldFashion = skinParam.displayGenericWithOldFashion(); final boolean displayGenericWithOldFashion = skinParam.displayGenericWithOldFashion();
final String generic = displayGenericWithOldFashion ? null : entity.getGeneric(); final String generic = displayGenericWithOldFashion ? null : entity.getGeneric();
FontConfiguration fontConfigurationName = new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype); FontConfiguration fontConfigurationName;
if (SkinParam.USE_STYLES()) {
final Style style = FontParam.CLASS.getStyleDefinition(SName.classDiagram)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
fontConfigurationName = new FontConfiguration(style, skinParam, stereotype, FontParam.CLASS);
} else {
fontConfigurationName = new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype);
}
if (italic) { if (italic) {
fontConfigurationName = fontConfigurationName.italic(); fontConfigurationName = fontConfigurationName.italic();
} }
@ -105,10 +116,9 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {
stereo = null; stereo = null;
} else { } else {
stereo = TextBlockUtils.withMargin( stereo = TextBlockUtils.withMargin(Display.create(stereotype.getLabels(skinParam.guillemet())).create(
Display.create(stereotype.getLabels(skinParam.guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype),
new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam), 1, 0);
HorizontalAlignment.CENTER, skinParam), 1, 0);
} }
TextBlock genericBlock; TextBlock genericBlock;
@ -119,8 +129,7 @@ public class EntityImageClassHeader extends AbstractEntityImage {
new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype),
HorizontalAlignment.CENTER, skinParam); HorizontalAlignment.CENTER, skinParam);
genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1); genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1);
final HColor classBackground = SkinParamUtils final HColor classBackground = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.background);
.getColor(getSkinParam(), stereotype, ColorParam.background);
final HColor classBorder = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS_STEREOTYPE, final HColor classBorder = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS_STEREOTYPE,
stereotype); stereotype);

View File

@ -123,7 +123,7 @@ public class EntityImageDescription extends AbstractEntityImage {
} else { } else {
desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), getSkinParam(),
HorizontalAlignment.LEFT, stereotype, symbol.manageHorizontalLine(), false, entity, HorizontalAlignment.LEFT, stereotype, symbol.manageHorizontalLine(), false, entity,
skinParam.minClassWidth()); skinParam.minClassWidth(), SName.componentDiagram);
} }
this.url = entity.getUrl99(); this.url = entity.getUrl99();
@ -180,7 +180,7 @@ public class EntityImageDescription extends AbstractEntityImage {
} }
name = new BodyEnhanced(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER, name = new BodyEnhanced(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER,
stereotype, symbol.manageHorizontalLine(), false, entity); stereotype, symbol.manageHorizontalLine(), false, entity, SName.componentDiagram);
if (hideText) { if (hideText) {
asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
@ -191,7 +191,7 @@ public class EntityImageDescription extends AbstractEntityImage {
} }
private USymbol getUSymbol(ILeaf entity) { private USymbol getUSymbol(ILeaf entity) {
final USymbol result = entity.getUSymbol() == null ? getSkinParam().componentStyle().toSymbol() final USymbol result = entity.getUSymbol() == null ? getSkinParam().componentStyle().toUSymbol()
: entity.getUSymbol(); : entity.getUSymbol();
if (result == null) { if (result == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@ -121,7 +121,7 @@ public class EntityImageEmptyPackage extends AbstractEntityImage {
final double roundCorner = 0; final double roundCorner = 0;
final UStroke stroke = GeneralImageBuilder.getForcedStroke(getEntity().getStereotype(), getSkinParam()); final UStroke stroke = GeneralImageBuilder.getForcedStroke(getEntity().getStereotype(), getSkinParam());
final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().getPackageStyle(), null, desc, final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().packageStyle(), null, desc,
stereoBlock, 0, 0, widthTotal, heightTotal, stroke); stereoBlock, 0, 0, widthTotal, heightTotal, stroke);
final double shadowing = getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0; final double shadowing = getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0;

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
@ -76,14 +77,14 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage {
super(entity, skinParam); super(entity, skinParam);
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
final USymbol symbol = entity.getUSymbol() == null ? skinParam.componentStyle().toSymbol() final USymbol symbol = entity.getUSymbol() == null ? skinParam.componentStyle().toUSymbol()
: entity.getUSymbol(); : entity.getUSymbol();
if (symbol == null) { if (symbol == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, HorizontalAlignment.CENTER, this.desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, HorizontalAlignment.CENTER,
stereotype, symbol.manageHorizontalLine(), false, entity); stereotype, symbol.manageHorizontalLine(), false, entity, SName.componentDiagram);
this.url = entity.getUrl99(); this.url = entity.getUrl99();

View File

@ -88,9 +88,9 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil {
this.lineConfig = entity; this.lineConfig = entity;
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
this.roundCorner = skinParam.getRoundCorner(CornerParam.DEFAULT, null); this.roundCorner = skinParam.getRoundCorner(CornerParam.DEFAULT, null);
this.name = TextBlockUtils.withMargin( final FontConfiguration fc = new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype);
entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype), final TextBlock tmp = getUnderlinedName(entity).create(fc, HorizontalAlignment.CENTER, skinParam);
HorizontalAlignment.CENTER, skinParam), 2, 2); this.name = TextBlockUtils.withMargin(tmp, 2, 2);
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {
this.stereo = null; this.stereo = null;
@ -100,7 +100,6 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil {
HorizontalAlignment.CENTER, skinParam); HorizontalAlignment.CENTER, skinParam);
} }
// final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity);
final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity); final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity);
if (entity.getBodier().getFieldsToDisplay().size() == 0) { if (entity.getBodier().getFieldsToDisplay().size() == 0) {
@ -113,6 +112,13 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil {
} }
private Display getUnderlinedName(ILeaf entity) {
if (getSkinParam().strictUmlStyle()) {
return entity.getDisplay().underlinedName();
}
return entity.getDisplay();
}
private int marginEmptyFieldsOrMethod = 13; private int marginEmptyFieldsOrMethod = 13;
public Dimension2D calculateDimension(StringBounder stringBounder) { public Dimension2D calculateDimension(StringBounder stringBounder) {
@ -194,8 +200,8 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil {
private Dimension2D getNameAndSteretypeDimension(StringBounder stringBounder) { private Dimension2D getNameAndSteretypeDimension(StringBounder stringBounder) {
final Dimension2D nameDim = name.calculateDimension(stringBounder); final Dimension2D nameDim = name.calculateDimension(stringBounder);
final Dimension2D stereoDim = stereo == null ? new Dimension2DDouble(0, 0) : stereo final Dimension2D stereoDim = stereo == null ? new Dimension2DDouble(0, 0)
.calculateDimension(stringBounder); : stereo.calculateDimension(stringBounder);
final Dimension2D nameAndStereo = new Dimension2DDouble(Math.max(nameDim.getWidth(), stereoDim.getWidth()), final Dimension2D nameAndStereo = new Dimension2DDouble(Math.max(nameDim.getWidth(), stereoDim.getWidth()),
nameDim.getHeight() + stereoDim.getHeight()); nameDim.getHeight() + stereoDim.getHeight());
return nameAndStereo; return nameAndStereo;

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -86,14 +87,15 @@ public class EntityImageState2 extends AbstractEntityImage {
// backcolor = HtmlColorUtils.BLUE; // backcolor = HtmlColorUtils.BLUE;
final HColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); final HColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder());
final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow( final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5))
getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0); .withShadow(getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0);
this.url = entity.getUrl99(); this.url = entity.getUrl99();
TextBlock stereo = TextBlockUtils.empty(0, 0); TextBlock stereo = TextBlockUtils.empty(0, 0);
final TextBlock desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, final TextBlock desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam,
HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, entity); HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, entity,
SName.stateDiagram);
asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment()); asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment());

View File

@ -58,6 +58,7 @@ 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.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
@ -80,7 +81,7 @@ public class EntityImageUseCase extends AbstractEntityImage {
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.USECASE, skinParam, final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.USECASE, skinParam,
HorizontalAlignment.CENTER, stereotype, true, false, entity); HorizontalAlignment.CENTER, stereotype, true, false, entity, SName.componentDiagram);
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {

View File

@ -36,6 +36,8 @@ package net.sourceforge.plantuml.timingdiagram;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
@ -59,6 +61,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class PlayerBinary extends Player { public class PlayerBinary extends Player {
private final List<TimeConstraint> constraints = new ArrayList<TimeConstraint>();
private final SortedMap<TimeTick, Boolean> values = new TreeMap<TimeTick, Boolean>(); private final SortedMap<TimeTick, Boolean> values = new TreeMap<TimeTick, Boolean>();
private Boolean initialState; private Boolean initialState;
@ -67,8 +70,12 @@ public class PlayerBinary extends Player {
this.suggestedHeight = 30; this.suggestedHeight = 30;
} }
private double getHeightForConstraints(StringBounder stringBounder) {
return TimeConstraint.getHeightForConstraints(stringBounder, constraints);
}
public double getFullHeight(StringBounder stringBounder) { public double getFullHeight(StringBounder stringBounder) {
return suggestedHeight; return getHeightForConstraints(stringBounder) + suggestedHeight;
} }
public void drawFrameTitle(UGraphic ug) { public void drawFrameTitle(UGraphic ug) {
@ -80,7 +87,8 @@ public class PlayerBinary extends Player {
public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) {
final double x = ruler.getPosInPixel(tick); final double x = ruler.getPosInPixel(tick);
return new IntricatedPoint(new Point2D.Double(x, getYpos(false)), new Point2D.Double(x, getYpos(true))); return new IntricatedPoint(new Point2D.Double(x, getYpos(stringBounder, false)),
new Point2D.Double(x, getYpos(stringBounder, true)));
} }
public void addNote(TimeTick now, Display note, Position position) { public void addNote(TimeTick now, Display note, Position position) {
@ -105,13 +113,21 @@ public class PlayerBinary extends Player {
} }
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) { public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
throw new UnsupportedOperationException(); this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam));
} }
private final double ymargin = 8; private final double ymargin = 8;
private double getYpos(boolean state) { private double getYpos(StringBounder stringBounder, boolean state) {
return state ? ymargin : getFullHeight(null) - ymargin; return state ? getYhigh(stringBounder) : getYlow(stringBounder);
}
private double getYlow(StringBounder stringBounder) {
return getFullHeight(stringBounder) - ymargin;
}
private double getYhigh(StringBounder stringBounder) {
return ymargin + getHeightForConstraints(stringBounder);
} }
public TextBlock getPart1(double fullAvailableWidth, double specialVSpace) { public TextBlock getPart1(double fullAvailableWidth, double specialVSpace) {
@ -138,18 +154,30 @@ public class PlayerBinary extends Player {
ug = getContext().apply(ug); ug = getContext().apply(ug);
double lastx = 0; double lastx = 0;
boolean lastValue = initialState == null ? false : initialState; boolean lastValue = initialState == null ? false : initialState;
final StringBounder stringBounder = ug.getStringBounder();
final ULine vline = ULine.vline(getYlow(stringBounder) - getYhigh(stringBounder));
for (Map.Entry<TimeTick, Boolean> ent : values.entrySet()) { for (Map.Entry<TimeTick, Boolean> ent : values.entrySet()) {
final double x = ruler.getPosInPixel(ent.getKey()); final double x = ruler.getPosInPixel(ent.getKey());
ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(ULine.hline(x - lastx)); ug.apply(new UTranslate(lastx, getYpos(stringBounder, lastValue))).draw(ULine.hline(x - lastx));
if (lastValue != ent.getValue()) { if (lastValue != ent.getValue()) {
ug.apply(new UTranslate(x, ymargin)).draw(ULine.vline(getFullHeight(null) - 2 * ymargin)); ug.apply(new UTranslate(x, getYhigh(stringBounder))).draw(vline);
} }
lastx = x; lastx = x;
lastValue = ent.getValue(); lastValue = ent.getValue();
} }
ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(ULine.hline(ruler.getWidth() - lastx)); ug.apply(new UTranslate(lastx, getYpos(stringBounder, lastValue)))
.draw(ULine.hline(ruler.getWidth() - lastx));
drawConstraints(ug.apply(UTranslate.dy(getHeightForConstraints(ug.getStringBounder()))));
} }
}; };
} }
private void drawConstraints(final UGraphic ug) {
for (TimeConstraint constraint : constraints) {
constraint.drawU(ug, ruler);
}
}
} }

View File

@ -178,9 +178,15 @@ public class DriverShadowedG2d {
g2d.scale(1 / dpiFactor, 1 / dpiFactor); g2d.scale(1 / dpiFactor, 1 / dpiFactor);
final Shape sav = g2d.getClip(); final Shape sav = g2d.getClip();
Area full = new Area(new Rectangle2D.Double(0, 0, bounds.getMaxX() + deltaShadow * 2 + 6, final Area full = new Area(
bounds.getMaxY() + deltaShadow * 2 + 6)); new Rectangle2D.Double(0, 0, (bounds.getMaxX() + deltaShadow * 2 + 6) * dpiFactor,
full.subtract(new Area(shape)); (bounds.getMaxY() + deltaShadow * 2 + 6) * dpiFactor));
if (dpiFactor == 1) {
full.subtract(new Area(shape));
} else {
full.subtract(
new Area(shape).createTransformedArea(AffineTransform.getScaleInstance(dpiFactor, dpiFactor)));
}
g2d.setClip(full); g2d.setClip(full);
g2d.drawImage(destination, (int) (bounds.getMinX() * dpiFactor), (int) (bounds.getMinY() * dpiFactor), g2d.drawImage(destination, (int) (bounds.getMinX() * dpiFactor), (int) (bounds.getMinY() * dpiFactor),

View File

@ -44,7 +44,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000; private static final int MAJOR_SEPARATOR = 1000000;
public static int version() { public static int version() {
return 1202013; return 1202014;
} }
public static int versionPatched() { public static int versionPatched() {
@ -93,7 +93,7 @@ public class Version {
} }
public static long compileTime() { public static long compileTime() {
return 1592051198896L; return 1592662474056L;
} }
public static String compileTimeString() { public static String compileTimeString() {