mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-29 16:23:55 +00:00
Improve style support
This commit is contained in:
parent
463f691f94
commit
6fdb340b37
@ -265,16 +265,16 @@ public class NwDiagram extends UmlDiagram {
|
||||
};
|
||||
}
|
||||
|
||||
private StyleSignature getStyleDefinitionNetwork() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.network);
|
||||
private StyleSignature getStyleDefinitionNetwork(SName sname) {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, sname);
|
||||
}
|
||||
|
||||
private TextBlock toTextBlock(String name, String s) {
|
||||
private TextBlock toTextBlockForNetworkName(String name, String s) {
|
||||
if (s != null) {
|
||||
name += "\\n" + s;
|
||||
}
|
||||
final StyleBuilder styleBuilder = getSkinParam().getCurrentStyleBuilder();
|
||||
final Style style = getStyleDefinitionNetwork().getMergedStyle(styleBuilder);
|
||||
final Style style = getStyleDefinitionNetwork(SName.network).getMergedStyle(styleBuilder);
|
||||
final FontConfiguration fontConfiguration = style.getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
return Display.getWithNewlines(name).create(fontConfiguration, HorizontalAlignment.RIGHT,
|
||||
@ -304,7 +304,7 @@ public class NwDiagram extends UmlDiagram {
|
||||
for (int i = 0; i < networks.size(); i++) {
|
||||
final Network current = networks.get(i);
|
||||
final String address = current.getOwnAdress();
|
||||
final TextBlock desc = toTextBlock(current.getDisplayName(), address);
|
||||
final TextBlock desc = toTextBlockForNetworkName(current.getDisplayName(), address);
|
||||
final Dimension2D dim = desc.calculateDimension(stringBounder);
|
||||
if (i == 0) {
|
||||
deltaY = (dim.getHeight() - GridTextBlockDecorated.NETWORK_THIN) / 2;
|
||||
@ -315,7 +315,7 @@ public class NwDiagram extends UmlDiagram {
|
||||
for (int i = 0; i < networks.size(); i++) {
|
||||
final Network current = networks.get(i);
|
||||
final String address = current.getOwnAdress();
|
||||
final TextBlock desc = toTextBlock(current.getDisplayName(), address);
|
||||
final TextBlock desc = toTextBlockForNetworkName(current.getDisplayName(), address);
|
||||
final Dimension2D dim = desc.calculateDimension(stringBounder);
|
||||
desc.drawU(ug.apply(new UTranslate(deltaX - dim.getWidth(), y)));
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class NServer {
|
||||
return connections.get(network);
|
||||
}
|
||||
|
||||
private TextBlock toTextBlock(String s, ISkinParam skinParam) {
|
||||
private TextBlock toTextBlock(String s, ISkinParam skinParam, SName sname) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
@ -96,32 +96,32 @@ public class NServer {
|
||||
return TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
s = s.replace(", ", "\\n");
|
||||
return Display.getWithNewlines(s).create(getFontConfiguration(skinParam), HorizontalAlignment.LEFT, skinParam);
|
||||
return Display.getWithNewlines(s).create(getFontConfiguration(skinParam, sname), HorizontalAlignment.LEFT,
|
||||
skinParam);
|
||||
}
|
||||
|
||||
private StyleSignature getStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.server);
|
||||
private StyleSignature getStyleDefinition(SName sname) {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, sname);
|
||||
}
|
||||
|
||||
private FontConfiguration getFontConfiguration(ISkinParam skinParam) {
|
||||
private FontConfiguration getFontConfiguration(ISkinParam skinParam, SName sname) {
|
||||
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
|
||||
final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
|
||||
final Style style = getStyleDefinition(sname).getMergedStyle(styleBuilder);
|
||||
return style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
|
||||
}
|
||||
|
||||
public LinkedElement asTextBlock(double topMargin, Map<Network, String> conns, List<Network> networks,
|
||||
ISkinParam skinParam) {
|
||||
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
|
||||
final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
|
||||
final SymbolContext symbolContext = style.getSymbolContext(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
final SymbolContext symbolContext = getStyleDefinition(SName.server).getMergedStyle(styleBuilder)
|
||||
.getSymbolContext(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
|
||||
|
||||
final Map<Network, TextBlock> conns2 = new LinkedHashMap<Network, TextBlock>();
|
||||
for (Entry<Network, String> ent : conns.entrySet()) {
|
||||
conns2.put(ent.getKey(), toTextBlock(ent.getValue(), skinParam));
|
||||
conns2.put(ent.getKey(), toTextBlock(ent.getValue(), skinParam, SName.arrow));
|
||||
}
|
||||
|
||||
final TextBlock desc = toTextBlock(getDescription(), skinParam);
|
||||
final TextBlock desc = toTextBlock(getDescription(), skinParam, SName.server);
|
||||
final TextBlock box = getShape().asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0),
|
||||
symbolContext, HorizontalAlignment.CENTER);
|
||||
return new LinkedElement(topMargin, this, box, conns2, networks);
|
||||
|
@ -36,6 +36,7 @@ package net.sourceforge.plantuml.nwdiag.next;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.nwdiag.core.Network;
|
||||
@ -49,6 +50,7 @@ import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class GridTextBlockDecorated extends GridTextBlockSimple {
|
||||
|
||||
@ -70,10 +72,17 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
||||
drawGroups(ug, group, getSkinParam());
|
||||
}
|
||||
drawNetworkTube(ug);
|
||||
drawLinks(ug);
|
||||
drawLinks(ug, getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private void drawLinks(UGraphic ug) {
|
||||
private void drawLinks(UGraphic ug, StyleBuilder styleBuilder) {
|
||||
|
||||
final Style style = getStyleDefinitionNetwork(SName.arrow).getMergedStyle(styleBuilder);
|
||||
final HColor lineColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
|
||||
ug = ug.apply(lineColor);
|
||||
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
for (int i = 0; i < data.getNbLines(); i++) {
|
||||
final double lineHeight = lineHeight(stringBounder, i);
|
||||
@ -125,8 +134,8 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
||||
return false;
|
||||
}
|
||||
|
||||
private StyleSignature getStyleDefinitionNetwork() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.network);
|
||||
private StyleSignature getStyleDefinitionNetwork(SName sname) {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, sname);
|
||||
}
|
||||
|
||||
private void drawNetworkTube(UGraphic ug) {
|
||||
@ -141,7 +150,7 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
||||
|
||||
UGraphic ug2 = ug.apply(new UTranslate(network.getXmin(), y));
|
||||
final StyleBuilder styleBuilder = getSkinParam().getCurrentStyleBuilder();
|
||||
final Style style = getStyleDefinitionNetwork().getMergedStyle(styleBuilder);
|
||||
final Style style = getStyleDefinitionNetwork(SName.network).getMergedStyle(styleBuilder);
|
||||
final double deltaShadow = style.value(PName.Shadowing).asDouble();
|
||||
ug2 = ug2.apply(style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet()));
|
||||
|
@ -119,9 +119,6 @@ public class LinkedElement {
|
||||
final double alpha = yMiddle - dimBox.getHeight() / 2;
|
||||
final double posLink1 = (yMiddle - dimBox.getHeight() / 2 - topMargin + MAGIC) / 2;
|
||||
|
||||
final HColor color = ColorParam.activityBorder.getDefaultValue();
|
||||
ug = ug.apply(color);
|
||||
|
||||
final double xMiddle = width / 2;
|
||||
final double xLinkPos = width / 2;
|
||||
|
||||
|
@ -75,9 +75,9 @@ public enum SName {
|
||||
ganttDiagram, //
|
||||
group, //
|
||||
groupHeader, //
|
||||
header, //
|
||||
hexagon, //
|
||||
highlight, //
|
||||
header, //
|
||||
interface_, //
|
||||
jsonDiagram, //
|
||||
gitDiagram, //
|
||||
@ -92,6 +92,7 @@ public enum SName {
|
||||
note, //
|
||||
nwdiagDiagram, //
|
||||
objectDiagram, //
|
||||
object, //
|
||||
package_, //
|
||||
participant, //
|
||||
partition, //
|
||||
@ -108,6 +109,7 @@ public enum SName {
|
||||
server, //
|
||||
stack, //
|
||||
stateDiagram, //
|
||||
state, //
|
||||
stereotype, //
|
||||
storage, //
|
||||
swimlane, //
|
||||
|
@ -295,9 +295,18 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
|
||||
static public StyleSignature getDefaultStyleDefinition(SName styleName) {
|
||||
if (styleName == SName.stateDiagram)
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.group);
|
||||
return StyleSignature.of(SName.root, SName.element, styleName, SName.group);
|
||||
}
|
||||
|
||||
static public StyleSignature getDefaultStyleDefinitionStateGroup(Stereotype stereotype) {
|
||||
if (stereotype == null)
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.group);
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.group)
|
||||
.with(stereotype);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug, UStroke strokeForState, UmlDiagramType umlDiagramType, ISkinParam skinParam2) {
|
||||
if (group.isHidden()) {
|
||||
return;
|
||||
@ -307,8 +316,9 @@ public class Cluster implements Moveable {
|
||||
ug.draw(new UComment("cluster " + fullName));
|
||||
}
|
||||
HColor borderColor;
|
||||
Style style = null;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinition(umlDiagramType.getStyleName())
|
||||
style = getDefaultStyleDefinition(umlDiagramType.getStyleName())
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
borderColor = style.value(PName.LineColor).asColor(skinParam2.getThemeStyle(),
|
||||
skinParam2.getIHtmlColorSet());
|
||||
@ -360,8 +370,6 @@ public class Cluster implements Moveable {
|
||||
final double shadowing;
|
||||
final UStroke stroke;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinition(umlDiagramType.getStyleName())
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
shadowing = style.value(PName.Shadowing).asDouble();
|
||||
stroke = style.getStroke();
|
||||
} else {
|
||||
@ -374,7 +382,7 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
stroke = getStrokeInternal(group, skinParam2);
|
||||
}
|
||||
HColor backColor = getBackColor(umlDiagramType);
|
||||
HColor backColor = getBackColor(umlDiagramType, style);
|
||||
backColor = getBackColor(backColor, skinParam2, group.getStereotype(), umlDiagramType.getStyleName());
|
||||
if (ztitle != null || zstereo != null) {
|
||||
final double roundCorner = group.getUSymbol() == null ? 0
|
||||
@ -409,11 +417,6 @@ public class Cluster implements Moveable {
|
||||
return group.getUSymbol().getSkinParameter().getStroke(skinParam, group.getStereotype());
|
||||
}
|
||||
return GeneralImageBuilder.getForcedStroke(group.getStereotype(), skinParam);
|
||||
// UStroke stroke = skinParam.getThickness(LineParam.packageBorder, group.getStereotype());
|
||||
// if (stroke == null) {
|
||||
// stroke = new UStroke(1.5);
|
||||
// }
|
||||
// return stroke;
|
||||
}
|
||||
|
||||
public void manageEntryExitPoint(StringBounder stringBounder) {
|
||||
@ -455,7 +458,7 @@ public class Cluster implements Moveable {
|
||||
|
||||
}
|
||||
|
||||
private HColor getColor(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) {
|
||||
private HColor getColorLegacy(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) {
|
||||
return new Rose().getHtmlColor(skinParam, stereo, colorParam);
|
||||
}
|
||||
|
||||
@ -470,13 +473,18 @@ public class Cluster implements Moveable {
|
||||
+ IEntityImage.MARGIN_LINE;
|
||||
}
|
||||
|
||||
HColor stateBack = getBackColor(umlDiagramType);
|
||||
final Style styleGroup = getDefaultStyleDefinitionStateGroup(group.getStereotype())
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
|
||||
HColor stateBack = getBackColor(umlDiagramType, styleGroup);
|
||||
if (stateBack == null) {
|
||||
stateBack = getColor(skinParam2, ColorParam.stateBackground, group.getStereotype());
|
||||
stateBack = getColorLegacy(skinParam2, ColorParam.stateBackground, group.getStereotype());
|
||||
}
|
||||
final HColor background = getColor(skinParam2, ColorParam.background, null);
|
||||
final Style style = getStyle(FontParam.STATE_ATTRIBUTE, skinParam2);
|
||||
final TextBlock attribute = GeneralImageBuilder.stateHeader(group, style, skinParam2);
|
||||
final HColor background = getColorLegacy(skinParam2, ColorParam.background, null);
|
||||
|
||||
// final Style style = getStyle(FontParam.STATE_ATTRIBUTE, skinParam2);
|
||||
|
||||
final TextBlock attribute = GeneralImageBuilder.stateHeader(group, styleGroup, skinParam2);
|
||||
final double attributeHeight = attribute.calculateDimension(ug.getStringBounder()).getHeight();
|
||||
if (total.getWidth() == 0) {
|
||||
System.err.println("Cluster::drawUState issue");
|
||||
@ -892,7 +900,7 @@ public class Cluster implements Moveable {
|
||||
return colorTitle;
|
||||
}
|
||||
|
||||
private final HColor getBackColor(final UmlDiagramType umlDiagramType) {
|
||||
private final HColor getBackColor(UmlDiagramType umlDiagramType, Style style) {
|
||||
if (EntityUtils.groupRoot(group)) {
|
||||
return null;
|
||||
}
|
||||
@ -901,6 +909,11 @@ public class Cluster implements Moveable {
|
||||
return result;
|
||||
}
|
||||
final Stereotype stereo = group.getStereotype();
|
||||
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
return style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
|
||||
}
|
||||
|
||||
final USymbol sym = group.getUSymbol() == null ? USymbol.PACKAGE : group.getUSymbol();
|
||||
final ColorParam backparam = umlDiagramType == UmlDiagramType.ACTIVITY ? ColorParam.partitionBackground
|
||||
: sym.getColorParamBack();
|
||||
@ -911,7 +924,7 @@ public class Cluster implements Moveable {
|
||||
if (parentCluster == null) {
|
||||
return null;
|
||||
}
|
||||
return parentCluster.getBackColor(umlDiagramType);
|
||||
return parentCluster.getBackColor(umlDiagramType, style);
|
||||
}
|
||||
|
||||
public boolean isClusterOf(IEntity ent) {
|
||||
|
@ -164,7 +164,7 @@ public final class GeneralImageBuilder {
|
||||
return entityImageClass;
|
||||
}
|
||||
if (leaf.getLeafType() == LeafType.NOTE) {
|
||||
return new EntityImageNote(leaf, skinParam);
|
||||
return new EntityImageNote(leaf, skinParam, umlDiagramType);
|
||||
}
|
||||
if (leaf.getLeafType() == LeafType.ACTIVITY) {
|
||||
return new EntityImageActivity(leaf, skinParam, bibliotekon);
|
||||
@ -271,7 +271,7 @@ public final class GeneralImageBuilder {
|
||||
}
|
||||
|
||||
if (leaf.getLeafType() == LeafType.TIPS) {
|
||||
return new EntityImageTips(leaf, skinParam, bibliotekon);
|
||||
return new EntityImageTips(leaf, skinParam, bibliotekon, umlDiagramType);
|
||||
}
|
||||
// TODO Clean
|
||||
if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null
|
||||
|
@ -43,6 +43,7 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
|
||||
@ -62,7 +63,10 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
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.image.EntityImageState;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
@ -119,11 +123,28 @@ public final class GroupPngMakerState {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Style getStyleHeader() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.header)
|
||||
.with(group.getStereotype()).getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private Style getStyle() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state).with(group.getStereotype())
|
||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
public IEntityImage getImage() {
|
||||
final Display display = group.getDisplay();
|
||||
final ISkinParam skinParam = diagram.getSkinParam();
|
||||
final TextBlock title = display.create(new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()),
|
||||
HorizontalAlignment.CENTER, diagram.getSkinParam());
|
||||
|
||||
final FontConfiguration fontConfiguration;
|
||||
if (UseStyle.useBetaStyle())
|
||||
fontConfiguration = getStyleHeader().getFontConfiguration(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
else
|
||||
fontConfiguration = new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype());
|
||||
|
||||
final TextBlock title = display.create(fontConfiguration, HorizontalAlignment.CENTER, diagram.getSkinParam());
|
||||
|
||||
if (group.size() == 0 && group.getChildren().size() == 0) {
|
||||
return new EntityImageState(group, diagram.getSkinParam());
|
||||
@ -149,12 +170,24 @@ public final class GroupPngMakerState {
|
||||
|
||||
HColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
|
||||
if (borderColor == null) {
|
||||
if (UseStyle.useBetaStyle())
|
||||
borderColor = getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
else
|
||||
borderColor = getColor(ColorParam.stateBorder, group.getStereotype());
|
||||
}
|
||||
final Stereotype stereo = group.getStereotype();
|
||||
final HColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null
|
||||
? getColor(ColorParam.stateBackground, stereo)
|
||||
: group.getColors(skinParam).getColor(ColorType.BACK);
|
||||
final HColor tmp = group.getColors(skinParam).getColor(ColorType.BACK);
|
||||
final HColor backColor;
|
||||
if (tmp == null)
|
||||
if (UseStyle.useBetaStyle())
|
||||
backColor = getStyle().value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
else
|
||||
backColor = getColor(ColorParam.stateBackground, stereo);
|
||||
else
|
||||
backColor = tmp;
|
||||
|
||||
final TextBlock attribute = GeneralImageBuilder.stateHeader((IEntity) group, null, skinParam);
|
||||
|
||||
final Stereotype stereotype = group.getStereotype();
|
||||
|
@ -143,12 +143,8 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
||||
}
|
||||
|
||||
private Style getStyle() {
|
||||
return getDefaultStyleDefinition().with(getEntity().getStereotype())
|
||||
.getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_);
|
||||
return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_)
|
||||
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private void drawInternal(UGraphic ug) {
|
||||
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
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.HeaderLayout;
|
||||
import net.sourceforge.plantuml.svek.ShapeType;
|
||||
@ -84,7 +85,8 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
||||
FontConfiguration fontConfigurationName;
|
||||
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = FontParam.CLASS.getStyleDefinition(SName.classDiagram).with(stereotype)
|
||||
final Style style = StyleSignature
|
||||
.of(SName.root, SName.element, SName.classDiagram, SName.class_, SName.header).with(stereotype)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
fontConfigurationName = new FontConfiguration(skinParam, style);
|
||||
} else {
|
||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineParam;
|
||||
import net.sourceforge.plantuml.SkinParamBackcolored;
|
||||
import net.sourceforge.plantuml.SkinParamUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.creole.Stencil;
|
||||
@ -96,7 +97,7 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
|
||||
public EntityImageNote(ILeaf entity, ISkinParam skinParam) {
|
||||
public EntityImageNote(ILeaf entity, ISkinParam skinParam, UmlDiagramType umlDiagramType) {
|
||||
super(entity, getSkin(getISkinParam(skinParam, entity), entity));
|
||||
this.skinParam = getISkinParam(skinParam, entity);
|
||||
|
||||
@ -106,7 +107,8 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil {
|
||||
final Rose rose = new Rose();
|
||||
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
final Style style = getDefaultStyleDefinition(umlDiagramType.getStyleName())
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
if (entity.getColors(getSkinParam()).getColor(ColorType.BACK) == null) {
|
||||
this.noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
@ -201,8 +203,8 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil {
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
public StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note);
|
||||
private StyleSignature getDefaultStyleDefinition(SName sname) {
|
||||
return StyleSignature.of(SName.root, SName.element, sname, SName.note);
|
||||
}
|
||||
|
||||
final public void drawU(UGraphic ug) {
|
||||
|
@ -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.TextBlockEmpty;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
|
||||
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.ShapeType;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2;
|
||||
@ -89,8 +94,15 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil {
|
||||
this.lineConfig = entity;
|
||||
final Stereotype stereotype = entity.getStereotype();
|
||||
this.roundCorner = skinParam.getRoundCorner(CornerParam.DEFAULT, null);
|
||||
final FontConfiguration fc = new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype);
|
||||
final TextBlock tmp = getUnderlinedName(entity).create(fc, HorizontalAlignment.CENTER, skinParam);
|
||||
|
||||
final FontConfiguration fcHeader;
|
||||
if (UseStyle.useBetaStyle())
|
||||
fcHeader = getStyleHeader().getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
fcHeader = new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype);
|
||||
|
||||
final TextBlock tmp = getUnderlinedName(entity).create(fcHeader, HorizontalAlignment.CENTER, skinParam);
|
||||
this.name = TextBlockUtils.withMargin(tmp, 2, 2);
|
||||
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|
||||
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {
|
||||
@ -107,12 +119,22 @@ 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(), null);
|
||||
entity.getStereotype(), getStyle());
|
||||
}
|
||||
this.url = entity.getUrl99();
|
||||
|
||||
}
|
||||
|
||||
private Style getStyle() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.objectDiagram, SName.object)
|
||||
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private Style getStyleHeader() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.objectDiagram, SName.object, SName.header)
|
||||
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private Display getUnderlinedName(ILeaf entity) {
|
||||
if (getSkinParam().strictUmlStyle()) {
|
||||
return entity.getDisplay().underlinedName();
|
||||
@ -146,10 +168,16 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil {
|
||||
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) {
|
||||
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) {
|
||||
|
@ -40,6 +40,7 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
@ -48,6 +49,9 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGroupType;
|
||||
@ -76,8 +80,16 @@ public class EntityImageState extends EntityImageStateCommon {
|
||||
|
||||
this.withSymbol = stereotype != null && stereotype.isWithOOSymbol();
|
||||
final Display list = Display.create(entity.getBodier().getRawBody());
|
||||
this.fields = list.create8(new FontConfiguration(getSkinParam(), FontParam.STATE_ATTRIBUTE, stereotype),
|
||||
HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL, skinParam.wrapWidth());
|
||||
final FontConfiguration fontConfiguration;
|
||||
|
||||
if (UseStyle.useBetaStyle())
|
||||
fontConfiguration = getStyleMember().getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.STATE_ATTRIBUTE, stereotype);
|
||||
|
||||
this.fields = list.create8(fontConfiguration, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL,
|
||||
skinParam.wrapWidth());
|
||||
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineConfigurable;
|
||||
import net.sourceforge.plantuml.SkinParamUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
@ -50,6 +51,10 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
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.ShapeType;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
@ -70,12 +75,30 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
|
||||
this.lineConfig = entity;
|
||||
final Stereotype stereotype = entity.getStereotype();
|
||||
|
||||
this.desc = entity.getDisplay().create8(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype),
|
||||
HorizontalAlignment.CENTER, skinParam, CreoleMode.FULL, skinParam.wrapWidth());
|
||||
final FontConfiguration fontConfiguration;
|
||||
|
||||
if (UseStyle.useBetaStyle())
|
||||
fontConfiguration = getStyleHeader().getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype);
|
||||
|
||||
this.desc = entity.getDisplay().create8(fontConfiguration, HorizontalAlignment.CENTER, skinParam,
|
||||
CreoleMode.FULL, skinParam.wrapWidth());
|
||||
this.url = entity.getUrl99();
|
||||
|
||||
}
|
||||
|
||||
final protected Style getStyleHeader() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.header)
|
||||
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
final protected Style getStyleMember() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state)
|
||||
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
final protected UStroke getStroke() {
|
||||
UStroke stroke = lineConfig.getColors(getSkinParam()).getSpecificLineStroke();
|
||||
if (stroke == null) {
|
||||
@ -100,12 +123,21 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
|
||||
|
||||
HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE);
|
||||
if (classBorder == null) {
|
||||
if (UseStyle.useBetaStyle())
|
||||
classBorder = getStyleMember().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder);
|
||||
}
|
||||
ug = ug.apply(getStroke()).apply(classBorder);
|
||||
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
|
||||
if (backcolor == null) {
|
||||
if (UseStyle.useBetaStyle())
|
||||
backcolor = getStyleMember().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground);
|
||||
|
||||
}
|
||||
ug = ug.apply(backcolor.bg());
|
||||
|
||||
|
@ -46,6 +46,8 @@ import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.command.Position;
|
||||
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
@ -58,6 +60,10 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
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.Bibliotekon;
|
||||
import net.sourceforge.plantuml.svek.ShapeType;
|
||||
@ -78,17 +84,41 @@ public class EntityImageTips extends AbstractEntityImage {
|
||||
|
||||
private final double ySpacing = 10;
|
||||
|
||||
public EntityImageTips(ILeaf entity, ISkinParam skinParam, Bibliotekon bibliotekon) {
|
||||
public EntityImageTips(ILeaf entity, ISkinParam skinParam, Bibliotekon bibliotekon, UmlDiagramType type) {
|
||||
super(entity, EntityImageNote.getSkin(skinParam, entity));
|
||||
this.skinParam = skinParam;
|
||||
this.bibliotekon = bibliotekon;
|
||||
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinition(type.getStyleName())
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
|
||||
if (entity.getColors(skinParam).getColor(ColorType.BACK) == null) {
|
||||
noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
|
||||
this.noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
|
||||
} else {
|
||||
noteBackgroundColor = entity.getColors(skinParam).getColor(ColorType.BACK);
|
||||
this.noteBackgroundColor = entity.getColors(skinParam).getColor(ColorType.BACK);
|
||||
}
|
||||
|
||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
|
||||
} else {
|
||||
|
||||
if (entity.getColors(skinParam).getColor(ColorType.BACK) == null) {
|
||||
this.noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
|
||||
} else {
|
||||
this.noteBackgroundColor = entity.getColors(skinParam).getColor(ColorType.BACK);
|
||||
}
|
||||
|
||||
this.borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private StyleSignature getDefaultStyleDefinition(SName sname) {
|
||||
return StyleSignature.of(SName.root, SName.element, sname, SName.note);
|
||||
}
|
||||
|
||||
private Position getPosition() {
|
||||
|
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 3;
|
||||
final int beta = 5;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user