1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-05 21:17:52 +00:00

version 1.2019.13

This commit is contained in:
Arnaud Roques 2019-12-10 22:45:49 +01:00
parent 36c461dabe
commit 275cde19a8
124 changed files with 1582 additions and 1046 deletions

View File

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

View File

@ -68,13 +68,17 @@ public class FileSystem {
}
public File getFile(String nameOrPath) throws IOException {
final File dir = currentDir.get();
if (dir == null || isAbsolute(nameOrPath)) {
if (isAbsolute(nameOrPath)) {
return new File(nameOrPath).getCanonicalFile();
}
final File filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
if (filecurrent.exists()) {
return filecurrent.getCanonicalFile();
final File dir = currentDir.get();
File filecurrent = null;
if (dir != null) {
filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
if (filecurrent.exists()) {
return filecurrent.getCanonicalFile();
}
}
for (File d : getPath("plantuml.include.path", true)) {
if (d.isDirectory()) {
@ -92,6 +96,11 @@ public class FileSystem {
}
}
}
if (dir == null) {
assert filecurrent == null;
return new File(nameOrPath).getCanonicalFile();
}
assert filecurrent != null;
return filecurrent;
}

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.style.Style;
@ -182,10 +183,11 @@ public interface ISkinParam extends ISkinSimple {
public void muteStyle(Style modifiedStyle);
public Collection<String> getAllSpriteNames();
public String getDefaultSkin();
public void setDefaultSkin(String newSkin);
public ActorStyle getActorStyle();
}

View File

@ -65,6 +65,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.sprite.Sprite;
@ -101,7 +102,7 @@ public class SkinParam implements ISkinParam {
}
if (type == UmlDiagramType.SEQUENCE) {
// skin = "debug.skin";
//USE_STYLE2.set(true);
// USE_STYLE2.set(true);
}
// if (type == UmlDiagramType.ACTIVITY) {
// // skin = "debug.skin";
@ -1046,7 +1047,7 @@ public class SkinParam implements ISkinParam {
}
return value;
}
public String getPreserveAspectRatio() {
final String value = getValue("preserveaspectratio");
if (value == null) {
@ -1055,7 +1056,6 @@ public class SkinParam implements ISkinParam {
return value;
}
public String getMonospacedFamily() {
final String value = getValue("defaultMonospacedFontName");
if (value == null) {
@ -1207,4 +1207,12 @@ public class SkinParam implements ISkinParam {
.withBorderColor(border).withRoundCorner(roundCorner);
}
public ActorStyle getActorStyle() {
final String value = getValue("actorstyle");
if ("awesome".equalsIgnoreCase(value)) {
return ActorStyle.AWESOME;
}
return ActorStyle.STICKMAN;
}
}

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.sprite.Sprite;
@ -234,7 +235,7 @@ public class SkinParamDelegator implements ISkinParam {
public String getSvgLinkTarget() {
return skinParam.getSvgLinkTarget();
}
public String getPreserveAspectRatio() {
return skinParam.getPreserveAspectRatio();
}
@ -359,5 +360,8 @@ public class SkinParamDelegator implements ISkinParam {
skinParam.setDefaultSkin(newFileName);
}
public ActorStyle getActorStyle() {
return skinParam.getActorStyle();
}
}

View File

@ -221,7 +221,7 @@ public class SourceStringReader {
}
private void noStartumlFound(OutputStream os, FileFormatOption fileFormatOption, long seed) throws IOException {
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml found"),
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"),
fileFormatOption.isUseRedForError());
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, error.getBackcolor(), null,
null, 0, 0, null, false);

View File

@ -232,6 +232,9 @@ public class StringUtils {
// }
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s, String format) {
if (s == null) {
return null;
}
if (format.contains("\"") && s.length() > 1 && isDoubleQuote(s.charAt(0))
&& isDoubleQuote(s.charAt(s.length() - 1))) {
return s.substring(1, s.length() - 1);

View File

@ -72,21 +72,6 @@ public class UrlBuilder {
this.mode = mode;
}
// private static String multilineTooltip(String label) {
// final Pattern2 p = MyPattern.cmpile("(?i)^(" + URL_PATTERN + ")?(.*)$");
// final Matcher2 m = p.matcher(label);
// if (m.matches() == false) {
// return label;
// }
// String gr1 = m.group(1);
// if (gr1 == null) {
// return label;
// }
// final String gr2 = m.group(m.groupCount());
// gr1 = gr1.replaceAll("\\\\n", BackSlash.BS_N);
// return gr1 + gr2;
// }
public Url getUrl(String s) {
final Pattern2 p;
if (mode == ModeUrl.STRICT) {
@ -100,18 +85,18 @@ public class UrlBuilder {
if (m.matches() == false) {
return null;
}
// String url = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m.group(1));
// if (url.startsWith("http:") == false && url.startsWith("https:") == false) {
// // final String top = getSystem().getSkinParam().getValue("topurl");
// if (topurl != null) {
// url = topurl + url;
// }
// }
final String quotedPart = m.group(1);
final String full = m.group(2);
final int openBracket = full.indexOf('{');
final int closeBracket = full.lastIndexOf('}');
final String fullpp = m.group(2).replaceAll("\\{scale=([0-9.]+)\\}", "\uE000scale=$1\uE001");
final int openBracket = openBracketBeforeSpace(fullpp);
final int closeBracket;
if (openBracket == -1) {
closeBracket = -1;
} else {
closeBracket = fullpp.lastIndexOf('}');
}
final String full = fullpp.replace('\uE000', '{').replace('\uE001', '}');
if (quotedPart == null) {
if (openBracket != -1 && closeBracket != -1) {
return new Url(withTopUrl(full.substring(0, openBracket)),
@ -130,6 +115,27 @@ public class UrlBuilder {
return new Url(withTopUrl(quotedPart), null, null);
}
// private int openBracketBeforeSpace(final String full) {
// return full.indexOf('{');
// }
private int openBracketBeforeSpace(final String full) {
// final int firstSpace = full.indexOf(' ');
final int result = full.indexOf('{');
// if (result != -1 && full.substring(result).startsWith("{scale")) {
// return -1;
// }
// if (firstSpace == -1 || result == -1) {
// return result;
// }
// assert firstSpace >= 0;
// assert result >= 0;
// if (result > firstSpace + 1) {
// return -1;
// }
return result;
}
private String withTopUrl(String url) {
if (url.startsWith("http:") == false && url.startsWith("https:") == false && topurl != null) {
return topurl + url;

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.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.USymbol;
@ -61,34 +62,40 @@ public class ActivityDiagram extends CucaDiagram {
public ActivityDiagram(ISkinSimple skinParam) {
super(skinParam);
setNamespaceSeparator(null);
}
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
return getOrCreateLeafDefault(code, type, symbol);
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
checkNotNull(ident);
// final Ident idNewLong = buildLeafIdent(id);
return getOrCreateLeafDefault(ident, code, type, symbol);
}
private String getAutoBranch() {
return "#" + UniqueSequence.getValue();
}
public IEntity getOrCreate(Code code, Display display, LeafType type) {
public IEntity getOrCreate(Ident idNewLong, Code code, Display display, LeafType type) {
final IEntity result;
// final Ident idNewLong = buildLeafIdent(id);
if (leafExist(code)) {
result = getOrCreateLeafDefault(code, type, null);
result = getOrCreateLeafDefault(idNewLong, code, type, null);
if (result.getLeafType() != type) {
// throw new IllegalArgumentException("Already known: " + code + " " + result.getType() + " " + type);
return null;
}
} else {
result = createLeaf(code, display, type, null);
result = createLeaf(idNewLong, code, display, type, null);
}
updateLasts(result);
return result;
}
public void startIf(Code optionalCode) {
final IEntity br = createLeaf(optionalCode == null ? Code.of(getAutoBranch()) : optionalCode,
Display.create(""), LeafType.BRANCH, null);
public void startIf(String optionalCodeString) {
final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString;
final Ident idNewLong = buildLeafIdent(idShort);
final IEntity br = createLeaf(idNewLong, buildCode(idShort), Display.create(""),
LeafType.BRANCH, null);
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
}
@ -97,12 +104,14 @@ public class ActivityDiagram extends CucaDiagram {
}
public ILeaf getStart() {
return (ILeaf) getOrCreate(Code.of("start"), Display.getWithNewlines("start"), LeafType.CIRCLE_START);
return (ILeaf) getOrCreate(buildLeafIdent("start"), buildCode("start"),
Display.getWithNewlines("start"), LeafType.CIRCLE_START);
}
public ILeaf getEnd(String suppId) {
final Code code = suppId == null ? Code.of("end") : Code.of("end$" + suppId);
return (ILeaf) getOrCreate(code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
final String tmp = suppId == null ? "end" : "end$" + suppId;
final Code code = buildCode(tmp);
return (ILeaf) getOrCreate(buildLeafIdent(tmp), code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
}
private void updateLasts(final IEntity result) {
@ -116,14 +125,17 @@ public class ActivityDiagram extends CucaDiagram {
}
@Override
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
final ILeaf result = super.createLeaf(code, display, type, symbol);
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
checkNotNull(idNewLong);
final ILeaf result = super.createLeaf(idNewLong, code, display, type, symbol);
updateLasts(result);
return result;
}
public IEntity createNote(Code code, Display display) {
return super.createLeaf(code, display, LeafType.NOTE, null);
public IEntity createNote(Ident idNewLong, Code code, Display display) {
checkNotNull(idNewLong);
// final Ident idNewLong = buildLeafIdent(id);
return super.createLeaf(idNewLong, code, display, LeafType.NOTE, null);
}
final protected List<String> getDotStrings() {
@ -159,8 +171,10 @@ public class ActivityDiagram extends CucaDiagram {
public IEntity createInnerActivity() {
// Log.println("createInnerActivity A");
final Code code = Code.of("##" + UniqueSequence.getValue());
gotoGroup2(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
final String idShort = "##" + UniqueSequence.getValue();
final Code code = buildCode(idShort);
final Ident idNewLong = buildLeafIdent(idShort);
gotoGroup(idNewLong, code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
NamespaceStrategy.SINGLE);
final IEntity g = getCurrentGroup();
// g.setRankdir(Rankdir.LEFT_TO_RIGHT);
@ -177,12 +191,14 @@ public class ActivityDiagram extends CucaDiagram {
endGroup();
// Log.println("endgroup");
}
final String idShort = "##" + UniqueSequence.getValue();
// Log.println("concurrentActivity A name=" + name+" "+getCurrentGroup());
final Code code = Code.of("##" + UniqueSequence.getValue());
final Code code = buildCode(idShort);
if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) {
throw new IllegalStateException("type=" + getCurrentGroup().getGroupType());
}
gotoGroup2(code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(),
final Ident idNewLong = buildLeafIdent(idShort);
gotoGroup(idNewLong, code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(),
NamespaceStrategy.SINGLE);
lastEntityConsulted = null;
lastEntityBrancheConsulted = null;

View File

@ -48,7 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -107,7 +106,7 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
ifCode = null;
ifLabel = arg.get("IF2", 0);
}
diagram.startIf(Code.of(ifCode));
diagram.startIf(ifCode);
int lenght = 2;

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -182,82 +183,101 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
}
static IEntity getEntity(ActivityDiagram system, RegexResult arg, final boolean start) {
static IEntity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean start) {
final String suf = start ? "" : "2";
final String openBracket2 = arg.get("OPENBRACKET" + suf, 0);
if (openBracket2 != null) {
return system.createInnerActivity();
return diagram.createInnerActivity();
}
if (arg.get("STAR" + suf, 0) != null) {
final String suppId = arg.get("STAR" + suf, 1);
if (start) {
if (suppId != null) {
system.getStart().setTop(true);
diagram.getStart().setTop(true);
}
return system.getStart();
return diagram.getStart();
}
return system.getEnd(suppId);
return diagram.getEnd(suppId);
}
String partition = arg.get("PARTITION" + suf, 0);
if (partition != null) {
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
}
final Code code = Code.of(arg.get("CODE" + suf, 0));
if (code != null) {
final String idShort = arg.get("CODE" + suf, 0);
if (idShort != null) {
final Code code = diagram.buildCode(idShort);
if (partition != null) {
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup(), NamespaceStrategy.SINGLE);
final Ident idNewLong = diagram.buildLeafIdent(partition);
diagram.gotoGroup(idNewLong, diagram.buildCode(partition), Display.getWithNewlines(partition),
GroupType.PACKAGE, diagram.getRootGroup(), NamespaceStrategy.SINGLE);
}
final IEntity result = system.getOrCreate(code, Display.getWithNewlines(code),
CommandLinkActivity.getTypeIfExisting(system, code));
final LeafType type = getTypeIfExisting(diagram, code);
final IEntity result = diagram.getOrCreate(diagram.buildLeafIdent(idShort), code,
Display.getWithNewlines(code), type);
if (partition != null) {
system.endGroup();
diagram.endGroup();
}
return result;
}
final String bar = arg.get("BAR" + suf, 0);
if (bar != null) {
return system.getOrCreate(Code.of(bar), Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR);
return diagram.getOrCreate(diagram.buildLeafIdent(bar), diagram.buildCode(bar),
Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR);
}
final RegexPartialMatch quoted = arg.get("QUOTED" + suf);
if (quoted.get(0) != null) {
final Code quotedCode = Code.of(quoted.get(1) == null ? quoted.get(0) : quoted.get(1));
final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1);
final Code quotedCode = diagram.buildCode(quotedString);
if (partition != null) {
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup(), NamespaceStrategy.SINGLE);
final Ident idNewLong = diagram.buildLeafIdent(partition);
diagram.gotoGroup(idNewLong, diagram.buildCode(partition), Display.getWithNewlines(partition),
GroupType.PACKAGE, diagram.getRootGroup(), NamespaceStrategy.SINGLE);
}
final IEntity result = system.getOrCreate(quotedCode, Display.getWithNewlines(quoted.get(0)),
CommandLinkActivity.getTypeIfExisting(system, quotedCode));
final LeafType type = getTypeIfExisting(diagram, quotedCode);
final IEntity result = diagram.getOrCreate(diagram.buildLeafIdent(quotedString), quotedCode,
Display.getWithNewlines(quoted.get(0)), type);
if (partition != null) {
system.endGroup();
diagram.endGroup();
}
return result;
}
final Code quotedInvisible = Code.of(arg.get("QUOTED_INVISIBLE" + suf, 0));
if (quotedInvisible != null) {
final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0);
if (quoteInvisibleString != null) {
final Code quotedInvisible = diagram.buildCode(quoteInvisibleString);
if (partition != null) {
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
system.getRootGroup(), NamespaceStrategy.SINGLE);
final Ident idNewLong = diagram.buildLeafIdent(partition);
diagram.gotoGroup(idNewLong, diagram.buildCode(partition), Display.getWithNewlines(partition),
GroupType.PACKAGE, diagram.getRootGroup(), NamespaceStrategy.SINGLE);
}
final IEntity result = system.getOrCreate(quotedInvisible, Display.getWithNewlines(quotedInvisible),
LeafType.ACTIVITY);
final IEntity result = diagram.getOrCreate(diagram.buildLeafIdent(quoteInvisibleString), quotedInvisible,
Display.getWithNewlines(quotedInvisible), LeafType.ACTIVITY);
if (partition != null) {
system.endGroup();
diagram.endGroup();
}
return result;
}
final String first = arg.get("FIRST" + suf, 0);
if (first == null) {
return system.getLastEntityConsulted();
return diagram.getLastEntityConsulted();
}
return null;
}
static LeafType getTypeIfExisting(ActivityDiagram system, Code code) {
private static LeafType getTypeIfExisting(ActivityDiagram system, Ident ident) {
if (system.leafExist(ident)) {
final IEntity ent = system.getLeaf(ident);
if (ent.getLeafType() == LeafType.BRANCH) {
return LeafType.BRANCH;
}
}
return LeafType.ACTIVITY;
}
private static LeafType getTypeIfExisting(ActivityDiagram system, Code code) {
if (system.leafExist(code)) {
final IEntity ent = system.getLeafsget(code);
final IEntity ent = system.getLeaf(code);
if (ent.getLeafType() == LeafType.BRANCH) {
return LeafType.BRANCH;
}

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -166,7 +167,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
}
final String display = sb.toString();
final Code code = Code.of(lineLast.get(1) == null ? display : lineLast.get(1));
final String idShort = lineLast.get(1) == null ? display : lineLast.get(1);
final Code code = diagram.buildCode(idShort);
String partition = null;
if (lineLast.get(3) != null) {
@ -174,10 +176,12 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
}
if (partition != null) {
diagram.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null,
NamespaceStrategy.SINGLE);
final Ident idNewLong = diagram.buildLeafIdent(partition);
diagram.gotoGroup(idNewLong, diagram.buildCode(partition),
Display.getWithNewlines(partition), GroupType.PACKAGE, null, NamespaceStrategy.SINGLE);
}
final IEntity entity2 = diagram.getOrCreate(code, Display.getWithNewlines(display), LeafType.ACTIVITY);
final IEntity entity2 = diagram.getOrCreate(diagram.buildLeafIdent(idShort), code,
Display.getWithNewlines(display), LeafType.ACTIVITY);
if (entity2 == null) {
return CommandExecutionResult.error("No such entity");
}

View File

@ -50,6 +50,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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -84,9 +85,11 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0)));
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage,
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.gotoGroup(idNewLong, code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();

View File

@ -222,8 +222,10 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleabl
if (back != null) {
final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back))
.apply(new UTranslate(x2, 0));
background.draw(new URectangle(swimlane.getActualWidth(), dimensionFull.getHeight()
+ titleHeightTranslate.getDy()));
final URectangle rectangle = new URectangle(swimlane.getActualWidth(), dimensionFull.getHeight()
+ titleHeightTranslate.getDy());
rectangle.setIgnoreForCompression(true);
background.draw(rectangle);
}
full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane).apply(swimlane.getTranslate()).apply(

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@ -83,6 +84,14 @@ class FtileIfLongVertical extends AbstractFtile {
private final Rainbow arrowColor;
@Override
public Collection<Ftile> getMyChildren() {
final List<Ftile> result = new ArrayList<Ftile>(tiles);
result.add(tile2);
return Collections.unmodifiableList(result);
}
private FtileIfLongVertical(List<Ftile> diamonds, List<Ftile> tiles, Ftile tile2, Rainbow arrowColor,
Ftile lastDiamond) {
super(tiles.get(0).skinParam());

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.TextBlock;
@ -63,83 +64,81 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
super(skinParam);
}
private final String getNamespace(Code fullyCode) {
return getNamespace(fullyCode, fullyCode.getSeparator());
}
public final Code getShortName(Code code) {
final String separator = code.getSeparator();
private Code getShortName1972(Code code) {
final String separator = getNamespaceSeparator();
if (separator == null) {
throw new IllegalArgumentException();
}
final String codeString = code.getFullName();
final String namespace = getNamespace(code);
final String codeString = code.getName();
final String namespace = getNamespace1972(code, getNamespaceSeparator());
if (namespace == null) {
return Code.of(codeString, separator);
return buildCode(codeString);
}
return Code.of(codeString.substring(namespace.length() + separator.length()), separator);
return buildCode(codeString.substring(namespace.length() + separator.length()));
}
@Override
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
if (getNamespaceSeparator() != null) {
code = code.withSeparator(getNamespaceSeparator());
}
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
checkNotNull(ident);
if (type == null) {
code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
if (getNamespaceSeparator() == null) {
return getOrCreateLeafDefault(code, LeafType.CLASS, symbol);
return getOrCreateLeafDefault(ident, code, LeafType.CLASS, symbol);
}
code = getFullyQualifiedCode(code);
code = getFullyQualifiedCode1972(code);
if (super.leafExist(code)) {
return getOrCreateLeafDefault(code, LeafType.CLASS, symbol);
return getOrCreateLeafDefault(ident, code, LeafType.CLASS, symbol);
}
return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), LeafType.CLASS, symbol);
return createEntityWithNamespace1972(ident, code, Display.getWithNewlines(ident.getLast()), LeafType.CLASS,
symbol);
}
if (getNamespaceSeparator() == null) {
return getOrCreateLeafDefault(code, type, symbol);
return getOrCreateLeafDefault(ident, code, type, symbol);
}
code = getFullyQualifiedCode(code);
code = getFullyQualifiedCode1972(code);
if (super.leafExist(code)) {
return getOrCreateLeafDefault(code, type, symbol);
return getOrCreateLeafDefault(ident, code, type, symbol);
}
return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), type, symbol);
return createEntityWithNamespace1972(ident, code, Display.getWithNewlines(ident.getLast()), type, symbol);
}
@Override
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
if (getNamespaceSeparator() != null) {
code = code.withSeparator(getNamespaceSeparator());
}
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
checkNotNull(idNewLong);
if (type != LeafType.ABSTRACT_CLASS && type != LeafType.ANNOTATION && type != LeafType.CLASS
&& type != LeafType.INTERFACE && type != LeafType.ENUM && type != LeafType.LOLLIPOP_FULL
&& type != LeafType.LOLLIPOP_HALF && type != LeafType.NOTE) {
return super.createLeaf(code, display, type, symbol);
return super.createLeaf(idNewLong, code, display, type, symbol);
}
if (getNamespaceSeparator() == null) {
return super.createLeaf(code, display, type, symbol);
return super.createLeaf(idNewLong, code, display, type, symbol);
}
code = getFullyQualifiedCode(code);
code = getFullyQualifiedCode1972(code);
if (super.leafExist(code)) {
throw new IllegalArgumentException("Already known: " + code);
}
return createEntityWithNamespace(code, display, type, symbol);
return createEntityWithNamespace1972(idNewLong, code, display, type, symbol);
}
private ILeaf createEntityWithNamespace(Code fullyCode, Display display, LeafType type, USymbol symbol) {
private ILeaf createEntityWithNamespace1972(Ident id, Code fullyCode, Display display, LeafType type, USymbol symbol) {
checkNotNull(id);
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);
gotoGroupInternal(namespace2, Display.getWithNewlines(namespace), namespace2, GroupType.PACKAGE,
getRootGroup());
final String namespaceString = getNamespace1972(fullyCode, getNamespaceSeparator());
if (namespaceString != null
&& (EntityUtils.groupRoot(group) || group.getCodeGetName().equals(namespaceString) == false)) {
final Code namespace = buildCode(namespaceString);
final Display tmp = Display.getWithNewlines(namespaceString);
final Ident newIdLong = buildLeafIdentSpecial(namespaceString);
gotoGroupExternal(newIdLong, namespace, tmp, namespace, GroupType.PACKAGE, getRootGroup());
}
final ILeaf result = createLeafInternal(
fullyCode,
Display.isNull(display) ? Display.getWithNewlines(getShortName(fullyCode)).withCreoleMode(
CreoleMode.SIMPLE_LINE) : display, type, symbol);
final Display tmpDisplay;
if (Display.isNull(display)) {
tmpDisplay = Display.getWithNewlines(getShortName1972(fullyCode)).withCreoleMode(CreoleMode.SIMPLE_LINE);
} else {
tmpDisplay = display;
}
final ILeaf result = createLeafInternal(id, fullyCode, tmpDisplay, type, symbol);
gotoThisGroup(backupCurrentGroup);
return result;
}
@ -149,8 +148,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
if (getNamespaceSeparator() == null) {
return super.leafExist(code);
}
code = code.withSeparator(getNamespaceSeparator());
return super.leafExist(getFullyQualifiedCode(code));
return super.leafExist(getFullyQualifiedCode1972(code));
}
@Override
@ -198,7 +196,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
private RowLayout getRawLayout(int raw) {
final RowLayout rawLayout = new RowLayout();
for (ILeaf leaf : entityFactory.getLeafsvalues()) {
for (ILeaf leaf : entityFactory.leafs()) {
if (leaf.getRawLayout() == raw) {
rawLayout.addLeaf(getEntityImageClass(leaf));
}

View File

@ -64,12 +64,14 @@ public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram system, LineLocation location, RegexResult arg) {
final IEntity entity = system.getOrCreateLeaf(Code.of(arg.get("NAME", 0)), null, null);
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final String idShort = arg.get("NAME", 0);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort),
diagram.buildCode(idShort), null, null);
final String field = arg.get("DATA", 0);
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {
system.setVisibilityModifierPresent(true);
diagram.setVisibilityModifierPresent(true);
}
entity.getBodier().addFieldOrMethod(field, entity);
return CommandExecutionResult.ok();

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@ -125,7 +126,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
final Code code = Code.of(arg.getLazzy("CODE", 0)).eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0), "\"([:");
final Code code = diagram.buildCode(idShort);
final String display = arg.getLazzy("DISPLAY", 0);
final String genericOption = arg.getLazzy("DISPLAY", 1);
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
@ -133,12 +135,13 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
final String stereotype = arg.get("STEREO", 0);
final ILeaf entity;
if (diagram.leafExist(code)) {
entity = diagram.getOrCreateLeaf(code, type, null);
entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, type, null);
if (entity.muteToType(type, null) == false) {
return CommandExecutionResult.error("Bad name");
}
} else {
entity = diagram.createLeaf(code, Display.getWithNewlines(display), type, null);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
}
if (stereotype != null) {
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
@ -188,7 +191,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
// public static void manageExtends(ClassDiagram system, RegexResult arg, final IEntity entity) {
// if (arg.get("EXTENDS", 1) != null) {
// final Mode mode = arg.get("EXTENDS", 1).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;
// final Code other = Code.of(arg.get("EXTENDS", 2));
// final Code other = diagram.buildCode(arg.get("EXTENDS", 2));
// LeafType type2 = LeafType.CLASS;
// if (mode == Mode.IMPLEMENTS) {
// type2 = LeafType.INTERFACE;

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -205,8 +206,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
}
final String codes = arg.get(keyword, 1);
for (String s : codes.split(",")) {
final Code other = Code.of(StringUtils.trin(s));
final IEntity cl2 = diagram.getOrCreateLeaf(other, type2, null);
final String idShort = StringUtils.trin(s);
final Code other = diagram.buildCode(idShort);
final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), other, type2, null);
LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS);
if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE) {
typeLink = typeLink.goDashed();
@ -228,7 +230,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false);
}
final Code code = Code.of(arg.getLazzy("CODE", 0)).eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0),
"\"([:");
final Code code = diagram.buildCode(idShort);
final String display = arg.getLazzy("DISPLAY", 0);
final String genericOption = arg.getLazzy("DISPLAY", 1);
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
@ -237,12 +241,13 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
final ILeaf result;
if (diagram.leafExist(code)) {
result = diagram.getOrCreateLeaf(code, null, null);
result = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, null, null);
if (result.muteToType(type, null) == false) {
return null;
}
} else {
result = diagram.createLeaf(code, Display.getWithNewlines(display), type, null);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
result = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
}
result.setVisibilityModifier(visibilityModifier);
if (stereotype != null) {

View File

@ -176,7 +176,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
if (symbol == null) {
type = LeafType.DESCRIPTION;
usymbol = USymbol.ACTOR;
usymbol = diagram.getSkinParam().getActorStyle().getUSymbol();
} else if (symbol.equalsIgnoreCase("usecase")) {
type = LeafType.USECASE;
usymbol = null;
@ -185,20 +185,21 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
usymbol = null;
} else {
type = LeafType.DESCRIPTION;
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().useUml2ForComponent());
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam());
if (usymbol == null) {
throw new IllegalStateException();
}
}
final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw));
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Code code = diagram.buildCode(idShort);
String display = displayRaw;
if (display == null) {
display = code.getFullName();
display = code.getName();
}
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
final IEntity entity = diagram.getOrCreateLeaf(code, type, usymbol);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, type, usymbol);
entity.setDisplay(Display.getWithNewlines(display));
entity.setUSymbol(usymbol);
if (stereotype != null) {

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram> {
@ -63,11 +64,13 @@ public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram>
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(arg.get("CODE", 0));
final String idShort = arg.get("CODE", 0);
final Code code = diagram.buildCode(idShort);
if (diagram.leafExist(code)) {
return CommandExecutionResult.error("Already existing : " + code.getFullName());
return CommandExecutionResult.error("Already existing : " + code.getName());
}
diagram.createLeaf(code, Display.NULL, LeafType.ASSOCIATION, null);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.createLeaf(idNewLong, code, Display.NULL, LeafType.ASSOCIATION, null);
return CommandExecutionResult.ok();
}

View File

@ -136,7 +136,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else if (arg1.startsWith("<<")) {
gender = EntityGenderUtils.byStereotype(arg1);
} else {
final IEntity entity = diagram.getOrCreateLeaf(Code.of(arg1), null, null);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(arg1),
diagram.buildCode(arg1), null, null);
gender = EntityGenderUtils.byEntityAlone(entity);
}
@ -144,7 +145,7 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeClassDiagram(AbstractClassOrObjectDiagram classDiagram, RegexResult arg) {
private CommandExecutionResult executeClassDiagram(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final EntityPortion portion = getEntityPortion(arg.get("PORTION", 0));
@ -167,7 +168,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else if (arg1.startsWith("<<")) {
gender = EntityGenderUtils.byStereotype(arg1);
} else {
final IEntity entity = classDiagram.getOrCreateLeaf(Code.of(arg1), null, null);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(arg1),
diagram.buildCode(arg1), null, null);
gender = EntityGenderUtils.byEntityAlone(entity);
}
if (gender != null) {
@ -176,17 +178,17 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
if (empty == true && emptyMembers == false) {
gender = EntityGenderUtils.and(gender, emptyByGender(portion));
}
if (EntityUtils.groupRoot(classDiagram.getCurrentGroup()) == false) {
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(classDiagram.getCurrentGroup()));
if (EntityUtils.groupRoot(diagram.getCurrentGroup()) == false) {
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
}
if (emptyMembers) {
classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)), EntityPortion.FIELD, arg
.get("COMMAND", 0).equalsIgnoreCase("show"));
classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.METHOD)), EntityPortion.METHOD,
arg.get("COMMAND", 0).equalsIgnoreCase("show"));
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)),
EntityPortion.FIELD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.METHOD)),
EntityPortion.METHOD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
} else {
classDiagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
diagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
}
}
return CommandExecutionResult.ok();

