version 1.2018.2

This commit is contained in:
Arnaud Roques 2018-03-09 22:37:34 +01:00
parent 557e8c94b9
commit 86c9c6d603
129 changed files with 1784 additions and 761 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2018.2-SNAPSHOT</version>
<version>1.2018.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlantUML</name>

View File

@ -51,16 +51,13 @@ public enum ColorParam {
activityStart(HtmlColorUtils.BLACK),
activityEnd(HtmlColorUtils.BLACK),
activityBar(HtmlColorUtils.BLACK),
// activityArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
swimlaneBorder(HtmlColorUtils.BLACK),
usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
usecaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
// usecaseArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
objectBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
objectBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
// objectArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
classHeaderBackground(null, true, ColorType.BACK),
classBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
@ -70,7 +67,11 @@ public enum ColorParam {
stereotypeABackground(HtmlColorUtils.COL_A9DCDF),
stereotypeIBackground(HtmlColorUtils.COL_B4A7E5),
stereotypeEBackground(HtmlColorUtils.COL_EB937F),
// classArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
stereotypeCBorder(null),
stereotypeNBorder(null),
stereotypeABorder(null),
stereotypeIBorder(null),
stereotypeEBorder(null),
packageBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
packageBorder(HtmlColorUtils.BLACK, ColorType.LINE),
@ -86,7 +87,6 @@ public enum ColorParam {
stateBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
stateBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
// stateArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
stateStart(HtmlColorUtils.BLACK),
stateEnd(HtmlColorUtils.BLACK),
@ -116,7 +116,6 @@ public enum ColorParam {
sequenceLifeLineBackground(HtmlColorUtils.WHITE, true, ColorType.BACK),
sequenceLifeLineBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
sequenceNewpageSeparator(HtmlColorUtils.BLACK, ColorType.LINE),
// sequenceArrow(HtmlColorUtils.MY_RED),
sequenceBoxBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK),

View File

@ -73,6 +73,8 @@ public interface ISkinParam extends ISkinSimple {
public int getCircledCharacterRadius();
public char getCircledCharacter(Stereotype stereotype);
public int classAttributeIconSize();
public ColorMapper getColorMapper();
@ -103,6 +105,8 @@ public interface ISkinParam extends ISkinSimple {
public LineBreakStrategy maxMessageSize();
public LineBreakStrategy wrapWidth();
public boolean strictUmlStyle();
public boolean forceSequenceParticipantUnderlined();
@ -147,4 +151,8 @@ public interface ISkinParam extends ISkinSimple {
public boolean displayGenericWithOldFashion();
public boolean responseMessageBelowArrow();
public boolean svgDimensionStyle();
}

View File

@ -216,6 +216,17 @@ public class SkinParam implements ISkinParam {
return getIHtmlColorSet().getColorIfValid(value, acceptTransparent);
}
public char getCircledCharacter(Stereotype stereotype) {
if (stereotype == null) {
throw new IllegalArgumentException();
}
final String value2 = getValue("spotchar" + stereotype.getLabel(false));
if (value2 != null && value2.length() > 0) {
return value2.charAt(0);
}
return 0;
}
public Colors getColors(ColorParam param, Stereotype stereotype) {
if (stereotype != null) {
checkStereotype(stereotype);
@ -707,7 +718,16 @@ public class SkinParam implements ISkinParam {
}
public LineBreakStrategy maxMessageSize() {
return new LineBreakStrategy(getValue("maxmessagesize"));
String value = getValue("wrapmessagewidth");
if (value == null) {
value = getValue("maxmessagesize");
}
return new LineBreakStrategy(value);
}
public LineBreakStrategy wrapWidth() {
final String value = getValue("wrapwidth");
return new LineBreakStrategy(value);
}
public boolean strictUmlStyle() {
@ -920,9 +940,25 @@ public class SkinParam implements ISkinParam {
return false;
}
public boolean responseMessageBelowArrow() {
final String value = getValue("responsemessagebelowarrow");
if ("true".equalsIgnoreCase(value)) {
return true;
}
return false;
}
public TikzFontDistortion getTikzFontDistortion() {
final String value = getValue("tikzFont");
return TikzFontDistortion.fromValue(value);
}
public boolean svgDimensionStyle() {
final String value = getValue("svgdimensionstyle");
if ("false".equalsIgnoreCase(value)) {
return false;
}
return true;
}
}

View File

@ -159,6 +159,10 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.maxMessageSize();
}
public LineBreakStrategy wrapWidth() {
return skinParam.wrapWidth();
}
public boolean strictUmlStyle() {
return skinParam.strictUmlStyle();
}
@ -275,4 +279,16 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getTikzFontDistortion();
}
public boolean responseMessageBelowArrow() {
return skinParam.responseMessageBelowArrow();
}
public boolean svgDimensionStyle() {
return skinParam.svgDimensionStyle();
}
public char getCircledCharacter(Stereotype stereotype) {
return skinParam.getCircledCharacter(stereotype);
}
}

View File

@ -298,8 +298,11 @@ public class StringUtils {
public static int getWcWidth(Display stringsToDisplay) {
int result = 1;
for (CharSequence s : stringsToDisplay) {
if (s == null) {
continue;
}
final int length = Wcwidth.length(s);
if (s != null && result < length) {
if (result < length) {
result = length;
}
}

View File

@ -103,6 +103,9 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann
private final SkinParam skinParam = SkinParam.create(getUmlDiagramType());
final public void setTitle(DisplayPositionned title) {
if (DisplayPositionned.isNull(title) || title.getDisplay().isWhite()) {
return;
}
this.title = title;
}

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.utils.UniqueSequence;
@ -154,8 +155,9 @@ public class ActivityDiagram extends CucaDiagram {
public IEntity createInnerActivity() {
// Log.println("createInnerActivity A");
final Code code = Code.of("##" + UniqueSequence.getValue());
final IEntity g = getOrCreateGroup(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY,
getCurrentGroup());
gotoGroup2(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
NamespaceStrategy.SINGLE);
final IEntity g = getCurrentGroup();
// g.setRankdir(Rankdir.LEFT_TO_RIGHT);
lastEntityConsulted = null;
lastEntityBrancheConsulted = null;
@ -175,7 +177,8 @@ public class ActivityDiagram extends CucaDiagram {
if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) {
throw new IllegalStateException("type=" + getCurrentGroup().getGroupType());
}
getOrCreateGroup(code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup());
gotoGroup2(code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(),
NamespaceStrategy.SINGLE);
lastEntityConsulted = null;
lastEntityBrancheConsulted = null;
}

View File

@ -58,6 +58,7 @@ 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.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -197,8 +198,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final Code code = Code.of(arg.get("CODE" + suf, 0));
if (code != null) {
if (partition != null) {
system.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup());
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup(), NamespaceStrategy.SINGLE);
}
final IEntity result = system.getOrCreate(code, Display.getWithNewlines(code),
CommandLinkActivity.getTypeIfExisting(system, code));
@ -215,8 +216,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (quoted.get(0) != null) {
final Code quotedCode = Code.of(quoted.get(1) == null ? quoted.get(0) : quoted.get(1));
if (partition != null) {
system.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup());
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup(), NamespaceStrategy.SINGLE);
}
final IEntity result = system.getOrCreate(quotedCode, Display.getWithNewlines(quoted.get(0)),
CommandLinkActivity.getTypeIfExisting(system, quotedCode));
@ -228,8 +229,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
final Code quotedInvisible = Code.of(arg.get("QUOTED_INVISIBLE" + suf, 0));
if (quotedInvisible != null) {
if (partition != null) {
system.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup());
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup(), NamespaceStrategy.SINGLE);
}
final IEntity result = system.getOrCreate(quotedInvisible, Display.getWithNewlines(quotedInvisible),
LeafType.ACTIVITY);

View File

@ -63,6 +63,7 @@ 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.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorType;
@ -164,7 +165,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
}
if (partition != null) {
diagram.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null);
diagram.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null,
NamespaceStrategy.SINGLE);
}
final IEntity entity2 = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.ACTIVITY, null);
if (partition != null) {

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
@ -79,8 +80,9 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
protected CommandExecutionResult executeArg(ActivityDiagram diagram, RegexResult arg) {
final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0)));
final IGroup currentPackage = diagram.getCurrentGroup();
final IEntity p = diagram.getOrCreateGroup(code, Display.getWithNewlines(code), GroupType.PACKAGE,
currentPackage);
diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
if (colors.isEmpty() == false) {

View File

@ -149,8 +149,8 @@ public class Branch {
return list.getLast();
}
public boolean isOnlySingleStop() {
return list.isOnlySingleStop();
public boolean isOnlySingleStopOrSpot() {
return list.isOnlySingleStopOrSpot();
}
}

View File

@ -65,9 +65,14 @@ public class InstructionList extends WithNote implements Instruction, Instructio
return all.isEmpty();
}
public boolean isOnlySingleStop() {
return all.size() == 1 && getLast() instanceof InstructionStop
&& ((InstructionStop) getLast()).hasNotes() == false;
public boolean isOnlySingleStopOrSpot() {
if (all.size() != 1) {
return false;
}
if (getLast() instanceof InstructionSpot) {
return true;
}
return getLast() instanceof InstructionStop && ((InstructionStop) getLast()).hasNotes() == false;
}
public InstructionList(Swimlane defaultSwimlane) {

View File

@ -35,20 +35,33 @@
*/
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D;
import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.activitydiagram3.Instruction;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileBreak;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.Genealogy;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
@ -60,8 +73,8 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) {
final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
: color;
final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(),
ColorParam.activityDiamondBackground) : color;
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam());
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
@ -75,8 +88,39 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
final FontConfiguration fontArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
return FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out,
Ftile result = FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out,
endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut);
final List<WeldingPoint> weldingPoints = whileBlock.getWeldingPoints();
if (weldingPoints.size() > 0) {
// printAllChild(repeat);
final Genealogy genealogy = new Genealogy(result);
final FtileBreak ftileBreak = (FtileBreak) weldingPoints.get(0);
result = FtileUtils.addConnection(result, new Connection() {
public void drawU(UGraphic ug) {
final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder());
final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
snake.addPoint(tr1.getDx(), tr1.getDy());
snake.addPoint(Diamond.diamondHalfSize, tr1.getDy());
ug.draw(snake);
}
public Ftile getFtile1() {
return ftileBreak;
}
public Ftile getFtile2() {
return null;
}
});
}
return result;
}
}

View File

