1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 19:09:03 +00:00

Fix themes issues

This commit is contained in:
Arnaud Roques 2021-11-16 18:47:07 +01:00
parent 2098d24467
commit c5c86ffcda
3 changed files with 57 additions and 8 deletions

View File

@ -43,6 +43,7 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -178,6 +179,7 @@ public class SkinParam implements ISkinParam {
private static final Pattern2 stereoPattern = MyPattern.cmpile(stereoPatternString); private static final Pattern2 stereoPattern = MyPattern.cmpile(stereoPatternString);
private final Map<String, String> params = new HashMap<String, String>(); private final Map<String, String> params = new HashMap<String, String>();
private final Map<String, String> paramsPendingForStyleMigration = new LinkedHashMap<String, String>();
private final Map<String, String> svgCharSizes = new HashMap<String, String>(); private final Map<String, String> svgCharSizes = new HashMap<String, String>();
private Rankdir rankdir = Rankdir.TOP_TO_BOTTOM; private Rankdir rankdir = Rankdir.TOP_TO_BOTTOM;
private final UmlDiagramType type; private final UmlDiagramType type;
@ -194,15 +196,17 @@ public class SkinParam implements ISkinParam {
public void setParam(String key, String value) { public void setParam(String key, String value) {
for (String key2 : cleanForKey(key)) { for (String key2 : cleanForKey(key)) {
params.put(key2, StringUtils.trin(value)); params.put(key2, StringUtils.trin(value));
if (key2.startsWith("usebetastyle")) { if (key2.startsWith("usebetastyle") && "true".equalsIgnoreCase(value))
final boolean betastyle = "true".equalsIgnoreCase(value); UseStyle.setBetaStyle(true);
UseStyle.setBetaStyle(betastyle);
}
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
applyPendingStyleMigration();
final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder()); final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder());
for (Style style : convertor.getStyles()) { for (Style style : convertor.getStyles())
muteStyle(style); muteStyle(style);
}
} else {
paramsPendingForStyleMigration.put(key, value);
} }
} }
if ("style".equalsIgnoreCase(key) && "strictuml".equalsIgnoreCase(value)) { if ("style".equalsIgnoreCase(key) && "strictuml".equalsIgnoreCase(value)) {
@ -221,6 +225,16 @@ public class SkinParam implements ISkinParam {
} }
} }
private void applyPendingStyleMigration() {
for (Entry<String, String> ent : paramsPendingForStyleMigration.entrySet()) {
final FromSkinparamToStyle convertor = new FromSkinparamToStyle(ent.getKey(), ent.getValue(),
getCurrentStyleBuilder());
for (Style style : convertor.getStyles())
muteStyle(style);
}
paramsPendingForStyleMigration.clear();
}
public static SkinParam create(UmlDiagramType type) { public static SkinParam create(UmlDiagramType type) {
return new SkinParam(type); return new SkinParam(type);
} }
@ -289,6 +303,8 @@ public class SkinParam implements ISkinParam {
} }
public String getValue(String key) { public String getValue(String key) {
if (UseStyle.useBetaStyle())
applyPendingStyleMigration();
for (String key2 : cleanForKey(key)) { for (String key2 : cleanForKey(key)) {
final String result = params.get(key2); final String result = params.get(key2);
if (result != null) { if (result != null) {

View File

@ -64,30 +64,38 @@ public class FromSkinparamToStyle {
addConvert("participantBorderColor", PName.LineColor, SName.participant); addConvert("participantBorderColor", PName.LineColor, SName.participant);
addConvert("participantBorderThickness", PName.LineThickness, SName.participant); addConvert("participantBorderThickness", PName.LineThickness, SName.participant);
addConFont("participant", SName.participant); addConFont("participant", SName.participant);
addConvert("boundaryBackgroundColor", PName.BackGroundColor, SName.boundary); addConvert("boundaryBackgroundColor", PName.BackGroundColor, SName.boundary);
addConvert("boundaryBorderColor", PName.LineColor, SName.boundary); addConvert("boundaryBorderColor", PName.LineColor, SName.boundary);
addConvert("boundaryBorderThickness", PName.LineThickness, SName.boundary); addConvert("boundaryBorderThickness", PName.LineThickness, SName.boundary);
addConFont("boundary", SName.boundary); addConFont("boundary", SName.boundary);
addConvert("controlBackgroundColor", PName.BackGroundColor, SName.control); addConvert("controlBackgroundColor", PName.BackGroundColor, SName.control);
addConvert("controlBorderColor", PName.LineColor, SName.control); addConvert("controlBorderColor", PName.LineColor, SName.control);
addConvert("controlBorderThickness", PName.LineThickness, SName.control); addConvert("controlBorderThickness", PName.LineThickness, SName.control);
addConFont("control", SName.control); addConFont("control", SName.control);
addConvert("collectionsBackgroundColor", PName.BackGroundColor, SName.collections); addConvert("collectionsBackgroundColor", PName.BackGroundColor, SName.collections);
addConvert("collectionsBorderColor", PName.LineColor, SName.collections); addConvert("collectionsBorderColor", PName.LineColor, SName.collections);
addConvert("collectionsBorderThickness", PName.LineThickness, SName.collections); addConvert("collectionsBorderThickness", PName.LineThickness, SName.collections);
addConFont("collections", SName.collections); addConFont("collections", SName.collections);
addConvert("actorBackgroundColor", PName.BackGroundColor, SName.actor); addConvert("actorBackgroundColor", PName.BackGroundColor, SName.actor);
addConvert("actorBorderColor", PName.LineColor, SName.actor); addConvert("actorBorderColor", PName.LineColor, SName.actor);
addConvert("actorBorderThickness", PName.LineThickness, SName.actor); addConvert("actorBorderThickness", PName.LineThickness, SName.actor);
addConFont("actor", SName.actor); addConFont("actor", SName.actor);
addConvert("databaseBackgroundColor", PName.BackGroundColor, SName.database); addConvert("databaseBackgroundColor", PName.BackGroundColor, SName.database);
addConvert("databaseBorderColor", PName.LineColor, SName.database); addConvert("databaseBorderColor", PName.LineColor, SName.database);
addConvert("databaseBorderThickness", PName.LineThickness, SName.database); addConvert("databaseBorderThickness", PName.LineThickness, SName.database);
addConFont("database", SName.database); addConFont("database", SName.database);
addConvert("entityBackgroundColor", PName.BackGroundColor, SName.entity); addConvert("entityBackgroundColor", PName.BackGroundColor, SName.entity);
addConvert("entityBorderColor", PName.LineColor, SName.entity); addConvert("entityBorderColor", PName.LineColor, SName.entity);
addConvert("entityBorderThickness", PName.LineThickness, SName.entity); addConvert("entityBorderThickness", PName.LineThickness, SName.entity);
addConFont("entity", SName.entity); addConFont("entity", SName.entity);
addConFont("header", SName.header);
addConFont("footer", SName.footer); addConFont("footer", SName.footer);
addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype); addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);
@ -119,12 +127,16 @@ public class FromSkinparamToStyle {
addConFont("note", SName.note); addConFont("note", SName.note);
addConvert("noteBorderThickness", PName.LineThickness, SName.note); addConvert("noteBorderThickness", PName.LineThickness, SName.note);
addConvert("noteBackgroundColor", PName.BackGroundColor, SName.note); addConvert("noteBackgroundColor", PName.BackGroundColor, SName.note);
addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group); addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group);
addConvert("packageBorderColor", PName.LineColor, SName.group); addConvert("packageBorderColor", PName.LineColor, SName.group);
addConvert("PartitionBorderColor", PName.LineColor, SName.partition); addConvert("PartitionBorderColor", PName.LineColor, SName.partition);
addConvert("PartitionBackgroundColor", PName.BackGroundColor, SName.partition); addConvert("PartitionBackgroundColor", PName.BackGroundColor, SName.partition);
addConFont("Partition", SName.partition); addConFont("Partition", SName.partition);
addConvert("hyperlinkColor", PName.HyperLinkColor, SName.root); addConvert("hyperlinkColor", PName.HyperLinkColor, SName.root);
addConvert("activityStartColor", PName.LineColor, SName.circle); addConvert("activityStartColor", PName.LineColor, SName.circle);
addConvert("activityBarColor", PName.LineColor, SName.activityBar); addConvert("activityBarColor", PName.LineColor, SName.activityBar);
addConvert("activityBorderColor", PName.LineColor, SName.activity); addConvert("activityBorderColor", PName.LineColor, SName.activity);
@ -134,7 +146,6 @@ public class FromSkinparamToStyle {
addConvert("activityDiamondBackgroundColor", PName.BackGroundColor, SName.diamond); addConvert("activityDiamondBackgroundColor", PName.BackGroundColor, SName.diamond);
addConvert("activityDiamondBorderColor", PName.LineColor, SName.diamond); addConvert("activityDiamondBorderColor", PName.LineColor, SName.diamond);
addConFont("activityDiamond", SName.diamond); addConFont("activityDiamond", SName.diamond);
addConvert("arrowColor", PName.LineColor, SName.arrow);
addConFont("arrow", SName.arrow); addConFont("arrow", SName.arrow);
addConvert("arrowThickness", PName.LineThickness, SName.arrow); addConvert("arrowThickness", PName.LineThickness, SName.arrow);
@ -143,25 +154,47 @@ public class FromSkinparamToStyle {
addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root); addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root);
addConvert("defaultFontName", PName.FontName, SName.root); addConvert("defaultFontName", PName.FontName, SName.root);
addConFont("SwimlaneTitle", SName.swimlane); addConFont("SwimlaneTitle", SName.swimlane);
addConvert("SwimlaneTitleBackgroundColor", PName.BackGroundColor, SName.swimlane); addConvert("SwimlaneTitleBackgroundColor", PName.BackGroundColor, SName.swimlane);
addConvert("SwimlaneBorderColor", PName.LineColor, SName.swimlane); addConvert("SwimlaneBorderColor", PName.LineColor, SName.swimlane);
addConvert("SwimlaneBorderThickness", PName.LineThickness, SName.swimlane); addConvert("SwimlaneBorderThickness", PName.LineThickness, SName.swimlane);
addConvert("roundCorner", PName.RoundCorner, SName.root); addConvert("roundCorner", PName.RoundCorner, SName.root);
addConvert("titleBorderThickness", PName.LineThickness, SName.title); addConvert("titleBorderThickness", PName.LineThickness, SName.title);
addConvert("titleBorderColor", PName.LineColor, SName.title); addConvert("titleBorderColor", PName.LineColor, SName.title);
addConvert("titleBackgroundColor", PName.BackGroundColor, SName.title); addConvert("titleBackgroundColor", PName.BackGroundColor, SName.title);
addConvert("titleBorderRoundCorner", PName.RoundCorner, SName.title); addConvert("titleBorderRoundCorner", PName.RoundCorner, SName.title);
addConFont("title", SName.title); addConFont("title", SName.title);
addConvert("legendBorderThickness", PName.LineThickness, SName.legend); addConvert("legendBorderThickness", PName.LineThickness, SName.legend);
addConvert("legendBorderColor", PName.LineColor, SName.legend); addConvert("legendBorderColor", PName.LineColor, SName.legend);
addConvert("legendBackgroundColor", PName.BackGroundColor, SName.legend); addConvert("legendBackgroundColor", PName.BackGroundColor, SName.legend);
addConvert("legendBorderRoundCorner", PName.RoundCorner, SName.legend); addConvert("legendBorderRoundCorner", PName.RoundCorner, SName.legend);
addConFont("legend", SName.legend); addConFont("legend", SName.legend);
addConvert("noteTextAlignment", PName.HorizontalAlignment, SName.note); addConvert("noteTextAlignment", PName.HorizontalAlignment, SName.note);
addConvert("BackgroundColor", PName.BackGroundColor, SName.document); addConvert("BackgroundColor", PName.BackGroundColor, SName.document);
addConvert("classBackgroundColor", PName.BackGroundColor, SName.class_);
addConvert("classBorderColor", PName.LineColor, SName.class_);
addConFont("class", SName.class_);
addConFont("classAttribute", SName.class_);
addConvert("classBorderThickness", PName.LineThickness, SName.class_);
addConvert("objectBackgroundColor", PName.BackGroundColor, SName.object);
addConvert("objectBorderColor", PName.LineColor, SName.object);
addConFont("object", SName.object);
addConFont("objectAttribute", SName.object);
addConvert("objectBorderThickness", PName.LineThickness, SName.object);
addConvert("stateBackgroundColor", PName.BackGroundColor, SName.state);
addConvert("stateBorderColor", PName.LineColor, SName.state);
addConFont("state", SName.state);
addConFont("stateAttribute", SName.state);
addConvert("stateBorderThickness", PName.LineThickness, SName.state);
} }

View File

@ -80,7 +80,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 2; final int beta = 3;
return beta; return beta;
} }