View File

@ -66,7 +66,7 @@ public class CommandHideShowSpecificClass extends SingleLineCommand2<CucaDiagram
// } else if (codeString.equals("interface")) {
// diagram.hideOrShow(LeafType.INTERFACE, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
// } else {
// final Code code = Code.of(codeString);
// final Code code = diagram.buildCode(codeString);
// IEntity hidden = diagram.getEntityFactory().getLeafsget(code);
// if (hidden == null) {
// hidden = diagram.getEntityFactory().getGroupsget(code);

View File

@ -108,11 +108,12 @@ public class CommandImport extends SingleLineCommand2<ClassDiagram> {
private void includeFileJava(ClassDiagram diagram, final File f) throws IOException {
final JavaFile javaFile = new JavaFile(f);
for (JavaClass cl : javaFile.getJavaClasses()) {
final Code name = Code.of(cl.getName());
final IEntity ent1 = diagram.getOrCreateLeaf(name, cl.getType(), null);
final String idShort = cl.getName();
final Code name = diagram.buildCode(idShort);
final IEntity ent1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), name, cl.getType(), null);
for (String p : cl.getParents()) {
final IEntity ent2 = diagram.getOrCreateLeaf(Code.of(p), cl.getParentType(), null);
final IEntity ent2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(p), diagram.buildCode(p), cl.getParentType(), null);
final Link link = new Link(ent2, ent1, new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS), Display.NULL,
2, diagram.getSkinParam().getCurrentStyleBuilder());
diagram.addLink(link);

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -127,66 +128,48 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
return "(?:\\.|::|\\\\|\\\\\\\\)";
}
// private static String optionalKeywords(UmlDiagramType type) {
// if (type == UmlDiagramType.CLASS) {
// return "(interface|enum|annotation|abstract[%s]+class|abstract|class|object|entity)";
// }
// if (type == UmlDiagramType.OBJECT) {
// return "(object)";
// }
// throw new IllegalArgumentException();
// }
//
// private LeafType getTypeIfObject(String type) {
// if ("object".equalsIgnoreCase(type)) {
// return LeafType.OBJECT;
// }
// return null;
// }
@Override
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) {
Code ent1 = Code.of(arg.get("ENT1", 0));
Code ent2 = Code.of(arg.get("ENT2", 0));
if (ent1 == null && ent2 == null) {
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
if (ent1String == null && ent2String == null) {
return executeArgSpecial3(diagram, arg);
}
if (ent1 == null) {
if (ent1String == null) {
return executeArgSpecial1(diagram, arg);
}
if (ent2 == null) {
if (ent2String == null) {
return executeArgSpecial2(diagram, arg);
}
ent1 = ent1.eventuallyRemoveStartingAndEndingDoubleQuote("\"");
ent2 = ent2.eventuallyRemoveStartingAndEndingDoubleQuote("\"");
if (isGroupButNotTheCurrentGroup(diagram, ent1) && isGroupButNotTheCurrentGroup(diagram, ent2)) {
Code code1 = diagram.buildCode(ent1String);
Code code2 = diagram.buildCode(ent2String);
Ident ident1 = diagram.buildLeafIdent(ent1String);
Ident ident2 = diagram.buildLeafIdent(ent2String);
if (isGroupButNotTheCurrentGroup(diagram, code1, ident1)
&& isGroupButNotTheCurrentGroup(diagram, code2, ident2)) {
return executePackageLink(diagram, arg);
}
String port1 = null;
String port2 = null;
if (removeMemberPart(diagram, ent1) != null) {
port1 = ent1.getPortMember();
ent1 = removeMemberPart(diagram, ent1);
if (removeMemberPart(diagram, ident1) != null) {
port1 = ident1.getPortMember();
code1 = removeMemberPart(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (removeMemberPart(diagram, ent2) != null) {
port2 = ent2.getPortMember();
ent2 = removeMemberPart(diagram, ent2);
if (removeMemberPart(diagram, ident2) != null) {
port2 = ident2.getPortMember();
code2 = removeMemberPart(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
final IEntity cl1 = isGroupButNotTheCurrentGroup(diagram, ent1) ? diagram.getGroup(Code.of(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""))) : diagram.getOrCreateLeaf(
ent1, null, null);
final IEntity cl2 = isGroupButNotTheCurrentGroup(diagram, ent2) ? diagram.getGroup(Code.of(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""))) : diagram.getOrCreateLeaf(
ent2, null, null);
// Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final IEntity cl1 = getFoo1(diagram, code1, ident1);
final IEntity cl2 = getFoo1(diagram, code2, ident2);
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
@ -277,33 +260,36 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
return CommandExecutionResult.ok();
}
private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code) {
if (diagram.getCurrentGroup().getCode().equals(code)) {
private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) {
if (isGroupButNotTheCurrentGroup(diagram, code, ident)) {
final Code tap = ident.toCode();
return diagram.getGroup(tap);
}
return diagram.getOrCreateLeaf(ident, code, null, null);
}
private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) {
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName())) {
return false;
}
return diagram.isGroup(code);
}
private Code removeMemberPart(AbstractClassOrObjectDiagram diagram, Code code) {
if (diagram.leafExist(code)) {
private Code removeMemberPart(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExist(ident)) {
return null;
}
final Code before = code.removeMemberPart();
if (before == null) {
final Ident before2 = ident.removeMemberPart();
if (before2 == null) {
return null;
}
final Code before = before2.toCode();
if (diagram.leafExist(before) == false) {
return null;
}
return before;
}
// private CommandExecutionResult executeLinkFields(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
// System.err.println("field1=" + arg.get("ENT1", 1));
// System.err.println("field2=" + arg.get("ENT2", 1));
// return CommandExecutionResult.error("not working yet");
// }
private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) {
diagram.addLink(link);
if (weight == null) {
@ -327,10 +313,10 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final IEntity cl1 = diagram.getGroup(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(
arg.get("ENT1", 0), "\"")));
final IEntity cl2 = diagram.getGroup(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(
arg.get("ENT2", 0), "\"")));
final IEntity cl1 = diagram.getGroup(diagram.buildCode(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"")));
final IEntity cl2 = diagram.getGroup(diagram.buildCode(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"")));
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
@ -357,8 +343,10 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final Code clName1A = Code.of(arg.get("COUPLE1", 0));
final Code clName1B = Code.of(arg.get("COUPLE1", 1));
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final Code clName1A = diagram.buildCode(name1A);
final Code clName1B = diagram.buildCode(name1B);
if (diagram.leafExist(clName1A) == false) {
return CommandExecutionResult.error("No class " + clName1A);
}
@ -366,13 +354,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
return CommandExecutionResult.error("No class " + clName1B);
}
final Code ent2 = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""));
final IEntity cl2 = diagram.getOrCreateLeaf(ent2, null, null);
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final Code ent2 = diagram.buildCode(idShort);
final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent2, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(1, clName1A, clName1B, cl2, linkType, label);
final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label);
if (result == false) {
return CommandExecutionResult.error("Cannot have more than 2 assocications");
}
@ -381,10 +370,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final Code clName1A = Code.of(arg.get("COUPLE1", 0));
final Code clName1B = Code.of(arg.get("COUPLE1", 1));
final Code clName2A = Code.of(arg.get("COUPLE2", 0));
final Code clName2B = Code.of(arg.get("COUPLE2", 1));
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Code clName1A = diagram.buildCode(name1A);
final Code clName1B = diagram.buildCode(name1B);
final Code clName2A = diagram.buildCode(name2A);
final Code clName2B = diagram.buildCode(name2B);
if (diagram.leafExist(clName1A) == false) {
return CommandExecutionResult.error("No class " + clName1A);
}
@ -401,12 +394,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
return diagram.associationClass(clName1A, clName1B, clName2A, clName2B, linkType, label);
return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label);
}
private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final Code clName2A = Code.of(arg.get("COUPLE2", 0));
final Code clName2B = Code.of(arg.get("COUPLE2", 1));
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Code clName2A = diagram.buildCode(name2A);
final Code clName2B = diagram.buildCode(name2B);
if (diagram.leafExist(clName2A) == false) {
return CommandExecutionResult.error("No class " + clName2A);
}
@ -414,13 +409,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
return CommandExecutionResult.error("No class " + clName2B);
}
final Code ent1 = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""));
final IEntity cl1 = diagram.getOrCreateLeaf(ent1, null, null);
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final Code ent1 = diagram.buildCode(idShort);
final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent1, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(2, clName2A, clName2B, cl1, linkType, label);
final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label);
if (result == false) {
return CommandExecutionResult.error("Cannot have more than 2 assocications");
}