@ -38,6 +38,8 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -81,6 +83,14 @@ class FtileWhile extends AbstractFtile {
private final Ftile diamond1;
private final Ftile specialOut;
@Override
public Collection<Ftile> getMyChildren() {
if (specialOut == null) {
return Arrays.asList(whileBlock, diamond1);
}
return Arrays.asList(whileBlock, diamond1, specialOut);
}
public Set<Swimlane> getSwimlanes() {
final Set<Swimlane> result = new HashSet<Swimlane>(whileBlock.getSwimlanes());
result.add(getSwimlaneIn());

View File

@ -108,16 +108,16 @@ public class ConditionalBuilder {
ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) {
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor,
ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder, fcArrow, fcTest);
if (isEmptyOrOnlySingleStop(branch2) && isEmptyOrOnlySingleStop(branch1) == false) {
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false) {
return builder.createDown(builder.branch1, builder.branch2);
}
if (branch1.isEmpty() && branch2.isOnlySingleStop()) {
if (branch1.isEmpty() && branch2.isOnlySingleStopOrSpot()) {
return builder.createDown(builder.branch1, builder.branch2);
}
if (isEmptyOrOnlySingleStop(branch1) && isEmptyOrOnlySingleStop(branch2) == false) {
if (isEmptyOrOnlySingleStopOrSpot(branch1) && isEmptyOrOnlySingleStopOrSpot(branch2) == false) {
return builder.createDown(builder.branch2, builder.branch1);
}
if (branch2.isEmpty() && branch1.isOnlySingleStop()) {
if (branch2.isEmpty() && branch1.isOnlySingleStopOrSpot()) {
return builder.createDown(builder.branch2, builder.branch1);
}
return builder.createWithLinks();
@ -125,8 +125,8 @@ public class ConditionalBuilder {
// return builder.createNude();
}
private static boolean isEmptyOrOnlySingleStop(Branch branch) {
return branch.isEmpty() || branch.isOnlySingleStop();
private static boolean isEmptyOrOnlySingleStopOrSpot(Branch branch) {
return branch.isEmpty() || branch.isOnlySingleStopOrSpot();
}
private Ftile createDown(Branch branch1, Branch branch2) {
@ -136,11 +136,11 @@ public class ConditionalBuilder {
final TextBlock tb2 = getLabelPositive(branch2);
final Ftile diamond1 = getDiamond1(false, tb1, tb2);
final Ftile diamond2 = getDiamond2(branch1, branch2, true);
if (branch2.isOnlySingleStop()) {
if (branch2.isOnlySingleStopOrSpot()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
arrowColor, ftileFactory, branch2.getFtile(), branch2.getInlinkRenderingColorAndStyle());
}
if (branch1.isOnlySingleStop()) {
if (branch1.isOnlySingleStopOrSpot()) {
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
arrowColor, ftileFactory, branch1.getFtile(), branch1.getInlinkRenderingColorAndStyle());
}

View File

@ -58,6 +58,38 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
public class ClassDiagram extends AbstractClassOrObjectDiagram {
private final String getNamespace(Code fullyCode) {
return getNamespace(fullyCode, fullyCode.getSeparator());
}
private final String getNamespace(Code fullyCode, String separator) {
String name = fullyCode.getFullName();
if (separator == null) {
throw new IllegalArgumentException(toString());
}
do {
final int x = name.lastIndexOf(separator);
if (x == -1) {
return null;
}
name = name.substring(0, x);
} while (entityFactory.getLeafsget(Code.of(name, separator)) != null);
return name;
}
public final Code getShortName(Code code) {
final String separator = code.getSeparator();
if (separator == null) {
throw new IllegalArgumentException();
}
final String codeString = code.getFullName();
final String namespace = getNamespace(code);
if (namespace == null) {
return Code.of(codeString, separator);
}
return Code.of(codeString.substring(namespace.length() + separator.length()), separator);
}
@Override
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
if (getNamespaceSeparator() != null) {
@ -68,24 +100,22 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
if (getNamespaceSeparator() == null) {
return getOrCreateLeafDefault(code, LeafType.CLASS, symbol);
}
code = code.getFullyQualifiedCode(getCurrentGroup());
code = getFullyQualifiedCode(code);
if (super.leafExist(code)) {
return getOrCreateLeafDefault(code, LeafType.CLASS, symbol);
}
return createEntityWithNamespace(code, Display.getWithNewlines(code.getShortName(getLeafs())),
LeafType.CLASS, symbol);
return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), LeafType.CLASS, symbol);
}
if (getNamespaceSeparator() == null) {
return getOrCreateLeafDefault(code, LeafType.CLASS, symbol);
}
code = code.getFullyQualifiedCode(getCurrentGroup());
code = getFullyQualifiedCode(code);
if (super.leafExist(code)) {
return getOrCreateLeafDefault(code, type, symbol);
}
return createEntityWithNamespace(code, Display.getWithNewlines(code.getShortName(getLeafs())), type, symbol);
return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), type, symbol);
}
@Override
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
if (getNamespaceSeparator() != null) {
@ -99,7 +129,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
if (getNamespaceSeparator() == null) {
return super.createLeaf(code, display, type, symbol);
}
code = code.getFullyQualifiedCode(getCurrentGroup());
code = getFullyQualifiedCode(code);
if (super.leafExist(code)) {
throw new IllegalArgumentException("Already known: " + code);
}
@ -107,30 +137,20 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
}
private ILeaf createEntityWithNamespace(Code fullyCode, Display display, LeafType type, USymbol symbol) {
IGroup group = getCurrentGroup();
final String namespace = getNamespace(fullyCode);
final IGroup backupCurrentGroup = getCurrentGroup();
final IGroup group = backupCurrentGroup;
final String namespace = getNamespace(fullyCode, getNamespaceSeparator());
if (namespace != null
&& (EntityUtils.groupRoot(group) || group.getCode().getFullName().equals(namespace) == false)) {
final Code namespace2 = Code.of(namespace);
group = getOrCreateNamespaceInternal(namespace2, Display.getWithNewlines(namespace), GroupType.PACKAGE,
getRootGroup());
gotoGroupInternal(namespace2, Display.getWithNewlines(namespace), namespace2, GroupType.PACKAGE, getRootGroup());
}
return createLeafInternal(
final ILeaf result = createLeafInternal(
fullyCode,
Display.isNull(display) ? Display.getWithNewlines(fullyCode.getShortName(getLeafs())).withCreoleMode(
CreoleMode.SIMPLE_LINE) : display, type, group, symbol);
}
private final String getNamespace(Code fullyCode) {
String name = fullyCode.getFullName();
do {
final int x = name.lastIndexOf(getNamespaceSeparator());
if (x == -1) {
return null;
}
name = name.substring(0, x);
} while (getLeafs().containsKey(Code.of(name, getNamespaceSeparator())));
return name;
Display.isNull(display) ? Display.getWithNewlines(getShortName(fullyCode)).withCreoleMode(
CreoleMode.SIMPLE_LINE) : display, type, symbol);
gotoThisGroup(backupCurrentGroup);
return result;
}
@Override
@ -139,7 +159,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
return super.leafExist(code);
}
code = code.withSeparator(getNamespaceSeparator());
return super.leafExist(code.getFullyQualifiedCode(getCurrentGroup()));
return super.leafExist(getFullyQualifiedCode(code));
}
@Override
@ -187,7 +207,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
private RowLayout getRawLayout(int raw) {
final RowLayout rawLayout = new RowLayout();
for (ILeaf leaf : getLeafs().values()) {
for (ILeaf leaf : entityFactory.getLeafsvalues()) {
if (leaf.getRawLayout() == raw) {
rawLayout.addLeaf(getEntityImageClass(leaf));
}

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultiline
import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2.Mode;
import net.sourceforge.plantuml.classdiagram.command.CommandDiamondAssociation;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificClass;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificStereotype;
import net.sourceforge.plantuml.classdiagram.command.CommandImport;
@ -53,6 +54,7 @@ import net.sourceforge.plantuml.classdiagram.command.CommandLayoutNewLine;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkLollipop;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
import net.sourceforge.plantuml.classdiagram.command.CommandStereotype;
import net.sourceforge.plantuml.classdiagram.command.CommandUrl;
import net.sourceforge.plantuml.command.Command;
@ -91,10 +93,12 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandRankDir());
cmds.add(new CommandNewpage(this));
cmds.add(new CommandHideShowSpecificStereotype());
// cmds.add(new CommandHideShowSpecificStereotype());
cmds.add(new CommandPage());
cmds.add(new CommandAddMethod());
cmds.add(new CommandHideShow2());
cmds.add(new CommandRemoveRestore());
cmds.add(new CommandCreateClass());
cmds.add(new CommandCreateEntityObject());
@ -142,7 +146,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandDiamondAssociation());
cmds.add(new CommandHideShowSpecificClass());
// cmds.add(new CommandHideShowSpecificClass());
cmds.add(new CommandNamespaceSeparator());

View File

@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -90,6 +91,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
color().getRegex(), //
@ -163,6 +166,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
// manageExtends(diagram, arg, entity);
CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity);
CommandCreateClassMultilines.manageExtends("IMPLEMENTS", diagram, arg, entity);
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
return CommandExecutionResult.ok();
}

View File

@ -57,6 +57,7 @@ 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.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -102,6 +103,8 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
color().getRegex(), //
@ -127,15 +130,15 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
if (lines.size() > 1) {
lines = lines.subExtract(1, 1);
final Url url = null;
// if (lines.size() > 0) {
// final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
// url = urlBuilder.getUrl(lines.getFirst499().toString());
// } else {
// url = null;
// }
// if (url != null) {
// lines = lines.subExtract(1, 0);
// }
// if (lines.size() > 0) {
// final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
// url = urlBuilder.getUrl(lines.getFirst499().toString());
// } else {
// url = null;
// }
// if (url != null) {
// lines = lines.subExtract(1, 0);
// }
for (CharSequence s : lines) {
if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s)) {
diagram.setVisibilityModifierPresent(true);
@ -149,10 +152,22 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
manageExtends("EXTENDS", diagram, line0, entity);
manageExtends("IMPLEMENTS", diagram, line0, entity);
addTags(entity, line0.get("TAGS", 0));
return CommandExecutionResult.ok();
}
public static void addTags(IEntity entity, String tags) {
if (tags == null) {
return;
}
for (String tag : tags.split("[ ]+")) {
assert tag.startsWith("$");
tag = tag.substring(1);
entity.addStereotag(new Stereotag(tag));
}
}
public static void manageExtends(String keyword, ClassDiagram system, RegexResult arg, final IEntity entity) {
if (arg.get(keyword, 1) != null) {
final Mode mode = arg.get(keyword, 1).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;

View File

@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementFull;
import net.sourceforge.plantuml.graphic.USymbol;
@ -90,6 +91,8 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
), //
new RegexLeaf("STEREOTYPE", "(?:[%s]*(\\<\\<.+\\>\\>))?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
@ -165,6 +168,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
.getIHtmlColorSet()));
}
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
final String urlString = arg.get("URL", 0);
if (urlString != null) {

View File

@ -0,0 +1,67 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.classdiagram.command;
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.RegexResult;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public class CommandHideShow2 extends SingleLineCommand2<CucaDiagram> {
public CommandHideShow2() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("COMMAND", "(hide|show)"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("WHAT", "(.+)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(CucaDiagram diagram, RegexResult arg) {
final boolean show = arg.get("COMMAND", 0).equalsIgnoreCase("show");
final String what = arg.get("WHAT", 0).trim();
diagram.hideOrShow2(what, show);
return CommandExecutionResult.ok();
}
}

View File

@ -62,22 +62,23 @@ public class CommandHideShowSpecificClass extends SingleLineCommand2<CucaDiagram
@Override
protected CommandExecutionResult executeArg(CucaDiagram diagram, RegexResult arg) {
final String codeString = arg.get("CODE", 0);
if (codeString.equals("class")) {
diagram.hideOrShow(LeafType.CLASS, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
} else if (codeString.equals("interface")) {
diagram.hideOrShow(LeafType.INTERFACE, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
} else {
final Code code = Code.of(codeString);
IEntity hidden = diagram.getEntityFactory().getLeafs().get(code);
if (hidden == null) {
hidden = diagram.getEntityFactory().getGroups().get(code);
}
if (hidden == null) {
return CommandExecutionResult.error("Class/Package does not exist : " + code.getFullName());
}
diagram.hideOrShow(hidden, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
}
return CommandExecutionResult.ok();
// final String codeString = arg.get("CODE", 0);
// if (codeString.equals("class")) {
// diagram.hideOrShow(LeafType.CLASS, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
// } else if (codeString.equals("interface")) {
// diagram.hideOrShow(LeafType.INTERFACE, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
// } else {
// final Code code = Code.of(codeString);
// IEntity hidden = diagram.getEntityFactory().getLeafsget(code);
// if (hidden == null) {
// hidden = diagram.getEntityFactory().getGroupsget(code);
// }
// if (hidden == null) {
// return CommandExecutionResult.error("Class/Package does not exist : " + code.getFullName());
// }
// diagram.hideOrShow(hidden, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
// }
// return CommandExecutionResult.ok();
throw new UnsupportedOperationException();
}
}

View File

@ -60,9 +60,10 @@ public class CommandHideShowSpecificStereotype extends SingleLineCommand2<CucaDi
@Override
protected CommandExecutionResult executeArg(CucaDiagram diagram, RegexResult arg) {
final String stereotype = arg.get("STEREOTYPE", 0);
diagram.hideOrShow(new Stereotype(stereotype), arg.get("COMMAND", 0).equalsIgnoreCase("show"));
return CommandExecutionResult.ok();
// final String stereotype = arg.get("STEREOTYPE", 0);
// diagram.hideOrShow(new Stereotype(stereotype), arg.get("COMMAND", 0).equalsIgnoreCase("show"));
//
// return CommandExecutionResult.ok();
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,67 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.classdiagram.command;
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.RegexResult;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public class CommandRemoveRestore extends SingleLineCommand2<CucaDiagram> {
public CommandRemoveRestore() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("COMMAND", "(remove|restore)"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("WHAT", "(.+)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(CucaDiagram diagram, RegexResult arg) {
final boolean show = arg.get("COMMAND", 0).equalsIgnoreCase("restore");
final String what = arg.get("WHAT", 0).trim();
diagram.removeOrRestore(what, show);
return CommandExecutionResult.ok();
}
}

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
@ -73,8 +74,8 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
protected CommandExecutionResult executeArg(ClassDiagram diagram, RegexResult arg) {
final Code code = Code.of(arg.get("NAME", 0));
final IGroup currentPackage = diagram.getCurrentGroup();
final IEntity p = diagram.getOrCreateNamespace(code, Display.getWithNewlines(code), GroupType.PACKAGE,
currentPackage);
diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {
p.setStereotype(new Stereotype(stereotype));

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
@ -48,6 +49,8 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -71,6 +74,8 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
color().getRegex(), //
@ -99,8 +104,9 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
code = Code.of(arg.get("AS", 0));
}
final IGroup currentPackage = diagram.getCurrentGroup();
final IEntity p = diagram.getOrCreateGroup(code, Display.getWithNewlines(display), GroupType.PACKAGE,
currentPackage);
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
final USymbol type = USymbol.getFromString(arg.get("TYPE", 0));
if (type == USymbol.TOGETHER) {
@ -113,6 +119,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
p.setUSymbol(usymbol);
}
}
CommandCreateClassMultilines.addTags(p, arg.get("TAGS", 0));
final String urlString = arg.get("URL", 0);
if (urlString != null) {

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.utils.UniqueSequence;
@ -71,11 +72,13 @@ public class CommandPackageEmpty extends SingleLineCommand<AbstractEntityDiagram
code = Code.of(arg.get(1));
}
final IGroup currentPackage = diagram.getCurrentGroup();
final IEntity p = diagram.getOrCreateGroup(code, Display.getWithNewlines(display), GroupType.PACKAGE,
currentPackage);
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
final String color = arg.get(2);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
}
diagram.endGroup();
return CommandExecutionResult.ok();

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.command.note;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -49,6 +50,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
@ -58,6 +60,8 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
return new RegexConcat(new RegexLeaf("^[%s]*(note)[%s]+"), //
new RegexLeaf("CODE", "as[%s]+([\\p{L}0-9_.]+)"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
new RegexLeaf("$") //
);
@ -67,6 +71,9 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
return new RegexConcat(new RegexLeaf("^[%s]*note[%s]+"), //
new RegexLeaf("DISPLAY", "[%g]([^%g]+)[%g][%s]+as[%s]+"), //
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)[%s]*"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
new RegexLeaf("$") //
);
@ -112,6 +119,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
final IEntity entity = diagram.createLeaf(code, display.toDisplay(), LeafType.NOTE, null);
assert entity != null;
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
return CommandExecutionResult.ok();
}

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -59,6 +60,7 @@ 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.Stereotag;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
@ -82,6 +84,8 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), //
new RegexLeaf("")), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
color().getRegex(), //
new RegexLeaf("URL", "[%s]*(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*:[%s]*"), //
@ -101,6 +105,8 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), //
new RegexLeaf("")), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
color().getRegex(), //
new RegexLeaf("URL", "[%s]*(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf(withBracket ? "[%s]*\\{" : "[%s]*"), //
@ -136,10 +142,11 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
Url url = null;
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"),
ModeUrl.STRICT);
url = urlBuilder.getUrl(line0.get("URL", 0));
}
@ -174,6 +181,7 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
if (url != null) {
note.addUrl(url);
}
CommandCreateClassMultilines.addTags(note, line0.get("TAGS", 0));
final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir(
diagram.getSkinParam().getRankdir());

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate;
@ -122,10 +123,11 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
}
final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0));
final Display display = system.manageVariable(lines.toDisplay());
if (m instanceof AbstractMessage) {
((AbstractMessage) m).setNote(lines.toDisplay(), position, style, line0.get("COLOR", 0), url);
((AbstractMessage) m).setNote(display, position, style, line0.get("COLOR", 0), url);
} else {
((GroupingLeaf) m).setNote(lines.toDisplay(), position, style, line0.get("COLOR", 0), url);
((GroupingLeaf) m).setNote(display, position, style, line0.get("COLOR", 0), url);
}
}

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
public class CommandCreatePackageBlock extends SingleLineCommand<CompositeDiagram> {
@ -59,7 +60,8 @@ public class CommandCreatePackageBlock extends SingleLineCommand<CompositeDiagra
if (display == null) {
display = code.getFullName();
}
diagram.getOrCreateGroup(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage);
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
return CommandExecutionResult.ok();
}

