mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 19:09:03 +00:00
Merge branch 'wip'
This commit is contained in:
commit
742542290a
@ -133,7 +133,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
final String genericOption = arg.getLazzy("DISPLAY", 1);
|
||||
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 Ident idNewLong = diagram.buildLeafIdent(idShort);
|
||||
if (diagram.V1972()) {
|
||||
@ -156,10 +156,11 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
|
||||
}
|
||||
}
|
||||
if (stereotype != null) {
|
||||
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
if (stereo != null) {
|
||||
entity.setStereotype(Stereotype.build(stereo, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
entity.setStereostyle(stereo);
|
||||
}
|
||||
if (generic != null) {
|
||||
entity.setGeneric(generic);
|
||||
|
@ -49,8 +49,7 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
|
||||
|
||||
public class CommandCreoleColorChange implements Command {
|
||||
|
||||
private static final Pattern2 pattern = MyPattern
|
||||
.cmpile("^(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
|
||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
|
||||
|
||||
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 FontConfiguration fc2 = fc1.changeColor(color);
|
||||
stripe.setActualFontConfiguration(fc2);
|
||||
stripe.analyzeAndAdd(m.group(3));
|
||||
stripe.setActualFontConfiguration(fc1);
|
||||
return line.substring(m.group(1).length());
|
||||
} catch (NoSuchColorException e) {
|
||||
throw new NoSuchColorRuntimeException();
|
||||
// Too late for parsing error
|
||||
// So we just ignore
|
||||
}
|
||||
stripe.analyzeAndAdd(m.group(3));
|
||||
stripe.setActualFontConfiguration(fc1);
|
||||
return line.substring(m.group(1).length());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ public class GroupRoot implements IGroup {
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ILeaf> getLeafsDirect() {
|
||||
final List<ILeaf> result = new ArrayList<>();
|
||||
for (ILeaf ent : entityFactory.leafs()) {
|
||||
@ -82,71 +83,79 @@ public class GroupRoot implements IGroup {
|
||||
return "ROOT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGroup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Display getDisplay() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplay(Display display) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeafType getLeafType() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUid() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Url getUrl99() {
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stereotype getStereotype() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStereotype(Stereotype stereotype) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
public TextBlock getBody(PortionShower portionShower, FontParam fontParam, ISkinParam skinParam) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Code getCode() {
|
||||
return CodeImpl.of("__ROOT__");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCodeGetName() {
|
||||
return getCode().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUrl(Url url) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGroup getParentContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsLeafRecurse(ILeaf entity) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IGroup> getChildren() {
|
||||
final List<IGroup> result = new ArrayList<>();
|
||||
if (entityFactory.namespaceSeparator.V1972()) {
|
||||
@ -166,93 +175,105 @@ public class GroupRoot implements IGroup {
|
||||
return Collections.unmodifiableCollection(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveEntitiesTo(IGroup dest) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupType getGroupType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Code getNamespace() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageStyle getPackageStyle() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void overrideImage(IEntityImage img, LeafType state) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public USymbol getUSymbol() {
|
||||
return null;
|
||||
// throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUSymbol(USymbol symbol) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleStrategy getSingleStrategy() {
|
||||
return SingleStrategy.SQUARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRemoved() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasUrl() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getHectorLayer() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void setHectorLayer(int layer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRawLayout() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getConcurrentSeparator() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConcurrentSeparator(char separator) {
|
||||
// throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putTip(String member, Display display) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Display> getTips() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bodier getBodier() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Colors getColors(ISkinParam skinParam) {
|
||||
return Colors.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColors(Colors colors) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@ -277,31 +298,48 @@ public class GroupRoot implements IGroup {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLegend(DisplayPositionned legend) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DisplayPositionned getLegend() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ident getIdent() {
|
||||
return Ident.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAloneAndUnlinked() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThisIsTogether() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCodeLine() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCodeLine(LineLocation codeLine) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStereostyle(String stereo) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stereostyles getStereostyles() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
@ -82,10 +82,6 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
|
||||
|
||||
public boolean hasUrl();
|
||||
|
||||
public int getHectorLayer();
|
||||
|
||||
public void setHectorLayer(int layer);
|
||||
|
||||
public int getRawLayout();
|
||||
|
||||
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 setStereostyle(String stereo);
|
||||
|
||||
public Stereostyles getStereostyles();
|
||||
|
||||
}
|
||||
|
74
src/net/sourceforge/plantuml/cucadiagram/Stereostyles.java
Normal file
74
src/net/sourceforge/plantuml/cucadiagram/Stereostyles.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
@ -66,6 +66,7 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
|
||||
@ -98,6 +99,7 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
|
||||
private LeafType leafType;
|
||||
private Stereotype stereotype;
|
||||
private Stereostyles stereostyles = Stereostyles.NONE;
|
||||
private String generic;
|
||||
private IGroup parentContainer;
|
||||
|
||||
@ -662,19 +664,6 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
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() {
|
||||
if (symbol != null) {
|
||||
return symbol.getFontParam();
|
||||
@ -804,4 +793,14 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
this.codeLine = codeLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStereostyle(String stereo) {
|
||||
this.stereostyles = Stereostyles.build(stereo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stereostyles getStereostyles() {
|
||||
return stereostyles;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class NBox implements Staged {
|
||||
|
||||
public void add(NBar bar) {
|
||||
if (this.bars.contains(bar)) {
|
||||
throw new IllegalStateException();
|
||||
return;
|
||||
}
|
||||
this.bars.add(bar);
|
||||
this.tetris.add(bar);
|
||||
|
@ -83,7 +83,7 @@ public class Participant implements SpecificBackcolorable, WithStyle {
|
||||
final StyleSignature signature = getDefaultStyleDefinition().with(stereotype);
|
||||
Style tmp = signature.getMergedStyle(styleBuilder);
|
||||
tmp = tmp.eventuallyOverride(getColors(null));
|
||||
Style stereo = getDefaultStyleDefinition().withStereotype(stereotype).getMergedStyle(styleBuilder);
|
||||
Style stereo = getDefaultStyleDefinition().forStereotypeItself(stereotype).getMergedStyle(styleBuilder);
|
||||
if (tmp != null) {
|
||||
stereo = tmp.mergeWith(stereo);
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ import net.sourceforge.plantuml.statediagram.command.CommandCreatePackageState;
|
||||
import net.sourceforge.plantuml.statediagram.command.CommandCreateState;
|
||||
import net.sourceforge.plantuml.statediagram.command.CommandEndState;
|
||||
import net.sourceforge.plantuml.statediagram.command.CommandLinkState;
|
||||
import net.sourceforge.plantuml.statediagram.command.CommandLinkStateReverse;
|
||||
|
||||
public class StateDiagramFactory extends PSystemCommandFactory {
|
||||
|
||||
@ -75,6 +76,7 @@ public class StateDiagramFactory extends PSystemCommandFactory {
|
||||
cmds.add(new CommandRemoveRestore());
|
||||
cmds.add(new CommandCreateState());
|
||||
cmds.add(new CommandLinkState());
|
||||
cmds.add(new CommandLinkStateReverse());
|
||||
cmds.add(new CommandCreatePackageState());
|
||||
cmds.add(new CommandEndState());
|
||||
cmds.add(new CommandAddField());
|
||||
|
@ -36,31 +36,12 @@
|
||||
*/
|
||||
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.RegexLeaf;
|
||||
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.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() {
|
||||
super(getRegex());
|
||||
@ -91,128 +72,4 @@ public class CommandLinkState extends SingleLineCommand2<StateDiagram> {
|
||||
)), 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
|
||||
public class StyleSignature {
|
||||
@ -153,7 +154,7 @@ public class StyleSignature {
|
||||
return new StyleSignature(result);
|
||||
}
|
||||
|
||||
public StyleSignature withStereotype(Stereotype stereotype) {
|
||||
public StyleSignature forStereotypeItself(Stereotype stereotype) {
|
||||
final List<String> result = new ArrayList<>(names);
|
||||
if (stereotype != null) {
|
||||
for (String name : stereotype.getStyleNames()) {
|
||||
@ -174,6 +175,16 @@ public class StyleSignature {
|
||||
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) {
|
||||
return name.toLowerCase().replace("_", "");
|
||||
}
|
||||
|
@ -317,13 +317,26 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
HColor borderColor;
|
||||
Style style = null;
|
||||
final double rounded;
|
||||
final double shadowing;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
style = getDefaultStyleDefinition(umlDiagramType.getStyleName())
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
shadowing = style.value(PName.Shadowing).asDouble();
|
||||
borderColor = style.value(PName.LineColor).asColor(skinParam2.getThemeStyle(),
|
||||
skinParam2.getIHtmlColorSet());
|
||||
if (umlDiagramType == UmlDiagramType.STATE)
|
||||
rounded = style.value(PName.RoundCorner).asDouble();
|
||||
else
|
||||
rounded = IEntityImage.CORNER;
|
||||
|
||||
} 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) {
|
||||
borderColor = getColor(ColorParam.stateBorder, skinParam, group.getStereotype());
|
||||
} else if (umlDiagramType == UmlDiagramType.ACTIVITY) {
|
||||
@ -353,7 +366,7 @@ public class Cluster implements Moveable {
|
||||
if (group.getColors(skinParam).getColor(ColorType.LINE) != null) {
|
||||
borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
|
||||
}
|
||||
drawUState(ug, borderColor, skinParam2, strokeForState, umlDiagramType);
|
||||
drawUState(ug, borderColor, skinParam2, strokeForState, umlDiagramType, rounded, shadowing);
|
||||
return;
|
||||
}
|
||||
PackageStyle packageStyle = group.getPackageStyle();
|
||||
@ -367,19 +380,10 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
}
|
||||
|
||||
final double shadowing;
|
||||
final UStroke stroke;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
shadowing = style.value(PName.Shadowing).asDouble();
|
||||
stroke = style.getStroke();
|
||||
} 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);
|
||||
}
|
||||
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,
|
||||
UmlDiagramType umlDiagramType) {
|
||||
UmlDiagramType umlDiagramType, double rounded, double shadowing) {
|
||||
final Dimension2D total = new Dimension2DDouble(maxX - minX, maxY - minY);
|
||||
final double suppY;
|
||||
if (ztitle == null) {
|
||||
@ -492,8 +496,8 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
final RoundedContainer r = new RoundedContainer(total, suppY,
|
||||
attributeHeight + (attributeHeight > 0 ? IEntityImage.MARGIN : 0), borderColor, stateBack, background,
|
||||
stroke);
|
||||
r.drawU(ug.apply(new UTranslate(minX, minY)), skinParam2.shadowing(group.getStereotype()));
|
||||
stroke, rounded, shadowing);
|
||||
r.drawU(ug.apply(new UTranslate(minX, minY)));
|
||||
|
||||
if (ztitle != null) {
|
||||
ztitle.drawU(ug.apply(new UTranslate(xTitle, yTitle)));
|
||||
|
@ -643,7 +643,7 @@ public final class GeneralImageBuilder {
|
||||
final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER);
|
||||
final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder);
|
||||
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);
|
||||
final double attributeHeight = dimAttribute.getHeight();
|
||||
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)
|
||||
.getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
@ -700,10 +700,19 @@ public final class GeneralImageBuilder {
|
||||
if (label == null) {
|
||||
return TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
|
||||
final ISkinParam skinParam = dotData.getSkinParam();
|
||||
final FontConfiguration fontConfiguration = g.getFontConfigurationForTitle(skinParam);
|
||||
return label.create(fontConfiguration, HorizontalAlignment.CENTER, skinParam);
|
||||
final FontConfiguration fontConfiguration;
|
||||
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) {
|
||||
|
@ -123,12 +123,12 @@ public final class GroupPngMakerState {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Style getStyleHeader() {
|
||||
private Style getStyleStateHeader() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.header)
|
||||
.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())
|
||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
@ -138,11 +138,20 @@ public final class GroupPngMakerState {
|
||||
final ISkinParam skinParam = diagram.getSkinParam();
|
||||
|
||||
final FontConfiguration fontConfiguration;
|
||||
if (UseStyle.useBetaStyle())
|
||||
fontConfiguration = getStyleHeader().getFontConfiguration(skinParam.getThemeStyle(),
|
||||
final double rounded;
|
||||
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());
|
||||
else
|
||||
} else {
|
||||
rounded = IEntityImage.CORNER;
|
||||
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());
|
||||
|
||||
@ -171,7 +180,7 @@ 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(),
|
||||
borderColor = getStyleState().value(PName.LineColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
else
|
||||
borderColor = getColor(ColorParam.stateBorder, group.getStereotype());
|
||||
@ -181,8 +190,10 @@ public final class GroupPngMakerState {
|
||||
final HColor backColor;
|
||||
if (tmp == null)
|
||||
if (UseStyle.useBetaStyle())
|
||||
backColor = getStyle().value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
backColor =
|
||||
|
||||
getStyleState().value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
else
|
||||
backColor = getColor(ColorParam.stateBackground, stereo);
|
||||
else
|
||||
@ -200,8 +211,8 @@ public final class GroupPngMakerState {
|
||||
if (stroke == null) {
|
||||
stroke = new UStroke(1.5);
|
||||
}
|
||||
return new InnerStateAutonom(image, title, attribute, borderColor, backColor,
|
||||
skinParam.shadowing(group.getStereotype()), group.getUrl99(), withSymbol, stroke);
|
||||
return new InnerStateAutonom(image, title, attribute, borderColor, backColor, group.getUrl99(), withSymbol,
|
||||
stroke, rounded, shadowing);
|
||||
|
||||
}
|
||||
|
||||
|
@ -55,13 +55,14 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
|
||||
private final TextBlock attribute;
|
||||
private final HColor borderColor;
|
||||
private final HColor backColor;
|
||||
private final boolean shadowing;
|
||||
private final Url url;
|
||||
private final boolean withSymbol;
|
||||
private final UStroke stroke;
|
||||
private final double rounded;
|
||||
private final double shadowing;
|
||||
|
||||
public InnerStateAutonom(final IEntityImage im, final TextBlock title, TextBlock attribute, HColor borderColor,
|
||||
HColor backColor, boolean shadowing, Url url, boolean withSymbol, UStroke stroke) {
|
||||
public InnerStateAutonom(IEntityImage im, TextBlock title, TextBlock attribute, HColor borderColor,
|
||||
HColor backColor, Url url, boolean withSymbol, UStroke stroke, double rounded, double shadowing) {
|
||||
this.im = im;
|
||||
this.withSymbol = withSymbol;
|
||||
this.title = title;
|
||||
@ -71,6 +72,7 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
|
||||
this.attribute = attribute;
|
||||
this.url = url;
|
||||
this.stroke = stroke;
|
||||
this.rounded = rounded;
|
||||
}
|
||||
|
||||
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 RoundedContainer r = new RoundedContainer(total, titreHeight, attr.getHeight() + marginForFields,
|
||||
borderColor, backColor, im.getBackcolor(), stroke);
|
||||
borderColor, backColor, im.getBackcolor(), stroke, rounded, shadowing);
|
||||
|
||||
if (url != null) {
|
||||
ug.startUrl(url);
|
||||
}
|
||||
|
||||
r.drawU(ug, shadowing);
|
||||
r.drawU(ug);
|
||||
title.drawU(ug.apply(new UTranslate((total.getWidth() - text.getWidth()) / 2, IEntityImage.MARGIN)));
|
||||
attribute.drawU(ug.apply(
|
||||
new UTranslate(0 + IEntityImage.MARGIN, IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN)));
|
||||
|
@ -53,12 +53,15 @@ public final class RoundedContainer {
|
||||
private final HColor backColor;
|
||||
private final HColor imgBackcolor;
|
||||
private final UStroke stroke;
|
||||
private final double rounded;
|
||||
private final double shadowing;
|
||||
|
||||
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) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.rounded = rounded;
|
||||
this.dim = dim;
|
||||
this.imgBackcolor = imgBackcolor;
|
||||
this.titleHeight = titleHeight;
|
||||
@ -66,15 +69,13 @@ public final class RoundedContainer {
|
||||
this.backColor = backColor;
|
||||
this.attributeHeight = attributeHeight;
|
||||
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);
|
||||
final URectangle rect = new URectangle(dim.getWidth(), dim.getHeight()).rounded(IEntityImage.CORNER);
|
||||
if (shadowing) {
|
||||
rect.setDeltaShadow(3.0);
|
||||
}
|
||||
final URectangle rect = new URectangle(dim.getWidth(), dim.getHeight()).rounded(rounded);
|
||||
rect.setDeltaShadow(shadowing);
|
||||
ug.apply(stroke).draw(rect);
|
||||
|
||||
final double yLine = titleHeight + attributeHeight;
|
||||
@ -84,9 +85,8 @@ public final class RoundedContainer {
|
||||
final double thickness = stroke.getThickness();
|
||||
|
||||
final URectangle inner = new URectangle(dim.getWidth() - 4 * thickness,
|
||||
dim.getHeight() - titleHeight - 4 * thickness - attributeHeight).rounded(IEntityImage.CORNER);
|
||||
ug.apply(imgBackcolor).apply(new UTranslate(2 * thickness, yLine + 2 * thickness))
|
||||
.draw(inner);
|
||||
dim.getHeight() - titleHeight - 4 * thickness - attributeHeight).rounded(rounded);
|
||||
ug.apply(imgBackcolor).apply(new UTranslate(2 * thickness, yLine + 2 * thickness)).draw(inner);
|
||||
|
||||
if (titleHeight > 0) {
|
||||
ug.apply(stroke).apply(UTranslate.dy(yLine)).draw(ULine.hline(dim.getWidth()));
|
||||
|
@ -93,7 +93,10 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
||||
super(entity, entity.getColors(skinParam).mute(skinParam));
|
||||
this.leafType = entity.getLeafType();
|
||||
this.lineConfig = entity;
|
||||
this.roundCorner = getSkinParam().getRoundCorner(CornerParam.DEFAULT, null);
|
||||
if (UseStyle.useBetaStyle())
|
||||
this.roundCorner = getStyle().value(PName.RoundCorner).asDouble();
|
||||
else
|
||||
this.roundCorner = getSkinParam().getRoundCorner(CornerParam.DEFAULT, null);
|
||||
this.shield = version != null && version.useShield() && entity.hasNearDecoration() ? Margins.uniform(16)
|
||||
: Margins.NONE;
|
||||
final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity);
|
||||
@ -101,7 +104,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
||||
this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, getSkinParam(), showMethods, showFields,
|
||||
entity.getStereotype(), getStyle());
|
||||
|
||||
header = new EntityImageClassHeader(entity, getSkinParam(), portionShower);
|
||||
this.header = new EntityImageClassHeader(entity, getSkinParam(), portionShower);
|
||||
this.url = entity.getUrl99();
|
||||
}
|
||||
|
||||
@ -143,8 +146,10 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
||||
}
|
||||
|
||||
private Style getStyle() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_)
|
||||
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_) //
|
||||
.with(getEntity().getStereotype()) //
|
||||
.with(getEntity().getStereostyles()) //
|
||||
.getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private void drawInternal(UGraphic ug) {
|
||||
|
@ -86,7 +86,9 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
||||
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
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());
|
||||
fontConfigurationName = new FontConfiguration(skinParam, style);
|
||||
} else {
|
||||
|
@ -146,7 +146,7 @@ public class EntityImageDescription extends AbstractEntityImage {
|
||||
symbol.getSkinParameter().getStyleName());
|
||||
style = tmp.with(stereotype).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
style = style.eventuallyOverride(colors);
|
||||
final Style styleStereo = tmp.withStereotype(stereotype)
|
||||
final Style styleStereo = tmp.forStereotypeItself(stereotype)
|
||||
.getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
forecolor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
|
@ -83,7 +83,7 @@ public class EntityImageState extends EntityImageStateCommon {
|
||||
final FontConfiguration fontConfiguration;
|
||||
|
||||
if (UseStyle.useBetaStyle())
|
||||
fontConfiguration = getStyleMember().getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
fontConfiguration = getStyleState().getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.STATE_ATTRIBUTE, stereotype);
|
||||
|
@ -78,7 +78,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
|
||||
final FontConfiguration fontConfiguration;
|
||||
|
||||
if (UseStyle.useBetaStyle())
|
||||
fontConfiguration = getStyleHeader().getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
fontConfiguration = getStyleStateHeader().getFontConfiguration(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
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)
|
||||
.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)
|
||||
.with(getEntity().getStereotype()).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
@ -112,10 +112,19 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
|
||||
}
|
||||
|
||||
final protected URectangle getShape(final Dimension2D dimTotal) {
|
||||
final URectangle rect = new URectangle(dimTotal).rounded(CORNER);
|
||||
if (getSkinParam().shadowing(getEntity().getStereotype())) {
|
||||
rect.setDeltaShadow(4);
|
||||
double deltaShadow = 0;
|
||||
final double corner;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -124,7 +133,7 @@ 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(),
|
||||
classBorder = getStyleState().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
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);
|
||||
if (backcolor == null) {
|
||||
if (UseStyle.useBetaStyle())
|
||||
backcolor = getStyleMember().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
||||
backcolor = getStyleState().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
else
|
||||
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground);
|
||||
|
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 0;
|
||||
final int beta = 3;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user