1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-26 14:56:28 +00:00

Minor fixes

This commit is contained in:
Arnaud Roques 2021-10-20 18:33:09 +02:00
parent af52908bd9
commit 1f922c2650
23 changed files with 231 additions and 63 deletions

View File

@ -38,15 +38,21 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.util.Collection;
import java.util.Objects;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
@ -131,14 +137,6 @@ public class Branch {
return list.getSwimlanes();
}
public final Display getLabelPositive() {
final LinkRendering in = ftile.getInLinkRendering();
if (in != null && Display.isNull(in.getDisplay()) == false) {
return in.getDisplay();
}
return labelPositive.getDisplay();
}
public final Display getLabelTest() {
return labelTest;
}
@ -215,4 +213,30 @@ public class Branch {
return special;
}
public final Display getDisplayPositive() {
final LinkRendering in = ftile.getInLinkRendering();
if (in != null && Display.isNull(in.getDisplay()) == false) {
return in.getDisplay();
}
return labelPositive.getDisplay();
}
public final TextBlock getTextBlockPositive() {
LineBreakStrategy lineBreak = LineBreakStrategy.NONE;
final FontConfiguration fcArrow;
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
lineBreak = style.wrapWidth();
fcArrow = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
} else {
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}
return getDisplayPositive().create0(fcArrow, HorizontalAlignment.LEFT, skinParam(), lineBreak,
CreoleMode.SIMPLE_LINE, null, null);
}
}

View File

@ -114,6 +114,16 @@ public class FtileGeometry extends Dimension2D {
return new FtileGeometry(width, height + northHeight, left, inY, outY);
}
public FtileGeometry addTop(double northHeight) {
if (hasPointOut())
return new FtileGeometry(width, height + northHeight, left, inY + northHeight, outY + northHeight);
return new FtileGeometry(width, height + northHeight, left, inY + northHeight, Double.MIN_NORMAL);
}
public FtileGeometry incRight(double missing) {
return new FtileGeometry(width + missing, height, left, inY, outY);
}
// public FtileGeometry incInnerHeight(double northHeight) {
// return new FtileGeometry(width, height + northHeight, left, inY, outY + northHeight);
// }

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D;
import java.util.ArrayList;
import java.util.List;
@ -53,6 +54,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitch
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithDiamonds;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateInLabel;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -102,9 +104,13 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
final List<Ftile> ftiles = new ArrayList<>();
final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
for (Branch branch : branches) {
ftiles.add(new FtileMinWidthCentered(branch.getFtile(), 30));
final Dimension2D dimLabel = branch.getTextBlockPositive().calculateDimension(getStringBounder());
// ftiles.add(new FtileMinWidthCentered(branch.getFtile(), 30));
ftiles.add(new FtileDecorateInLabel(branch.getFtile(), dimLabel.getWidth(), dimLabel.getHeight()));
}
final Rainbow arrowColor;
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());

View File

@ -156,7 +156,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
List<Ftile> diamonds = new ArrayList<>();
List<Double> inlabelSizes = new ArrayList<>();
for (Branch branch : thens) {
final TextBlock tb1 = branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT,
final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
ftileFactory.skinParam());
final TextBlock tbTest = branch.getLabelTest().create(fcTest,
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
@ -177,7 +177,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
diamonds.add(diamond);
}
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT,
final TextBlock tb2 = branch2.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
ftileFactory.skinParam());
final int last = diamonds.size() - 1;
diamonds.set(last, ((FtileDiamondInside2) diamonds.get(last)).withEast(tb2));

View File

@ -138,7 +138,7 @@ class FtileIfLongVertical extends AbstractFtile {
List<Ftile> diamonds = new ArrayList<>();
for (Branch branch : thens) {
final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT,
final TextBlock tb1 = branch.getDisplayPositive().create(fc, HorizontalAlignment.LEFT,
ftileFactory.skinParam());
final TextBlock tbTest = branch.getLabelTest().create(fc,
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
@ -149,7 +149,7 @@ class FtileIfLongVertical extends AbstractFtile {
diamonds.add(diamond);
}
final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam());
final TextBlock tb2 = branch2.getDisplayPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam());
final int last = diamonds.size() - 1;
diamonds.set(last, ((FtileDiamondInside3) diamonds.get(last)).withSouth(tb2));

View File

@ -108,7 +108,7 @@ class FtileSwitch extends AbstractFtile {
List<Double> inlabelSizes = new ArrayList<>();
for (Branch branch : thens) {
final TextBlock tb1 = branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT,
final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
ftileFactory.skinParam());
final TextBlock tbTest = branch.getLabelTest().create(fcTest,
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),

View File

@ -283,7 +283,7 @@ public class ConditionalBuilder {
}
private TextBlock getLabelPositive(Branch branch) {
return branch.getLabelPositive().create0(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(),
return branch.getDisplayPositive().create0(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(),
labelLineBreak, CreoleMode.SIMPLE_LINE, null, null);
}

View File

@ -201,23 +201,4 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
return new UTranslate(x2, y2);
}
final public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.arrow);
}
final protected TextBlock getLabelPositive(Branch branch) {
LineBreakStrategy lineBreak = LineBreakStrategy.NONE;
final FontConfiguration fcArrow;
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
lineBreak = style.wrapWidth();
fcArrow = style.getFontConfiguration(skinParam().getThemeStyle(), getIHtmlColorSet());
} else {
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}
return branch.getLabelPositive().create0(fcArrow, HorizontalAlignment.LEFT, skinParam(), lineBreak,
CreoleMode.SIMPLE_LINE, null, null);
}
}