View File

@ -52,11 +52,13 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAutomatic;
import net.sourceforge.plantuml.graphic.HtmlColorSimple;
import net.sourceforge.plantuml.graphic.Splitter;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.openiconic.OpenIcon;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -230,7 +232,12 @@ public class AtomText implements Atom {
if (url != null) {
ug.startUrl(url);
}
ug = ug.apply(new UChangeColor(fontConfiguration.getColor()));
HtmlColor textColor = fontConfiguration.getColor();
FontConfiguration useFontConfiguration = fontConfiguration;
if (textColor instanceof HtmlColorAutomatic && ug.getParam().getBackcolor() != null) {
textColor = ((HtmlColorSimple) ug.getParam().getBackcolor()).opposite();
useFontConfiguration = fontConfiguration.changeColor(textColor);
}
if (marginLeft != ZERO) {
ug = ug.apply(new UTranslate(marginLeft.getDouble(ug.getStringBounder()), 0));
}
@ -250,7 +257,7 @@ public class AtomText implements Atom {
final double remainder = x % tabSize;
x += tabSize - remainder;
} else {
final UText utext = new UText(s, fontConfiguration);
final UText utext = new UText(s, useFontConfiguration);
final Dimension2D dim = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), s);
ug.apply(new UTranslate(x, ypos)).draw(utext);
x += dim.getWidth();

View File

