1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-30 00:33:53 +00:00

Merge branch 'wip'

This commit is contained in:
Arnaud Roques 2021-10-17 11:04:20 +02:00
commit 742542290a
24 changed files with 546 additions and 246 deletions

View File

@ -133,7 +133,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
final String genericOption = arg.getLazzy("DISPLAY", 1); final String genericOption = arg.getLazzy("DISPLAY", 1);
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0); final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
final String stereotype = arg.get("STEREO", 0); final String stereo = arg.get("STEREO", 0);
final ILeaf entity; final ILeaf entity;
final Ident idNewLong = diagram.buildLeafIdent(idShort); final Ident idNewLong = diagram.buildLeafIdent(idShort);
if (diagram.V1972()) { if (diagram.V1972()) {
@ -156,10 +156,11 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null); entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
} }
} }
if (stereotype != null) { if (stereo != null) {
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), entity.setStereotype(Stereotype.build(stereo, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
entity.setStereostyle(stereo);
} }
if (generic != null) { if (generic != null) {
entity.setGeneric(generic); entity.setGeneric(generic);

View File

@ -49,8 +49,7 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CommandCreoleColorChange implements Command { public class CommandCreoleColorChange implements Command {
private static final Pattern2 pattern = MyPattern private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
.cmpile("^(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
private static final Pattern2 patternEol = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*)$)"); private static final Pattern2 patternEol = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*)$)");
@ -90,12 +89,13 @@ public class CommandCreoleColorChange implements Command {
final HColor color = HColorSet.instance().getColor(themeStyle, s); final HColor color = HColorSet.instance().getColor(themeStyle, s);
final FontConfiguration fc2 = fc1.changeColor(color); final FontConfiguration fc2 = fc1.changeColor(color);
stripe.setActualFontConfiguration(fc2); stripe.setActualFontConfiguration(fc2);
} catch (NoSuchColorException e) {
// Too late for parsing error
// So we just ignore
}
stripe.analyzeAndAdd(m.group(3)); stripe.analyzeAndAdd(m.group(3));
stripe.setActualFontConfiguration(fc1); stripe.setActualFontConfiguration(fc1);
return line.substring(m.group(1).length()); return line.substring(m.group(1).length());
} catch (NoSuchColorException e) {
throw new NoSuchColorRuntimeException();
}
} }
} }

View File