View File

@ -51,6 +51,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -113,8 +114,10 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) {
final Code ent1 = Code.of(arg.get("ENT1", 1));
final Code ent2 = Code.of(arg.get("ENT2", 1));
final String ent1 = arg.get("ENT1", 1);
final String ent2 = arg.get("ENT2", 1);
final Code ent1code = diagram.buildCode(ent1);
final Code ent2code = diagram.buildCode(ent2);
final IEntity cl1;
final IEntity cl2;
@ -123,13 +126,15 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
final String suffix = "lol" + UniqueSequence.getValue();
if (arg.get("LOL_THEN_ENT", 1) == null) {
assert arg.get("ENT_THEN_LOL", 0) != null;
cl1 = diagram.getOrCreateLeaf(ent1, null, null);
cl2 = diagram.createLeaf(cl1.getCode().addSuffix(suffix), Display.getWithNewlines(ent2),
cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent1), ent1code, null, null);
final Ident idNewLong = diagram.buildLeafIdent(ent1 + suffix);
cl2 = diagram.createLeaf(idNewLong, idNewLong.toCode(), Display.getWithNewlines(ent2code),
getType(arg.get("ENT_THEN_LOL", 1)), null);
normalEntity = cl1;
} else {
cl2 = diagram.getOrCreateLeaf(ent2, null, null);
cl1 = diagram.createLeaf(cl2.getCode().addSuffix(suffix), Display.getWithNewlines(ent1),
cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent2), ent2code, null, null);
final Ident idNewLong = diagram.buildLeafIdent(ent2 + suffix);
cl1 = diagram.createLeaf(idNewLong, idNewLong.toCode(), Display.getWithNewlines(ent1code),
getType(arg.get("LOL_THEN_ENT", 0)), null);
normalEntity = cl2;
}

View File

@ -64,9 +64,10 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(arg.get("NAME", 0));
final String name = arg.get("NAME", 0);
final Code code = diagram.buildCode(name);
final String stereotype = arg.get("STEREO", 0);
final IEntity entity = diagram.getOrCreateLeaf(code, null, null);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, null, null);
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
.getIHtmlColorSet()));

View File

@ -72,11 +72,12 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(arg.get("CODE", 0));
final String idShort = arg.get("CODE", 0);
final Code code = diagram.buildCode(idShort);
final String urlString = arg.get("URL", 0);
final IEntity entity;
if (diagram.leafExist(code)) {
entity = diagram.getOrCreateLeaf(code, null, null);
entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, null, null);
} else if (diagram.isGroup(code)) {
entity = diagram.getGroup(code);
} else {

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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -77,10 +78,12 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(arg.get("NAME", 0));
final String idShort = arg.get("NAME", 0);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
final Display display = Display.getWithNewlines(code);
diagram.gotoGroup2(code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {

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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -85,11 +86,13 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(arg.get("NAME", 0));
final String idShort = arg.get("NAME", 0);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
final String disp = arg.getLazzy("DISPLAY", 0);
final Display display = Display.getWithNewlines(disp);
diagram.gotoGroup2(code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {

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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -80,10 +81,12 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
final Code code = Code.of(arg.get("NAME", 0));
final String idShort = arg.get("NAME", 0);
final Code code = diagram.buildCode(idShort);
final IGroup currentPackage = diagram.getCurrentGroup();
final Display display = Display.getWithNewlines(code);
diagram.gotoGroup2(code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {

View File

@ -52,6 +52,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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@ -102,30 +103,35 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final Code code;
final String idShort;
final String display;
final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
if (arg.get("AS", 0) == null) {
if (name.length() == 0) {
code = Code.of("##" + UniqueSequence.getValue());
idShort = "##" + UniqueSequence.getValue();
code = diagram.buildCode(idShort);
display = null;
} else {
code = Code.of(name);
display = code.getFullName();
idShort = name;
code = diagram.buildCode(idShort);
display = code.getName();
}
} else {
display = name;
code = Code.of(arg.get("AS", 0));
idShort = arg.get("AS", 0);
code = diagram.buildCode(idShort);
}
final IGroup currentPackage = diagram.getCurrentGroup();
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
final Ident idNewLong = diagram.buildLeafIdentSpecial(idShort);
diagram.gotoGroup(idNewLong, 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));
final USymbol type = USymbol.getFromString(arg.get("TYPE", 0), diagram.getSkinParam().getActorStyle());
if (type == USymbol.TOGETHER) {
p.setUSymbol(type);
} else if (stereotype != null) {
final USymbol usymbol = USymbol.getFromString(stereotype);
final USymbol usymbol = USymbol.getFromString(stereotype, diagram.getSkinParam().getActorStyle());
if (usymbol == null) {
p.setStereotype(new Stereotype(stereotype));
} else {

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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.utils.UniqueSequence;
@ -82,21 +83,26 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
final Code code;
final String idShort;
final String display;
if (arg.get("CODE", 0) == null) {
if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)).length() == 0) {
code = Code.of("##" + UniqueSequence.getValue());
idShort = "##" + UniqueSequence.getValue();
code = diagram.buildCode(idShort);
display = null;
} else {
code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)));
display = code.getFullName();
idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0));
code = diagram.buildCode(idShort);
display = code.getName();
}
} else {
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0));
code = Code.of(arg.get("CODE", 0));
idShort = arg.get("CODE", 0);
code = diagram.buildCode(idShort);
}
final IGroup currentPackage = diagram.getCurrentGroup();
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.gotoGroup(idNewLong, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
final String color = arg.get("COLOR", 0);

View File

@ -52,8 +52,10 @@ import net.sourceforge.plantuml.command.regex.IRegex;
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.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -96,7 +98,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
return "(?i)^[%s]*end[%s]?note$";
}
public final CommandExecutionResult executeNow(final ActivityDiagram system, BlocLines lines) {
public final CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) {
// StringUtils.trim(lines, true);
final RegexResult arg = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
lines = lines.subExtract(1, 1);
@ -106,7 +108,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
Url url = null;
if (strings.size() > 0) {
final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"),
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"),
ModeUrl.STRICT);
url = urlBuilder.getUrl(strings.get(0).toString());
}
@ -116,11 +118,14 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
// final String s = StringUtils.getMergedLines(strings);
final IEntity note = system.createLeaf(UniqueSequence.getCode("GMN"), strings, LeafType.NOTE, null);
final String code = UniqueSequence.getString("GMN");
final Ident idNewLong = diagram.buildLeafIdent(code);
final IEntity note = diagram.createLeaf(idNewLong, diagram.buildCode(code),
strings, LeafType.NOTE, null);
if (url != null) {
note.addUrl(url);
}
return executeInternal(system, arg, note);
return executeInternal(diagram, arg, note);
}
};
}
@ -129,11 +134,13 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
return new SingleLineCommand2<ActivityDiagram>(getRegexConcatSingleLine()) {
@Override
protected CommandExecutionResult executeArg(final ActivityDiagram system, LineLocation location,
protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location,
RegexResult arg) {
final IEntity note = system.createNote(UniqueSequence.getCode("GN"),
final String tmp = UniqueSequence.getString("GN");
final Ident idNewLong = diagram.buildLeafIdent(tmp);
final IEntity note = diagram.createNote(idNewLong, diagram.buildCode(tmp),
Display.getWithNewlines(arg.get("NOTE", 0)));
return executeInternal(system, arg, note);
return executeInternal(diagram, arg, note);
}
};
}

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -125,11 +126,13 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
}
private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display) {
final Code code = Code.of(arg.get("CODE", 0));
final String idShort = arg.get("CODE", 0);
final Code code = diagram.buildCode(idShort);
if (diagram.leafExist(code)) {
return CommandExecutionResult.error("Note already created: " + code.getFullName());
return CommandExecutionResult.error("Note already created: " + code.getName());
}
final IEntity entity = diagram.createLeaf(code, display.toDisplay(), LeafType.NOTE, null);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
final IEntity entity = diagram.createLeaf(idNewLong, code, display.toDisplay(), LeafType.NOTE, null);
assert entity != null;
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));

View File

@ -57,6 +57,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -197,21 +198,26 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
final String pos = line0.get("POSITION", 0);
final Code code = Code.of(line0.get("ENTITY", 0));
final String idShort = line0.get("ENTITY", 0);
final IEntity cl1;
if (code == null) {
if (idShort == null) {
cl1 = diagram.getLastEntity();
if (cl1 == null) {
return CommandExecutionResult.error("Nothing to note to");
}
} else if (diagram.isGroup(code)) {
cl1 = diagram.getGroup(code);
} else {
cl1 = diagram.getOrCreateLeaf(code, null, null);
final Code code = diagram.buildCode(idShort);
if (diagram.isGroup(code)) {
cl1 = diagram.getGroup(code);
} else {
cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, null, null);
}
}
final IEntity note = diagram
.createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null);
final String tmp = UniqueSequence.getString("GMN");
final Ident idNewLong = diagram.buildLeafIdent(tmp);
final IEntity note = diagram.createLeaf(idNewLong, diagram.buildCode(tmp), strings.toDisplay(), LeafType.NOTE,
null);
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
note.setColors(colors);

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -143,19 +144,22 @@ public final class FactoryTipOnEntityCommand implements SingleMultiFactoryComman
final String pos = line0.get("POSITION", 0);
final Code code = Code.of(line0.get("ENTITY", 0));
final String idShort = line0.get("ENTITY", 0);
final Code codeShort = diagram.buildCode(idShort);
final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1));
if (code == null) {
if (codeShort == null) {
return CommandExecutionResult.error("Nothing to note to");
}
final IEntity cl1 = diagram.getOrCreateLeaf(code, null, null);
final Ident identShort = diagram.buildLeafIdent(idShort);
final IEntity cl1 = diagram.getOrCreateLeaf(identShort, codeShort, null, null);
final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir(
diagram.getSkinParam().getRankdir());
final Code codeTip = code.addSuffix("$$$" + position.name());
IEntity tips = diagram.getLeafsget(codeTip);
final Ident identTip = diagram.buildLeafIdent(idShort + "$$$" + position.name());
IEntity tips = diagram.getLeaf(identTip);
if (tips == null) {
tips = diagram.getOrCreateLeaf(codeTip, LeafType.TIPS, null);
// final Code codeTip = codeShort.addSuffix("$$$" + position.name());
tips = diagram.getOrCreateLeaf(identTip, identTip.toCode(), LeafType.TIPS, null);
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
final Link link;
if (position == Position.RIGHT) {

View File

@ -61,27 +61,7 @@ public abstract class MyPattern {
}
private static String transformAndCheck(String p) {
// if (p.contains("\\s")) {
// Thread.dumpStack();
// System.err.println(p);
// System.exit(0);
// }
// if (p.contains("'")) {
// Thread.dumpStack();
// System.err.println(p);
// System.exit(0);
// }
// if (p.contains("\"")) {
// Thread.dumpStack();
// System.err.println(p);
// System.exit(0);
// }
p = transform(p);
// if (p.contains(" ") || p.contains("%")) {
// Thread.dumpStack();
// System.err.println(p);
// System.exit(0);
// }
return p;
}
@ -93,10 +73,6 @@ public abstract class MyPattern {
return p;
}
// public static boolean mtches(String input, String regex) {
// return cmpile(regex).matcher(input).matches();
// }
//
public static boolean mtches(CharSequence input, String regex) {
return cmpile(regex).matcher(input).matches();
}

View File

@ -77,17 +77,6 @@ public class RegexLeaf implements IRegex {
public RegexLeaf(String name, String regex) {
this.pattern = regex;
this.name = name;
// unknow=(left[%s]to[%s]right|top[%s]to[%s]bottom)
// unknow=is off on
// unknow=(-+)\>
// unknow=\[([^\[\]]+?)\]
// unknow=([*]+)
// if (regex.equals("([*]+)") || regex.equals("\\[([^\\[\\]]+?)\\]") || regex.equals("(-+)\\>")
// || regex.equals("is off on")) {
// Thread.dumpStack();
// System.exit(0);
// }
}
@Override

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.USymbol;
@ -50,14 +51,16 @@ public class CompositeDiagram extends AbstractEntityDiagram {
}
@Override
public IEntity getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
public IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
checkNotNull(ident);
// final Ident idNewLong = buildLeafIdent(id);
if (type == null) {
if (isGroup(code)) {
return getGroup(code);
}
return getOrCreateLeafDefault(code, LeafType.BLOCK, symbol);
return getOrCreateLeafDefault(ident, code, LeafType.BLOCK, symbol);
}
return getOrCreateLeafDefault(code, type, symbol);
return getOrCreateLeafDefault(ident, code, type, symbol);
}
@Override

View File

@ -71,11 +71,12 @@ public class CommandCreateBlock extends SingleLineCommand2<CompositeDiagram> {
@Override
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
String display = arg.get("DISPLAY", 0);
final Code code = Code.of(arg.get("CODE", 0));
final String idShort = arg.get("CODE", 0);
final Code code = diagram.buildCode(idShort);
if (display == null) {
display = code.getFullName();
display = code.getName();
}
final IEntity ent = diagram.getOrCreateLeaf(code, null, null);
final IEntity ent = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, null, null);
ent.setDisplay(Display.getWithNewlines(display));
return CommandExecutionResult.ok();
}

View File

@ -48,6 +48,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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
public class CommandCreatePackageBlock extends SingleLineCommand2<CompositeDiagram> {
@ -75,11 +76,13 @@ public class CommandCreatePackageBlock extends SingleLineCommand2<CompositeDiagr
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
final IGroup currentPackage = diagram.getCurrentGroup();
String display = arg.get("DISPLAY", 0);
final Code code = Code.of(arg.get("CODE", 0));
final String idShort = arg.get("CODE", 0);
final Code code = diagram.buildCode(idShort);
if (display == null) {
display = code.getFullName();
display = code.getName();
}
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.gotoGroup(idNewLong, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
return CommandExecutionResult.ok();
}

View File

@ -76,8 +76,12 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
@Override
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
final IEntity cl1 = diagram.getOrCreateLeaf(Code.of(arg.get("ENT1", 0)), null, null);
final IEntity cl2 = diagram.getOrCreateLeaf(Code.of(arg.get("ENT2", 0)), null, null);
final String ent1 = arg.get("ENT1", 0);
final String ent2 = arg.get("ENT2", 0);
final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent1),
diagram.buildCode(ent1), null, null);
final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent2),
diagram.buildCode(ent2), null, null);
final String deco1 = arg.get("DECO1", 0);
final String deco2 = arg.get("DECO2", 0);
@ -91,7 +95,8 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
final String queue = arg.get("QUEUE", 0);
final Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length(), diagram.getSkinParam().getCurrentStyleBuilder());
final Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length(),
diagram.getSkinParam().getCurrentStyleBuilder());
diagram.addLink(link);
return CommandExecutionResult.ok();
}