@ -82,11 +82,11 @@ public class CreoleParser {
}
private static boolean isTableLine(String line) {
return line.matches("^(\\<#\\w+\\>)?\\|(\\=)?.*\\|$");
return line.matches("^(\\<#\\w+(,#?\\w+)?\\>)?\\|(\\=)?.*\\|$");
}
public static boolean doesStartByColor(String line) {
return line.matches("^(\\<#\\w+\\>).*");
return line.matches("^(\\<#\\w+(,#?\\w+)?\\>).*");
}
public static boolean isTreeStart(String line) {

View File

@ -60,9 +60,13 @@ public class StripeTable implements Stripe {
final private StripeStyle stripeStyle = new StripeStyle(StripeStyleType.NORMAL, 0, '\0');
public StripeTable(FontConfiguration fontConfiguration, ISkinSimple skinParam, String line) {
this.fontConfiguration = fontConfiguration;
this.skinParam = skinParam;
this.table = new AtomTable(fontConfiguration.getColor());
this.fontConfiguration = fontConfiguration;
HtmlColor lineColor = getBackOrFrontColor(line, 1);
if (lineColor == null) {
lineColor = fontConfiguration.getColor();
}
this.table = new AtomTable(lineColor);
this.marged = new AtomWithMargin(table, 2, 2);
analyzeAndAddInternal(line, Mode.HEADER);
}
@ -79,15 +83,17 @@ public class StripeTable implements Stripe {
return new SheetBlock1(sheet, LineBreakStrategy.NONE, padding);
}
private HtmlColor getBackColor(String line) {
private HtmlColor getBackOrFrontColor(String line, int idx) {
if (CreoleParser.doesStartByColor(line)) {
final int idx1 = line.indexOf('#');
final int idx2 = line.indexOf('>');
if (idx2 == -1) {
throw new IllegalStateException();
}
final String color = line.substring(idx1, idx2);
return skinParam.getIHtmlColorSet().getColorIfValid(color);
final String[] color = line.substring(idx1, idx2).split(",");
if (idx < color.length) {
return skinParam.getIHtmlColorSet().getColorIfValid(color[idx]);
}
}
return null;
}
@ -101,14 +107,14 @@ public class StripeTable implements Stripe {
}
private void analyzeAndAddInternal(String line, Mode mode) {
HtmlColor lineBackColor = getBackColor(line);
HtmlColor lineBackColor = getBackOrFrontColor(line, 0);
if (lineBackColor != null) {
line = withouBackColor(line);
}
table.newLine(lineBackColor);
for (final StringTokenizer st = new StringTokenizer(line, "|"); st.hasMoreTokens();) {
String v = st.nextToken();
HtmlColor cellBackColor = getBackColor(v);
HtmlColor cellBackColor = getBackOrFrontColor(v, 0);
if (cellBackColor != null) {
v = withouBackColor(v);
}

View File

@ -45,6 +45,7 @@ import java.util.ListIterator;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.CreoleMode;
@ -138,6 +139,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
char separator = lineFirst ? '_' : 0;
TextBlock title = null;
List<Member> members = new ArrayList<Member>();
final LineBreakStrategy lineBreakStrategy = skinParam.wrapWidth();
for (ListIterator<String> it = rawBody.listIterator(); it.hasNext();) {
final String s = it.next();
if (manageHorizontalLine && isBlockSeparator(s)) {

View File

@ -41,6 +41,7 @@ import java.util.List;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -60,12 +61,14 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
private final ISkinSimple spriteContainer;
private final HorizontalAlignment align;
private final LineBreakStrategy lineBreakStrategy;
// private final List<Url> urls = new ArrayList<Url>();
public BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple spriteContainer, HorizontalAlignment align,
FontConfiguration titleConfig) {
FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) {
this.rawBody2 = rawBody;
this.lineBreakStrategy = lineBreakStrategy;
this.spriteContainer = spriteContainer;
this.titleConfig = titleConfig;
@ -121,7 +124,7 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
}
private TextBlock getTextBlock(Display members2, StringBounder stringBounder) {
final TextBlock result = members2.create(titleConfig, align, spriteContainer);
final TextBlock result = members2.create(titleConfig, align, spriteContainer, lineBreakStrategy);
return result;
}

View File

@ -35,8 +35,6 @@
*/
package net.sourceforge.plantuml.cucadiagram;
import java.util.Map;
import net.sourceforge.plantuml.StringUtils;
public class Code implements Comparable<Code> {
@ -68,10 +66,6 @@ public class Code implements Comparable<Code> {
return fullName.substring(x + 2);
}
// public String getNamespaceSeparator() {
// return separator;
// }
public Code withSeparator(String separator) {
if (separator == null) {
throw new IllegalArgumentException();
@ -125,52 +119,8 @@ public class Code implements Comparable<Code> {
return Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(fullName, format), separator);
}
private final String getNamespace(Map<Code, ILeaf> leafs) {
String name = this.getFullName();
if (separator == null) {
throw new IllegalArgumentException(toString());
}
do {
final int x = name.lastIndexOf(separator);
if (x == -1) {
return null;
}
name = name.substring(0, x);
} while (leafs.containsKey(Code.of(name, separator)));
return name;
}
public final Code getShortName(Map<Code, ILeaf> leafs) {
if (separator == null) {
throw new IllegalArgumentException();
}
final String code = this.getFullName();
final String namespace = getNamespace(leafs);
if (namespace == null) {
return Code.of(code, separator);
}
return Code.of(code.substring(namespace.length() + separator.length()), separator);
}
public final Code getFullyQualifiedCode(IGroup g) {
if (separator == null) {
throw new IllegalArgumentException();
}
final String full = this.getFullName();
if (full.startsWith(separator)) {
return Code.of(full.substring(separator.length()), separator);
}
if (full.contains(separator)) {
return Code.of(full, separator);
}
if (EntityUtils.groupRoot(g)) {
return Code.of(full, separator);
}
final Code namespace2 = g.getNamespace2();
if (namespace2 == null) {
return Code.of(full, separator);
}
return Code.of(namespace2.fullName + separator + full, separator);
public final String getSeparator() {
return separator;
}
}

View File

@ -43,7 +43,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.BackSlash;
@ -70,11 +69,11 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
private int horizontalPages = 1;
private int verticalPages = 1;
private final Set<LeafType> hiddenType = new HashSet<LeafType>();
private final Set<String> hiddenStereotype = new HashSet<String>();
protected final EntityFactory entityFactory = new EntityFactory(hiddenType, hiddenStereotype);
protected IGroup currentGroup = entityFactory.getRootGroup();
private final List<HideOrShow2> hides2 = new ArrayList<HideOrShow2>();
private final List<HideOrShow2> removed = new ArrayList<HideOrShow2>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed);
private IGroup currentGroup = entityFactory.getRootGroup();
private boolean visibilityModifierPresent;
@ -90,10 +89,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return namespaceSeparator;
}
// public String getNamespaceSeparator() {
// return null;
// }
@Override
public boolean hasUrl() {
for (IEntity entity : getGroups(true)) {
@ -101,7 +96,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return true;
}
}
for (IEntity entity : getLeafs().values()) {
for (IEntity entity : entityFactory.getLeafsvalues()) {
if (entity.hasUrl()) {
return true;
}
@ -114,17 +109,13 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return false;
}
// public ILeaf getOrCreateLeaf1(Code code, LeafType type) {
// return getOrCreateLeaf1Default(code, type);
// }
final protected ILeaf getOrCreateLeafDefault(Code code, LeafType type, USymbol symbol) {
if (type == null) {
throw new IllegalArgumentException();
}
ILeaf result = getLeafs().get(code);
ILeaf result = entityFactory.getLeafsget(code);
if (result == null) {
result = createLeafInternal(code, Display.getWithNewlines(code), type, getCurrentGroup(), symbol);
result = createLeafInternal(code, Display.getWithNewlines(code), type, symbol);
result.setUSymbol(symbol);
}
if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT) {
@ -137,17 +128,19 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
if (getLeafs().containsKey(code)) {
throw new IllegalArgumentException("Already known: " + code);
if (entityFactory.getLeafsget(code) != null) {
return null;
// throw new IllegalArgumentException("Already known: " + code);
}
return createLeafInternal(code, display, type, getCurrentGroup(), symbol);
return createLeafInternal(code, display, type, symbol);
}
final protected ILeaf createLeafInternal(Code code, Display display, LeafType type, IGroup group, USymbol symbol) {
final protected ILeaf createLeafInternal(Code code, Display display, LeafType type, USymbol symbol) {
if (Display.isNull(display)) {
display = Display.getWithNewlines(code);
}
final ILeaf leaf = entityFactory.createLeaf(code, display, type, group, getHides(), getNamespaceSeparator());
final ILeaf leaf = entityFactory.createLeaf(code, display, type, getCurrentGroup(), getHides(),
getNamespaceSeparator());
entityFactory.addLeaf(leaf);
this.lastEntity = leaf;
leaf.setUSymbol(symbol);
@ -155,7 +148,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public boolean leafExist(Code code) {
return getLeafs().containsKey(code);
return entityFactory.getLeafsget(code) != null;
}
final public Collection<IGroup> getChildrenGroups(IGroup parent) {
@ -167,47 +160,28 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
return Collections.unmodifiableCollection(result);
}
final public IGroup getOrCreateNamespace(Code namespace, Display display, GroupType type, IGroup parent) {
if (getNamespaceSeparator() != null) {
namespace = namespace.withSeparator(getNamespaceSeparator()).getFullyQualifiedCode(getCurrentGroup());
}
final IGroup g = getOrCreateNamespaceInternal(namespace, display, type, parent);
currentGroup = g;
return g;
}
final public IGroup getOrCreateGroup(Code code, Display display, GroupType type, IGroup parent) {
final IGroup g = getOrCreateGroupInternal(code, display, null, type, parent);
currentGroup = g;
return g;
}
final protected IGroup getOrCreateNamespaceInternal(Code namespace, Display display, GroupType type, IGroup parent) {
IGroup result = entityFactory.getGroups().get(namespace);
if (result != null) {
return result;
}
if (entityFactory.getLeafs().containsKey(namespace)) {
result = entityFactory.muteToGroup(namespace, namespace, type, parent);
result.setDisplay(display);
final public void gotoGroup2(Code code, Display display, GroupType type, IGroup parent, NamespaceStrategy strategy) {
if (strategy == NamespaceStrategy.MULTIPLE) {
if (getNamespaceSeparator() != null) {
code = getFullyQualifiedCode(code.withSeparator(getNamespaceSeparator()));
}
gotoGroupInternal(code, display, code, type, parent);
} else if (strategy == NamespaceStrategy.SINGLE) {
gotoGroupInternal(code, display, null, type, parent);
} else {
result = entityFactory.createGroup(namespace, display, namespace, type, parent, getHides(),
getNamespaceSeparator());
throw new IllegalArgumentException();
}
entityFactory.addGroup(result);
return result;
}
private IGroup getOrCreateGroupInternal(Code code, Display display, Code namespace2, GroupType type, IGroup parent) {
IGroup result = entityFactory.getGroups().get(code);
final protected void gotoGroupInternal(final Code code, Display display, final Code namespace2, GroupType type,
IGroup parent) {
IGroup result = entityFactory.getGroupsget(code);
if (result != null) {
return result;
currentGroup = result;
return;
}
if (entityFactory.getLeafs().containsKey(code)) {
if (entityFactory.getLeafsget(code) != null) {
result = entityFactory.muteToGroup(code, namespace2, type, parent);
result.setDisplay(display);
} else {
@ -215,7 +189,33 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
getNamespaceSeparator());
}
entityFactory.addGroup(result);
return result;
currentGroup = result;
}
public final void gotoThisGroup(IGroup group) {
currentGroup = group;
}
final protected Code getFullyQualifiedCode(Code code) {
final String separator = code.getSeparator();
if (separator == null) {
throw new IllegalArgumentException();
}
final String full = code.getFullName();
if (full.startsWith(separator)) {
return Code.of(full.substring(separator.length()), separator);
}
if (full.contains(separator)) {
return Code.of(full, separator);
}
if (EntityUtils.groupRoot(currentGroup)) {
return Code.of(full, separator);
}
final Code namespace2 = currentGroup.getNamespace2();
if (namespace2 == null) {
return Code.of(full, separator);
}
return Code.of(namespace2.getFullName() + separator + full, separator);
}
public final IGroup getCurrentGroup() {
@ -223,7 +223,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public final IGroup getGroup(Code code) {
final IGroup p = entityFactory.getGroups().get(code);
final IGroup p = entityFactory.getGroupsget(code);
if (p == null) {
throw new IllegalArgumentException();
// return null;
@ -240,38 +240,33 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public final boolean isGroup(Code code) {
return leafExist(code) == false && entityFactory.getGroups().containsKey(code);
return leafExist(code) == false && entityFactory.getGroupsget(code) != null;
}
public final Collection<IGroup> getGroups(boolean withRootGroup) {
if (withRootGroup == false) {
return entityFactory.getGroups().values();
return entityFactory.getGroupsvalues();
}
final Collection<IGroup> result = new ArrayList<IGroup>();
result.add(getRootGroup());
result.addAll(entityFactory.getGroups().values());
result.addAll(entityFactory.getGroupsvalues());
return Collections.unmodifiableCollection(result);
}
public IGroup getRootGroup() {
return entityFactory.getRootGroup();
}
final protected Map<Code, ILeaf> getLeafs() {
return entityFactory.getLeafs();
}
public Collection<ILeaf> getLeafsvalues() {
return getLeafs().values();
return entityFactory.getLeafsvalues();
}
public final int getLeafssize() {
return getLeafs().size();
return getLeafsvalues().size();
}
public final ILeaf getLeafsget(Code code) {
return getLeafs().get(code);
return entityFactory.getLeafsget(code);
}
final public void addLink(Link link) {
@ -302,7 +297,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
this.verticalPages = verticalPages;
}
// final public List<File> createPng2(File pngFile) throws IOException, InterruptedException {
// final public List<File> createPng2(File pngFile) throws IOException,
// InterruptedException {
// final CucaDiagramPngMaker3 maker = new CucaDiagramPngMaker3(this);
// return maker.createPng(pngFile);
// }
@ -370,7 +366,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
throw new UnsupportedOperationException();
}
// final CucaDiagramFileMaker maker = OptionFlags.USE_HECTOR ? new CucaDiagramFileMakerHectorC1(this)
// final CucaDiagramFileMaker maker = OptionFlags.USE_HECTOR ? new
// CucaDiagramFileMakerHectorC1(this)
// : new CucaDiagramFileMakerSvek(this);
final CucaDiagramFileMaker maker = this.isUseJDot() ? new CucaDiagramFileMakerJDot(this,
fileFormatOption.getDefaultStringBounder()) : new CucaDiagramFileMakerSvek(this);
@ -529,24 +526,32 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
}
public void hideOrShow(IEntity leaf, boolean show) {
leaf.setRemoved(!show);
// public void hideOrShow(IEntity leaf, boolean show) {
// leaf.setRemoved(!show);
// }
// public void hideOrShow(Stereotype stereotype, boolean show) {
// if (show) {
// hiddenStereotype.remove(stereotype.getLabel(false));
// } else {
// hiddenStereotype.add(stereotype.getLabel(false));
// }
// }
//
// public void hideOrShow(LeafType leafType, boolean show) {
// if (show) {
// hiddenType.remove(leafType);
// } else {
// hiddenType.add(leafType);
// }
// }
public void hideOrShow2(String what, boolean show) {
this.hides2.add(new HideOrShow2(what, show));
}
public void hideOrShow(Stereotype stereotype, boolean show) {
if (show) {
hiddenStereotype.remove(stereotype.getLabel(false));
} else {
hiddenStereotype.add(stereotype.getLabel(false));
}
}
public void hideOrShow(LeafType leafType, boolean show) {
if (show) {
hiddenType.remove(leafType);
} else {
hiddenType.add(leafType);
}
public void removeOrRestore(String what, boolean show) {
this.removed.add(new HideOrShow2(what, show));
}
private final List<HideOrShow> hideOrShows = new ArrayList<HideOrShow>();
@ -600,7 +605,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
private ILeaf lastEntity = null;
final public ILeaf getLastEntity() {
// for (final Iterator<ILeaf> it = getLeafs().values().iterator(); it.hasNext();) {
// for (final Iterator<ILeaf> it = getLeafs().values().iterator();
// it.hasNext();) {
// final ILeaf ent = it.next();
// if (it.hasNext() == false) {
// return ent;

View File

@ -83,6 +83,17 @@ public class Display implements Iterable<CharSequence> {
public final static Display NULL = new Display(null, null, true, CreoleMode.FULL);
public Display replace(String src, String dest) {
final List<CharSequence> newDisplay = new ArrayList<CharSequence>();
for (CharSequence cs : display) {
if (cs.toString().contains(src)) {
cs = cs.toString().replace(src, dest);
}
newDisplay.add(cs);
}
return new Display(newDisplay, naturalHorizontalAlignment, isNull, defaultCreoleMode);
}
public boolean isWhite() {
return display.size() == 0 || (display.size() == 1 && display.get(0).toString().matches("\\s*"));
}
@ -385,6 +396,12 @@ public class Display implements Iterable<CharSequence> {
null, null);
}
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
ISkinSimple spriteContainer, CreoleMode modeSimpleLine, LineBreakStrategy maxMessageSize) {
return create(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, modeSimpleLine,
null, null);
}
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize) {
return create(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, defaultCreoleMode, null,

View File

@ -40,6 +40,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
@ -66,7 +67,7 @@ public class GroupRoot implements IGroup {
public Collection<ILeaf> getLeafsDirect() {
final List<ILeaf> result = new ArrayList<ILeaf>();
for (ILeaf ent : entityFactory.getLeafs().values()) {
for (ILeaf ent : entityFactory.getLeafsvalues()) {
if (ent.getParentContainer() == this) {
result.add(ent);
}
@ -142,7 +143,7 @@ public class GroupRoot implements IGroup {
public Collection<IGroup> getChildren() {
final List<IGroup> result = new ArrayList<IGroup>();
for (IGroup ent : entityFactory.getGroups().values()) {
for (IGroup ent : entityFactory.getGroupsvalues()) {
if (ent.getParentContainer() == this) {
result.add(ent);
}
@ -253,7 +254,11 @@ public class GroupRoot implements IGroup {
throw new UnsupportedOperationException();
}
public void setRemoved(boolean removed) {
public void addStereotag(Stereotag tag) {
throw new UnsupportedOperationException();
}
public Set<Stereotag> stereotags() {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,102 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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;
public class HideOrShow2 {
private final String what;
private final boolean show;
private boolean isApplyable(ILeaf leaf) {
if (what.startsWith("$")) {
return isApplyableTag(leaf, what.substring(1));
}
if (what.startsWith("<<") && what.endsWith(">>")) {
return isApplyableStereotype(leaf, what.substring(2, what.length() - 2).trim());
}
final String fullName = leaf.getCode().getFullName();
// System.err.println("fullName=" + fullName);
return match(fullName, what);
}
private boolean isApplyableStereotype(ILeaf leaf, String pattern) {
final Stereotype stereotype = leaf.getStereotype();
if (stereotype == null) {
return false;
}
for (String label : stereotype.getMultipleLabels()) {
if (match(label, pattern)) {
return true;
}
}
return false;
}
private boolean isApplyableTag(ILeaf leaf, String pattern) {
for (Stereotag tag : leaf.stereotags()) {
if (match(tag.getName(), pattern)) {
return true;
}
}
return false;
}
private boolean match(String s, String pattern) {
if (pattern.contains("*")) {
// System.err.println("f1=" + pattern);
// System.err.println("f2=" + Pattern.quote(pattern));
// System.err.println("f3=" + Matcher.quoteReplacement(pattern));
String reg = "^" + pattern.replace("*", ".*") + "$";
return s.matches(reg);
}
return s.equals(pattern);
}
public HideOrShow2(String what, boolean show) {
this.what = what;
this.show = show;
}
public boolean apply(boolean hidden, ILeaf leaf) {
if (isApplyable(leaf)) {
return !show;
}
return hidden;
}
}

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.cucadiagram;
import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.Hideable;
import net.sourceforge.plantuml.LineConfigurable;
@ -88,5 +89,8 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
public Map<String, Display> getTips();
public void setRemoved(boolean removed);
public void addStereotag(Stereotag tag);
public Set<Stereotag> stereotags();
}

View File

@ -43,20 +43,14 @@ public class LinkStyle {
NORMAL, DASHED, DOTTED, BOLD, INVISIBLE;
}
private LinkStyle(Type type, double thickness) {
private LinkStyle(Type type, Double thickness) {
this.type = type;
this.thickness = thickness;
}
// private final static LinkStyle NORMAL = new LinkStyle();
// private final static LinkStyle DASHED = new LinkStyle();
// private final static LinkStyle DOTTED = new LinkStyle();
// private final static LinkStyle BOLD = new LinkStyle();
// private final static LinkStyle INVISIBLE = new LinkStyle();
private final Type type;
private final double thickness;
private final Double thickness;
@Override
public String toString() {
@ -78,23 +72,23 @@ public class LinkStyle {
}
public static LinkStyle NORMAL() {
return new LinkStyle(Type.NORMAL, 0);
return new LinkStyle(Type.NORMAL, null);
}
public static LinkStyle INVISIBLE() {
return new LinkStyle(Type.INVISIBLE, 0);
return new LinkStyle(Type.INVISIBLE, null);
}
public static LinkStyle BOLD() {
return new LinkStyle(Type.BOLD, 0);
return new LinkStyle(Type.BOLD, null);
}
public static LinkStyle DOTTED() {
return new LinkStyle(Type.DOTTED, 0);
return new LinkStyle(Type.DOTTED, null);
}
public static LinkStyle DASHED() {
return new LinkStyle(Type.DASHED, 0);
return new LinkStyle(Type.DASHED, null);
}
public LinkStyle goThickness(double thickness) {
@ -122,7 +116,7 @@ public class LinkStyle {
}
private double nonZeroThickness() {
if (thickness == 0) {
if (thickness == null) {
return 1;
}
return thickness;
@ -153,7 +147,7 @@ public class LinkStyle {
}
public boolean isThicknessOverrided() {
return thickness != 0;
return thickness != null;
}
}

View File

@ -166,7 +166,8 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
if (m.isStatic()) {
config = config.underline();
}
TextBlock bloc = Display.getWithNewlines(s).create(config, align, skinParam, CreoleMode.SIMPLE_LINE);
TextBlock bloc = Display.getWithNewlines(s).create(config, align, skinParam, CreoleMode.SIMPLE_LINE,
skinParam.wrapWidth());
bloc = TextBlockUtils.fullInnerPosition(bloc, m.getDisplay(false));
return new TextBlockTracer(m, bloc);
}

View File

@ -37,36 +37,4 @@ package net.sourceforge.plantuml.cucadiagram;
public class Namespace {
private final String namespace;
private Namespace(String namespace) {
if (namespace == null) {
throw new IllegalArgumentException();
}
this.namespace = namespace;
}
public final String getNamespace() {
return namespace;
}
public static Namespace of(String namespace) {
return new Namespace(namespace);
}
@Override
public int hashCode() {
return namespace.hashCode();
}
@Override
public boolean equals(Object obj) {
final Namespace other = (Namespace) obj;
return this.namespace.equals(other.namespace);
}
public boolean isMain() {
return namespace.length() == 0;
}
}

View File

@ -0,0 +1,42 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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;
public enum NamespaceStrategy {
SINGLE, MULTIPLE;
}

View File

@ -0,0 +1,77 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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;
public class Stereotag {
private static final String SINGLE = "(\\$[^%s{}%g<>$]+)";
public static String pattern() {
return "(" + SINGLE + "([%s]+" + SINGLE + ")*)";
}
private String name;
public Stereotag(String name) {
if (name == null) {
throw new IllegalArgumentException();
}
if (name.startsWith("$")) {
throw new IllegalArgumentException(name);
}
this.name = name;
}
public String getName() {
return name;
}
@Override
public int hashCode() {
return name.hashCode();
}
@Override
public boolean equals(Object arg0) {
return name.equals(((Stereotag) arg0).name);
}
@Override
public String toString() {
return "$" + name;
}
}

View File

@ -42,7 +42,6 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.Hideable;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
@ -54,7 +53,7 @@ import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
public class Stereotype implements CharSequence, Hideable {
public class Stereotype implements CharSequence {
private final static Pattern2 circleChar = MyPattern
.cmpile("\\<\\<[%s]*\\(?(\\S)[%s]*,[%s]*(#[0-9a-fA-F]{6}|\\w+)[%s]*(?:[),](.*?))?\\>\\>");
private final static Pattern2 circleSprite = MyPattern.cmpile("\\<\\<[%s]*\\(?\\$(" + SpriteUtils.SPRITE_NAME
@ -248,8 +247,4 @@ public class Stereotype implements CharSequence, Hideable {
return null;
}
public boolean isHidden() {
return "<<hidden>>".equalsIgnoreCase(label);
}
}

View File

@ -52,9 +52,12 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Member;
import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.posimo.Block;
import net.sourceforge.plantuml.posimo.Cluster;
import net.sourceforge.plantuml.posimo.GraphvizSolverB;
@ -67,6 +70,7 @@ public final class CucaDiagramTxtMaker {
// private final CucaDiagram diagram;
private final FileFormat fileFormat;
private final UGraphicTxt globalUg = new UGraphicTxt();
private final PortionShower portionShower;
private static double getXPixelPerChar() {
return 5;
@ -76,9 +80,15 @@ public final class CucaDiagramTxtMaker {
return 10;
}
private boolean showMember(IEntity entity) {
final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity);
final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity);
return showMethods || showFields;
}
public CucaDiagramTxtMaker(CucaDiagram diagram, FileFormat fileFormat) throws IOException {
// this.diagram = diagram;
this.fileFormat = fileFormat;
this.portionShower = diagram;
final Cluster root = new Cluster(null, 0, 0);
int uid = 0;
@ -123,20 +133,22 @@ public final class CucaDiagramTxtMaker {
final int h = getHeight(ent);
ug.getCharArea().drawBoxSimple(0, 0, w, h);
ug.getCharArea().drawStringsLR(ent.getDisplay().as(), 1, 1);
int y = 2;
ug.getCharArea().drawHLine('-', y, 1, w - 1);
y++;
for (Member att : ent.getBodier().getFieldsToDisplay()) {
final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
ug.getCharArea().drawStringsLR(disp, 1, y);
y += StringUtils.getHeight(disp);
}
ug.getCharArea().drawHLine('-', y, 1, w - 1);
y++;
for (Member att : ent.getBodier().getMethodsToDisplay()) {
final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
ug.getCharArea().drawStringsLR(disp, 1, y);
y += StringUtils.getHeight(disp);
if (showMember(ent)) {
int y = 2;
ug.getCharArea().drawHLine('-', y, 1, w - 1);
y++;
for (Member att : ent.getBodier().getFieldsToDisplay()) {
final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
ug.getCharArea().drawStringsLR(disp, 1, y);
y += StringUtils.getHeight(disp);
}
ug.getCharArea().drawHLine('-', y, 1, w - 1);
y++;
for (Member att : ent.getBodier().getMethodsToDisplay()) {
final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
ug.getCharArea().drawStringsLR(disp, 1, y);
y += StringUtils.getHeight(disp);
}
}
}
@ -151,27 +163,33 @@ public final class CucaDiagramTxtMaker {
private int getHeight(IEntity entity) {
int result = StringUtils.getHeight(entity.getDisplay());
for (Member att : entity.getBodier().getMethodsToDisplay()) {
result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true)));
if (showMember(entity)) {
for (Member att : entity.getBodier().getMethodsToDisplay()) {
result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true)));
}
result++;
for (Member att : entity.getBodier().getFieldsToDisplay()) {
result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true)));
}
result++;
}
for (Member att : entity.getBodier().getFieldsToDisplay()) {
result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true)));
}
return result + 4;
return result + 2;
}
private int getWidth(IEntity entity) {
int result = StringUtils.getWcWidth(entity.getDisplay());
for (Member att : entity.getBodier().getMethodsToDisplay()) {
final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true)));
if (w > result) {
result = w;
if (showMember(entity)) {
for (Member att : entity.getBodier().getMethodsToDisplay()) {
final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true)));
if (w > result) {
result = w;
}
}
}
for (Member att : entity.getBodier().getFieldsToDisplay()) {
final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true)));
if (w > result) {
result = w;
for (Member att : entity.getBodier().getFieldsToDisplay()) {
final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true)));
if (w > result) {
result = w;
}
}
}
return result + 2;

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
@ -65,24 +66,28 @@ public class EntityFactory {
private int rawLayout;
private final IGroup rootGroup = new GroupRoot(this);
private final Set<LeafType> hiddenTypes;
private final Set<String> hiddenStereotype;
private final List<HideOrShow2> hides2;
private final List<HideOrShow2> removed;
public EntityFactory(Set<LeafType> hiddenTypes, Set<String> hiddenStereotype) {
this.hiddenTypes = hiddenTypes;
this.hiddenStereotype = hiddenStereotype;
public EntityFactory(List<HideOrShow2> hides2, List<HideOrShow2> removed) {
this.hides2 = hides2;
this.removed = removed;
}
public boolean isHidden(ILeaf leaf) {
if (hiddenTypes.contains(leaf.getLeafType())) {
return true;
boolean hidden = false;
for (HideOrShow2 hide : hides2) {
hidden = hide.apply(hidden, leaf);
}
final Stereotype stereotype = leaf.getStereotype();
if (stereotype != null && hiddenStereotype.contains(stereotype.getLabel(false))) {
return true;
}
return false;
return hidden;
}
public boolean isRemoved(ILeaf leaf) {
boolean result = false;
for (HideOrShow2 hide : removed) {
result = hide.apply(result, leaf);
}
return result;
}
public ILeaf createLeaf(Code code, Display display, LeafType entityType, IGroup parentContainer,
@ -127,8 +132,12 @@ public class EntityFactory {
return rootGroup;
}
public final Map<Code, ILeaf> getLeafs() {
return Collections.unmodifiableMap(leafs);
public final ILeaf getLeafsget(Code code) {
return leafs.get(code);
}
public final Collection<ILeaf> getLeafsvalues() {
return Collections.unmodifiableCollection(leafs.values());
}
public void addLeaf(ILeaf entity) {
@ -157,8 +166,12 @@ public class EntityFactory {
}
}
public final Map<Code, IGroup> getGroups() {
return Collections.unmodifiableMap(groups);
public final Collection<IGroup> getGroupsvalues() {
return Collections.unmodifiableCollection(groups.values());
}
public final IGroup getGroupsget(Code code) {
return groups.get(code);
}
public final List<Link> getLinks() {
@ -177,7 +190,7 @@ public class EntityFactory {
}
public IGroup muteToGroup(Code code, Code namespace2, GroupType type, IGroup parent) {
final ILeaf leaf = getLeafs().get(code);
final ILeaf leaf = leafs.get(code);
((EntityImpl) leaf).muteToGroup(namespace2, type, parent);
final IGroup result = (IGroup) leaf;
removeLeaf(code);

View File

@ -40,8 +40,10 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
@ -59,6 +61,7 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LongCode;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -106,11 +109,20 @@ final class EntityImpl implements ILeaf, IGroup {
private int xposition;
private IEntityImage svekImage;
private boolean removed = false;
private USymbol symbol;
private final int rawLayout;
private char concurrentSeparator;
private Set<Stereotag> tags = new LinkedHashSet<Stereotag>();
public void addStereotag(Stereotag tag) {
this.tags.add(tag);
}
public Set<Stereotag> stereotags() {
return Collections.unmodifiableSet(tags);
}
// Back to Entity
public final boolean isTop() {
checkNotGroup();
@ -338,7 +350,7 @@ final class EntityImpl implements ILeaf, IGroup {
public Collection<ILeaf> getLeafsDirect() {
checkGroup();
final List<ILeaf> result = new ArrayList<ILeaf>();
for (ILeaf ent : entityFactory.getLeafs().values()) {
for (ILeaf ent : entityFactory.getLeafsvalues()) {
if (ent.isGroup()) {
throw new IllegalStateException();
}
@ -352,7 +364,7 @@ final class EntityImpl implements ILeaf, IGroup {
public Collection<IGroup> getChildren() {
checkGroup();
final Collection<IGroup> result = new ArrayList<IGroup>();
for (IGroup g : entityFactory.getGroups().values()) {
for (IGroup g : entityFactory.getGroupsvalues()) {
if (g != this && g.getParentContainer() == this) {
result.add(g);
}
@ -432,7 +444,7 @@ final class EntityImpl implements ILeaf, IGroup {
}
entityFactory.removeGroup(this.getCode());
for (ILeaf ent : new ArrayList<ILeaf>(entityFactory.getLeafs().values())) {
for (ILeaf ent : new ArrayList<ILeaf>(entityFactory.getLeafsvalues())) {
if (this != ent && this == ent.getParentContainer()) {
entityFactory.removeLeaf(ent.getCode());
}
@ -454,16 +466,6 @@ final class EntityImpl implements ILeaf, IGroup {
this.parentContainer = parentContainer;
}
public boolean isHidden() {
if (entityFactory.isHidden(this)) {
return true;
}
if (stereotype != null) {
return stereotype.isHidden();
}
return false;
}
public USymbol getUSymbol() {
if (getLeafType() == LeafType.CIRCLE) {
return USymbol.INTERFACE;
@ -482,32 +484,67 @@ final class EntityImpl implements ILeaf, IGroup {
return SingleStrategy.SQUARRE;
}
public boolean isRemoved() {
public boolean isHidden() {
if (parentContainer != null && parentContainer.isHidden()) {
return true;
}
return isHiddenInternal();
}
private boolean isHiddenInternal() {
if (isGroup()) {
if (removed) {
if (entityFactory.isHidden(this)) {
return true;
}
if (getLeafsDirect().size() == 0) {
return false;
}
for (ILeaf leaf : getLeafsDirect()) {
if (leaf.isRemoved() == false) {
if (((EntityImpl) leaf).isHiddenInternal() == false) {
return false;
}
}
for (IGroup g : getChildren()) {
if (g.isRemoved() == false) {
if (((EntityImpl) g).isHiddenInternal() == false) {
return false;
}
}
return true;
}
return removed;
return entityFactory.isHidden(this);
}
public void setRemoved(boolean removed) {
this.removed = removed;
public boolean isRemoved() {
if (parentContainer != null && parentContainer.isRemoved()) {
return true;
}
return isRemovedInternal();
}
private boolean isRemovedInternal() {
if (isGroup()) {
if (entityFactory.isRemoved(this)) {
return true;
}
if (getLeafsDirect().size() == 0) {
return false;
}
for (ILeaf leaf : getLeafsDirect()) {
if (((EntityImpl) leaf).isRemovedInternal() == false) {
return false;
}
}
for (IGroup g : getChildren()) {
if (((EntityImpl) g).isRemovedInternal() == false) {
return false;
}
}
return true;
}
return entityFactory.isRemoved(this);
}
private int layer;
@ -590,10 +627,6 @@ final class EntityImpl implements ILeaf, IGroup {
}
}
// public void setSpecificLineStroke(UStroke specificLineStroke) {
// colors = colors.addSpecificLineStroke(specificLineStroke);
// }
public Collection<String> getPortShortNames() {
checkNotGroup();
return Collections.unmodifiableCollection(portShortNames);

View File

@ -38,7 +38,9 @@ package net.sourceforge.plantuml.descdiagram;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificClass;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
import net.sourceforge.plantuml.classdiagram.command.CommandUrl;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandEndPackage;
@ -78,6 +80,8 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandPage());
cmds.add(new CommandLinkElement());
cmds.add(new CommandHideShow2());
cmds.add(new CommandRemoveRestore());
//
cmds.add(new CommandPackageWithUSymbol());
cmds.add(new CommandEndPackage());
@ -110,7 +114,7 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory {
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
cmds.add(new CommandHideShowSpecificClass());
// cmds.add(new CommandHideShowSpecificClass());
cmds.add(new CommandArchimate());

View File

@ -91,7 +91,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("DESC", "as[%s]*[%g](.*)$"));
new RegexLeaf("DESC", "as[%s]*[%g]([^%g]*)$"));
}
if (type == 1) {
return new RegexConcat(new RegexLeaf("^"), //
@ -145,6 +145,9 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined");
}
final ILeaf result = diagram.createLeaf(code, display, type, usymbol);
if (result == null) {
return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined");
}
result.setUSymbol(usymbol);
if (stereotype != null) {
result.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -49,6 +50,8 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -92,6 +95,8 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
color().getRegex(), //
@ -121,13 +126,15 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
}
final IGroup currentPackage = diagram.getCurrentGroup();
final IEntity p = diagram.getOrCreateGroup(code, Display.getWithNewlines(display), GroupType.PACKAGE,
currentPackage);
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
p.setUSymbol(USymbol.getFromString(arg.get("SYMBOL", 0)));
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
if (stereotype != null) {
p.setStereotype(new Stereotype(stereotype, false));
}
CommandCreateClassMultilines.addTags(p, arg.get("TAGS", 0));
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
p.setColors(colors);
return CommandExecutionResult.ok();

View File

@ -65,19 +65,19 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem {
public static final String DONORS = "6-860AmER5DRWVz05mqtRsdC3wE5OekdFiA99Jtd00yCChUnCxOWUAuehg02v8LOSzl-wuP5HI5qgCA_"
+ "ggpzBTFN3kjWmEMYEWvoSaK1Cfs8SH6qMc-nrEca90_odEvgROGc6Whp7KzqIYH-9gGNJuX8r4WIYxya"
+ "Q99kIF-42Y5hIz2iaM2fNV3h4EVWF3XDLej3CUmhKhpjIJUlLtOy56inEI8Fr1nyeswQcytLB1Lv4eXp"
+ "b1IwVXvj7WTj_Y79naykn8P70Io06icBLc3iEAZWk0HOoA_9PcoKSUU93Iw2q8dxyKLPCBobAciwjd3S"
+ "Ne30wmz10EczYbhORFese4XBQz6qfAAEZoynbTaaJadrqd2Cjd6pH0pace3y1xtWtTkgBQzdl0mRITqX"
+ "-HutXKQkzGRVuK2Vo094no00zSHC7y-FwjbIKgtsERxpR82xfLBDzaDFySe98SUVXr0M6mlW3T2XiR2M"
+ "l5iTDmlT8LwjRADUd3EJTnC1SLEcWONU9fjhqbUwoD5GENOJ5gQs3iURKO6Mk2ho1lX5Ay97dHEGihJu"
+ "t7GzRNmcjYRYmjwNa6zMirJu_zoBp7890MqDuqjqCM6rO0wi6fCi4O4rGFy6tDGaBvhhxLgEjzTDuUgc"
+ "WNYhaecosWnW_rJSs7HDXRWwRknicGF0ojwAs3WUMqH8Q0Tq7bIUKMKHzjzTakMBnkYna7DyY8anY2RT"
+ "NNaHStkefQjXH5sRfOFQAreJS846XKZBgMqL3HW8HC-cUZsCWNgb1vhkCyfv7ELRCTq2AyloMDLbeN16"
+ "-CdFGrT-rDsYBX8ztVOFwOjwlv97bFxavDqIpMzAP4KlCsWVWIYrV1qYbd4RN1zCzjHY6iTb1ScniqKJ"
+ "FcD38ByKS4kFzRmUwRHcKrpLTNKJ2kE7-A85ge1D867dV4VR6OQZijusxqWQs-8rX7aNK3872PxIYTKO"
+ "ANIahoLaPDpiwRTEEtvPamLwZSgCFCXGk4AYY0C0";
public static final String DONORS = "6mK70AmER5DRWVz05mqtRsdC3wE5OakdUGahTcCbkRKA_62GTnixOmk2vuhY2Yf0NeWrj-s_RbXK54A7"
+ "AlohojhVCdtjt3gOud9H7GSveQY5J2TYN0IjrbiiTJefoOCyfvl_omKs9aZlhB4fyl0ue1ip6cFXn6XC"
+ "-pyg6_HVT0LQmDEeR5bKvfRu4AdqPTSkbKjo1YU8B2kSajPYAeRT8iNTDePvtR93aA_5wuWySVFh6_MY"
+ "kzbSpLA99n5nZf93r-stzNsdjn-GB838njZek661A2HFUi7OSd2XSWW0oAx9C3QiM7bYG0iVT88_lYWB"
+ "XRTKOqq7Yihf1H6u_I4AIFgZl1Oncru656ePBUgMDDNnyIMbD9liANzj6exHDqwMc06e2UG_w8dktbPT"
+ "8ZtZPK0azGt9jsm2ZIJt6jzXeazK7uYJKG3MGpDbF3-ghQMiMbt7-CsZ8TmjbMks6__6AoV47FyUahAu"
+ "j82y0HqQ2x3a7-XOB7I7TBMo2_Vgd5gyGmG4fqo3XTwcs6l-7xj8CLJ8RcHX3lrql1aDs59NITuWVcg5"
+ "-AnpWgGiBJuFVPusFfDO4yAuzoNiczKi5Vz_xcLcK8AWZM6eg8i9q9mvjAfDYYW2ju3-ZN1JbxpehhTh"
+ "EzvU3yLhX2xelPDCdBjDZ_PFnGsaQocarK7fT9a9O6coOZQLonO9Ojg1JgFACwuimhxTPLc-R2nvBEma"
+ "pHgDeMZJtPKdARU7Udet3AdtPlzkxIMj2LoWe31vYHgho6P7z-wuQ5xFOB2xqWCFfCyuvxwNNqhf5e0Y"
+ "osDDbuNY6U47VnwwzCVzMTJ6ukSR_v1NqUDNyfZIMoZlbdX_KvGLFQUaNO38ShqAaSYu2QwF9djgiKpb"
+ "i8BiMDcY2u-nOR1V2jp20sxhaK5hDgLLlQ-kGn7y45_qeFBQH69sj3iupZ0U1KR7l2DvR8lNaCnUGF4S"
+ "9dXA9w0nKjAHlXR9o7ijqMsTVloqneNQDhubtEDGUCT4inuRU4u15EoX6m00";
@Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)

View File

@ -44,7 +44,7 @@ import javax.imageio.ImageIO;
public class IconLoader {
private static final int NUMBER_OF_ICONS = 21;
private static final int NUMBER_OF_ICONS = 25;
private final static Map<String, BufferedImage> all = new ConcurrentHashMap<String, BufferedImage>();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,39 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.graphic;
public class HtmlColorAutomatic implements HtmlColor {
}

View File

@ -255,6 +255,8 @@ public class HtmlColorSetSimple implements IHtmlColorSet {
final Color color;
if (s.equalsIgnoreCase("transparent")) {
return new HtmlColorTransparent();
} else if (s.equalsIgnoreCase("automatic")) {
return new HtmlColorAutomatic();
} else if (s.matches("[0-9A-Fa-f]{3}")) {
s = "" + s.charAt(0) + s.charAt(0) + s.charAt(1) + s.charAt(1) + s.charAt(2) + s.charAt(2);
color = new Color(Integer.parseInt(s, 16));
@ -278,6 +280,9 @@ public class HtmlColorSetSimple implements IHtmlColorSet {
if (s.matches("[0-9A-Fa-f]{6}")) {
return true;
}
if (s.equalsIgnoreCase("automatic")) {
return true;
}
if (acceptTransparent && s.equalsIgnoreCase("transparent")) {
return true;
}

View File

@ -251,7 +251,10 @@ public class QuoteUtils {
"Cercnengvba vf gur xrl gb fhpprffshy, vapbafcvphbhf gvzr geniry.",
"Vg'f arire gbb yngr gb or jub lbh zvtug unir orra.",
"Rg cbhe nyyre purm Zvpxrl vyf ibag fherzrag cnf pbafgehver har tner gbhf yrf 100 zrgerf",
"Nyy lbhe onfr ner orybat gb hf");
"Nyy lbhe onfr ner orybat gb hf", "Znqr ba Rnegu ol uhznaf", "Jvaaref Qba'g Hfr Qehtf",
"Lbh xabj jung fhecevfrq zr gur zbfg? Vg jnfa'g zrrgvat gurz. Vg jnf zrrgvat lbh.",
"Va jne gurer ner ab jvaaref, bayl jvqbjf",
"Vs lbh guvax guvf Havirefr vf onq, lbh fubhyq frr fbzr bs gur bguref");
private QuoteUtils() {
}

View File

@ -95,16 +95,28 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
return ug.apply(stroke);
}
private boolean noBorder() {
if (stroke == null) {
return false;
}
return stroke.getThickness() == 0;
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Shadowable polygon = getPolygonNormal(stringBounder);
final UGraphic ugOriginal = ug;
if (withShadow) {
polygon.setDeltaShadow(4);
}
ug = ug.apply(new UChangeBackColor(backgroundColor)).apply(new UChangeColor(borderColor));
ug = applyStroke(ug);
if (noBorder()) {
ug = ug.apply(new UChangeBackColor(backgroundColor)).apply(new UChangeColor(backgroundColor));
} else {
ug = ug.apply(new UChangeBackColor(backgroundColor)).apply(new UChangeColor(borderColor));
ug = applyStroke(ug);
}
ug.draw(polygon);
textBlock.drawU(ug.apply(new UTranslate(marginX, marginY)));
textBlock.drawU(ugOriginal.apply(new UTranslate(marginX, marginY)));
}
private Shadowable getPolygonNormal(final StringBounder stringBounder) {

View File

@ -73,7 +73,7 @@ public class MDADiagramImpl implements MDADiagram {
private MDADiagramImpl(ClassDiagram classDiagram) {
final EntityFactory entityFactory = classDiagram.getEntityFactory();
packages.add(new MDAPackageImpl(entityFactory.getRootGroup()));
for (IGroup group : entityFactory.getGroups().values()) {
for (IGroup group : entityFactory.getGroupsvalues()) {
packages.add(new MDAPackageImpl(group));
}
}

View File

@ -45,9 +45,9 @@ import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.EnsureVisible;
import net.sourceforge.plantuml.asciiart.BasicCharArea;
@ -58,6 +58,7 @@ import net.sourceforge.plantuml.svek.ClusterPosition;
import net.sourceforge.plantuml.svek.MinFinder;
import net.sourceforge.plantuml.svek.PointAndAngle;
import net.sourceforge.plantuml.svek.PointDirected;
import net.sourceforge.plantuml.svek.SvgResult;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.USegmentType;
@ -66,16 +67,13 @@ import net.sourceforge.plantuml.ugraphic.UShape;
public class DotPath implements UShape, Moveable {
static class TriPoints {
public TriPoints(String p1, String p2, String p, double deltaY) {
final StringTokenizer st1 = new StringTokenizer(p1, ",");
x1 = Double.parseDouble(st1.nextToken());
y1 = Double.parseDouble(st1.nextToken()) + deltaY;
final StringTokenizer st2 = new StringTokenizer(p2, ",");
x2 = Double.parseDouble(st2.nextToken());
y2 = Double.parseDouble(st2.nextToken()) + deltaY;
final StringTokenizer st = new StringTokenizer(p, ",");
x = Double.parseDouble(st.nextToken());
y = Double.parseDouble(st.nextToken()) + deltaY;
public TriPoints(Point2D.Double p1, Point2D.Double p2, Point2D.Double p) {
x1 = p1.getX();
y1 = p1.getY();
x2 = p2.getX();
y2 = p2.getY();
x = p.getX();
y = p.getY();
}
private final double x1;
@ -129,28 +127,25 @@ public class DotPath implements UShape, Moveable {
return new Point2D.Double(x, y);
}
public DotPath(String init, double deltaY) {
if (isPathConsistent(init) == false) {
public DotPath(SvgResult fullSvg) {
if (isPathConsistent(fullSvg.getSvg()) == false) {
throw new IllegalArgumentException();
}
final int posC = init.indexOf("C");
final int posC = fullSvg.indexOf("C", 0);
if (posC == -1) {
throw new IllegalArgumentException();
}
final StringTokenizer st = new StringTokenizer(init.substring(1, posC), ",");
final double startX = Double.parseDouble(st.nextToken());
final double startY = Double.parseDouble(st.nextToken()) + deltaY;
final Point2D start = fullSvg.substring(1, posC).getNextPoint();
final StringTokenizer st2 = new StringTokenizer(init.substring(posC + 1), " ");
final List<TriPoints> triPoints = new ArrayList<TriPoints>();
while (st2.hasMoreTokens()) {
final String p1 = st2.nextToken();
final String p2 = st2.nextToken();
final String p = st2.nextToken();
triPoints.add(new TriPoints(p1, p2, p, deltaY));
for (Iterator<Point2D.Double> it = fullSvg.substring(posC + 1).getPoints(" ").iterator(); it.hasNext();) {
final Point2D.Double p1 = it.next();
final Point2D.Double p2 = it.next();
final Point2D.Double p = it.next();
triPoints.add(new TriPoints(p1, p2, p));
}
double x = startX;
double y = startY;
double x = start.getX();
double y = start.getY();
for (TriPoints p : triPoints) {
final CubicCurve2D.Double bezier = new CubicCurve2D.Double(x, y, p.x1, p.y1, p.x2, p.y2, p.x, p.y);
beziers.add(bezier);

View File

@ -43,10 +43,8 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -55,6 +53,8 @@ import net.sourceforge.plantuml.cucadiagram.dot.Graphviz;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.cucadiagram.dot.ProcessState;
import net.sourceforge.plantuml.svek.MinFinder;
import net.sourceforge.plantuml.svek.SvgResult;
import net.sourceforge.plantuml.svek.YDelta;
public class GraphvizSolverB {
@ -122,15 +122,16 @@ public class GraphvizSolverB {
final int width = Integer.parseInt(mGraph.group(1));
final int height = Integer.parseInt(mGraph.group(2));
final YDelta yDelta = new YDelta(height);
for (Block b : root.getRecursiveContents()) {
final String start = "b" + b.getUid();
final int p1 = s.indexOf("<title>" + start + "</title>");
if (p1 == -1) {
throw new IllegalStateException();
}
final List<Point2D.Double> pointsList = extractPointsList(s, p1);
final List<Point2D.Double> pointsList = extractPointsList(s, p1, yDelta);
b.setX(getMinX(pointsList));
b.setY(getMinY(pointsList) + height);
b.setY(getMinY(pointsList));
minMax.manage(b.getPosition());
}
@ -140,9 +141,9 @@ public class GraphvizSolverB {
if (p1 == -1) {
throw new IllegalStateException();
}
final List<Point2D.Double> pointsList = extractPointsList(s, p1);
final List<Point2D.Double> pointsList = extractPointsList(s, p1, yDelta);
cl.setX(getMinX(pointsList));
cl.setY(getMinY(pointsList) + height);
cl.setY(getMinY(pointsList));
final double w = getMaxX(pointsList) - getMinX(pointsList);
final double h = getMaxY(pointsList) - getMinY(pointsList);
cl.setHeight(h);
@ -161,15 +162,15 @@ public class GraphvizSolverB {
final int p2 = s.indexOf(" d=\"", p1);
final int p3 = s.indexOf("\"", p2 + " d=\"".length());
final String points = s.substring(p2 + " d=\"".length(), p3);
final DotPath dotPath = new DotPath(points, height);
final DotPath dotPath = new DotPath(new SvgResult(points, yDelta));
p.setDotPath(dotPath);
minMax.manage(dotPath.getMinFinder());
// Log.println("pointsList=" + pointsList);
if (p.getLabel() != null) {
final List<Point2D.Double> pointsList = extractPointsList(s, p1);
final List<Point2D.Double> pointsList = extractPointsList(s, p1, yDelta);
final double x = getMinX(pointsList);
final double y = getMinY(pointsList) + height;
final double y = getMinY(pointsList);
p.setLabelPosition(x, y);
minMax.manage(x, y);
}
@ -177,13 +178,8 @@ public class GraphvizSolverB {
return new Dimension2DDouble(width, height);
}
static private List<Point2D.Double> extractPointsList(final String svg, final int starting) {
final String pointsString = "points=\"";
final int p2 = svg.indexOf(pointsString, starting);
final int p3 = svg.indexOf("\"", p2 + pointsString.length());
final String points = svg.substring(p2 + pointsString.length(), p3);
final List<Point2D.Double> pointsList = getPoints(points);
return pointsList;
static private List<Point2D.Double> extractPointsList(final String svg, final int starting, final YDelta yDelta) {
return new SvgResult(svg, yDelta).substring(starting).extractList(SvgResult.POINTS_EQUALS);
}
static private double getMaxX(List<Point2D.Double> points) {
@ -226,19 +222,6 @@ public class GraphvizSolverB {
return result;
}
static private List<Point2D.Double> getPoints(String points) {
final List<Point2D.Double> result = new ArrayList<Point2D.Double>();
final StringTokenizer st = new StringTokenizer(points, " ");
while (st.hasMoreTokens()) {
final String t = st.nextToken();
final StringTokenizer st2 = new StringTokenizer(t, ",");
final double x = Double.parseDouble(st2.nextToken());
final double y = Double.parseDouble(st2.nextToken());
result.add(new Point2D.Double(x, y));
}
return result;
}
private void exportPng(final String dotString, File f) throws IOException {
final Graphviz graphviz = GraphvizUtils.create(null, dotString, "png");
final OutputStream os = new BufferedOutputStream(new FileOutputStream(f));

View File

@ -82,7 +82,7 @@ public class PSystemProject extends AbstractPSystem {
final BufferedImage im = createImage(diagram);
PngIO.write(im, os, fileFormatOption.isWithMetadata() ? getMetadata() : null, 96);
} else if (fileFormat == FileFormat.SVG) {
final UGraphicSvg svg = new UGraphicSvg(new Dimension2DDouble(0, 0), colorMapper, StringUtils.getAsHtml(background), false, 1.0,
final UGraphicSvg svg = new UGraphicSvg(true, new Dimension2DDouble(0, 0), colorMapper, StringUtils.getAsHtml(background), false, 1.0,
fileFormatOption.getSvgLinkTarget(), fileFormatOption.getHoverColor(), seed());
diagram.draw(svg, 0, 0);
svg.createXml(os, fileFormatOption.isWithMetadata() ? getMetadata() : null);

View File

@ -81,7 +81,7 @@ public class PSystemProject2 extends AbstractPSystem {
final BufferedImage im = createImage(diagram);
PngIO.write(im, os, fileFormatOption.isWithMetadata() ? getMetadata() : null, 96);
} else if (fileFormat == FileFormat.SVG) {
final UGraphicSvg svg = new UGraphicSvg(new Dimension2DDouble(0, 0),colorMapper, StringUtils.getAsHtml(background), false, 1.0,
final UGraphicSvg svg = new UGraphicSvg(true, new Dimension2DDouble(0, 0),colorMapper, StringUtils.getAsHtml(background), false, 1.0,
fileFormatOption.getSvgLinkTarget(), fileFormatOption.getHoverColor(), seed());
diagram.draw(svg, 0, 0);
svg.createXml(os, fileFormatOption.isWithMetadata() ? getMetadata() : null);

View File

@ -43,6 +43,7 @@ public class AutoNumber {
private int increment;
private DecimalFormat format;
private String last = "";
public final void go(DottedNumber startingNumber, int increment, DecimalFormat format) {
this.running = true;
@ -82,9 +83,15 @@ public class AutoNumber {
if (running == false) {
return null;
}
final String result = current.format(format);
last = current.format(format);
current.incrementMinor(increment);
return result;
return last;
}
public String getCurrentMessageNumber(boolean formatted) {
if (formatted) {
return last;
}
return last.replace("<b>", "").replace("</b>", "");
}
}

View File

@ -536,4 +536,7 @@ public class SequenceDiagram extends UmlDiagram {
}
}
public Display manageVariable(Display labels) {
return labels.replace("%autonumber%", autoNumber.getCurrentMessageNumber(false));
}
}

View File

@ -216,10 +216,12 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
diagram.activate(p2, LifeEventType.CREATE, null);
}
final Message msg = new Message(p1, p2, labels, config, diagram.getNextMessageNumber());
if (arg.get("URL", 0) != null) {
final String messageNumber = diagram.getNextMessageNumber();
final Message msg = new Message(p1, p2, diagram.manageVariable(labels), config, messageNumber);
final String url = arg.get("URL", 0);
if (url != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final Url urlLink = urlBuilder.getUrl(arg.get("URL", 0));
final Url urlLink = urlBuilder.getUrl(url);
msg.setUrl(urlLink);
}

View File

@ -64,17 +64,16 @@ public abstract class AbstractTextualComponent extends AbstractComponent {
private final UFont font;
private final HtmlColor fontColor;
public AbstractTextualComponent(LineBreakStrategy maxMessageSize, CharSequence label,
FontConfiguration font, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2,
int marginY, ISkinSimple spriteContainer, UFont fontForStereotype,
HtmlColor htmlColorForStereotype) {
public AbstractTextualComponent(LineBreakStrategy maxMessageSize, CharSequence label, FontConfiguration font,
HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY,
ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
this(maxMessageSize, Display.getWithNewlines(label == null ? "" : label.toString()), font, horizontalAlignment,
marginX1, marginX2, marginY, spriteContainer, false, fontForStereotype, htmlColorForStereotype);
}
public AbstractTextualComponent(LineBreakStrategy maxMessageSize, Display strings, FontConfiguration font,
HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, ISkinSimple spriteContainer,
boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY,
ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
this.font = font.getFont();
this.fontColor = font.getColor();
this.marginX1 = marginX1;
@ -85,7 +84,8 @@ public abstract class AbstractTextualComponent extends AbstractComponent {
if (strings.size() == 1 && strings.get(0).length() == 0) {
textBlock = new TextBlockEmpty();
} else if (enhanced) {
textBlock = new BodyEnhanced2(strings, FontParam.NOTE, spriteContainer, HorizontalAlignment.LEFT, font);
textBlock = new BodyEnhanced2(strings, FontParam.NOTE, spriteContainer, HorizontalAlignment.LEFT, font,
maxMessageSize);
} else {
textBlock = strings.create(font, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL,
fontForStereotype, htmlColorForStereotype);

View File

@ -65,14 +65,17 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
private final HorizontalAlignment messagePosition;
private final boolean niceArrow;
private final boolean belowForResponse;
public ComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay,
ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer,
HorizontalAlignment textHorizontalAlignment, LineBreakStrategy maxMessageSize, boolean niceArrow) {
HorizontalAlignment textHorizontalAlignment, LineBreakStrategy maxMessageSize, boolean niceArrow,
boolean belowForResponse) {
super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, textHorizontalAlignment,
maxMessageSize);
this.messagePosition = messagePosition;
this.niceArrow = niceArrow;
this.belowForResponse = belowForResponse;
}
public static final double spaceCrossX = 6;
@ -86,7 +89,6 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
}
final Dimension2D dimensionToUse = area.getDimensionToUse();
final StringBounder stringBounder = ug.getStringBounder();
final int textHeight = (int) getTextHeight(stringBounder);
ug = ug.apply(new UChangeColor(getForegroundColor()));
final ArrowDressing dressing1 = getArrowConfiguration().getDressing1();
@ -115,9 +117,6 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
len -= diamCircle + thinCircle;
}
drawDressing1(ug, pos1, dressing1, getArrowConfiguration().getDecoration1());
drawDressing2(ug, pos2, dressing2, getArrowConfiguration().getDecoration2());
if (dressing2.getPart() == ArrowPart.FULL && dressing2.getHead() == ArrowHead.NORMAL) {
len -= getArrowDeltaX() / 2;
}
@ -134,7 +133,19 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
len -= 2 * spaceCrossX;
}
getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, textHeight)).draw(new ULine(len, 0));
final double posArrow;
final double yText;
if (belowForResponse && getDirection2() == ArrowDirection.RIGHT_TO_LEFT_REVERSE) {
posArrow = 0;
yText = getMarginY();
} else {
posArrow = getTextHeight(stringBounder);
yText = 0;
}
drawDressing1(ug.apply(new UTranslate(0, posArrow)), pos1, dressing1, getArrowConfiguration().getDecoration1());
drawDressing2(ug.apply(new UTranslate(0, posArrow)), pos2, dressing2, getArrowConfiguration().getDecoration2());
getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(new ULine(len, 0));
final ArrowDirection direction2 = getDirection2();
final double textPos;
@ -150,120 +161,118 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
+ (direction2 == ArrowDirection.RIGHT_TO_LEFT_REVERSE
|| direction2 == ArrowDirection.BOTH_DIRECTION ? getArrowDeltaX() : 0);
}
getTextBlock().drawU(ug.apply(new UTranslate(textPos, 0)));
getTextBlock().drawU(ug.apply(new UTranslate(textPos, yText)));
}
private void drawDressing1(UGraphic ug, double x, ArrowDressing dressing, ArrowDecoration decoration) {
final StringBounder stringBounder = ug.getStringBounder();
final int textHeight = (int) getTextHeight(stringBounder);
if (decoration == ArrowDecoration.CIRCLE) {
final UEllipse circle = new UEllipse(diamCircle, diamCircle);
ug.apply(new UStroke(thinCircle))
.apply(new UChangeColor(getForegroundColor()))
.apply(new UTranslate(x - diamCircle / 2 - thinCircle, textHeight - diamCircle / 2 - thinCircle / 2))
ug.apply(new UStroke(thinCircle)).apply(new UChangeColor(getForegroundColor()))
.apply(new UTranslate(x - diamCircle / 2 - thinCircle, -diamCircle / 2 - thinCircle / 2))
.draw(circle);
x += diamCircle / 2 + thinCircle;
}
if (dressing.getHead() == ArrowHead.ASYNC) {
if (dressing.getPart() != ArrowPart.BOTTOM_PART) {
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY()));
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, 0))
.draw(new ULine(getArrowDeltaX(), -getArrowDeltaY()));
}
if (dressing.getPart() != ArrowPart.TOP_PART) {
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), getArrowDeltaY()));
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, 0))
.draw(new ULine(getArrowDeltaX(), getArrowDeltaY()));
}
} else if (dressing.getHead() == ArrowHead.CROSSX) {
ug = ug.apply(new UStroke(2));
ug.apply(new UTranslate(spaceCrossX, textHeight - getArrowDeltaX() / 2)).draw(
ug.apply(new UTranslate(spaceCrossX, -getArrowDeltaX() / 2)).draw(
new ULine(getArrowDeltaX(), getArrowDeltaX()));
ug.apply(new UTranslate(spaceCrossX, textHeight + getArrowDeltaX() / 2)).draw(
ug.apply(new UTranslate(spaceCrossX, getArrowDeltaX() / 2)).draw(
new ULine(getArrowDeltaX(), -getArrowDeltaX()));
} else if (dressing.getHead() == ArrowHead.NORMAL) {
final UPolygon polygon = getPolygonReverse(dressing.getPart(), textHeight);
final UPolygon polygon = getPolygonReverse(dressing.getPart());
ug.apply(new UChangeBackColor(getForegroundColor())).apply(new UTranslate(x, 0)).draw(polygon);
}
}
private void drawDressing2(UGraphic ug, double x, ArrowDressing dressing, ArrowDecoration decoration) {
final StringBounder stringBounder = ug.getStringBounder();
final int textHeight = (int) getTextHeight(stringBounder);
if (decoration == ArrowDecoration.CIRCLE) {
ug = ug.apply(new UStroke(thinCircle)).apply(new UChangeColor(getForegroundColor()));
final UEllipse circle = new UEllipse(diamCircle, diamCircle);
ug.apply(new UTranslate(x - diamCircle / 2 + thinCircle, textHeight - diamCircle / 2 - thinCircle / 2))
.draw(circle);
ug.apply(new UTranslate(x - diamCircle / 2 + thinCircle, -diamCircle / 2 - thinCircle / 2)).draw(circle);
ug = ug.apply(new UStroke());
x -= diamCircle / 2 + thinCircle;
}
if (dressing.getHead() == ArrowHead.ASYNC) {
if (dressing.getPart() != ArrowPart.BOTTOM_PART) {
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY()));
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, 0))
.draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY()));
}
if (dressing.getPart() != ArrowPart.TOP_PART) {
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), getArrowDeltaY()));
getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, 0))
.draw(new ULine(-getArrowDeltaX(), getArrowDeltaY()));
}
} else if (dressing.getHead() == ArrowHead.CROSSX) {
ug = ug.apply(new UStroke(2));
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), textHeight - getArrowDeltaX() / 2)).draw(
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), -getArrowDeltaX() / 2)).draw(
new ULine(getArrowDeltaX(), getArrowDeltaX()));
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), textHeight + getArrowDeltaX() / 2)).draw(
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), getArrowDeltaX() / 2)).draw(
new ULine(getArrowDeltaX(), -getArrowDeltaX()));
ug = ug.apply(new UStroke());
} else if (dressing.getHead() == ArrowHead.NORMAL) {
final UPolygon polygon = getPolygonNormal(dressing.getPart(), textHeight, x);
final UPolygon polygon = getPolygonNormal(dressing.getPart(), x);
ug.apply(new UChangeBackColor(getForegroundColor())).draw(polygon);
}
}
private UPolygon getPolygonNormal(ArrowPart part, final int textHeight, final double x2) {
private UPolygon getPolygonNormal(ArrowPart part, final double x2) {
final UPolygon polygon = new UPolygon();
if (part == ArrowPart.TOP_PART) {
polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
polygon.addPoint(x2, textHeight);
polygon.addPoint(x2 - getArrowDeltaX(), textHeight);
polygon.addPoint(x2 - getArrowDeltaX(), -getArrowDeltaY());
polygon.addPoint(x2, 0);
polygon.addPoint(x2 - getArrowDeltaX(), 0);
} else if (part == ArrowPart.BOTTOM_PART) {
polygon.addPoint(x2 - getArrowDeltaX(), textHeight + 1);
polygon.addPoint(x2, textHeight + 1);
polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY() + 1);
polygon.addPoint(x2 - getArrowDeltaX(), 1);
polygon.addPoint(x2, 1);
polygon.addPoint(x2 - getArrowDeltaX(), getArrowDeltaY() + 1);
} else {
polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
polygon.addPoint(x2, textHeight);
polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY());
polygon.addPoint(x2 - getArrowDeltaX(), -getArrowDeltaY());
polygon.addPoint(x2, 0);
polygon.addPoint(x2 - getArrowDeltaX(), +getArrowDeltaY());
if (niceArrow) {
polygon.addPoint(x2 - getArrowDeltaX() + 4, textHeight);
polygon.addPoint(x2 - getArrowDeltaX() + 4, 0);
}
}
return polygon;
}
private UPolygon getPolygonReverse(ArrowPart part, final int textHeight) {
private UPolygon getPolygonReverse(ArrowPart part) {
final UPolygon polygon = new UPolygon();
if (part == ArrowPart.TOP_PART) {
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
polygon.addPoint(0, textHeight);
polygon.addPoint(getArrowDeltaX(), textHeight);
polygon.addPoint(getArrowDeltaX(), -getArrowDeltaY());
polygon.addPoint(0, 0);
polygon.addPoint(getArrowDeltaX(), 0);
} else if (part == ArrowPart.BOTTOM_PART) {
polygon.addPoint(getArrowDeltaX(), textHeight + 1);
polygon.addPoint(0, textHeight + 1);
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY() + 1);
polygon.addPoint(getArrowDeltaX(), 1);
polygon.addPoint(0, 1);
polygon.addPoint(getArrowDeltaX(), getArrowDeltaY() + 1);
} else {
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
polygon.addPoint(0, textHeight);
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY());
polygon.addPoint(getArrowDeltaX(), -getArrowDeltaY());
polygon.addPoint(0, 0);
polygon.addPoint(getArrowDeltaX(), getArrowDeltaY());
if (niceArrow) {
polygon.addPoint(getArrowDeltaX() - 4, textHeight);
polygon.addPoint(getArrowDeltaX() - 4, 0);
}
}
return polygon;
}
public Point2D getStartPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
final int textHeight = (int) getTextHeight(stringBounder);
final double textHeight = getTextHeight(stringBounder);
if (getDirection2() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) {
return new Point2D.Double(getPaddingX(), textHeight + getPaddingY());
}
@ -271,7 +280,7 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
}
public Point2D getEndPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
final int textHeight = (int) getTextHeight(stringBounder);
final double textHeight = getTextHeight(stringBounder);
if (getDirection2() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) {
return new Point2D.Double(dimensionToUse.getWidth() + getPaddingX(), textHeight + getPaddingY());
}

View File

@ -105,7 +105,7 @@ public class Rose implements Skin {
AlignParam.SEQUENCE_MESSAGETEXT_ALIGN, config.getArrowDirection());
return new ComponentRoseArrow(sequenceArrow, getUFont2(param, FontParam.ARROW), stringsToDisplay, config,
messageHorizontalAlignment, param, textHorizontalAlignment, param.maxMessageSize(),
param.strictUmlStyle() == false);
param.strictUmlStyle() == false, param.responseMessageBelowArrow());
}
final double padding = param.getPadding(PaddingParam.PARTICIPANT);
final double roundCorner = param.getRoundCorner(RoundParam.DEFAULT, null);

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.utils.UniqueSequence;
@ -110,8 +111,9 @@ public class StateDiagram extends AbstractEntityDiagram {
}
public IEntity getHistorical(Code codeGroup) {
final IEntity g = getOrCreateGroup(codeGroup, Display.getWithNewlines(codeGroup), GroupType.STATE,
getRootGroup());
gotoGroup2(codeGroup, Display.getWithNewlines(codeGroup), GroupType.STATE, getRootGroup(),
NamespaceStrategy.SINGLE);
final IEntity g = getCurrentGroup();
final IEntity result = getOrCreateLeaf(Code.of("*historical*" + g.getCode().getFullName()),
LeafType.PSEUDO_STATE, null);
endGroup();
@ -125,13 +127,14 @@ public class StateDiagram extends AbstractEntityDiagram {
super.endGroup();
}
getCurrentGroup().setConcurrentSeparator(direction);
final IGroup conc1 = getOrCreateGroup(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""),
GroupType.CONCURRENT_STATE, getCurrentGroup());
gotoGroup2(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE,
getCurrentGroup(), NamespaceStrategy.SINGLE);
final IGroup conc1 = getCurrentGroup();
if (EntityUtils.groupRoot(cur) == false && cur.getGroupType() == GroupType.STATE) {
cur.moveEntitiesTo(conc1);
super.endGroup();
getOrCreateGroup(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE,
getCurrentGroup());
gotoGroup2(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE,
getCurrentGroup(), NamespaceStrategy.SINGLE);
}
// printlink("AFTER");
return true;

View File

@ -38,6 +38,8 @@ package net.sourceforge.plantuml.statediagram;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
import net.sourceforge.plantuml.classdiagram.command.CommandUrl;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored;
@ -68,6 +70,9 @@ public class StateDiagramFactory extends UmlDiagramFactory {
final List<Command> cmds = new ArrayList<Command>();
cmds.add(new CommandFootboxIgnored());
cmds.add(new CommandRankDir());
cmds.add(new CommandHideEmptyDescription());
cmds.add(new CommandHideShow2());
cmds.add(new CommandRemoveRestore());
cmds.add(new CommandCreateState());
// addCommand(new CommandLinkState());
cmds.add(new CommandLinkState());
@ -83,8 +88,6 @@ public class StateDiagramFactory extends UmlDiagramFactory {
cmds.add(factoryNoteOnEntityCommand.createMultiLine(true));
cmds.add(factoryNoteOnEntityCommand.createMultiLine(false));
cmds.add(new CommandHideEmptyDescription());
cmds.add(factoryNoteOnEntityCommand.createSingleLine());
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
cmds.add(factoryNoteOnLinkCommand.createSingleLine());

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -81,12 +82,11 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), //
new RegexLeaf("(?:[%s]*\\{|[%s]+begin)$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
private String getNotNull(RegexResult arg, String v1, String v2) {
if (arg.get(v1, 0) == null) {
return arg.get(v2, 0);
@ -102,8 +102,9 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
if (display == null) {
display = code.getFullName();
}
final IEntity p = diagram.getOrCreateGroup(code, Display.getWithNewlines(display), GroupType.STATE,
currentPackage);
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.STATE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {
p.setStereotype(new Stereotype(stereotype));
@ -114,7 +115,7 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
final Url url = urlBuilder.getUrl(urlString);
p.addUrl(url);
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1));
@ -126,9 +127,11 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
}
p.setColors(colors);
// p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
// p.setSpecificColorTOBEREMOVED(ColorType.LINE, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
// p.applyStroke(arg.get("LINECOLOR", 0));
// p.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
// p.setSpecificColorTOBEREMOVED(ColorType.LINE,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
// p.applyStroke(arg.get("LINECOLOR", 0));
return CommandExecutionResult.ok();
}

Some files were not shown because too many files have changed in this diff Show More