@ -66,6 +66,7 @@ public class GroupRoot implements IGroup {
this.entityFactory = entityFactory; this.entityFactory = entityFactory;
} }
@Override
public Collection<ILeaf> getLeafsDirect() { public Collection<ILeaf> getLeafsDirect() {
final List<ILeaf> result = new ArrayList<>(); final List<ILeaf> result = new ArrayList<>();
for (ILeaf ent : entityFactory.leafs()) { for (ILeaf ent : entityFactory.leafs()) {
@ -82,71 +83,79 @@ public class GroupRoot implements IGroup {
return "ROOT"; return "ROOT";
} }
@Override
public boolean isGroup() { public boolean isGroup() {
return true; return true;
} }
@Override
public Display getDisplay() { public Display getDisplay() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setDisplay(Display display) { public void setDisplay(Display display) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public LeafType getLeafType() { public LeafType getLeafType() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public String getUid() { public String getUid() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Url getUrl99() { public Url getUrl99() {
return null; return null;
} }
@Override
public Stereotype getStereotype() { public Stereotype getStereotype() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setStereotype(Stereotype stereotype) { public void setStereotype(Stereotype stereotype) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
}
public TextBlock getBody(PortionShower portionShower, FontParam fontParam, ISkinParam skinParam) {
throw new UnsupportedOperationException();
} }
@Override
public Code getCode() { public Code getCode() {
return CodeImpl.of("__ROOT__"); return CodeImpl.of("__ROOT__");
} }
@Override
public String getCodeGetName() { public String getCodeGetName() {
return getCode().getName(); return getCode().getName();
} }
@Override
public void addUrl(Url url) { public void addUrl(Url url) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public IGroup getParentContainer() { public IGroup getParentContainer() {
return null; return null;
} }
@Override
public boolean containsLeafRecurse(ILeaf entity) { public boolean containsLeafRecurse(ILeaf entity) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Collection<IGroup> getChildren() { public Collection<IGroup> getChildren() {
final List<IGroup> result = new ArrayList<>(); final List<IGroup> result = new ArrayList<>();
if (entityFactory.namespaceSeparator.V1972()) { if (entityFactory.namespaceSeparator.V1972()) {
@ -166,93 +175,105 @@ public class GroupRoot implements IGroup {
return Collections.unmodifiableCollection(result); return Collections.unmodifiableCollection(result);
} }
@Override
public void moveEntitiesTo(IGroup dest) { public void moveEntitiesTo(IGroup dest) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public int size() { public int size() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public GroupType getGroupType() { public GroupType getGroupType() {
return null; return null;
} }
@Override
public Code getNamespace() { public Code getNamespace() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public PackageStyle getPackageStyle() { public PackageStyle getPackageStyle() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void overrideImage(IEntityImage img, LeafType state) { public void overrideImage(IEntityImage img, LeafType state) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public boolean isHidden() { public boolean isHidden() {
return false; return false;
} }
@Override
public USymbol getUSymbol() { public USymbol getUSymbol() {
return null; return null;
// throw new UnsupportedOperationException(); // throw new UnsupportedOperationException();
} }
@Override
public void setUSymbol(USymbol symbol) { public void setUSymbol(USymbol symbol) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public SingleStrategy getSingleStrategy() { public SingleStrategy getSingleStrategy() {
return SingleStrategy.SQUARE; return SingleStrategy.SQUARE;
} }
@Override
public boolean isRemoved() { public boolean isRemoved() {
return false; return false;
} }
@Override
public boolean hasUrl() { public boolean hasUrl() {
return false; return false;
} }
public int getHectorLayer() { @Override
throw new UnsupportedOperationException();
}
public void setHectorLayer(int layer) {
throw new UnsupportedOperationException();
}
public int getRawLayout() { public int getRawLayout() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public char getConcurrentSeparator() { public char getConcurrentSeparator() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setConcurrentSeparator(char separator) { public void setConcurrentSeparator(char separator) {
// throw new UnsupportedOperationException(); // throw new UnsupportedOperationException();
} }
@Override
public void putTip(String member, Display display) { public void putTip(String member, Display display) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Map<String, Display> getTips() { public Map<String, Display> getTips() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Bodier getBodier() { public Bodier getBodier() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Colors getColors(ISkinParam skinParam) { public Colors getColors(ISkinParam skinParam) {
return Colors.empty(); return Colors.empty();
} }
@Override
public void setColors(Colors colors) { public void setColors(Colors colors) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -277,31 +298,48 @@ public class GroupRoot implements IGroup {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setLegend(DisplayPositionned legend) { public void setLegend(DisplayPositionned legend) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public DisplayPositionned getLegend() { public DisplayPositionned getLegend() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Ident getIdent() { public Ident getIdent() {
return Ident.empty(); return Ident.empty();
} }
@Override
public boolean isAloneAndUnlinked() { public boolean isAloneAndUnlinked() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setThisIsTogether() { public void setThisIsTogether() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public String getCodeLine() { public String getCodeLine() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setCodeLine(LineLocation codeLine) { public void setCodeLine(LineLocation codeLine) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setStereostyle(String stereo) {
throw new UnsupportedOperationException();
}
@Override
public Stereostyles getStereostyles() {
throw new UnsupportedOperationException();
}
} }

View File

@ -82,10 +82,6 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
public boolean hasUrl(); public boolean hasUrl();
public int getHectorLayer();
public void setHectorLayer(int layer);
public int getRawLayout(); public int getRawLayout();
public void putTip(String member, Display display); public void putTip(String member, Display display);
@ -104,4 +100,8 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
public void setCodeLine(LineLocation codeLine); public void setCodeLine(LineLocation codeLine);
public void setStereostyle(String stereo);
public Stereostyles getStereostyles();
} }

View File

@ -0,0 +1,74 @@
/* ========================================================================
* 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.cucadiagram;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
public class Stereostyles {
public static final Stereostyles NONE = new Stereostyles();
private final Set<String> names = new LinkedHashSet<String>();
private Stereostyles() {
}
public boolean isEmpty() {
return names.isEmpty();
}
public static Stereostyles build(String label) {
final Stereostyles result = new Stereostyles();
final Pattern2 p = MyPattern.cmpile("\\<{3}(.*?)\\>{3}");
final Matcher2 m = p.matcher(label);
while (m.find()) {
result.names.add(m.group(1));
}
return result;
}
public Collection<String> getStyleNames() {
return Collections.unmodifiableCollection(names);
}
}

View File

@ -66,6 +66,7 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
@ -98,6 +99,7 @@ final public class EntityImpl implements ILeaf, IGroup {
private LeafType leafType; private LeafType leafType;
private Stereotype stereotype; private Stereotype stereotype;
private Stereostyles stereostyles = Stereostyles.NONE;
private String generic; private String generic;
private IGroup parentContainer; private IGroup parentContainer;
@ -662,19 +664,6 @@ final public class EntityImpl implements ILeaf, IGroup {
return true; return true;
} }
private int layer;
public int getHectorLayer() {
return layer;
}
public void setHectorLayer(int layer) {
this.layer = layer;
if (layer > 1000) {
throw new IllegalArgumentException();
}
}
private FontParam getTitleFontParam() { private FontParam getTitleFontParam() {
if (symbol != null) { if (symbol != null) {
return symbol.getFontParam(); return symbol.getFontParam();
@ -804,4 +793,14 @@ final public class EntityImpl implements ILeaf, IGroup {
this.codeLine = codeLine; this.codeLine = codeLine;
} }
@Override
public void setStereostyle(String stereo) {
this.stereostyles = Stereostyles.build(stereo);
}
@Override
public Stereostyles getStereostyles() {
return stereostyles;
}
} }

View File

@ -45,7 +45,7 @@ public class NBox implements Staged {
public void add(NBar bar) { public void add(NBar bar) {
if (this.bars.contains(bar)) { if (this.bars.contains(bar)) {
throw new IllegalStateException(); return;
} }
this.bars.add(bar); this.bars.add(bar);
this.tetris.add(bar); this.tetris.add(bar);

View File

@ -83,7 +83,7 @@ public class Participant implements SpecificBackcolorable, WithStyle {
final StyleSignature signature = getDefaultStyleDefinition().with(stereotype); final StyleSignature signature = getDefaultStyleDefinition().with(stereotype);
Style tmp = signature.getMergedStyle(styleBuilder); Style tmp = signature.getMergedStyle(styleBuilder);
tmp = tmp.eventuallyOverride(getColors(null)); tmp = tmp.eventuallyOverride(getColors(null));
Style stereo = getDefaultStyleDefinition().withStereotype(stereotype).getMergedStyle(styleBuilder); Style stereo = getDefaultStyleDefinition().forStereotypeItself(stereotype).getMergedStyle(styleBuilder);
if (tmp != null) { if (tmp != null) {
stereo = tmp.mergeWith(stereo); stereo = tmp.mergeWith(stereo);
} }

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.statediagram.command.CommandCreatePackageState;
import net.sourceforge.plantuml.statediagram.command.CommandCreateState; import net.sourceforge.plantuml.statediagram.command.CommandCreateState;
import net.sourceforge.plantuml.statediagram.command.CommandEndState; import net.sourceforge.plantuml.statediagram.command.CommandEndState;
import net.sourceforge.plantuml.statediagram.command.CommandLinkState; import net.sourceforge.plantuml.statediagram.command.CommandLinkState;
import net.sourceforge.plantuml.statediagram.command.CommandLinkStateReverse;
public class StateDiagramFactory extends PSystemCommandFactory { public class StateDiagramFactory extends PSystemCommandFactory {
@ -75,6 +76,7 @@ public class StateDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandRemoveRestore()); cmds.add(new CommandRemoveRestore());
cmds.add(new CommandCreateState()); cmds.add(new CommandCreateState());
cmds.add(new CommandLinkState()); cmds.add(new CommandLinkState());
cmds.add(new CommandLinkStateReverse());
cmds.add(new CommandCreatePackageState()); cmds.add(new CommandCreatePackageState());
cmds.add(new CommandEndState()); cmds.add(new CommandEndState());
cmds.add(new CommandAddField()); cmds.add(new CommandAddField());

View File

@ -36,31 +36,12 @@
*/ */
package net.sourceforge.plantuml.statediagram.command; package net.sourceforge.plantuml.statediagram.command;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandLinkState extends SingleLineCommand2<StateDiagram> { public class CommandLinkState extends CommandLinkStateCommon {
public CommandLinkState() { public CommandLinkState() {
super(getRegex()); super(getRegex());
@ -91,128 +72,4 @@ public class CommandLinkState extends SingleLineCommand2<StateDiagram> {
)), RegexLeaf.end()); )), RegexLeaf.end());
} }
private static RegexLeaf getStatePattern(String name) {
return new RegexLeaf(name,
"([%pLN_.:]+|[%pLN_.:]+\\[H\\*?\\]|\\[\\*\\]|\\[H\\*?\\]|(?:==+)(?:[%pLN_.:]+)(?:==+))[%s]*(\\<\\<.*\\>\\>)?[%s]*(#\\w+)?");
}
@Override
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String ent1 = arg.get("ENT1", 0);
final String ent2 = arg.get("ENT2", 0);
final IEntity cl1 = getEntityStart(diagram, ent1);
if (cl1 == null) {
return CommandExecutionResult
.error("The state " + ent1 + " has been created in a concurrent state : it cannot be used here.");
}
final IEntity cl2 = getEntityEnd(diagram, ent2);
if (cl2 == null) {
return CommandExecutionResult
.error("The state " + ent2 + " has been created in a concurrent state : it cannot be used here.");
}
if (arg.get("ENT1", 1) != null) {
cl1.setStereotype(Stereotype.build(arg.get("ENT1", 1)));
}
if (arg.get("ENT1", 2) != null) {
final String s = arg.get("ENT1", 2);
cl1.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
}
if (arg.get("ENT2", 1) != null) {
cl2.setStereotype(Stereotype.build(arg.get("ENT2", 1)));
}
if (arg.get("ENT2", 2) != null) {
final String s = arg.get("ENT2", 2);
cl2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
}
String queue = arg.get("ARROW_BODY1", 0) + arg.get("ARROW_BODY2", 0);
final Direction dir = getDirection(arg);
if (dir == Direction.LEFT || dir == Direction.RIGHT) {
queue = "-";
}
final int lenght = queue.length();
final boolean crossStart = arg.get("ARROW_CROSS_START", 0) != null;
final boolean circleEnd = arg.get("ARROW_CIRCLE_END", 0) != null;
final LinkType linkType = new LinkType(circleEnd ? LinkDecor.ARROW_AND_CIRCLE : LinkDecor.ARROW,
crossStart ? LinkDecor.CIRCLE_CROSS : LinkDecor.NONE);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
Link link = new Link(cl1, cl2, linkType, label, lenght, diagram.getSkinParam().getCurrentStyleBuilder());
if (dir == Direction.LEFT || dir == Direction.UP) {
link = link.getInv();
}
link.applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0));
link.setUmlDiagramType(UmlDiagramType.STATE);
diagram.addLink(link);
return CommandExecutionResult.ok();
}
private Direction getDirection(RegexResult arg) {
final String arrowDirection = arg.get("ARROW_DIRECTION", 0);
if (arrowDirection != null) {
return StringUtils.getQueueDirection(arrowDirection);
}
return null;
}
private IEntity getEntityStart(StateDiagram diagram, final String codeString) {
if (codeString.startsWith("[*]")) {
return diagram.getStart();
}
return getFoo1(diagram, codeString);
}
private IEntity getEntityEnd(StateDiagram diagram, final String codeString) {
if (codeString.startsWith("[*]")) {
return diagram.getEnd();
}
return getFoo1(diagram, codeString);
}
private IEntity getFoo1(StateDiagram diagram, final String codeString) {
if (codeString.equalsIgnoreCase("[H]")) {
return diagram.getHistorical();
}
if (codeString.endsWith("[H]")) {
return diagram.getHistorical(codeString.substring(0, codeString.length() - 3));
}
if (codeString.equalsIgnoreCase("[H*]")) {
return diagram.getDeepHistory();
}
if (codeString.endsWith("[H*]")) {
return diagram.getDeepHistory(codeString.substring(0, codeString.length() - 4));
}
if (codeString.startsWith("=") && codeString.endsWith("=")) {
final String codeString1 = removeEquals(codeString);
final Ident ident1 = diagram.buildLeafIdent(codeString1);
final Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(codeString1);
return diagram.getOrCreateLeaf(ident1, code1, LeafType.SYNCHRO_BAR, null);
}
final Ident ident = diagram.buildLeafIdent(codeString);
final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString);
if (diagram.checkConcurrentStateOk(ident, code) == false) {
return null;
}
return diagram.getOrCreateLeaf(ident, code, null, null);
}
private String removeEquals(String code) {
while (code.startsWith("=")) {
code = code.substring(1);
}
while (code.endsWith("=")) {
code = code.substring(0, code.length() - 1);
}
return code;
}
} }

View File

@ -0,0 +1,195 @@
/* ========================================================================
* 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
* Contribution : Serge Wenger
*
*
*/
package net.sourceforge.plantuml.statediagram.command;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
abstract class CommandLinkStateCommon extends SingleLineCommand2<StateDiagram> {
CommandLinkStateCommon(IRegex pattern) {
super(pattern);
}
protected static RegexLeaf getStatePattern(String name) {
return new RegexLeaf(name,
"([%pLN_.:]+|[%pLN_.:]+\\[H\\*?\\]|\\[\\*\\]|\\[H\\*?\\]|(?:==+)(?:[%pLN_.:]+)(?:==+))[%s]*(\\<\\<.*\\>\\>)?[%s]*(#\\w+)?");
}
@Override
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String ent1 = arg.get("ENT1", 0);
final String ent2 = arg.get("ENT2", 0);
final IEntity cl1 = getEntityStart(diagram, ent1);
if (cl1 == null) {
return CommandExecutionResult
.error("The state " + ent1 + " has been created in a concurrent state : it cannot be used here.");
}
final IEntity cl2 = getEntityEnd(diagram, ent2);
if (cl2 == null) {
return CommandExecutionResult
.error("The state " + ent2 + " has been created in a concurrent state : it cannot be used here.");
}
if (arg.get("ENT1", 1) != null) {
cl1.setStereotype(Stereotype.build(arg.get("ENT1", 1)));
}
if (arg.get("ENT1", 2) != null) {
final String s = arg.get("ENT1", 2);
cl1.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
}
if (arg.get("ENT2", 1) != null) {
cl2.setStereotype(Stereotype.build(arg.get("ENT2", 1)));
}
if (arg.get("ENT2", 2) != null) {
final String s = arg.get("ENT2", 2);
cl2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
}
String queue = arg.get("ARROW_BODY1", 0) + arg.get("ARROW_BODY2", 0);
final Direction dir = getDirection(arg);
if (dir == Direction.LEFT || dir == Direction.RIGHT) {
queue = "-";
}
final int lenght = queue.length();
final boolean crossStart = arg.get("ARROW_CROSS_START", 0) != null;
final boolean circleEnd = arg.get("ARROW_CIRCLE_END", 0) != null;
final LinkType linkType = new LinkType(circleEnd ? LinkDecor.ARROW_AND_CIRCLE : LinkDecor.ARROW,
crossStart ? LinkDecor.CIRCLE_CROSS : LinkDecor.NONE);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
Link link = new Link(cl1, cl2, linkType, label, lenght, diagram.getSkinParam().getCurrentStyleBuilder());
if (dir == Direction.LEFT || dir == Direction.UP) {
link = link.getInv();
}
link.applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0));
link.setUmlDiagramType(UmlDiagramType.STATE);
diagram.addLink(link);
return CommandExecutionResult.ok();
}
private Direction getDirection(RegexResult arg) {
final String arrowDirection = arg.get("ARROW_DIRECTION", 0);
if (arrowDirection != null) {
return StringUtils.getQueueDirection(arrowDirection);
}
return getDefaultDirection();
}
protected Direction getDefaultDirection() {
return null;
}
private IEntity getEntityStart(StateDiagram diagram, final String codeString) {
if (codeString.startsWith("[*]")) {
return diagram.getStart();
}
return getFoo1(diagram, codeString);
}
private IEntity getEntityEnd(StateDiagram diagram, final String codeString) {
if (codeString.startsWith("[*]")) {
return diagram.getEnd();
}
return getFoo1(diagram, codeString);
}
private IEntity getFoo1(StateDiagram diagram, final String codeString) {
if (codeString.equalsIgnoreCase("[H]")) {
return diagram.getHistorical();
}
if (codeString.endsWith("[H]")) {
return diagram.getHistorical(codeString.substring(0, codeString.length() - 3));
}
if (codeString.equalsIgnoreCase("[H*]")) {
return diagram.getDeepHistory();
}
if (codeString.endsWith("[H*]")) {
return diagram.getDeepHistory(codeString.substring(0, codeString.length() - 4));
}
if (codeString.startsWith("=") && codeString.endsWith("=")) {
final String codeString1 = removeEquals(codeString);
final Ident ident1 = diagram.buildLeafIdent(codeString1);
final Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(codeString1);
return diagram.getOrCreateLeaf(ident1, code1, LeafType.SYNCHRO_BAR, null);
}
final Ident ident = diagram.buildLeafIdent(codeString);
final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString);
if (diagram.checkConcurrentStateOk(ident, code) == false) {
return null;
}
return diagram.getOrCreateLeaf(ident, code, null, null);
}
private String removeEquals(String code) {
while (code.startsWith("=")) {
code = code.substring(1);
}
while (code.endsWith("=")) {
code = code.substring(0, code.length() - 1);
}
return code;
}
}

View File

@ -0,0 +1,81 @@
/* ========================================================================
* 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
* Contribution : Serge Wenger
*
*
*/
package net.sourceforge.plantuml.statediagram.command;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
public class CommandLinkStateReverse extends CommandLinkStateCommon {
public CommandLinkStateReverse() {
super(getRegex());
}
static RegexConcat getRegex() {
return RegexConcat.build(CommandLinkStateReverse.class.getName(), RegexLeaf.start(), //
getStatePattern("ENT2"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexConcat(
//
new RegexLeaf("ARROW_CIRCLE_END", "(o[%s]+)?"), //
new RegexLeaf("\\<"), //
new RegexLeaf("ARROW_BODY2", "(-*)"), //
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)?"), //
new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_BODY1", "(-+)"), //
new RegexLeaf("ARROW_CROSS_START", "(x)?")), //
RegexLeaf.spaceZeroOrMore(), //
getStatePattern("ENT1"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional( //
new RegexConcat( //
new RegexLeaf(":"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL", "(.+)") //
)), RegexLeaf.end());
}
@Override
protected Direction getDefaultDirection() {
return Direction.LEFT;
}
}

View File

@ -43,6 +43,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
public class StyleSignature { public class StyleSignature {
@ -153,7 +154,7 @@ public class StyleSignature {
return new StyleSignature(result); return new StyleSignature(result);
} }
public StyleSignature withStereotype(Stereotype stereotype) { public StyleSignature forStereotypeItself(Stereotype stereotype) {
final List<String> result = new ArrayList<>(names); final List<String> result = new ArrayList<>(names);
if (stereotype != null) { if (stereotype != null) {
for (String name : stereotype.getStyleNames()) { for (String name : stereotype.getStyleNames()) {
@ -174,6 +175,16 @@ public class StyleSignature {
return new StyleSignature(result); return new StyleSignature(result);
} }
public StyleSignature with(Stereostyles stereostyles) {
if (stereostyles.isEmpty())
return this;
final List<String> result = new ArrayList<>(names);
for (String name : stereostyles.getStyleNames()) {
result.add(clean(name));
}
return new StyleSignature(result);
}
private String clean(String name) { private String clean(String name) {
return name.toLowerCase().replace("_", ""); return name.toLowerCase().replace("_", "");
} }

View File

@ -317,13 +317,26 @@ public class Cluster implements Moveable {
} }
HColor borderColor; HColor borderColor;
Style style = null; Style style = null;
final double rounded;
final double shadowing;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinition(umlDiagramType.getStyleName()) style = getDefaultStyleDefinition(umlDiagramType.getStyleName())
.getMergedStyle(skinParam.getCurrentStyleBuilder()); .getMergedStyle(skinParam.getCurrentStyleBuilder());
shadowing = style.value(PName.Shadowing).asDouble();
borderColor = style.value(PName.LineColor).asColor(skinParam2.getThemeStyle(), borderColor = style.value(PName.LineColor).asColor(skinParam2.getThemeStyle(),
skinParam2.getIHtmlColorSet()); skinParam2.getIHtmlColorSet());
if (umlDiagramType == UmlDiagramType.STATE)
rounded = style.value(PName.RoundCorner).asDouble();
else
rounded = IEntityImage.CORNER;
} else { } else {
if (group.getUSymbol() == null) {
shadowing = skinParam2.shadowing2(group.getStereotype(), USymbol.PACKAGE.getSkinParameter()) ? 3 : 0;
} else {
shadowing = skinParam2.shadowing2(group.getStereotype(), group.getUSymbol().getSkinParameter()) ? 3 : 0;
}
rounded = IEntityImage.CORNER;
if (umlDiagramType == UmlDiagramType.STATE) { if (umlDiagramType == UmlDiagramType.STATE) {
borderColor = getColor(ColorParam.stateBorder, skinParam, group.getStereotype()); borderColor = getColor(ColorParam.stateBorder, skinParam, group.getStereotype());
} else if (umlDiagramType == UmlDiagramType.ACTIVITY) { } else if (umlDiagramType == UmlDiagramType.ACTIVITY) {
@ -353,7 +366,7 @@ public class Cluster implements Moveable {
if (group.getColors(skinParam).getColor(ColorType.LINE) != null) { if (group.getColors(skinParam).getColor(ColorType.LINE) != null) {
borderColor = group.getColors(skinParam).getColor(ColorType.LINE); borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
} }
drawUState(ug, borderColor, skinParam2, strokeForState, umlDiagramType); drawUState(ug, borderColor, skinParam2, strokeForState, umlDiagramType, rounded, shadowing);
return; return;
} }
PackageStyle packageStyle = group.getPackageStyle(); PackageStyle packageStyle = group.getPackageStyle();
@ -367,19 +380,10 @@ public class Cluster implements Moveable {
} }
} }
final double shadowing;
final UStroke stroke; final UStroke stroke;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
shadowing = style.value(PName.Shadowing).asDouble();
stroke = style.getStroke(); stroke = style.getStroke();
} else { } else {
if (group.getUSymbol() == null) {
shadowing = skinParam2.shadowing2(group.getStereotype(), USymbol.PACKAGE.getSkinParameter()) ? 3
: 0;
} else {
shadowing = skinParam2.shadowing2(group.getStereotype(), group.getUSymbol().getSkinParameter()) ? 3
: 0;
}
stroke = getStrokeInternal(group, skinParam2); stroke = getStrokeInternal(group, skinParam2);
} }
HColor backColor = getBackColor(umlDiagramType, style); HColor backColor = getBackColor(umlDiagramType, style);
@ -463,7 +467,7 @@ public class Cluster implements Moveable {
} }
private void drawUState(UGraphic ug, HColor borderColor, ISkinParam skinParam2, UStroke stroke, private void drawUState(UGraphic ug, HColor borderColor, ISkinParam skinParam2, UStroke stroke,
UmlDiagramType umlDiagramType) { UmlDiagramType umlDiagramType, double rounded, double shadowing) {
final Dimension2D total = new Dimension2DDouble(maxX - minX, maxY - minY); final Dimension2D total = new Dimension2DDouble(maxX - minX, maxY - minY);
final double suppY; final double suppY;
if (ztitle == null) { if (ztitle == null) {
@ -492,8 +496,8 @@ public class Cluster implements Moveable {
} }
final RoundedContainer r = new RoundedContainer(total, suppY, final RoundedContainer r = new RoundedContainer(total, suppY,
attributeHeight + (attributeHeight > 0 ? IEntityImage.MARGIN : 0), borderColor, stateBack, background, attributeHeight + (attributeHeight > 0 ? IEntityImage.MARGIN : 0), borderColor, stateBack, background,
stroke); stroke, rounded, shadowing);
r.drawU(ug.apply(new UTranslate(minX, minY)), skinParam2.shadowing(group.getStereotype())); r.drawU(ug.apply(new UTranslate(minX, minY)));
if (ztitle != null) { if (ztitle != null) {
ztitle.drawU(ug.apply(new UTranslate(xTitle, yTitle))); ztitle.drawU(ug.apply(new UTranslate(xTitle, yTitle)));

View File

@ -643,7 +643,7 @@ public final class GeneralImageBuilder {
final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER); final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER);
final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder); final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder);
if (dimLabel.getWidth() > 0) { if (dimLabel.getWidth() > 0) {
final Dimension2D dimAttribute = stateHeader((IEntity) g, getStyle(FontParam.STATE_ATTRIBUTE), final Dimension2D dimAttribute = stateHeader((IEntity) g, getStyleState(FontParam.STATE_ATTRIBUTE),
dotData.getSkinParam()).calculateDimension(stringBounder); dotData.getSkinParam()).calculateDimension(stringBounder);
final double attributeHeight = dimAttribute.getHeight(); final double attributeHeight = dimAttribute.getHeight();
final double attributeWidth = dimAttribute.getWidth(); final double attributeWidth = dimAttribute.getWidth();
@ -690,7 +690,7 @@ public final class GeneralImageBuilder {
} }
private Style getStyle(FontParam fontParam) { private Style getStyleState(FontParam fontParam) {
return fontParam.getStyleDefinition(SName.stateDiagram) return fontParam.getStyleDefinition(SName.stateDiagram)
.getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder()); .getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder());
} }
@ -700,10 +700,19 @@ public final class GeneralImageBuilder {
if (label == null) { if (label == null) {
return TextBlockUtils.empty(0, 0); return TextBlockUtils.empty(0, 0);
} }
final ISkinParam skinParam = dotData.getSkinParam(); final ISkinParam skinParam = dotData.getSkinParam();
final FontConfiguration fontConfiguration = g.getFontConfigurationForTitle(skinParam); final FontConfiguration fontConfiguration;
return label.create(fontConfiguration, HorizontalAlignment.CENTER, skinParam); if (UseStyle.useBetaStyle()) {
final SName sname = dotData.getUmlDiagramType().getStyleName();
final Style style = StyleSignature.of(SName.root, SName.element, sname, SName.title) //
.with(g.getStereotype()) //
.with(g.getStereostyles()) //
.getMergedStyle(skinParam.getCurrentStyleBuilder());
fontConfiguration = style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else
fontConfiguration = g.getFontConfigurationForTitle(skinParam);
final HorizontalAlignment alignment = HorizontalAlignment.CENTER;
return label.create(fontConfiguration, alignment, dotData.getSkinParam());
} }
private TextBlock addLegend(TextBlock original, DisplayPositionned legend) { private TextBlock addLegend(TextBlock original, DisplayPositionned legend) {

View File

@ -123,12 +123,12 @@ public final class GroupPngMakerState {
return result; return result;
} }
private Style getStyleHeader() { private Style getStyleStateHeader() {
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.header) return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.header)
.with(group.getStereotype()).getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); .with(group.getStereotype()).getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
} }
private Style getStyle() { private Style getStyleState() {
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state).with(group.getStereotype()) return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state).with(group.getStereotype())
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
} }
@ -138,11 +138,20 @@ public final class GroupPngMakerState {
final ISkinParam skinParam = diagram.getSkinParam(); final ISkinParam skinParam = diagram.getSkinParam();
final FontConfiguration fontConfiguration; final FontConfiguration fontConfiguration;
if (UseStyle.useBetaStyle()) final double rounded;
fontConfiguration = getStyleHeader().getFontConfiguration(skinParam.getThemeStyle(), double shadowing = 0;
if (UseStyle.useBetaStyle()) {
rounded = getStyleState().value(PName.RoundCorner).asDouble();
shadowing = getStyleState().value(PName.Shadowing).asDouble();
fontConfiguration = getStyleStateHeader().getFontConfiguration(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet()); skinParam.getIHtmlColorSet());
else } else {
rounded = IEntityImage.CORNER;
fontConfiguration = new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()); fontConfiguration = new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype());
if (skinParam.shadowing(group.getStereotype()))
shadowing = 3.0;
}
final TextBlock title = display.create(fontConfiguration, HorizontalAlignment.CENTER, diagram.getSkinParam()); final TextBlock title = display.create(fontConfiguration, HorizontalAlignment.CENTER, diagram.getSkinParam());
@ -171,7 +180,7 @@ public final class GroupPngMakerState {
HColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE); HColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
if (borderColor == null) { if (borderColor == null) {
if (UseStyle.useBetaStyle()) if (UseStyle.useBetaStyle())
borderColor = getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), borderColor = getStyleState().value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet()); skinParam.getIHtmlColorSet());
else else
borderColor = getColor(ColorParam.stateBorder, group.getStereotype()); borderColor = getColor(ColorParam.stateBorder, group.getStereotype());
@ -181,7 +190,9 @@ public final class GroupPngMakerState {
final HColor backColor; final HColor backColor;
if (tmp == null) if (tmp == null)
if (UseStyle.useBetaStyle()) if (UseStyle.useBetaStyle())
backColor = getStyle().value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), backColor =
getStyleState().value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet()); skinParam.getIHtmlColorSet());
else else
backColor = getColor(ColorParam.stateBackground, stereo); backColor = getColor(ColorParam.stateBackground, stereo);
@ -200,8 +211,8 @@ public final class GroupPngMakerState {
if (stroke == null) { if (stroke == null) {
stroke = new UStroke(1.5); stroke = new UStroke(1.5);
} }
return new InnerStateAutonom(image, title, attribute, borderColor, backColor, return new InnerStateAutonom(image, title, attribute, borderColor, backColor, group.getUrl99(), withSymbol,
skinParam.shadowing(group.getStereotype()), group.getUrl99(), withSymbol, stroke); stroke, rounded, shadowing);
} }

View File

@ -55,13 +55,14 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
private final TextBlock attribute; private final TextBlock attribute;
private final HColor borderColor; private final HColor borderColor;
private final HColor backColor; private final HColor backColor;
private final boolean shadowing;
private final Url url; private final Url url;
private final boolean withSymbol; private final boolean withSymbol;
private final UStroke stroke; private final UStroke stroke;
private final double rounded;
private final double shadowing;
public InnerStateAutonom(final IEntityImage im, final TextBlock title, TextBlock attribute, HColor borderColor, public InnerStateAutonom(IEntityImage im, TextBlock title, TextBlock attribute, HColor borderColor,
HColor backColor, boolean shadowing, Url url, boolean withSymbol, UStroke stroke) { HColor backColor, Url url, boolean withSymbol, UStroke stroke, double rounded, double shadowing) {
this.im = im; this.im = im;
this.withSymbol = withSymbol; this.withSymbol = withSymbol;
this.title = title; this.title = title;
@ -71,6 +72,7 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
this.attribute = attribute; this.attribute = attribute;
this.url = url; this.url = url;
this.stroke = stroke; this.stroke = stroke;
this.rounded = rounded;
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
@ -81,13 +83,13 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
final double titreHeight = IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN_LINE; final double titreHeight = IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN_LINE;
final RoundedContainer r = new RoundedContainer(total, titreHeight, attr.getHeight() + marginForFields, final RoundedContainer r = new RoundedContainer(total, titreHeight, attr.getHeight() + marginForFields,
borderColor, backColor, im.getBackcolor(), stroke); borderColor, backColor, im.getBackcolor(), stroke, rounded, shadowing);
if (url != null) { if (url != null) {
ug.startUrl(url); ug.startUrl(url);
} }
r.drawU(ug, shadowing); r.drawU(ug);
title.drawU(ug.apply(new UTranslate((total.getWidth() - text.getWidth()) / 2, IEntityImage.MARGIN))); title.drawU(ug.apply(new UTranslate((total.getWidth() - text.getWidth()) / 2, IEntityImage.MARGIN)));
attribute.drawU(ug.apply( attribute.drawU(ug.apply(
new UTranslate(0 + IEntityImage.MARGIN, IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN))); new UTranslate(0 + IEntityImage.MARGIN, IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN)));

View File

@ -53,12 +53,15 @@ public final class RoundedContainer {
private final HColor backColor; private final HColor backColor;
private final HColor imgBackcolor; private final HColor imgBackcolor;
private final UStroke stroke; private final UStroke stroke;
private final double rounded;
private final double shadowing;
public RoundedContainer(Dimension2D dim, double titleHeight, double attributeHeight, HColor borderColor, public RoundedContainer(Dimension2D dim, double titleHeight, double attributeHeight, HColor borderColor,
HColor backColor, HColor imgBackcolor, UStroke stroke) { HColor backColor, HColor imgBackcolor, UStroke stroke, double rounded, double shadowing) {
if (dim.getWidth() == 0) { if (dim.getWidth() == 0) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.rounded = rounded;
this.dim = dim; this.dim = dim;
this.imgBackcolor = imgBackcolor; this.imgBackcolor = imgBackcolor;
this.titleHeight = titleHeight; this.titleHeight = titleHeight;
@ -66,15 +69,13 @@ public final class RoundedContainer {
this.backColor = backColor; this.backColor = backColor;
this.attributeHeight = attributeHeight; this.attributeHeight = attributeHeight;
this.stroke = stroke; this.stroke = stroke;
this.shadowing = shadowing;
} }
public void drawU(UGraphic ug, boolean shadowing) { public void drawU(UGraphic ug) {
ug = ug.apply(backColor.bg()).apply(borderColor); ug = ug.apply(backColor.bg()).apply(borderColor);
final URectangle rect = new URectangle(dim.getWidth(), dim.getHeight()).rounded(IEntityImage.CORNER); final URectangle rect = new URectangle(dim.getWidth(), dim.getHeight()).rounded(rounded);
if (shadowing) { rect.setDeltaShadow(shadowing);
rect.setDeltaShadow(3.0);
}
ug.apply(stroke).draw(rect); ug.apply(stroke).draw(rect);
final double yLine = titleHeight + attributeHeight; final double yLine = titleHeight + attributeHeight;
@ -84,9 +85,8 @@ public final class RoundedContainer {
final double thickness = stroke.getThickness(); final double thickness = stroke.getThickness();
final URectangle inner = new URectangle(dim.getWidth() - 4 * thickness, final URectangle inner = new URectangle(dim.getWidth() - 4 * thickness,
dim.getHeight() - titleHeight - 4 * thickness - attributeHeight).rounded(IEntityImage.CORNER); dim.getHeight() - titleHeight - 4 * thickness - attributeHeight).rounded(rounded);
ug.apply(imgBackcolor).apply(new UTranslate(2 * thickness, yLine + 2 * thickness)) ug.apply(imgBackcolor).apply(new UTranslate(2 * thickness, yLine + 2 * thickness)).draw(inner);
.draw(inner);
if (titleHeight > 0) { if (titleHeight > 0) {
ug.apply(stroke).apply(UTranslate.dy(yLine)).draw(ULine.hline(dim.getWidth())); ug.apply(stroke).apply(UTranslate.dy(yLine)).draw(ULine.hline(dim.getWidth()));

View File

@ -93,6 +93,9 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
super(entity, entity.getColors(skinParam).mute(skinParam)); super(entity, entity.getColors(skinParam).mute(skinParam));
this.leafType = entity.getLeafType(); this.leafType = entity.getLeafType();
this.lineConfig = entity; this.lineConfig = entity;
if (UseStyle.useBetaStyle())
this.roundCorner = getStyle().value(PName.RoundCorner).asDouble();
else
this.roundCorner = getSkinParam().getRoundCorner(CornerParam.DEFAULT, null); this.roundCorner = getSkinParam().getRoundCorner(CornerParam.DEFAULT, null);
this.shield = version != null && version.useShield() && entity.hasNearDecoration() ? Margins.uniform(16) this.shield = version != null && version.useShield() && entity.hasNearDecoration() ? Margins.uniform(16)
: Margins.NONE; : Margins.NONE;
@ -101,7 +104,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, getSkinParam(), showMethods, showFields, this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, getSkinParam(), showMethods, showFields,
entity.getStereotype(), getStyle()); entity.getStereotype(), getStyle());
header = new EntityImageClassHeader(entity, getSkinParam(), portionShower); this.header = new EntityImageClassHeader(entity, getSkinParam(), portionShower);
this.url = entity.getUrl99(); this.url = entity.getUrl99();
} }
@ -143,8 +146,10 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
} }
private Style getStyle() { private Style getStyle() {
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()); .with(getEntity().getStereotype()) //
.with(getEntity().getStereostyles()) //
.getMergedStyle(getSkinParam().getCurrentStyleBuilder());
} }
private void drawInternal(UGraphic ug) { private void drawInternal(UGraphic ug) {

View File

@ -86,7 +86,9 @@ public class EntityImageClassHeader extends AbstractEntityImage {
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
final Style style = StyleSignature final Style style = StyleSignature
.of(SName.root, SName.element, SName.classDiagram, SName.class_, SName.header).with(stereotype) .of(SName.root, SName.element, SName.classDiagram, SName.class_, SName.header) //
.with(stereotype) //
.with(entity.getStereostyles()) //
.getMergedStyle(skinParam.getCurrentStyleBuilder()); .getMergedStyle(skinParam.getCurrentStyleBuilder());
fontConfigurationName = new FontConfiguration(skinParam, style); fontConfigurationName = new FontConfiguration(skinParam, style);
} else { } else {

View File

@ -146,7 +146,7 @@ public class EntityImageDescription extends AbstractEntityImage {
symbol.getSkinParameter().getStyleName()); symbol.getSkinParameter().getStyleName());
style = tmp.with(stereotype).getMergedStyle(getSkinParam().getCurrentStyleBuilder()); style = tmp.with(stereotype).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
style = style.eventuallyOverride(colors); style = style.eventuallyOverride(colors);
final Style styleStereo = tmp.withStereotype(stereotype) final Style styleStereo = tmp.forStereotypeItself(stereotype)
.getMergedStyle(getSkinParam().getCurrentStyleBuilder()); .getMergedStyle(getSkinParam().getCurrentStyleBuilder());
forecolor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), forecolor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet()); getSkinParam().getIHtmlColorSet());

View File

@ -83,7 +83,7 @@ public class EntityImageState extends EntityImageStateCommon {
final FontConfiguration fontConfiguration; final FontConfiguration fontConfiguration;
if (UseStyle.useBetaStyle()) if (UseStyle.useBetaStyle())
fontConfiguration = getStyleMember().getFontConfiguration(getSkinParam().getThemeStyle(), fontConfiguration = getStyleState().getFontConfiguration(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet()); getSkinParam().getIHtmlColorSet());
else else
fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.STATE_ATTRIBUTE, stereotype); fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.STATE_ATTRIBUTE, stereotype);

View File

@ -78,7 +78,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
final FontConfiguration fontConfiguration; final FontConfiguration fontConfiguration;
if (UseStyle.useBetaStyle()) if (UseStyle.useBetaStyle())
fontConfiguration = getStyleHeader().getFontConfiguration(getSkinParam().getThemeStyle(), fontConfiguration = getStyleStateHeader().getFontConfiguration(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet()); getSkinParam().getIHtmlColorSet());
else else
fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype); fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype);
@ -89,12 +89,12 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
} }
final protected Style getStyleHeader() { private Style getStyleStateHeader() {
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.header) return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.header)
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder()); .with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
} }
final protected Style getStyleMember() { final protected Style getStyleState() {
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state) return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state)
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder()); .with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
} }
@ -112,10 +112,19 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
} }
final protected URectangle getShape(final Dimension2D dimTotal) { final protected URectangle getShape(final Dimension2D dimTotal) {
final URectangle rect = new URectangle(dimTotal).rounded(CORNER); double deltaShadow = 0;
if (getSkinParam().shadowing(getEntity().getStereotype())) { final double corner;
rect.setDeltaShadow(4); if (UseStyle.useBetaStyle()) {
corner = getStyleState().value(PName.RoundCorner).asDouble();
deltaShadow = getStyleState().value(PName.Shadowing).asDouble();
} else {
corner = CORNER;
if (getSkinParam().shadowing(getEntity().getStereotype()))
deltaShadow = 4;
} }
final URectangle rect = new URectangle(dimTotal).rounded(corner);
rect.setDeltaShadow(deltaShadow);
return rect; return rect;
} }
@ -124,7 +133,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE);
if (classBorder == null) { if (classBorder == null) {
if (UseStyle.useBetaStyle()) if (UseStyle.useBetaStyle())
classBorder = getStyleMember().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), classBorder = getStyleState().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet()); getSkinParam().getIHtmlColorSet());
else else
classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder); classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder);
@ -133,7 +142,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
if (backcolor == null) { if (backcolor == null) {
if (UseStyle.useBetaStyle()) if (UseStyle.useBetaStyle())
backcolor = getStyleMember().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), backcolor = getStyleState().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet()); getSkinParam().getIHtmlColorSet());
else else
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground);

View File

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