View File

@ -35,97 +35,9 @@
*/
package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.StringUtils;
public interface Code {
public class Code implements Comparable<Code> {
private final String fullName;
private final String separator;
private Code(String fullName, String separator) {
if (fullName == null) {
throw new IllegalArgumentException();
}
this.fullName = fullName;
this.separator = separator;
}
public Code removeMemberPart() {
final int x = fullName.lastIndexOf("::");
if (x == -1) {
return null;
}
return new Code(fullName.substring(0, x), separator);
}
public String getPortMember() {
final int x = fullName.lastIndexOf("::");
if (x == -1) {
return null;
}
return fullName.substring(x + 2);
}
public Code withSeparator(String separator) {
if (separator == null) {
throw new IllegalArgumentException();
}
if (this.separator != null && this.separator.equals(separator) == false) {
throw new IllegalStateException();
}
return new Code(fullName, separator);
}
public static Code of(String code) {
return of(code, null);
}
public static Code of(String code, String separator) {
if (code == null) {
return null;
}
return new Code(code, separator);
}
public final String getFullName() {
return fullName;
}
@Override
public String toString() {
return fullName + "(" + separator + ")";
}
@Override
public int hashCode() {
return fullName.hashCode();
}
@Override
public boolean equals(Object obj) {
final Code other = (Code) obj;
return this.fullName.equals(other.fullName);
}
public Code addSuffix(String suffix) {
return new Code(fullName + suffix, separator);
}
public int compareTo(Code other) {
return this.fullName.compareTo(other.fullName);
}
public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format) {
return Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(fullName, format), separator);
}
public final String getSeparator() {
return separator;
}
public String getLastPart() {
final int x = this.fullName.lastIndexOf(separator);
return this.fullName.substring(x + separator.length());
}
public String getName();
public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format);
}

View File