View File

@ -85,7 +85,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
final double x2 = p2.getX();
final double y2 = p2.getY();
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(),
arrowHorizontalAlignment());
snake.addPoint(x1, y1);
snake.addPoint(x2, y1);
@ -195,7 +195,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
final double x2 = p2.getX();
final double y2 = p2.getY();
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(),
VerticalAlignment.CENTER);
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
snake.addPoint(x2, p1d.getY());
@ -274,7 +274,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
protected double getYdelta1a(StringBounder stringBounder) {
double max = 10;
for (Branch branch : branches) {
max = Math.max(max, getLabelPositive(branch).calculateDimension(stringBounder).getHeight());
max = Math.max(max, branch.getTextBlockPositive().calculateDimension(stringBounder).getHeight());
}
if (mode == Mode.BIG_DIAMOND) {
final double diamondHeight = diamond1.calculateDimension(stringBounder).getHeight();

View File

@ -80,7 +80,7 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
final double x2 = p2.getX();
final double y2 = p2.getY();
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(),
arrowHorizontalAlignment());
// snake.addPoint(x1, y1);
snake.addPoint(x2, y1);

View File

@ -0,0 +1,71 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileDecorateInLabel extends FtileDecorate {
final private double xl;
final private double yl;
public FtileDecorateInLabel(final Ftile ftile, double xl, double yl) {
super(ftile);
this.xl = xl;
this.yl = yl;
}
@Override
public FtileGeometry calculateDimension(StringBounder stringBounder) {
FtileGeometry result = super.calculateDimension(stringBounder);
result = result.addTop(yl);
final double missing = xl - result.getRight();
if (missing > 0)
result = result.incRight(missing);
return result;
}
@Override
public void drawU(UGraphic ug) {
super.drawU(ug.apply(UTranslate.dy(yl)));
}
}

View File

@ -39,6 +39,7 @@ import java.util.List;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
@ -54,7 +55,7 @@ public interface Bodier {
public void addFieldOrMethod(String s) throws NoSuchColorException;
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
Stereotype stereotype, Style style);
Stereotype stereotype, Style style, FontConfiguration fontConfiguration);
public List<CharSequence> getRawBody();

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
@ -62,6 +63,7 @@ public class BodierLikeClassOrObject implements Bodier {
private List<Member> fieldsToDisplay;
private ILeaf leaf;
@Override
public void muteClassToObject() {
methodsToDisplay = null;
fieldsToDisplay = null;
@ -77,11 +79,13 @@ public class BodierLikeClassOrObject implements Bodier {
this.hides = hides;
}
@Override
public void setLeaf(ILeaf leaf) {
this.leaf = Objects.requireNonNull(leaf);
}
@Override
public void addFieldOrMethod(String s) {
// Empty cache
methodsToDisplay = null;
@ -109,6 +113,7 @@ public class BodierLikeClassOrObject implements Bodier {
return purged.contains("(") || purged.contains(")");
}
@Override
public Display getMethodsToDisplay() {
if (methodsToDisplay == null) {
methodsToDisplay = new ArrayList<>();
@ -138,6 +143,7 @@ public class BodierLikeClassOrObject implements Bodier {
return isMethod(rawBody.get(i));
}
@Override
public Display getFieldsToDisplay() {
if (fieldsToDisplay == null) {
fieldsToDisplay = new ArrayList<>();
@ -164,6 +170,7 @@ public class BodierLikeClassOrObject implements Bodier {
}
}
@Override
public boolean hasUrl() {
for (CharSequence cs : getFieldsToDisplay()) {
if (cs instanceof Member) {
@ -201,8 +208,9 @@ public class BodierLikeClassOrObject implements Bodier {
return result;
}
@Override
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
Stereotype stereotype, Style style) {
Stereotype stereotype, Style style, FontConfiguration fontConfiguration) {
if (BodyFactory.BODY3) {
return new Body3(rawBody, fontParam, skinParam, stereotype, style);
@ -245,6 +253,7 @@ public class BodierLikeClassOrObject implements Bodier {
return TextBlockUtils.mergeTB(bb1, bb2, HorizontalAlignment.LEFT);
}
@Override
public List<CharSequence> getRawBody() {
return Collections.unmodifiableList(rawBody);
}

View File

@ -46,6 +46,7 @@ import java.util.regex.Pattern;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.Style;
@ -55,6 +56,7 @@ public class BodierMap implements Bodier {
private final Map<String, String> map = new LinkedHashMap<String, String>();
private ILeaf leaf;
@Override
public void muteClassToObject() {
throw new UnsupportedOperationException();
}
@ -62,6 +64,7 @@ public class BodierMap implements Bodier {
public BodierMap() {
}
@Override
public void setLeaf(ILeaf leaf) {
this.leaf = Objects.requireNonNull(leaf);
@ -76,6 +79,7 @@ public class BodierMap implements Bodier {
return null;
}
@Override
public void addFieldOrMethod(String s) {
if (s.contains("=>")) {
final int x = s.indexOf("=>");
@ -87,23 +91,28 @@ public class BodierMap implements Bodier {
}
}
@Override
public Display getMethodsToDisplay() {
throw new UnsupportedOperationException();
}
@Override
public Display getFieldsToDisplay() {
throw new UnsupportedOperationException();
}
@Override
public boolean hasUrl() {
return false;
}
@Override
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, final boolean showMethods,
final boolean showFields, Stereotype stereotype, Style style) {
return new TextBlockMap(fontParam, skinParam, map);
final boolean showFields, Stereotype stereotype, Style style, FontConfiguration fontConfiguration) {
return new TextBlockMap(fontConfiguration, fontParam, skinParam, map);
}
@Override
public List<CharSequence> getRawBody() {
return Collections.unmodifiableList(rawBody);
}

View File

@ -42,6 +42,7 @@ import java.util.Objects;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.Style;
@ -52,6 +53,7 @@ public class BodierSimple implements Bodier {
private final List<CharSequence> rawBody = new ArrayList<>();
private ILeaf leaf;
@Override
public void muteClassToObject() {
throw new UnsupportedOperationException();
}
@ -59,33 +61,40 @@ public class BodierSimple implements Bodier {
BodierSimple() {
}
@Override
public void setLeaf(ILeaf leaf) {
this.leaf = Objects.requireNonNull(leaf);
}
@Override
public void addFieldOrMethod(String s) throws NoSuchColorException {
final Display display = Display.getWithNewlines2(s);
rawBody.addAll(display.asList());
}
@Override
public Display getMethodsToDisplay() {
throw new UnsupportedOperationException();
}
@Override
public Display getFieldsToDisplay() {
throw new UnsupportedOperationException();
}
@Override
public boolean hasUrl() {
return false;
}
@Override
public List<CharSequence> getRawBody() {
return Collections.unmodifiableList(rawBody);
}
@Override
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
Stereotype stereotype, Style style) {
Stereotype stereotype, Style style, FontConfiguration fontConfiguration) {
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), rawBody, fontParam,
skinParam, stereotype, leaf, style);
}

View File

@ -64,13 +64,16 @@ public class TextBlockMap extends AbstractTextBlock implements WithPorts {
private final FontParam fontParam;
private final ISkinParam skinParam;
private final FontConfiguration fontConfiguration;
private final Map<TextBlock, TextBlock> blocksMap = new LinkedHashMap<TextBlock, TextBlock>();
private final List<String> keys = new ArrayList<>();
private double totalWidth;
public TextBlockMap(FontParam fontParam, ISkinParam skinParam, Map<String, String> map) {
public TextBlockMap(FontConfiguration fontConfiguration, FontParam fontParam, ISkinParam skinParam,
Map<String, String> map) {
this.fontParam = fontParam;
this.skinParam = skinParam;
this.fontConfiguration = fontConfiguration;
for (Map.Entry<String, String> ent : map.entrySet()) {
final String key = ent.getKey();
this.keys.add(key);
@ -198,7 +201,9 @@ public class TextBlockMap extends AbstractTextBlock implements WithPorts {
}
private FontConfiguration getFontConfiguration() {
return new FontConfiguration(skinParam, fontParam, null);
if (fontConfiguration == null)
return new FontConfiguration(skinParam, fontParam, null);
return fontConfiguration;
}
public void setTotalWidth(double totalWidth) {

View File

@ -223,7 +223,12 @@ public final class EntityFactory {
public ILeaf createLeaf(Ident ident, Code code, Display display, LeafType entityType, IGroup parentContainer,
Set<VisibilityModifier> hides, String namespaceSeparator) {
final Bodier bodier = Objects.requireNonNull(entityType) == LeafType.MAP ? new BodierMap() : BodyFactory.createLeaf(entityType, hides);
final Bodier bodier;
if (Objects.requireNonNull(entityType) == LeafType.MAP)
bodier = new BodierMap();
else
bodier = BodyFactory.createLeaf(entityType, hides);
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, entityType,
namespaceSeparator, rawLayout);
bodier.setLeaf(result);

View File

@ -302,7 +302,8 @@ public class SequenceDiagram extends UmlDiagram {
}
final boolean ok = lastEventWithDeactivate.addLifeEvent(lifeEvent);
if (lastEventWithDeactivate instanceof AbstractMessage) {
lifeEvent.setMessage((AbstractMessage) lastEventWithDeactivate);
final AbstractMessage lastMessage = (AbstractMessage) lastEventWithDeactivate;
lifeEvent.setMessage(lastMessage);
}
if (ok) {
return null;

View File

@ -76,12 +76,12 @@ public class CommandActivate extends SingleLineCommand2<SequenceDiagram> {
final LifeEventType type = LifeEventType.valueOf(StringUtils.goUpperCase(arg.get("TYPE", 0)));
final Participant p = diagram
.getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("WHO", 0)));
String s = arg.get("BACK", 0);
final HColor backColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
String s1 = arg.get("LINE", 0);
final HColor lineColor = s1 == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s1);
final String back = arg.get("BACK", 0);
final HColor backColor = back == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), back);
final String line = arg.get("LINE", 0);
final HColor lineColor = line == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), line);
final String error = diagram.activate(p, type, backColor, lineColor);
if (error == null) {
return CommandExecutionResult.ok();

View File

@ -85,6 +85,7 @@ public enum SName {
leafNode, //
legend, //
lifeLine, //
map, //
milestone, //
mindmapDiagram, //
network, //

View File

@ -102,7 +102,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity);
final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity);
this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, getSkinParam(), showMethods, showFields,
entity.getStereotype(), getStyle());
entity.getStereotype(), getStyle(), null);
this.header = new EntityImageClassHeader(entity, getSkinParam(), portionShower);
this.url = entity.getUrl99();

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.LineConfigurable;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
@ -61,6 +62,10 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
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.Ports;
import net.sourceforge.plantuml.svek.ShapeType;
@ -91,10 +96,17 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
this.lineConfig = entity;
final Stereotype stereotype = entity.getStereotype();
this.roundCorner = skinParam.getRoundCorner(CornerParam.DEFAULT, null);
this.name = TextBlockUtils.withMargin(
entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype),
HorizontalAlignment.CENTER, skinParam),
2, 2);
final FontConfiguration fcHeader;
if (UseStyle.useBetaStyle())
fcHeader = getStyleHeader().getFontConfiguration(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet());
else
fcHeader = new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype);
this.name = TextBlockUtils
.withMargin(entity.getDisplay().create(fcHeader, HorizontalAlignment.CENTER, skinParam), 2, 2);
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {
this.stereo = null;
@ -104,8 +116,15 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
HorizontalAlignment.CENTER, skinParam);
}
this.entries = entity.getBodier().getBody(FontParam.OBJECT_ATTRIBUTE, skinParam, false, false,
entity.getStereotype(), null);
if (UseStyle.useBetaStyle()) {
final FontConfiguration fontConfiguration = getStyleHeader()
.getFontConfiguration(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet());
this.entries = entity.getBodier().getBody(FontParam.OBJECT_ATTRIBUTE, skinParam, false, false,
entity.getStereotype(), getStyle(), fontConfiguration);
} else
this.entries = entity.getBodier().getBody(FontParam.OBJECT_ATTRIBUTE, skinParam, false, false,
entity.getStereotype(), null, null);
this.url = entity.getUrl99();
}
@ -129,6 +148,16 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
return new Dimension2DDouble(width, height);
}
private Style getStyle() {
return StyleSignature.of(SName.root, SName.element, SName.objectDiagram, SName.map)
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
}
private Style getStyleHeader() {
return StyleSignature.of(SName.root, SName.element, SName.objectDiagram, SName.map, SName.header)
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
}
final public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimTotal = calculateDimension(stringBounder);
@ -141,11 +170,18 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
rect.setDeltaShadow(4);
}
ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder));
final HColor borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder);
ug = ug.apply(borderColor);
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
if (backcolor == null) {
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBackground);
if (UseStyle.useBetaStyle())
backcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet());
else
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBackground);
}
ug = ug.apply(backcolor.bg());
if (url != null) {
ug.startUrl(url);

View File

@ -119,7 +119,7 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil {
this.fields = new TextBlockLineBefore(new TextBlockEmpty(10, 16));
} else {
this.fields = entity.getBodier().getBody(FontParam.OBJECT_ATTRIBUTE, skinParam, false, showFields,
entity.getStereotype(), getStyle());
entity.getStereotype(), getStyle(), null);
}
this.url = entity.getUrl99();