@ -36,57 +36,49 @@
package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
public class LongCode implements Comparable<LongCode> {
public class CodeImpl implements Code {
private final String fullName;
private final String separator;
private final String name;
private LongCode(String fullName, String separator) {
if (fullName == null) {
private CodeImpl(String name) {
if (name == null) {
throw new IllegalArgumentException();
}
this.fullName = fullName;
this.separator = separator;
this.name = name;
}
public String getNamespaceSeparator() {
return separator;
}
public static LongCode of(String code, String separator) {
public static Code of(String code) {
if (code == null) {
throw new IllegalStateException();
EntityFactory.bigError();
}
return new LongCode(code, separator);
return new CodeImpl(code);
}
public final String getFullName() {
return fullName;
public final String getName() {
return name;
}
@Override
public String toString() {
return fullName + "(" + separator + ")";
return name;
}
@Override
public int hashCode() {
return fullName.hashCode();
return name.hashCode();
}
@Override
public boolean equals(Object obj) {
final LongCode other = (LongCode) obj;
return this.fullName.equals(other.fullName);
final CodeImpl other = (CodeImpl) obj;
return this.name.equals(other.name);
}
public int compareTo(LongCode other) {
return this.fullName.compareTo(other.fullName);
}
private LongCode eventuallyRemoveStartingAndEndingDoubleQuote() {
return LongCode.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(fullName), separator);
public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format) {
return CodeImpl.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(getName(), format));
}
}

View File

@ -75,14 +75,25 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
private final List<HideOrShow2> removed = new ArrayList<HideOrShow2>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed);
private IGroup currentGroup = entityFactory.getRootGroup();
private List<Ident> stacks2 = new ArrayList<Ident>();
private List<IGroup> stacks = new ArrayList<IGroup>();
private boolean visibilityModifierPresent;
public abstract IEntity getOrCreateLeaf(Code code, LeafType type, USymbol symbol);
public abstract IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol);
public CucaDiagram(ISkinSimple orig) {
super(orig);
this.stacks2.add(Ident.empty());
}
private Ident getLastID() {
if (stacks2.size() == 0) {
// Thread.dumpStack();
return Ident.empty();
// throw new IllegalArgumentException();
}
return this.stacks2.get(stacks2.size() - 1);
}
private String namespaceSeparator = ".";
@ -102,7 +113,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return true;
}
}
for (IEntity entity : entityFactory.getLeafsvalues()) {
for (IEntity entity : entityFactory.leafs()) {
if (entity.hasUrl()) {
return true;
}
@ -115,13 +126,14 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return false;
}
final protected ILeaf getOrCreateLeafDefault(Code code, LeafType type, USymbol symbol) {
final protected ILeaf getOrCreateLeafDefault(Ident idNewLong, Code code, LeafType type, USymbol symbol) {
checkNotNull(idNewLong);
if (type == null) {
throw new IllegalArgumentException();
}
ILeaf result = entityFactory.getLeafsget(code);
ILeaf result = entityFactory.getLeaf(code);
if (result == null) {
result = createLeafInternal(code, Display.getWithNewlines(code), type, symbol);
result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol);
result.setUSymbol(symbol);
}
if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT) {
@ -133,19 +145,21 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return result;
}
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
if (entityFactory.getLeafsget(code) != null) {
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
checkNotNull(idNewLong);
if (entityFactory.getLeaf(idNewLong) != null) {
return null;
// throw new IllegalArgumentException("Already known: " + code);
}
return createLeafInternal(code, display, type, symbol);
return createLeafInternal(idNewLong, code, display, type, symbol);
}
final protected ILeaf createLeafInternal(Code code, Display display, LeafType type, USymbol symbol) {
final protected ILeaf createLeafInternal(Ident newIdent, Code code, Display display, LeafType type, USymbol symbol) {
checkNotNull(newIdent);
if (Display.isNull(display)) {
display = Display.getWithNewlines(code);
}
final ILeaf leaf = entityFactory.createLeaf(code, display, type, getCurrentGroup(), getHides(),
final ILeaf leaf = entityFactory.createLeaf(newIdent, code, display, type, getCurrentGroup(), getHides(),
getNamespaceSeparator());
entityFactory.addLeaf(leaf);
this.lastEntity = leaf;
@ -153,8 +167,35 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return leaf;
}
final public Ident buildLeafIdent(String id) {
return getLastID().add(id, namespaceSeparator);
}
final public Code buildCode(String s) {
return CodeImpl.of(s);
}
final public Ident buildLeafIdentSpecial(String id) {
if (namespaceSeparator != null) {
if (id.contains(namespaceSeparator)) {
return Ident.empty().add(id, namespaceSeparator);
}
}
return getLastID().add(id, namespaceSeparator);
}
protected final void checkNotNull(Object id) {
if (id == null) {
throw new IllegalArgumentException();
}
}
public boolean leafExist(Code code) {
return entityFactory.getLeafsget(code) != null;
return entityFactory.getLeaf(code) != null;
}
public boolean leafExist(Ident ident) {
return entityFactory.getLeaf(ident) != null;
}
final public Collection<IGroup> getChildrenGroups(IGroup parent) {
@ -167,21 +208,24 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return Collections.unmodifiableCollection(result);
}
final public void gotoGroup2(Code code, Display display, GroupType type, IGroup parent, NamespaceStrategy strategy) {
final public void gotoGroup(Ident ident, Code code, Display display, GroupType type, IGroup parent,
NamespaceStrategy strategy) {
if (strategy == NamespaceStrategy.MULTIPLE) {
if (getNamespaceSeparator() != null) {
code = getFullyQualifiedCode(code.withSeparator(getNamespaceSeparator()));
code = getFullyQualifiedCode1972(code);
}
gotoGroupInternalWithNamespace(code, display, code, type, parent);
gotoGroupInternalWithNamespace(ident, code, display, code, type, parent);
} else if (strategy == NamespaceStrategy.SINGLE) {
gotoGroupInternal(code, display, null, type, parent);
final Ident newIdLong = buildLeafIdentSpecial(ident.toString(this.namespaceSeparator));
gotoGroupExternal(newIdLong, code, display, null, type, parent);
stacks2.add(newIdLong);
} else {
throw new IllegalArgumentException();
}
}
protected final String getNamespace(Code fullyCode, String separator) {
String name = fullyCode.getFullName();
protected final String getNamespace1972(Code fullyCode, String separator) {
String name = fullyCode.getName();
if (separator == null) {
throw new IllegalArgumentException(toString());
}
@ -191,31 +235,31 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return null;
}
name = name.substring(0, x);
} while (entityFactory.getLeafsget(Code.of(name, separator)) != null);
} while (entityFactory.getLeaf(buildCode(name)) != null);
return name;
}
final protected void gotoGroupInternalWithNamespace(final Code code, Display display, final Code namespace2,
private void gotoGroupInternalWithNamespace(Ident idNewLong, Code code, Display display, Code namespaceNew,
GroupType type, IGroup parent) {
this.stacks.add(currentGroup);
this.stacks2.add(idNewLong);
if (getNamespaceSeparator() == null) {
gotoGroupInternal(code, display, namespace2, type, parent);
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
return;
}
final String namespace = getNamespace(code, getNamespaceSeparator());
if (namespace == null) {
gotoGroupInternal(code, display, namespace2, type, parent);
final String namespaceCurrent = getNamespace1972(code, getNamespaceSeparator());
if (namespaceCurrent == null) {
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
return;
}
final IGroup realParent = entityFactory.getGroupsget(Code.of(namespace));
final IGroup realParent = entityFactory.getGroup(buildCode(namespaceCurrent));
if (realParent == null) {
gotoGroupInternal(code, display, namespace2, type, parent);
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
return;
}
display = Display.create(code.getLastPart());
IGroup result = entityFactory.createGroup(code, display, namespace2, type, realParent, getHides(),
display = Display.create(idNewLong.getLast());
IGroup result = entityFactory.createGroup(idNewLong, code, display, namespaceNew, type, realParent, getHides(),
getNamespaceSeparator());
entityFactory.addGroup(result);
@ -224,6 +268,10 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public void endGroup() {
if (stacks2.size() > 0) {
// Thread.dumpStack();
stacks2.remove(stacks2.size() - 1);
}
if (EntityUtils.groupRoot(currentGroup)) {
Log.error("No parent group");
return;
@ -235,48 +283,67 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
}
final protected void gotoGroupInternal(final Code code, Display display, final Code namespace2, GroupType type,
IGroup parent) {
IGroup result = entityFactory.getGroupsget(code);
private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
IGroup result = entityFactory.getGroup(code);
if (result != null) {
currentGroup = result;
return;
}
if (entityFactory.getLeafsget(code) != null) {
result = entityFactory.muteToGroup(code, namespace2, type, parent);
if (entityFactory.getLeaf(idNewLong) != null) {
result = entityFactory.muteToGroup(code.getName(), namespace, type, parent);
result.setDisplay(display);
} else {
result = entityFactory.createGroup(code, display, namespace2, type, parent, getHides(),
result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(),
getNamespaceSeparator());
}
entityFactory.addGroup(result);
currentGroup = result;
}
final protected void gotoGroupExternal(Ident newIdLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
IGroup result = entityFactory.getGroup(code);
if (result != null) {
currentGroup = result;
return;
}
if (entityFactory.getLeaf(code) != null) {
result = entityFactory.muteToGroup(code.getName(), namespace, type, parent);
result.setDisplay(display);
} else {
result = entityFactory.createGroup(newIdLong, code, display, namespace, type, parent, getHides(),
getNamespaceSeparator());
}
entityFactory.addGroup(result);
// entityFactory.thisIsNotArealGroup(newIdLong);
currentGroup = result;
}
public final void gotoThisGroup(IGroup group) {
currentGroup = group;
}
final protected Code getFullyQualifiedCode(Code code) {
final String separator = code.getSeparator();
final protected Code getFullyQualifiedCode1972(Code code) {
final String separator = getNamespaceSeparator();
if (separator == null) {
throw new IllegalArgumentException();
}
final String full = code.getFullName();
final String full = code.getName();
if (full.startsWith(separator)) {
return Code.of(full.substring(separator.length()), separator);
return buildCode(full.substring(separator.length()));
}
if (full.contains(separator)) {
return Code.of(full, separator);
return buildCode(full);
}
if (EntityUtils.groupRoot(currentGroup)) {
return Code.of(full, separator);
return buildCode(full);
}
final Code namespace2 = currentGroup.getNamespace2();
if (namespace2 == null) {
return Code.of(full, separator);
final Code namespace = currentGroup.getNamespace();
if (namespace == null) {
return buildCode(full);
}
return Code.of(namespace2.getFullName() + separator + full, separator);
return buildCode(namespace.getName() + separator + full);
}
public final IGroup getCurrentGroup() {
@ -284,7 +351,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public final IGroup getGroup(Code code) {
final IGroup p = entityFactory.getGroupsget(code);
final IGroup p = entityFactory.getGroup(code);
if (p == null) {
throw new IllegalArgumentException();
// return null;
@ -293,16 +360,20 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public final boolean isGroup(Code code) {
return leafExist(code) == false && entityFactory.getGroupsget(code) != null;
return leafExist(code) == false && entityFactory.getGroup(code) != null;
}
public final boolean isGroup(Ident ident) {
return leafExist(ident) == false && entityFactory.getGroup(ident) != null;
}
public final Collection<IGroup> getGroups(boolean withRootGroup) {
if (withRootGroup == false) {
return entityFactory.getGroupsvalues();
return entityFactory.groups();
}
final Collection<IGroup> result = new ArrayList<IGroup>();
result.add(getRootGroup());
result.addAll(entityFactory.getGroupsvalues());
result.addAll(entityFactory.groups());
return Collections.unmodifiableCollection(result);
}
@ -310,16 +381,20 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return entityFactory.getRootGroup();
}
public Collection<ILeaf> getLeafsvalues() {
return entityFactory.getLeafsvalues();
public final Collection<ILeaf> getLeafsvalues() {
return entityFactory.leafs2();
}
public final int getLeafssize() {
return getLeafsvalues().size();
}
public final ILeaf getLeafsget(Code code) {
return entityFactory.getLeafsget(code);
public final ILeaf getLeaf(Code code) {
return entityFactory.getLeaf(code);
}
public final ILeaf getLeaf(Ident ident) {
return entityFactory.getLeaf(ident);
}
final public void addLink(Link link) {
@ -355,17 +430,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return this.horizontalPages * this.verticalPages;
}
// final public List<File> createPng2(File pngFile) throws IOException,
// InterruptedException {
// final CucaDiagramPngMaker3 maker = new CucaDiagramPngMaker3(this);
// return maker.createPng(pngFile);
// }
//
// final public void createPng2(OutputStream os) throws IOException {
// final CucaDiagramPngMaker3 maker = new CucaDiagramPngMaker3(this);
// maker.createPng(os);
// }
abstract protected List<String> getDotStrings();
final public String[] getDotStringSkek() {
@ -424,9 +488,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
throw new UnsupportedOperationException();
}
// 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);
final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption);
@ -457,14 +518,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
maker.createFiles(os, index);
}
// public final Rankdir getRankdir() {
// return rankdir;
// }
//
// public final void setRankdir(Rankdir rankdir) {
// this.rankdir = rankdir;
// }
public boolean isAutarkic(IGroup g) {
if (g.getGroupType() == GroupType.PACKAGE) {
return false;
@ -638,14 +691,6 @@ 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();) {
// final ILeaf ent = it.next();
// if (it.hasNext() == false) {
// return ent;
// }
// }
// return null;
return lastEntity;
}
@ -658,7 +703,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
for (IGroup g : getGroups(true)) {
final List<ILeaf> standalones = new ArrayList<ILeaf>();
// final SingleStrategy singleStrategy = g.getSingleStrategy();
for (ILeaf ent : g.getLeafsDirect()) {
if (isStandalone(ent)) {
@ -671,10 +715,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final Magma magma = new Magma(this, standalones);
magma.putInSquare();
magmaList.add(magma);
// for (Link link : singleStrategy.generateLinks(standalones)) {
// addLink(link);
// }
}
for (IGroup g : getGroups(true)) {

View File

@ -75,7 +75,6 @@ import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.wbs.WBSDiagram;
public class Display implements Iterable<CharSequence> {
@ -147,7 +146,7 @@ public class Display implements Iterable<CharSequence> {
}
public static Display getWithNewlines(Code s) {
return getWithNewlines(s.getFullName());
return getWithNewlines(s.getName());
}
public static Display getWithNewlines(String s) {

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@ -86,10 +87,11 @@ class Election {
public Map<Member, String> getAllElected(Collection<String> shortNames) {
final Map<Member, String> memberWithPort = new HashMap<Member, String>();
for (String shortName : shortNames) {
for (String shortName : new HashSet<String>(shortNames)) {
final Member m = getCandidate(shortName);
if (m != null) {
memberWithPort.put(m, shortName);
shortNames.remove(shortName);
}
}
return Collections.unmodifiableMap(memberWithPort);

View File

@ -71,8 +71,8 @@ public class EntityPort {
return this.uid.equals(other.uid);
}
private String getPortName() {
return portName;
}
// private String getPortName() {
// return portName;
// }
}

View File

@ -51,7 +51,7 @@ public class GroupPrinter {
pw.println("<table border=1 cellpadding=8 cellspacing=0>");
pw.println("<tr>");
pw.println("<td bgcolor=#DDDDDD>");
pw.println(group.getCode());
pw.println(group.getCodeGetName());
pw.println("<tr>");
pw.println("<td>");
if (group.getLeafsDirect().size() == 0) {
@ -80,7 +80,7 @@ public class GroupPrinter {
}
private void printLeaf(ILeaf leaf) {
pw.println("<li>" + leaf.getCode());
pw.println("<li>" + leaf.getCodeGetName());
}
public static void print(File f, IGroup rootGroup) {

View File

@ -67,7 +67,7 @@ public class GroupRoot implements IGroup {
public Collection<ILeaf> getLeafsDirect() {
final List<ILeaf> result = new ArrayList<ILeaf>();
for (ILeaf ent : entityFactory.getLeafsvalues()) {
for (ILeaf ent : entityFactory.leafs()) {
if (ent.getParentContainer() == this) {
result.add(ent);
}
@ -120,11 +120,11 @@ public class GroupRoot implements IGroup {
}
public Code getCode() {
return Code.of("__ROOT__");
return CodeImpl.of("__ROOT__");
}
public LongCode getLongCode() {
return null;
public String getCodeGetName() {
return getCode().getName();
}
public void addUrl(Url url) {
@ -143,7 +143,7 @@ public class GroupRoot implements IGroup {
public Collection<IGroup> getChildren() {
final List<IGroup> result = new ArrayList<IGroup>();
for (IGroup ent : entityFactory.getGroupsvalues()) {
for (IGroup ent : entityFactory.groups()) {
if (ent.getParentContainer() == this) {
result.add(ent);
}
@ -163,7 +163,7 @@ public class GroupRoot implements IGroup {
return null;
}
public Code getNamespace2() {
public Code getNamespace() {
throw new UnsupportedOperationException();
}
@ -269,4 +269,8 @@ public class GroupRoot implements IGroup {
public DisplayPositionned getLegend() {
throw new UnsupportedOperationException();
}
public Ident getIdent() {
return Ident.empty();
}
}

View File

@ -47,7 +47,7 @@ public class HideOrShow2 {
if (what.startsWith("<<") && what.endsWith(">>")) {
return isApplyableStereotype(leaf, what.substring(2, what.length() - 2).trim());
}
final String fullName = leaf.getCode().getFullName();
final String fullName = leaf.getCodeGetName();
// System.err.println("fullName=" + fullName);
return match(fullName, what);
}

View File

@ -49,7 +49,9 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
public Code getCode();
public LongCode getLongCode();
public String getCodeGetName();
public Ident getIdent();
public USymbol getUSymbol();

View File

@ -57,7 +57,7 @@ public interface IGroup extends IEntity {
public GroupType getGroupType();
public Code getNamespace2();
public Code getNamespace();
public PackageStyle getPackageStyle();
@ -74,4 +74,5 @@ public interface IGroup extends IEntity {
public void setLegend(DisplayPositionned legend);
public DisplayPositionned getLegend();
}

View File

@ -35,45 +35,205 @@
*/
package net.sourceforge.plantuml.cucadiagram;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
public class Ident implements Comparable<Ident> {
public class Ident implements Code {
private final String ident;
private final List<String> parts;
private Ident(String ident) {
if (ident == null) {
throw new IllegalArgumentException();
}
this.ident = ident;
}
public static Ident of(String code) {
return new Ident(code);
private Ident(List<String> parts) {
this.parts = parts;
}
@Override
public String toString() {
return ident;
return parts.toString();
}
@Override
public int hashCode() {
return ident.hashCode();
public String forXmi() {
final StringBuilder sb = new StringBuilder();
for (String s : parts) {
if (sb.length() > 0) {
sb.append(".");
}
sb.append(s);
}
return sb.toString();
}
public static Ident empty() {
return new Ident(Collections.<String> emptyList());
}
public String getLast() {
return parts.get(parts.size() - 1);
}
public Code toCode() {
return CodeImpl.of(getLast());
}
public Ident eventuallyRemoveStartingAndEndingDoubleQuote(String format) {
final List<String> copy = new ArrayList<String>(parts);
final int pos = copy.size() - 1;
copy.set(pos, StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(copy.get(pos), format));
return new Ident(copy);
}
public Ident removeStartingParenthesis() {
final List<String> copy = new ArrayList<String>(parts);
final int pos = copy.size() - 1;
final String last = copy.get(pos);
if (last.startsWith("()") == false) {
throw new IllegalStateException();
}
copy.set(pos, StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(last.substring(2).trim()));
return new Ident(copy);
}
public Ident addSuffix(String suffix) {
final List<String> copy = new ArrayList<String>(parts);
final int pos = copy.size() - 1;
copy.set(pos, copy.get(pos) + suffix);
return new Ident(copy);
// return new Code(fullName + suffix);
}
public Ident removeMemberPart() {
final String last = getLast();
final int x = last.lastIndexOf("::");
if (x == -1) {
return null;
}
final List<String> copy = new ArrayList<String>(parts);
final int pos = copy.size() - 1;
copy.set(pos, last.substring(0, x));
return new Ident(copy);
}
public String getPortMember() {
final String last = getLast();
final int x = last.lastIndexOf("::");
if (x == -1) {
return null;
}
return last.substring(x + 2);
}
static private Ident from(String full, String separator) {
final Ident result = new Ident(new ArrayList<String>());
if (separator == null || full.contains(separator + separator)) {
result.parts.add(full);
return result;
}
while (true) {
int idx = full.indexOf(separator);
if (idx == -1) {
result.parts.add(full);
result.checkResult(separator);
return result;
}
if (idx > 0) {
result.parts.add(full.substring(0, idx));
}
full = full.substring(idx + separator.length());
}
}
private void checkResult(String separator) {
for (String s : this.parts) {
if (s.length() == 0) {
throw new IllegalStateException(toString());
}
if (separator != null && s.contains(separator) && s.contains(separator + separator) == false) {
throw new IllegalStateException(toString());
}
}
}
public Ident add(String sup, String separator) {
this.checkResult(separator);
final Ident added = from(sup, separator);
final List<String> list = new ArrayList<String>(this.parts.size() + added.parts.size());
list.addAll(this.parts);
list.addAll(added.parts);
final Ident result = new Ident(list);
result.checkResult(separator);
return result;
}
public Ident parent() {
if (parts.size() == 0) {
throw new IllegalArgumentException();
}
return new Ident(parts.subList(0, parts.size() - 1));
}
@Override
public boolean equals(Object obj) {
final Ident other = (Ident) obj;
return this.ident.equals(other.ident);
return this.parts.equals(other.parts);
}
public int compareTo(Ident other) {
return this.ident.compareTo(other.ident);
@Override
public int hashCode() {
return parts.hashCode();
}
private Ident eventuallyRemoveStartingAndEndingDoubleQuote() {
return Ident.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ident));
public String toString(String sep) {
if (sep == null) {
sep = ".";
}
final StringBuilder sb = new StringBuilder();
for (String s : parts) {
if (sb.length() > 0) {
sb.append(sep);
}
sb.append(s);
}
return sb.toString();
}
public void checkSameAs(Code code, String separator) {
final String last = parts.get(parts.size() - 1);
if (separator == null) {
if (code.getName().equals(last) != true && code.getName().equals(toString(separator)) == false) {
System.err.println("code1=" + code);
System.err.println("this1=" + this);
EntityFactory.bigError();
}
} else {
if (getLastPart(code.getName(), separator).equals(last) != true
&& code.getName().equals(toString(separator)) == false) {
System.err.println("code2=" + code);
System.err.println("this2=" + this);
EntityFactory.bigError();
}
}
}
private String getLastPart(String fullName, String separator) {
if (separator == null) {
return fullName;
}
final int x = fullName.lastIndexOf(separator);
if (x == -1) {
return fullName;
}
return fullName.substring(x + separator.length());
}
// public int compareTo(Code o) {
// throw new UnsupportedOperationException();
// }
public String getName() {
return getLast();
}
}

View File

@ -102,24 +102,24 @@ public class Link extends WithLinkType implements Hideable, Removeable {
public String idCommentForSvg() {
if (type.looksLikeRevertedForSvg()) {
final String comment = getEntity1().getCode().getFullName() + "<-" + getEntity2().getCode().getFullName();
final String comment = getEntity1().getCodeGetName() + "<-" + getEntity2().getCodeGetName();
return comment;
}
if (type.looksLikeNoDecorAtAllSvg()) {
final String comment = getEntity1().getCode().getFullName() + "-" + getEntity2().getCode().getFullName();
final String comment = getEntity1().getCodeGetName() + "-" + getEntity2().getCodeGetName();
return comment;
}
final String comment = getEntity1().getCode().getFullName() + "->" + getEntity2().getCode().getFullName();
final String comment = getEntity1().getCodeGetName() + "->" + getEntity2().getCodeGetName();
return comment;
}
public UComment commentForSvg() {
if (type.looksLikeRevertedForSvg()) {
return new UComment("reverse link " + getEntity1().getCode().getFullName() + " to "
+ getEntity2().getCode().getFullName());
return new UComment("reverse link " + getEntity1().getCodeGetName() + " to "
+ getEntity2().getCodeGetName());
}
return new UComment("link " + getEntity1().getCode().getFullName() + " to "
+ getEntity2().getCode().getFullName());
return new UComment("link " + getEntity1().getCodeGetName() + " to "
+ getEntity2().getCodeGetName());
}
public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, StyleBuilder styleBuilder) {

View File

@ -65,7 +65,7 @@ public enum LinkDecor {
ARROW(10, true, 0.5), ARROW_TRIANGLE(10, true, 0.8), ARROW_AND_CIRCLE(10, false, 0.5),
CIRCLE(0, false, 0.5), CIRCLE_CONNECT(0, false, 0.5), PARENTHESIS(0, false, OptionFlags.USE_INTERFACE_EYE2 ? 0.5
CIRCLE(0, false, 0.5), CIRCLE_FILL(0, false, 0.5), CIRCLE_CONNECT(0, false, 0.5), PARENTHESIS(0, false, OptionFlags.USE_INTERFACE_EYE2 ? 0.5
: 1.0), SQUARE(0, false, 0.5),
CIRCLE_CROSS(0, false, 0.5), PLUS(0, false, 1.5), SQUARRE_toberemoved(30, false, 0);
@ -120,7 +120,9 @@ public enum LinkDecor {
} else if (this == LinkDecor.COMPOSITION) {
return new ExtremityFactoryDiamond(true, backgroundColor);
} else if (this == LinkDecor.CIRCLE) {
return new ExtremityFactoryCircle();
return new ExtremityFactoryCircle(false);
} else if (this == LinkDecor.CIRCLE_FILL) {
return new ExtremityFactoryCircle(true);
} else if (this == LinkDecor.SQUARE) {
return new ExtremityFactorySquarre();
} else if (this == LinkDecor.PARENTHESIS) {

View File

@ -55,6 +55,11 @@ public class MemberImpl implements Member {
private final VisibilityModifier visibilityModifier;
@Override
public String toString() {
return super.toString() + " " + display;
}
public MemberImpl(String tmpDisplay, boolean isMethod, boolean manageModifier) {
tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", "");
if (manageModifier) {
@ -96,7 +101,8 @@ public class MemberImpl implements Member {
this.visibilityModifier = null;
this.abstractModifier = false;
tmpDisplay = StringUtils.trin(tmpDisplay);
this.display = tmpDisplay.length() == 0 ? " " : Guillemet.GUILLEMET.manageGuillemet(StringUtils.trin(tmpDisplay));
this.display = tmpDisplay.length() == 0 ? " " : Guillemet.GUILLEMET.manageGuillemet(StringUtils
.trin(tmpDisplay));
}
}

View File

@ -149,7 +149,7 @@ final public class DotData implements PortionShower {
}
public boolean isDegeneratedWithFewEntities(int nb) {
return entityFactory.getGroupsvalues().size() == 0 && getLinks().size() == 0 && getLeafs().size() == nb;
return entityFactory.groups().size() == 0 && getLinks().size() == 0 && getLeafs().size() == nb;
}
public final boolean isHideEmptyDescriptionForState() {

View File

@ -52,16 +52,21 @@ import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LongCode;
import net.sourceforge.plantuml.skin.VisibilityModifier;
public class EntityFactory {
public final class EntityFactory {
private final Map<String, ILeaf> leafsByCode = new LinkedHashMap<String, ILeaf>();
private final Map<String, IGroup> groupsByCode = new LinkedHashMap<String, IGroup>();
private final Map<Ident, ILeaf> leafs2 = new LinkedHashMap<Ident, ILeaf>();
private final Map<Ident, IGroup> groups2 = new LinkedHashMap<Ident, IGroup>();
private final Map<Code, ILeaf> leafs = new LinkedHashMap<Code, ILeaf>();
private final List<Link> links = new ArrayList<Link>();
private final Map<Code, IGroup> groups = new LinkedHashMap<Code, IGroup>();
private int rawLayout;
private final IGroup rootGroup = new GroupRoot(this);
@ -89,42 +94,104 @@ public class EntityFactory {
return result;
}
public ILeaf createLeaf(Code code, Display display, LeafType entityType, IGroup parentContainer,
public void thisIsGoingToBeALeaf(Ident ident) {
// if (byIdents.containsKey(ident) == false) {
// System.err.println("thisIsGoingToBeALeaf::byIdents=" + byIdents.keySet());
// System.err.println("thisIsGoingToBeALeaf::ident=" + ident);
// // Thread.dumpStack();
// // System.exit(0);
// }
// byIdents.remove(ident);
}
public void thisIsNotArealGroup(Ident ident) {
// byIdents.remove(ident);
}
public ILeaf createLeaf(Ident ident, Code code, Display display, LeafType entityType, IGroup parentContainer,
Set<VisibilityModifier> hides, String namespaceSeparator) {
if (entityType == null) {
throw new IllegalArgumentException();
}
// if (byIdents.containsKey(ident)) {
// throw new IllegalArgumentException();
// }
final Bodier bodier = new Bodier(entityType, hides);
final LongCode longCode = getLongCode(code, namespaceSeparator);
final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, entityType, longCode,
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, entityType,
namespaceSeparator, rawLayout);
bodier.setLeaf(result);
result.setDisplay(display);
// System.err.println("adding1 "+ident);
// byIdents.put(ident, result);
// System.err.println("EntityFactory::createLeaf=" + result);
return result;
}
private LongCode getLongCode(Code code, String namespaceSeparator) {
final LongCode result = LongCode.of(code.getFullName(), namespaceSeparator);
// if (result.toString().equals(code.toString()) == false) {
// System.err.println("result=" + result);
// System.err.println(" code =" + code);
// throw new UnsupportedOperationException();
// }
return result;
}
public IGroup createGroup(Code code, Display display, Code namespace2, GroupType groupType, IGroup parentContainer,
Set<VisibilityModifier> hides, String namespaceSeparator) {
public IGroup createGroup(Ident ident, Code code, Display display, Code namespace, GroupType groupType,
IGroup parentContainer, Set<VisibilityModifier> hides, String namespaceSeparator) {
if (groupType == null) {
throw new IllegalArgumentException();
}
// if (byIdents.containsKey(ident)) {
// throw new IllegalArgumentException();
// }
final Bodier bodier = new Bodier(null, hides);
final LongCode longCode = getLongCode(code, namespaceSeparator);
final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, groupType, namespace2, longCode,
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, groupType, namespace,
namespaceSeparator, rawLayout);
if (Display.isNull(display) == false) {
result.setDisplay(display);
}
// System.err.println("adding2 "+ident);
// byIdents.put(ident, result);
// System.err.println("EntityFactory::createGroup=" + result);
return result;
}
public void addLeaf(ILeaf entity) {
// System.err.println("EntityFactory::addLeaf=" + entity);
leafsByCode.put(entity.getCodeGetName(), entity);
leafs2.put(entity.getIdent(), entity);
}
public void addGroup(IGroup group) {
// System.err.println("EntityFactory::addGroup=" + group);
groupsByCode.put(group.getCodeGetName(), group);
groups2.put(group.getIdent(), group);
}
void removeGroup(String name) {
final IEntity removed = groupsByCode.remove(name);
if (removed == null) {
throw new IllegalArgumentException();
}
final IEntity removed2 = groups2.remove(removed.getIdent());
if (removed != removed2) {
bigError();
}
}
public static void bigError() {
Thread.dumpStack();
// System.exit(0);
// throw new IllegalArgumentException();
}
void removeLeaf(String name) {
final IEntity removed = leafsByCode.remove(name);
if (removed == null) {
throw new IllegalArgumentException();
}
final IEntity removed2 = leafs2.remove(removed.getIdent());
if (removed != removed2) {
bigError();
}
}
public IGroup muteToGroup(String name, Code namespace, GroupType type, IGroup parent) {
final ILeaf leaf = leafsByCode.get(name);
((EntityImpl) leaf).muteToGroup(namespace, type, parent);
final IGroup result = (IGroup) leaf;
removeLeaf(name);
return result;
}
@ -132,48 +199,61 @@ public class EntityFactory {
return rootGroup;
}
public final ILeaf getLeafsget(Code code) {
return leafs.get(code);
public final ILeaf getLeaf(Ident ident) {
return leafs2.get(ident);
}
public final Collection<ILeaf> getLeafsvalues() {
return Collections.unmodifiableCollection(leafs.values());
public final ILeaf getLeaf(Code code) {
final ILeaf result = leafsByCode.get(code.getName());
if (result != null && result != leafs2.get(result.getIdent())) {
bigError();
}
return result;
}
public void addLeaf(ILeaf entity) {
leafs.put(entity.getCode(), entity);
public final IGroup getGroup(Code code) {
final IGroup result = groupsByCode.get(code.getName());
if (result != null && result != groups2.get(result.getIdent())) {
bigError();
}
return result;
}
public final IGroup getGroup(Ident ident) {
final IGroup result = groups2.get(ident);
return result;
}
public final Collection<ILeaf> leafs() {
final Collection<ILeaf> result = Collections.unmodifiableCollection(leafsByCode.values());
if (new ArrayList<ILeaf>(result).equals(new ArrayList<ILeaf>(leafs2())) == false) {
bigError();
}
return result;
}
public final Collection<IGroup> groups() {
final Collection<IGroup> result = Collections.unmodifiableCollection(groupsByCode.values());
if (new ArrayList<IGroup>(result).equals(new ArrayList<IGroup>(groups2())) == false) {
bigError();
}
return result;
}
public final Collection<IGroup> groups2() {
final Collection<IGroup> result = Collections.unmodifiableCollection(groups2.values());
return Collections.unmodifiableCollection(result);
}
public final Collection<ILeaf> leafs2() {
final Collection<ILeaf> result = Collections.unmodifiableCollection(leafs2.values());
return Collections.unmodifiableCollection(result);
}
public void incRawLayout() {
rawLayout++;
}
void removeLeaf(Code code) {
final IEntity removed = leafs.remove(code);
if (removed == null) {
throw new IllegalArgumentException();
}
}
public void addGroup(IGroup group) {
groups.put(group.getCode(), group);
}
void removeGroup(Code code) {
final IEntity removed = groups.remove(code);
if (removed == null) {
throw new IllegalArgumentException();
}
}
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() {
return Collections.unmodifiableList(links);
}
@ -201,12 +281,21 @@ public class EntityFactory {
}
}
public IGroup muteToGroup(Code code, Code namespace2, GroupType type, IGroup parent) {
final ILeaf leaf = leafs.get(code);
((EntityImpl) leaf).muteToGroup(namespace2, type, parent);
final IGroup result = (IGroup) leaf;
removeLeaf(code);
return result;
public IGroup getParentContainer(Ident ident, IGroup parentContainer) {
if (parentContainer == null) {
throw new IllegalArgumentException();
}
// if (parentContainer == null) {
// } else {
// final Ident identParent = parentContainer.getIdent();
// if (ident.parent().equals(identParent) == false) {
// System.err.println("ident=" + ident);
// System.err.println("parentContainer=" + identParent);
// Thread.dumpStack();
// System.exit(0);
// }
// }
return parentContainer;
}
}

View File

@ -60,9 +60,9 @@ import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LongCode;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
@ -84,7 +84,7 @@ final class EntityImpl implements ILeaf, IGroup {
// Entity
private final Code code;
private final LongCode longCode;
private final Ident ident;
private Url url;
@ -101,7 +101,7 @@ final class EntityImpl implements ILeaf, IGroup {
private boolean top;
// Group
private Code namespace2;
private Code namespace;
private GroupType groupType;
@ -136,30 +136,43 @@ final class EntityImpl implements ILeaf, IGroup {
this.top = top;
}
private EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
LongCode longCode, String namespaceSeparator, int rawLayout) {
private EntityImpl(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
String namespaceSeparator, int rawLayout) {
checkNotNull(ident);
if (code == null) {
throw new IllegalArgumentException();
}
this.ident = ident;
this.entityFactory = entityFactory;
this.bodier = bodier;
this.code = code;
this.parentContainer = parentContainer;
this.longCode = longCode;
this.rawLayout = rawLayout;
}
EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, LeafType leafType,
LongCode longCode, String namespaceSeparator, int rawLayout) {
this(entityFactory, code, bodier, parentContainer, longCode, namespaceSeparator, rawLayout);
EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
LeafType leafType, String namespaceSeparator, int rawLayout) {
this(ident, entityFactory, code, bodier, parentContainer, namespaceSeparator, rawLayout);
checkNotNull(ident);
// System.err.println("ID for leaf=" + code + " " + ident);
// ident.checkSameAs(code, namespaceSeparator);
this.leafType = leafType;
}
EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, GroupType groupType,
Code namespace2, LongCode longCode, String namespaceSeparator, int rawLayout) {
this(entityFactory, code, bodier, parentContainer, longCode, namespaceSeparator, rawLayout);
EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
GroupType groupType, Code namespace, String namespaceSeparator, int rawLayout) {
this(ident, entityFactory, code, bodier, parentContainer, namespaceSeparator, rawLayout);
checkNotNull(ident);
// System.err.println("ID for group=" + code + " " + ident);
ident.checkSameAs(code, namespaceSeparator);
this.groupType = groupType;
this.namespace2 = namespace2;
this.namespace = namespace;
}
private void checkNotNull(Ident id) {
if (id == null) {
throw new IllegalArgumentException();
}
}
public void setContainer(IGroup container) {
@ -206,6 +219,14 @@ final class EntityImpl implements ILeaf, IGroup {
return code;
}
public String getCodeGetName() {
return getCode().getName();
}
public Ident getIdent() {
return ident;
}
public Display getDisplay() {
return display;
}
@ -227,15 +248,18 @@ final class EntityImpl implements ILeaf, IGroup {
}
public final IGroup getParentContainer() {
if (parentContainer == null) {
throw new IllegalArgumentException();
}
return parentContainer;
return entityFactory.getParentContainer(ident, parentContainer);
// if (parentContainer == null) {
// throw new IllegalArgumentException();
// }
// return parentContainer;
}
@Override
public String toString() {
return code + " " + display + "(" + leafType + ") " + xposition + " " + getUid();
// return super.toString() + code + " " + display + "(" + leafType + ")[" + groupType + "] " + xposition + " "
// + getUid();
return super.toString() + code + ident + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid();
}
public final Url getUrl99() {
@ -352,7 +376,7 @@ final class EntityImpl implements ILeaf, IGroup {
public Collection<ILeaf> getLeafsDirect() {
checkGroup();
final List<ILeaf> result = new ArrayList<ILeaf>();
for (ILeaf ent : entityFactory.getLeafsvalues()) {
for (ILeaf ent : entityFactory.leafs()) {
if (ent.isGroup()) {
throw new IllegalStateException();
}
@ -366,7 +390,7 @@ final class EntityImpl implements ILeaf, IGroup {
public Collection<IGroup> getChildren() {
checkGroup();
final Collection<IGroup> result = new ArrayList<IGroup>();
for (IGroup g : entityFactory.getGroupsvalues()) {
for (IGroup g : entityFactory.groups()) {
if (g != this && g.getParentContainer() == this) {
result.add(g);
}
@ -406,9 +430,9 @@ final class EntityImpl implements ILeaf, IGroup {
return groupType;
}
public Code getNamespace2() {
public Code getNamespace() {
checkGroup();
return namespace2;
return namespace;
}
public PackageStyle getPackageStyle() {
@ -423,6 +447,7 @@ final class EntityImpl implements ILeaf, IGroup {
if (groupType != null && leafType != null) {
throw new IllegalStateException();
}
assert groupType == null || leafType == null;
if (groupType != null) {
return true;
}
@ -445,10 +470,10 @@ final class EntityImpl implements ILeaf, IGroup {
}
}
entityFactory.removeGroup(this.getCode());
for (ILeaf ent : new ArrayList<ILeaf>(entityFactory.getLeafsvalues())) {
entityFactory.removeGroup(getCodeGetName());
for (ILeaf ent : new ArrayList<ILeaf>(entityFactory.leafs())) {
if (this != ent && this == ent.getParentContainer()) {
entityFactory.removeLeaf(ent.getCode());
entityFactory.removeLeaf(ent.getCodeGetName());
}
}
@ -457,12 +482,12 @@ final class EntityImpl implements ILeaf, IGroup {
this.leafType = leafType;
}
void muteToGroup(Code namespace2, GroupType groupType, IGroup parentContainer) {
void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
checkNotGroup();
if (parentContainer.isGroup() == false) {
throw new IllegalArgumentException();
}
this.namespace2 = namespace2;
this.namespace = namespaceNew;
this.groupType = groupType;
this.leafType = null;
this.parentContainer = parentContainer;
@ -559,10 +584,6 @@ final class EntityImpl implements ILeaf, IGroup {
}
}
public LongCode getLongCode() {
return longCode;
}
private FontParam getTitleFontParam() {
if (symbol != null) {
return symbol.getFontParam();
@ -629,7 +650,8 @@ final class EntityImpl implements ILeaf, IGroup {
public Collection<String> getPortShortNames() {
checkNotGroup();
return Collections.unmodifiableCollection(portShortNames);
// return Collections.unmodifiableCollection(portShortNames);
return portShortNames;
}
public void addPortShortName(String portShortName) {

View File

@ -52,6 +52,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.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@ -94,7 +95,7 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
final String stereotype = arg.get("STEREO", 0);
if (diagram.leafExist(Code.of(code))) {
if (diagram.leafExist(diagram.buildCode(code))) {
return CommandExecutionResult.error("Object already exists : " + code);
}
Display d = Display.getWithNewlines(display);
@ -103,12 +104,15 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
IEntity entity;
if (group != null) {
final IGroup currentGroup = diagram.getCurrentGroup();
diagram.gotoGroup2(Code.of(code), d, type.equalsIgnoreCase("domain") ? GroupType.DOMAIN
: GroupType.REQUIREMENT, currentGroup, NamespaceStrategy.SINGLE);
final Ident idNewLong = diagram.buildLeafIdent(code);
diagram.gotoGroup(idNewLong, diagram.buildCode(code), d,
type.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT, currentGroup,
NamespaceStrategy.SINGLE);
entity = diagram.getCurrentGroup();
} else {
entity = diagram.createLeaf(Code.of(code), d, type.equalsIgnoreCase("domain") ? LeafType.DOMAIN
: LeafType.REQUIREMENT, null);
final Ident idNewLong = diagram.buildLeafIdent(code);
entity = diagram.createLeaf(idNewLong, diagram.buildCode(code), d,
type.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT, null);
}
if (stereotype != null) {
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
@ -139,7 +143,7 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
type = "biddable";
}
}
USymbol usymbol = USymbol.getFromString(type, diagram.getSkinParam().useUml2ForComponent());
USymbol usymbol = USymbol.getFromString(type, diagram.getSkinParam());
entity.setUSymbol(usymbol);
return CommandExecutionResult.ok();
}

View File

@ -41,78 +41,49 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.USymbol;
public class DescriptionDiagram extends AbstractEntityDiagram {
public DescriptionDiagram(ISkinSimple skinParam) {
super(skinParam);
}
@Override
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
if (getNamespaceSeparator() != null) {
code = code.withSeparator(getNamespaceSeparator());
}
if (getNamespaceSeparator() != null && code.getFullName().contains(getNamespaceSeparator())) {
// System.err.println("code=" + code);
final Code fullyCode = code;
// final String namespace = fullyCode.getNamespace(getLeafs());
// System.err.println("namespace=" + namespace);
}
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
checkNotNull(ident);
if (type == null) {
String code2 = code.getFullName();
if (code2.startsWith("[") && code2.endsWith("]")) {
String codeString = code.getName();
if (codeString.startsWith("[") && codeString.endsWith("]")) {
final USymbol sym = getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
return getOrCreateLeafDefault(code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
LeafType.DESCRIPTION, sym);
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(), LeafType.DESCRIPTION, sym);
}
if (code2.startsWith(":") && code2.endsWith(":")) {
return getOrCreateLeafDefault(code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
LeafType.DESCRIPTION, USymbol.ACTOR);
if (codeString.startsWith(":") && codeString.endsWith(":")) {
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(), LeafType.DESCRIPTION, getSkinParam().getActorStyle()
.getUSymbol());
}
if (code2.startsWith("()")) {
code2 = StringUtils.trin(code2.substring(2));
code2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code2);
return getOrCreateLeafDefault(Code.of(code2), LeafType.DESCRIPTION, USymbol.INTERFACE);
if (codeString.startsWith("()")) {
codeString = StringUtils.trin(codeString.substring(2));
codeString = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString);
final Ident idNewLong = buildLeafIdent(codeString);
return getOrCreateLeafDefault(idNewLong, buildCode(codeString), LeafType.DESCRIPTION, USymbol.INTERFACE);
}
code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
return getOrCreateLeafDefault(code, LeafType.STILL_UNKNOWN, symbol);
code = buildCode(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code.getName(), "\"([:"));
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
return getOrCreateLeafDefault(idNewLong, code, LeafType.STILL_UNKNOWN, symbol);
}
return getOrCreateLeafDefault(code, type, symbol);
return getOrCreateLeafDefault(ident, code, type, symbol);
}
// @Override
// public ILeaf createLeaf(Code code, List<? extends CharSequence> display, LeafType type) {
// if (type != LeafType.COMPONENT) {
// return super.createLeaf(code, display, type);
// }
// code = code.getFullyQualifiedCode(getCurrentGroup());
// if (super.leafExist(code)) {
// throw new IllegalArgumentException("Already known: " + code);
// }
// return createEntityWithNamespace(code, display, type);
// }
// private ILeaf createEntityWithNamespace(Code fullyCode, List<? extends CharSequence> display, LeafType type) {
// IGroup group = getCurrentGroup();
// final String namespace = fullyCode.getNamespace(getLeafs());
// if (namespace != null && (EntityUtils.groupRoot(group) || group.getCode().equals(namespace) == false)) {
// group = getOrCreateGroupInternal(Code.of(namespace), StringUtils.getWithNewlines(namespace), namespace,
// GroupType.PACKAGE, getRootGroup());
// }
// return createLeafInternal(fullyCode,
// display == null ? StringUtils.getWithNewlines(fullyCode.getShortName(getLeafs())) : display, type,
// group);
// }
private boolean isUsecase() {
for (ILeaf leaf : getLeafsvalues()) {
final LeafType type = leaf.getLeafType();
final USymbol usymbol = leaf.getUSymbol();
if (type == LeafType.USECASE || usymbol == USymbol.ACTOR) {
if (type == LeafType.USECASE || usymbol == getSkinParam().getActorStyle().getUSymbol()) {
return true;
}
}
@ -123,7 +94,7 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
public void makeDiagramReady() {
super.makeDiagramReady();
final LeafType defaultType = isUsecase() ? LeafType.DESCRIPTION : LeafType.DESCRIPTION;
final USymbol defaultSymbol = isUsecase() ? USymbol.ACTOR : USymbol.INTERFACE;
final USymbol defaultSymbol = isUsecase() ? getSkinParam().getActorStyle().getUSymbol() : USymbol.INTERFACE;
for (ILeaf leaf : getLeafsvalues()) {
if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) {
leaf.muteToType(defaultType, defaultSymbol);

View File

@ -121,16 +121,17 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
final String codeRaw = arg.getLazzy("CODE", 0);
final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw));
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Code code = diagram.buildCode(idShort);
final String icon = arg.getLazzy("STEREOTYPE", 0);
final IEntity entity = diagram.getOrCreateLeaf(code, LeafType.DESCRIPTION, USymbol.ARCHIMATE);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, LeafType.DESCRIPTION, USymbol.ARCHIMATE);
final String displayRaw = arg.getLazzy("DISPLAY", 0);
String display = displayRaw;
if (display == null) {
display = code.getFullName();
display = code.getName();
}
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);

View File

@ -102,10 +102,11 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
final String codeRaw = line0.getLazzy("CODE", 0);
final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw));
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Code code = diagram.buildCode(idShort);
final String icon = line0.getLazzy("STEREOTYPE", 0);
final IEntity entity = diagram.getOrCreateLeaf(code, LeafType.DESCRIPTION, USymbol.RECTANGLE);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, LeafType.DESCRIPTION, USymbol.RECTANGLE);
lines = lines.subExtract(1, 1);
Display display = lines.toDisplay();

View File

@ -172,7 +172,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
if (symbol == null) {
type = LeafType.DESCRIPTION;
usymbol = USymbol.ACTOR;
usymbol = diagram.getSkinParam().getActorStyle().getUSymbol();
} else if (symbol.equalsIgnoreCase("usecase")) {
type = LeafType.USECASE;
usymbol = null;
@ -181,26 +181,27 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
usymbol = null;
} else {
type = LeafType.DESCRIPTION;
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().useUml2ForComponent());
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam());
if (usymbol == null) {
throw new IllegalStateException();
}
}
final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw));
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Code code = diagram.buildCode(idShort);
if (diagram.isGroup(code)) {
return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined");
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
}
String display = displayRaw;
if (display == null) {
display = code.getFullName();
display = code.getName();
}
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
if (existsWithBadType(diagram, code, type, usymbol)) {
return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined");
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
}
final IEntity entity = diagram.getOrCreateLeaf(code, type, usymbol);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, type, usymbol);
entity.setDisplay(Display.getWithNewlines(display));
entity.setUSymbol(usymbol);
if (stereotype != null) {
@ -234,7 +235,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
if (diagram.leafExist(code) == false) {
return false;
}
final ILeaf other = diagram.getLeafsget(code);
final ILeaf other = diagram.getLeaf(code);
if (other.getLeafType() != type) {
return true;
}

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
@ -132,14 +133,15 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
type = LeafType.USECASE;
usymbol = null;
} else {
usymbol = USymbol.getFromString(symbol);
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().getActorStyle());
if (usymbol == null) {
throw new IllegalStateException();
}
type = LeafType.DESCRIPTION;
}
final Code code = Code.of(line0.get("CODE", 0));
final String idShort = line0.get("CODE", 0);
final Code code = diagram.buildCode(idShort);
final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast499()
.getString());
lines = lines.subExtract(1, 1);
@ -156,11 +158,12 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
final String stereotype = line0.get("STEREO", 0);
if (CommandCreateElementFull.existsWithBadType(diagram, code, type, usymbol)) {
return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined");
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
}
final ILeaf result = diagram.createLeaf(code, display, type, usymbol);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
final ILeaf result = diagram.createLeaf(idNewLong, code, display, type, usymbol);
if (result == null) {
return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined");
return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined");
}
result.setUSymbol(usymbol);
if (stereotype != null) {

View File

@ -52,6 +52,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
@ -82,14 +83,14 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("LABEL1", "[%g]([^%g]+)[%g]")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("HEAD2", "(0\\)|<<|[<^*+#0)]|<\\||[%s]+o)?"), //
new RegexLeaf("HEAD2", "(0\\)|<<|[<^*+#0@)]|<\\||[%s]+o)?"), //
new RegexLeaf("BODY1", "([-=.~]+)"), //
new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + LINE_STYLE_MUTILPLES + ")\\])?"), //
new RegexOptional(new RegexLeaf("DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)(?=[-=.~0()])")), //
new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), //
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + LINE_STYLE + ")\\])?"), //
new RegexLeaf("BODY2", "([-=.~]*)"), //
new RegexLeaf("HEAD1", "(\\(0|>>|[>^*+#0(]|\\|>|o[%s]+)?"), //
new RegexLeaf("HEAD1", "(\\(0|>>|[>^*+#0@(]|\\|>|o[%s]+)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("LABEL2", "[%g]([^%g]+)[%g]")), //
RegexLeaf.spaceZeroOrMore(), //
@ -117,6 +118,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
d1 = LinkDecor.SQUARE;
} else if (head1.equals("0")) {
d1 = LinkDecor.CIRCLE;
} else if (head1.equals("@")) {
d1 = LinkDecor.CIRCLE_FILL;
} else if (head1.equals("(")) {
d1 = LinkDecor.PARENTHESIS;
} else if (head1.equals(">")) {
@ -141,6 +144,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
d2 = LinkDecor.SQUARE;
} else if (head2.equals("0")) {
d2 = LinkDecor.CIRCLE;
} else if (head2.equals("@")) {
d2 = LinkDecor.CIRCLE_FILL;
} else if (head2.equals(")")) {
d2 = LinkDecor.PARENTHESIS;
} else if (head2.equals("<")) {
@ -223,7 +228,7 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
if (firstLabel == null && secondLabel == null) {
init();
}
labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink);
labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink, "\"");
if ("<".equals(labelLink)) {
linkArrow = LinkArrow.BACKWARD;
@ -282,24 +287,20 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
@Override
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
final Code ent1 = Code.of(arg.get("ENT1", 0));
final Code ent2 = Code.of(arg.get("ENT2", 0));
final String ent1String = arg.get("ENT1", 0);
final String ent2String = arg.get("ENT2", 0);
final Code code1 = diagram.buildCode(ent1String);
final Code code2 = diagram.buildCode(ent2String);
if (diagram.isGroup(ent1) && diagram.isGroup(ent2)) {
if (diagram.isGroup(code1) && diagram.isGroup(code2)) {
return executePackageLink(diagram, arg);
}
final IEntity cl1 = diagram.isGroup(ent1) ? diagram.getGroup(Code.of(arg.get("ENT1", 0))) : getOrCreateLeaf(
diagram, ent1);
final IEntity cl2 = diagram.isGroup(ent2) ? diagram.getGroup(Code.of(arg.get("ENT2", 0))) : getOrCreateLeaf(
diagram, ent2);
final Ident ident1 = diagram.buildLeafIdent(ent1String);
final Ident ident2 = diagram.buildLeafIdent(ent2String);
// if (arg.get("ENT1", 1) != null) {
// cl1.setStereotype(new Stereotype(arg.get("ENT1", 1)));
// }
// if (arg.get("ENT2", 1) != null) {
// cl2.setStereotype(new Stereotype(arg.get("ENT2", 1)));
// }
final IEntity cl1 = getFoo1(diagram, code1, ident1);
final IEntity cl2 = getFoo1(diagram, code2, ident2);
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
@ -329,31 +330,39 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
return CommandExecutionResult.ok();
}
private ILeaf getOrCreateLeaf(DescriptionDiagram diagram, final Code code2) {
final String code = code2.getFullName();
if (code.startsWith("()")) {
return diagram.getOrCreateLeaf(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils
.trin(code.substring(2)))), LeafType.DESCRIPTION, USymbol.INTERFACE);
private IEntity getFoo1(DescriptionDiagram diagram, Code code, Ident ident) {
if (diagram.isGroup(code)) {
return diagram.getGroup(code);
}
final char codeChar = code.length() > 2 ? code.charAt(0) : 0;
return getOrCreateLeafInternal(diagram, code, ident);
}
private ILeaf getOrCreateLeafInternal(DescriptionDiagram diagram, Code code, Ident ident) {
final String codeString = code.getName();
if (ident.getLast().startsWith("()")) {
ident = ident.removeStartingParenthesis();
return diagram.getOrCreateLeaf(ident, ident.toCode(), LeafType.DESCRIPTION, USymbol.INTERFACE);
}
final char codeChar = codeString.length() > 2 ? codeString.charAt(0) : 0;
final Code code3 = diagram.buildCode(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString, "\"([:"));
final Ident ident3 = diagram.buildLeafIdent(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(
codeString, "\"([:"));
if (codeChar == '(') {
return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
LeafType.USECASE, USymbol.USECASE);
return diagram.getOrCreateLeaf(ident3, code3, LeafType.USECASE, USymbol.USECASE);
} else if (codeChar == ':') {
return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
LeafType.DESCRIPTION, USymbol.ACTOR);
return diagram.getOrCreateLeaf(ident3, code3, LeafType.DESCRIPTION, diagram.getSkinParam().getActorStyle()
.getUSymbol());
} else if (codeChar == '[') {
final USymbol sym = diagram.getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
LeafType.DESCRIPTION, sym);
return diagram.getOrCreateLeaf(ident3, code3, LeafType.DESCRIPTION, sym);
}
return diagram.getOrCreateLeaf(code2, null, null);
return diagram.getOrCreateLeaf(ident, code, null, null);
}
private CommandExecutionResult executePackageLink(DescriptionDiagram diagram, RegexResult arg) {
final IEntity cl1 = diagram.getGroup(Code.of(arg.get("ENT1", 0)));
final IEntity cl2 = diagram.getGroup(Code.of(arg.get("ENT2", 0)));
final IEntity cl1 = diagram.getGroup(diagram.buildCode(arg.get("ENT1", 0)));
final IEntity cl2 = diagram.getGroup(diagram.buildCode(arg.get("ENT2", 0)));
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);

View File

@ -55,6 +55,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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@ -139,23 +140,27 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
final String displayRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0));
final Code code;
final String display;
final String idShort;
if (codeRaw.length() == 0) {
code = UniqueSequence.getCode("##");
idShort = UniqueSequence.getString("##");
code = diagram.buildCode(idShort);
display = null;
} else {
code = Code.of(codeRaw);
idShort = codeRaw;
code = diagram.buildCode(idShort);
if (displayRaw == null) {
display = code.getFullName();
display = code.getName();
} else {
display = displayRaw;
}
}
final IGroup currentPackage = diagram.getCurrentGroup();
diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
final Ident idNewLong = diagram.buildLeafIdent(idShort);
diagram.gotoGroup(idNewLong, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
p.setUSymbol(USymbol.getFromString(arg.get("SYMBOL", 0)));
p.setUSymbol(USymbol.getFromString(arg.get("SYMBOL", 0), diagram.getSkinParam().getActorStyle()));
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
if (stereotype != null) {
p.setStereotype(new Stereotype(stereotype, false));
@ -171,5 +176,4 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
p.setColors(colors);
return CommandExecutionResult.ok();
}
}

View File

@ -71,23 +71,23 @@ public class PSystemDonors extends AbstractPSystem {
private static final int COLS = 6;
private static final int FREE_LINES = 6;
public static final String DONORS = "6wO902mFU3XMJYceJdotTlPGzS6YgH3yYpFbZw2FTx01CWIrH4crEd9zz1eWg82keQF7tBxJutuZ_KLq"
+ "fNlVD2FQiZN5UKPHB0Xwl4sk6RQvjmV2d2KlWZjJWfuF5n0bqTtfBCiTANQVa85C9s9S14-RrrZgP2tv"
+ "1mcd-zyr5RAlgiAGBgiwVxf2SL807Z2x_5ETowPoBbUrwKqeGAVkNC5DLOUvTgAlJWmIOEBrR-TRrMHM"
+ "JF0GASwsS0HEepD3CnUjCx8Xi_OVzGzeip73Kf5RGd7KBedEFo-TsJRGVOu44nAxADWmvb3AOLgWUyYD"
+ "cCGcWeRwB4PZipLRdkXXS4CB-_AFHbBZaShCuMYJsDq31KxVnW58hzJK96RxDmFAH4QB6KjITM7SX3ld"
+ "OJ4LwGSDDuB2pe9Ma1g2l0bTyEan-rEJMrqD1Lxo3CczsIxKATi6jCsClirrIAByxpRDjF4UKowHwcpz"
+ "UQxtSGx8tL8hp_XZj3784TpxoOiALfvQ03y2lLGBbUJdf-mR2oaGzzRjYJmwLwxSHn4Ocp9CBFOgjbYB"
+ "_5YNjx4LMLOO2_helYuq8GCjTELoD_HjMfaqTBvGafPMBXzwT5gz369DnaplFFqP7NCv_xzIlCDCYXle"
+ "IedPfci4HUGSMaqN6nE1QQ77Gsu2iWBbxheLk_SF-NK-8FEMPGGYjpcZVL_nGjrr4M8wrdGrnGnW_fJI"
+ "5ed3WWW5xOBUHfL-fAqKknwkdkaJO-w-w9F7NJDZ40SwHMCHldeHtDqme-hDaGtjUymXU8Wlowkl-_0T"
+ "gm3MuTuR_aZDds0Wd-c54P568nhRrlsfSBU24bdK9HShybt5prmyT2TudScYGyoysXo7B0oL1qbQwfyC"
+ "FomPVFjCDkolIf4tu7bfc8PmP7mCBXzDUjJa4edDT9PZPYS0bofUiTzymdMXwfQQaoriYCd3Lnz29lWn"
+ "le2bCXMU1jQwUr6SGOmIvyIyLrOjAsjLyR60YbaXw4iBfMggADBdD3BYh47FGUjW-yt25kYbNdl3c51u"
+ "6wAx6XkmJH7JLKp_Q0AUY2gA9NefayG0lkR3hzL3Onry_6Pq7n47oEwI4485QewUE2tDjsDO1-ij-l_p"
+ "PJbv3_xytslQmQaLztnM0NI2aF_hA1W7JLtjCmflNJwSE1om0gasJcBbfQMdGG91v9QTFdMTPgHtOaIv"
+ "BLdqZkD3PRvI8Gv8OyFoYtwAeiQKaxwSh3YL3_lE6-4aXyZhdwBAcXHNfP6Q6C4cTdOKvsdiLhlXheih"
+ "yA0UN12e-_NZqyqiTuqrNq1g61uqvESZSkZGmxMWfgQ5iIom8iRwtYVzKAR7RyQcW5qbW3dJ0000";
public static final String DONORS = "6ym902mFR3fSuLzO9ciEU-UTVLaMenKnfVRDznXLdPaQKLLXAao0mEOTctOFBc-_C0Zx6pfwpEqxFUut"
+ "qbz4LxhtJJEYBLjJd6SKnOAWnzlacc6RUtjIPKW9Ogde_il4xUdMSI4sJgWGoY75FJja_dVfXBnNLM6M"
+ "xbPr_dI5saaRsR46R3M7opy5BaNbN0u56eGQqwaxr-5GHQEyUk1h2qqoA5pv2dnBAcR5n0wHugiRH-2J"
+ "pWnghTCwnoVIQlzI5z1Hvt9DYPI4yZnA95gtbVQE0tHVm6GIYKSTiC4ve9B3VeAftPw88N6hGOFAd8p6"
+ "fcgsFB70H02Qs8u_bA9cyvJCd8PE91vBe8JFht42i5UggOZPaSs0afxHegT9GfVNA-7cUB4qHUgWuJOm"
+ "uE6aJT1AGVu7Ek7NxgikcInZLzHCUGhprMmUYeSKNQnFPlJjh8M9yd-p8JFLyuhQvYcTnxhQ-9_DeTWq"
+ "PTNmcz76FEVWFhqjfD1neG3RIw3dUaV5_9cdZOLq2CzZwOLic8jNbb44pXgdYiLVnPRMoBzrXHfR5ylD"
+ "ZGLzpD-GMyb09rOX5aCVqqfcPUSJ9KrJu_EGHqF7Pn9hacRr3kbRYdCj__UsiAAPPXZeUXTpcgwDA1L6"
+ "GTMTR9e8J0kz6WeBo1selKnkrPVLG_phV43chOaa8hSvWNwcUaAzoyKgp1rhkjJ4363nb6Wd4gyRYI2h"
+ "BkXrG9b5fYFqsqrwfYsEXQTERtZSj1c3-g9ELqx2Lmk1TpTCohoP76pVuPo2n_7bUVLz7-5Z5S1Qt7lR"
+ "HMe-Wu5sImj6H5gEACTHTaburq0PMOmbBnhYpnxMk7ZePl0-aqNxc7ctEGvP0YhFceTMkiMuTKs6lYCc"
+ "cx1NiMXh8FYIc0Mg8-DzmEM2v84gBY5ncy4AE7W1mgyFNh4H5kxMGTKj8oT7rodCrdrr6cW9VjpMWQMo"
+ "3pnLk7Nth3Y3D4gTLynxOSsRnZwa-5X0kHmKpAI9ie-Kefgsbf5HOmnwzhg3vtQgsmAxZMyrZ1KARrDq"
+ "qs83jYbgkehjHXFpH5HHgH6NFXP6mCyy_2OyDDOXnj_qiXbnfhaXJ4c54vvVd2qDsnujibwZrstRzhPo"
+ "_lo_rsG7ftfSvrK5q1M4_DzCcTo81TSrFON-tkMBFfWpMIsgrJY9bUUMdWMO32AtRFQcVPgHtQapokrg"
+ "WpxhyQ6IlwaS9wZh4vPVp59KXoznDjlU6auLvhxvHZZ9eV3-fwYoAJ-uAYKrCO9DxEGepkDuhgCKTrrS"
+ "GGJq3HS5ndxpisBDbum-NpJdC1mPyjCHTZdStRMW2casfmKMwQplhTkwP7R_IqRmXL6JTbOFQurZX5IB" + "G57DXFeu3000";
/*
* Special thanks to our sponsors and donors:

View File

@ -326,7 +326,12 @@ public class QuoteUtils {
"Gnxr zr guebhtu gur qnexarff gb gur oernx bs gur qnl",
"Vg znxrf gur gehgu rira zber vapbzcerurafvoyr orpnhfr rirelguvat vf arj",
"V qba'g xabj ubj ohg V fhqqrayl ybfr pbageby", "Gurer ner zbzragf jura V guvax V'z tbvat penml",
"Jbhyq gung vg jrer fb fvzcyr", "Pnyy gung n xavsr? Guvf vf n xavsr.");
"Jbhyq gung vg jrer fb fvzcyr", "Pnyy gung n xavsr? Guvf vf n xavsr.",
"Fhe y'bprna qh grzcf dhv tyvffr...", "Snvyher serr bcrengvbaf erdhver rkcrevrapr jvgu snvyher.",
"Pngnfgebcur vf nyjnlf whfg nebhaq gur pbeare.",
"Orjner bs ohtf va gur nobir pbqr; V unir bayl cebirq vg pbeerpg, abg gevrq vg",
"V'z abg n erny cebtenzzre. V guebj gbtrgure guvatf hagvy vg jbexf gura V zbir ba",
"#qrsvar DHRFGVBA ((oo)||!(oo))");
private QuoteUtils() {
}

View File

@ -42,8 +42,10 @@ import java.util.Map;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.skin.ActorStyle;
public abstract class USymbol {
@ -68,7 +70,10 @@ public abstract class USymbol {
public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS, new USymbolCollections(
SkinParameter.RECTANGLE));
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT));
public final static USymbol ACTOR = record("ACTOR", SkinParameter.ACTOR, new USymbolActor());
public final static USymbol ACTOR_STICKMAN = record("ACTOR_STICKMAN", SkinParameter.ACTOR, new USymbolActor(
ActorStyle.STICKMAN));
public final static USymbol ACTOR_AWESOME = record("ACTOR_AWESOME", SkinParameter.ACTOR, new USymbolActor(
ActorStyle.AWESOME));
public final static USymbol USECASE = null;
public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1());
public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2());
@ -104,10 +109,13 @@ public abstract class USymbol {
return getSkinParameter().getColorParamBorder();
}
public static USymbol getFromString(String s) {
public static USymbol getFromString(String s, ActorStyle actorStyle) {
if (s == null) {
return null;
}
if (s.equalsIgnoreCase("actor")) {
return actorStyle.getUSymbol();
}
final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", "")));
if (result == null) {
if (s.equalsIgnoreCase("component")) {
@ -190,7 +198,7 @@ public abstract class USymbol {
};
}
public static USymbol getFromString(String symbol, boolean useUml2ForComponent) {
public static USymbol getFromString(String symbol, ISkinParam skinParam) {
USymbol usymbol = null;
if (symbol.equalsIgnoreCase("artifact")) {
usymbol = USymbol.ARTIFACT;
@ -221,9 +229,9 @@ public abstract class USymbol {
} else if (symbol.equalsIgnoreCase("agent")) {
usymbol = USymbol.AGENT;
} else if (symbol.equalsIgnoreCase("actor")) {
usymbol = USymbol.ACTOR;
usymbol = skinParam.getActorStyle().getUSymbol();
} else if (symbol.equalsIgnoreCase("component")) {
usymbol = useUml2ForComponent ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
usymbol = skinParam.useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
} else if (symbol.equalsIgnoreCase("boundary")) {
usymbol = USymbol.BOUNDARY;
} else if (symbol.equalsIgnoreCase("control")) {

View File

@ -35,21 +35,28 @@
*/
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.skin.StickMan;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.ugraphic.UStroke;
class USymbolActor extends USymbolSimpleAbstract {
private final ActorStyle actorStyle;
public USymbolActor(ActorStyle actorStyle) {
this.actorStyle = actorStyle;
}
@Override
public SkinParameter getSkinParameter() {
return SkinParameter.ACTOR;
}
@Override
protected TextBlock getDrawing(SymbolContext symbolContext) {
final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0;
return new StickMan(symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2)));
final SymbolContext tmp = symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2));
return actorStyle.getTextBlock(symbolContext);
}
}

View File

@ -39,6 +39,8 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
abstract class USymbolSimpleAbstract extends USymbol {
@ -54,7 +56,7 @@ abstract class USymbolSimpleAbstract extends USymbol {
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimName = label.calculateDimension(stringBounder);
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
final Dimension2D dimStickMan = stickman.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimension(stringBounder);
@ -62,8 +64,12 @@ abstract class USymbolSimpleAbstract extends USymbol {
final double stickmanY = dimStereo.getHeight();
ug = symbolContext.apply(ug);
stickman.drawU(ug.apply(new UTranslate(stickmanX, stickmanY)));
final double labelX = (dimTotal.getWidth() - dimName.getWidth()) / 2;
final double labelX = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
final double labelY = dimStickMan.getHeight() + dimStereo.getHeight();
// Actor bug?
// final UGraphic ug2 = UGraphicStencil.create(ug, getRectangleStencil(dimLabel), new UStroke());
// label.drawU(ug2.apply(new UTranslate(labelX, labelY)));
label.drawU(ug.apply(new UTranslate(labelX, labelY)));
final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2;
@ -71,10 +77,10 @@ abstract class USymbolSimpleAbstract extends USymbol {
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dimName = label.calculateDimension(stringBounder);
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
final Dimension2D dimActor = stickman.calculateDimension(stringBounder);
return Dimension2DDouble.mergeLayoutT12B3(dimStereo, dimActor, dimName);
return Dimension2DDouble.mergeLayoutT12B3(dimStereo, dimActor, dimLabel);
}
};
}
@ -83,7 +89,8 @@ abstract class USymbolSimpleAbstract extends USymbol {
@Override
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, TextBlock stereotype,
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
final double width, final double height, final SymbolContext symbolContext,
final HorizontalAlignment stereoAlignment) {
throw new UnsupportedOperationException();
}

View File

@ -117,7 +117,7 @@ public final class CucaDiagramHtmlMaker {
final File f = new File(dir, LinkHtmlPrinter.urlOf(entity));
final PrintWriter pw = new PrintWriter(f);
pw.println("<html>");
pw.println("<title>" + StringUtils.unicodeForHtml(entity.getCode().getFullName()) + "</title>");
pw.println("<title>" + StringUtils.unicodeForHtml(entity.getCodeGetName()) + "</title>");
pw.println("<h2>" + entity.getLeafType().toHtml() + "</h2>");
for (CharSequence s : entity.getDisplay()) {
pw.println(StringUtils.unicodeForHtml(s.toString()));

View File

@ -65,9 +65,9 @@ public final class LinkHtmlPrinter {
final String ent2h;
if (chiral) {
ent1h = htmlLink(link.getEntity1());
ent2h = "<i>" + StringUtils.unicodeForHtml(link.getEntity2().getCode().getFullName()) + "</i>";
ent2h = "<i>" + StringUtils.unicodeForHtml(link.getEntity2().getCodeGetName()) + "</i>";
} else {
ent1h = "<i>" + StringUtils.unicodeForHtml(link.getEntity1().getCode().getFullName()) + "</i>";
ent1h = "<i>" + StringUtils.unicodeForHtml(link.getEntity1().getCodeGetName()) + "</i>";
ent2h = htmlLink(link.getEntity2());
}
String label = link.getLabel() == null ? null : StringUtils.unicodeForHtml(link.getLabel());
@ -170,7 +170,7 @@ public final class LinkHtmlPrinter {
sb.append("<a href=\"");
sb.append(urlOf(ent));
sb.append("\">");
sb.append(StringUtils.unicodeForHtml(ent.getCode().getFullName()));
sb.append(StringUtils.unicodeForHtml(ent.getCodeGetName()));
sb.append("</a>");
return sb.toString();
}
@ -179,8 +179,8 @@ public final class LinkHtmlPrinter {
if (ent.getLeafType() == LeafType.NOTE) {
throw new IllegalArgumentException();
}
if (ent.getCode().getFullName().matches("[-\\w_ .]+")) {
return StringUtils.unicodeForHtml(ent.getCode().getFullName()) + ".html";
if (ent.getCodeGetName().matches("[-\\w_ .]+")) {
return StringUtils.unicodeForHtml(ent.getCodeGetName()) + ".html";
}
return StringUtils.unicodeForHtml(ent.getUid()) + ".html";
}

View File

@ -210,7 +210,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
continue;
}
if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) {
final ILeaf folder = diagram.getEntityFactory().createLeaf(g.getCode(), g.getDisplay(),
final ILeaf folder = diagram.getEntityFactory().createLeaf(g.getIdent(), g.getCode(), g.getDisplay(),
LeafType.EMPTY_PACKAGE, g.getParentContainer(), null, diagram.getNamespaceSeparator());
emptyGroups.put(g, folder);
final USymbol symbol = g.getUSymbol();

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.getGroupsvalues()) {
for (IGroup group : entityFactory.groups()) {
packages.add(new MDAPackageImpl(group));
}
}

View File

@ -47,7 +47,7 @@ public class MDAEntityImpl implements MDAEntity {
}
public String getName() {
return leaf.getCode().getFullName();
return leaf.getCodeGetName();
}
}

View File

@ -65,7 +65,7 @@ public class MDAPackageImpl implements MDAPackage {
if (group instanceof GroupRoot) {
return "";
}
return group.getCode().getFullName();
return group.getCodeGetName();
}
}

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
public class DiagElement {
@ -87,8 +88,8 @@ public class DiagElement {
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
ColorParam.activityBorder.getDefaultValue()).withShadow(3);
final TextBlock desc = toTextBlock(description);
final TextBlock box = shape
.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER);
final TextBlock box = shape.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0),
symbolContext, HorizontalAlignment.CENTER);
return new LinkedElement(ad1, box, ad2, mainNetwork, this);
}
@ -109,7 +110,7 @@ public class DiagElement {
}
public final void setShape(String shapeName) {
final USymbol shapeFromString = USymbol.getFromString(shapeName);
final USymbol shapeFromString = USymbol.getFromString(shapeName, ActorStyle.STICKMAN);
if (shapeFromString != null) {
this.shape = shapeFromString;
}

View File

@ -105,20 +105,26 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
private final List<Association> associations = new ArrayList<Association>();
public CommandExecutionResult associationClass(Code clName1A, Code clName1B, Code clName2A, Code clName2B,
public CommandExecutionResult associationClass(String name1A, String name1B, String name2A, String name2B,
LinkType linkType, Display label) {
final IEntity entity1A = getOrCreateLeaf(clName1A, null, null);
final IEntity entity1B = getOrCreateLeaf(clName1B, null, null);
final IEntity entity2A = getOrCreateLeaf(clName2A, null, null);
final IEntity entity2B = getOrCreateLeaf(clName2B, null, null);
final IEntity entity1A = getOrCreateLeaf(buildLeafIdent(name1A), buildCode(name1A),
null, null);
final IEntity entity1B = getOrCreateLeaf(buildLeafIdent(name1B), buildCode(name1B),
null, null);
final IEntity entity2A = getOrCreateLeaf(buildLeafIdent(name2A), buildCode(name2A),
null, null);
final IEntity entity2B = getOrCreateLeaf(buildLeafIdent(name2B), buildCode(name2B),
null, null);
final List<Association> same1 = getExistingAssociatedPoints(entity1A, entity1B);
final List<Association> same2 = getExistingAssociatedPoints(entity2A, entity2B);
if (same1.size() == 0 && same2.size() == 0) {
final IEntity point1 = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION,
null);
final IEntity point2 = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION,
null);
final String tmp1 = UniqueSequence.getString("apoint");
final IEntity point1 = getOrCreateLeaf(buildLeafIdent(tmp1), buildCode(tmp1),
LeafType.POINT_FOR_ASSOCIATION, null);
final String tmp2 = UniqueSequence.getString("apoint");
final IEntity point2 = getOrCreateLeaf(buildLeafIdent(tmp2), buildCode(tmp2),
LeafType.POINT_FOR_ASSOCIATION, null);
insertPointBetween(entity1A, entity1B, point1);
insertPointBetween(entity2A, entity2B, point2);
@ -168,10 +174,12 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
addLink(pointToEntity2);
}
public boolean associationClass(int mode, Code clName1, Code clName2, IEntity associed, LinkType linkType,
public boolean associationClass(int mode, String name1, String name2, IEntity associed, LinkType linkType,
Display label) {
final IEntity entity1 = getOrCreateLeaf(clName1, null, null);
final IEntity entity2 = getOrCreateLeaf(clName2, null, null);
final IEntity entity1 = getOrCreateLeaf(buildLeafIdent(name1), buildCode(name1), null,
null);
final IEntity entity2 = getOrCreateLeaf(buildLeafIdent(name2), buildCode(name2), null,
null);
final List<Association> same = getExistingAssociatedPoints(entity1, entity2);
if (same.size() > 1) {
return false;
@ -218,7 +226,9 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
this.entity1 = entity1;
this.entity2 = entity2;
this.associed = associed;
point = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION, null);
final String idShort = UniqueSequence.getString("apoint");
point = getOrCreateLeaf(buildLeafIdent(idShort), buildCode(idShort),
LeafType.POINT_FOR_ASSOCIATION, null);
}

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.USymbol;
@ -49,11 +50,12 @@ public class ObjectDiagram extends AbstractClassOrObjectDiagram {
}
@Override
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
if (type == null) {
type = LeafType.OBJECT;
}
return getOrCreateLeafDefault(code, type, symbol);
// final Ident idNewLong = buildLeafIdent(id);
return getOrCreateLeafDefault(ident, code, type, symbol);
}
@Override

View File

@ -65,7 +65,9 @@ public class CommandAddData extends SingleLineCommand2<AbstractClassOrObjectDiag
@Override
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) {
final IEntity entity = diagram.getOrCreateLeaf(Code.of(arg.get("NAME", 0)), null, null);
final String name = arg.get("NAME", 0);
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(name),
diagram.buildCode(name), null, null);
final String field = arg.get("DATA", 0);
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -77,13 +78,16 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
@Override
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) {
final Code code = Code.of(arg.get("NAME", 1));
final String idShort = arg.get("NAME", 1);
final Code code = diagram.buildCode(idShort);
final String display = arg.get("NAME", 0);
final String stereotype = arg.get("STEREO", 0);
if (diagram.leafExist(code)) {
return CommandExecutionResult.error("Object already exists : " + code);
}
final IEntity entity = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.OBJECT, null);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
final IEntity entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display),
LeafType.OBJECT, null);
if (stereotype != null) {
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
@ -103,13 +104,15 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Abst
}
private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) {
final Code code = Code.of(line0.get("NAME", 1));
final String name = line0.get("NAME", 1);
final Code code = diagram.buildCode(name);
final String display = line0.get("NAME", 0);
final String stereotype = line0.get("STEREO", 0);
if (diagram.leafExist(code)) {
return diagram.getOrCreateLeaf(code, LeafType.OBJECT, null);
return diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, LeafType.OBJECT, null);
}
final IEntity entity = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.OBJECT, null);
final Ident idNewLong = diagram.buildLeafIdent(name);
final IEntity entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), LeafType.OBJECT, null);
if (stereotype != null) {
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()

View File

@ -0,0 +1,111 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Rob Oxspring
*
*
*/
package net.sourceforge.plantuml.skin;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ActorAwesome extends AbstractTextBlock implements TextBlock {
private final double headDiam = 32;
private final double bodyWidth = 54;
private final double shoulder = 16;
private final double collar = 4;
private final double radius = 8;
private final double bodyHeight = 28;
private final SymbolContext symbolContext;
public ActorAwesome(SymbolContext symbolContext) {
this.symbolContext = symbolContext.withStroke(new UStroke(1.5));
}
public void drawU(UGraphic ug) {
final UEllipse head = new UEllipse(headDiam, headDiam);
final double centerX = getPreferredWidth() / 2;
final UPath path = new UPath();
path.moveTo(0, collar);
path.cubicTo(collar, collar, bodyWidth / 2 - shoulder - collar, collar, bodyWidth / 2 - shoulder, 0);
path.cubicTo(bodyWidth / 2 - shoulder / 2, 0, bodyWidth / 2, shoulder / 2, bodyWidth / 2, shoulder);
path.lineTo(bodyWidth / 2, bodyHeight - radius);
path.cubicTo(bodyWidth / 2, bodyHeight - radius / 2, bodyWidth / 2 - radius / 2, bodyHeight, bodyWidth / 2
- radius, bodyHeight);
path.lineTo(-bodyWidth / 2 + radius, bodyHeight);
path.cubicTo(-bodyWidth / 2 + radius / 2, bodyHeight, -bodyWidth / 2, bodyHeight - radius / 2, -bodyWidth / 2,
bodyHeight - radius);
path.lineTo(-bodyWidth / 2, shoulder);
path.cubicTo(-bodyWidth / 2, shoulder / 2, -bodyWidth / 2 + shoulder / 2, 0, -bodyWidth / 2 + shoulder, 0);
path.cubicTo(-bodyWidth / 2 + shoulder + collar, collar, -collar, collar, 0, collar);
path.closePath();
if (symbolContext.getDeltaShadow() != 0) {
head.setDeltaShadow(symbolContext.getDeltaShadow());
path.setDeltaShadow(symbolContext.getDeltaShadow());
}
ug = symbolContext.apply(ug);
ug.apply(new UTranslate(centerX - head.getWidth() / 2, thickness())).draw(head);
ug.apply(new UTranslate(centerX, head.getHeight() + thickness())).draw(path);
}
private double thickness() {
return symbolContext.getStroke().getThickness();
}
public double getPreferredWidth() {
return bodyWidth + thickness() * 2;
}
public double getPreferredHeight() {
return headDiam + bodyHeight + thickness() * 2;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(getPreferredWidth(), getPreferredHeight());
}
}

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
@ -47,10 +46,9 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class StickMan extends AbstractTextBlock implements TextBlock {
public class ActorStickMan extends AbstractTextBlock implements TextBlock {
private final double armsY = 8;
private final double armsLenght = 13;
@ -61,19 +59,10 @@ public class StickMan extends AbstractTextBlock implements TextBlock {
private final SymbolContext symbolContext;
public StickMan(SymbolContext symbolContext) {
ActorStickMan(SymbolContext symbolContext) {
this.symbolContext = symbolContext;
}
private StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow) {
this(new SymbolContext(backgroundColor, foregroundColor).withDeltaShadow(deltaShadow)
.withStroke(new UStroke(2)));
}
public StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor) {
this(new SymbolContext(backgroundColor, foregroundColor).withStroke(new UStroke(2)));
}
public void drawU(UGraphic ug) {
final double startX = Math.max(armsLenght, legsX) - headDiam / 2.0 + thickness();

View File

@ -33,32 +33,32 @@
*
*
*/
package net.sourceforge.plantuml.graphic;
package net.sourceforge.plantuml.skin;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.USymbol;
public class UGraphicAddAriaLabel extends UGraphicDelegator {
public enum ActorStyle {
private final String ariaLabel;
STICKMAN, AWESOME;
public UGraphicAddAriaLabel(UGraphic ug, String ariaLabel) {
super(ug);
this.ariaLabel = ariaLabel;
}
public UGraphic apply(UChange change) {
return new UGraphicAddAriaLabel(getUg().apply(change), ariaLabel);
}
@Override
public void draw(UShape shape) {
if (shape instanceof UText) {
shape = ((UText) shape).withAriaLabel(ariaLabel);
public USymbol getUSymbol() {
if (this == STICKMAN) {
return USymbol.ACTOR_STICKMAN;
} else if (this == AWESOME) {
return USymbol.ACTOR_AWESOME;
}
super.draw(shape);
throw new IllegalStateException();
}
public TextBlock getTextBlock(SymbolContext symbolContext) {
if (this == STICKMAN) {
return new ActorStickMan(symbolContext);
} else if (this == AWESOME) {
return new ActorAwesome(symbolContext);
}
throw new IllegalStateException();
}
}

View File

@ -35,11 +35,10 @@
*/
package net.sourceforge.plantuml.skin;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.Styleable;
public enum ComponentType implements Styleable {

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.StringBounder;

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -49,8 +48,9 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
import net.sourceforge.plantuml.skin.ActorStickMan;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.StickMan;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -61,15 +61,17 @@ public class ComponentRoseActor extends AbstractTextualComponent {
private final TextBlock stickman;
private final boolean head;
public ComponentRoseActor(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay,
boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
public ComponentRoseActor(ActorStyle actorStyle, Style style, Style stereo, SymbolContext biColor,
FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer,
UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0,
spriteContainer, false, fontForStereotype, htmlColorForStereotype);
this.head = head;
if (SkinParam.USE_STYLES()) {
biColor = style.getSymbolContext(getIHtmlColorSet());
}
this.stickman = new StickMan(biColor);
// this.stickman = new ActorStickMan(biColor);
this.stickman = actorStyle.getTextBlock(biColor);
}
@Override

View File

@ -40,7 +40,6 @@ import java.awt.geom.Point2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -53,7 +52,6 @@ import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.ArrowDressing;
import net.sourceforge.plantuml.skin.ArrowHead;
import net.sourceforge.plantuml.skin.ArrowPart;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -50,7 +49,6 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.Boundary;
import net.sourceforge.plantuml.ugraphic.UFont;

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.SkinParamBackcolored;
import net.sourceforge.plantuml.graphic.FontConfiguration;

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
@ -45,8 +44,8 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.AbstractComponent;
import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.skin.rose;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.cucadiagram.Display;

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