mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 1.2019.13
This commit is contained in:
parent
36c461dabe
commit
275cde19a8
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<groupId>net.sourceforge.plantuml</groupId>
|
<groupId>net.sourceforge.plantuml</groupId>
|
||||||
<artifactId>plantuml</artifactId>
|
<artifactId>plantuml</artifactId>
|
||||||
<version>1.2019.13-SNAPSHOT</version>
|
<version>1.2019.14-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>PlantUML</name>
|
<name>PlantUML</name>
|
||||||
|
@ -68,13 +68,17 @@ public class FileSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File getFile(String nameOrPath) throws IOException {
|
public File getFile(String nameOrPath) throws IOException {
|
||||||
final File dir = currentDir.get();
|
if (isAbsolute(nameOrPath)) {
|
||||||
if (dir == null || isAbsolute(nameOrPath)) {
|
|
||||||
return new File(nameOrPath).getCanonicalFile();
|
return new File(nameOrPath).getCanonicalFile();
|
||||||
}
|
}
|
||||||
final File filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
|
final File dir = currentDir.get();
|
||||||
if (filecurrent.exists()) {
|
File filecurrent = null;
|
||||||
return filecurrent.getCanonicalFile();
|
if (dir != null) {
|
||||||
|
filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
|
||||||
|
if (filecurrent.exists()) {
|
||||||
|
return filecurrent.getCanonicalFile();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (File d : getPath("plantuml.include.path", true)) {
|
for (File d : getPath("plantuml.include.path", true)) {
|
||||||
if (d.isDirectory()) {
|
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;
|
return filecurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
|||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.SkinParameter;
|
import net.sourceforge.plantuml.graphic.SkinParameter;
|
||||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
|
import net.sourceforge.plantuml.skin.ActorStyle;
|
||||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||||
import net.sourceforge.plantuml.skin.Padder;
|
import net.sourceforge.plantuml.skin.Padder;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
@ -182,10 +183,11 @@ public interface ISkinParam extends ISkinSimple {
|
|||||||
public void muteStyle(Style modifiedStyle);
|
public void muteStyle(Style modifiedStyle);
|
||||||
|
|
||||||
public Collection<String> getAllSpriteNames();
|
public Collection<String> getAllSpriteNames();
|
||||||
|
|
||||||
public String getDefaultSkin();
|
public String getDefaultSkin();
|
||||||
|
|
||||||
public void setDefaultSkin(String newSkin);
|
public void setDefaultSkin(String newSkin);
|
||||||
|
|
||||||
|
public ActorStyle getActorStyle();
|
||||||
|
|
||||||
}
|
}
|
@ -65,6 +65,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
|||||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||||
import net.sourceforge.plantuml.graphic.SkinParameter;
|
import net.sourceforge.plantuml.graphic.SkinParameter;
|
||||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
|
import net.sourceforge.plantuml.skin.ActorStyle;
|
||||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||||
import net.sourceforge.plantuml.skin.Padder;
|
import net.sourceforge.plantuml.skin.Padder;
|
||||||
import net.sourceforge.plantuml.sprite.Sprite;
|
import net.sourceforge.plantuml.sprite.Sprite;
|
||||||
@ -101,7 +102,7 @@ public class SkinParam implements ISkinParam {
|
|||||||
}
|
}
|
||||||
if (type == UmlDiagramType.SEQUENCE) {
|
if (type == UmlDiagramType.SEQUENCE) {
|
||||||
// skin = "debug.skin";
|
// skin = "debug.skin";
|
||||||
//USE_STYLE2.set(true);
|
// USE_STYLE2.set(true);
|
||||||
}
|
}
|
||||||
// if (type == UmlDiagramType.ACTIVITY) {
|
// if (type == UmlDiagramType.ACTIVITY) {
|
||||||
// // skin = "debug.skin";
|
// // skin = "debug.skin";
|
||||||
@ -1046,7 +1047,7 @@ public class SkinParam implements ISkinParam {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPreserveAspectRatio() {
|
public String getPreserveAspectRatio() {
|
||||||
final String value = getValue("preserveaspectratio");
|
final String value = getValue("preserveaspectratio");
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -1055,7 +1056,6 @@ public class SkinParam implements ISkinParam {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getMonospacedFamily() {
|
public String getMonospacedFamily() {
|
||||||
final String value = getValue("defaultMonospacedFontName");
|
final String value = getValue("defaultMonospacedFontName");
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -1207,4 +1207,12 @@ public class SkinParam implements ISkinParam {
|
|||||||
.withBorderColor(border).withRoundCorner(roundCorner);
|
.withBorderColor(border).withRoundCorner(roundCorner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActorStyle getActorStyle() {
|
||||||
|
final String value = getValue("actorstyle");
|
||||||
|
if ("awesome".equalsIgnoreCase(value)) {
|
||||||
|
return ActorStyle.AWESOME;
|
||||||
|
}
|
||||||
|
return ActorStyle.STICKMAN;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
|
|||||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||||
import net.sourceforge.plantuml.graphic.SkinParameter;
|
import net.sourceforge.plantuml.graphic.SkinParameter;
|
||||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
|
import net.sourceforge.plantuml.skin.ActorStyle;
|
||||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||||
import net.sourceforge.plantuml.skin.Padder;
|
import net.sourceforge.plantuml.skin.Padder;
|
||||||
import net.sourceforge.plantuml.sprite.Sprite;
|
import net.sourceforge.plantuml.sprite.Sprite;
|
||||||
@ -234,7 +235,7 @@ public class SkinParamDelegator implements ISkinParam {
|
|||||||
public String getSvgLinkTarget() {
|
public String getSvgLinkTarget() {
|
||||||
return skinParam.getSvgLinkTarget();
|
return skinParam.getSvgLinkTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPreserveAspectRatio() {
|
public String getPreserveAspectRatio() {
|
||||||
return skinParam.getPreserveAspectRatio();
|
return skinParam.getPreserveAspectRatio();
|
||||||
}
|
}
|
||||||
@ -359,5 +360,8 @@ public class SkinParamDelegator implements ISkinParam {
|
|||||||
skinParam.setDefaultSkin(newFileName);
|
skinParam.setDefaultSkin(newFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActorStyle getActorStyle() {
|
||||||
|
return skinParam.getActorStyle();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ public class SourceStringReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void noStartumlFound(OutputStream os, FileFormatOption fileFormatOption, long seed) throws IOException {
|
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());
|
fileFormatOption.isUseRedForError());
|
||||||
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, error.getBackcolor(), null,
|
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, error.getBackcolor(), null,
|
||||||
null, 0, 0, null, false);
|
null, 0, 0, null, false);
|
||||||
|
@ -232,6 +232,9 @@ public class StringUtils {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s, String format) {
|
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s, String format) {
|
||||||
|
if (s == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (format.contains("\"") && s.length() > 1 && isDoubleQuote(s.charAt(0))
|
if (format.contains("\"") && s.length() > 1 && isDoubleQuote(s.charAt(0))
|
||||||
&& isDoubleQuote(s.charAt(s.length() - 1))) {
|
&& isDoubleQuote(s.charAt(s.length() - 1))) {
|
||||||
return s.substring(1, s.length() - 1);
|
return s.substring(1, s.length() - 1);
|
||||||
|
@ -72,21 +72,6 @@ public class UrlBuilder {
|
|||||||
this.mode = mode;
|
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) {
|
public Url getUrl(String s) {
|
||||||
final Pattern2 p;
|
final Pattern2 p;
|
||||||
if (mode == ModeUrl.STRICT) {
|
if (mode == ModeUrl.STRICT) {
|
||||||
@ -100,18 +85,18 @@ public class UrlBuilder {
|
|||||||
if (m.matches() == false) {
|
if (m.matches() == false) {
|
||||||
return null;
|
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 quotedPart = m.group(1);
|
||||||
final String full = m.group(2);
|
final String fullpp = m.group(2).replaceAll("\\{scale=([0-9.]+)\\}", "\uE000scale=$1\uE001");
|
||||||
final int openBracket = full.indexOf('{');
|
|
||||||
final int closeBracket = full.lastIndexOf('}');
|
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 (quotedPart == null) {
|
||||||
if (openBracket != -1 && closeBracket != -1) {
|
if (openBracket != -1 && closeBracket != -1) {
|
||||||
return new Url(withTopUrl(full.substring(0, openBracket)),
|
return new Url(withTopUrl(full.substring(0, openBracket)),
|
||||||
@ -130,6 +115,27 @@ public class UrlBuilder {
|
|||||||
return new Url(withTopUrl(quotedPart), null, null);
|
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) {
|
private String withTopUrl(String url) {
|
||||||
if (url.startsWith("http:") == false && url.startsWith("https:") == false && topurl != null) {
|
if (url.startsWith("http:") == false && url.startsWith("https:") == false && topurl != null) {
|
||||||
return topurl + url;
|
return topurl + url;
|
||||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
@ -61,34 +62,40 @@ public class ActivityDiagram extends CucaDiagram {
|
|||||||
|
|
||||||
public ActivityDiagram(ISkinSimple skinParam) {
|
public ActivityDiagram(ISkinSimple skinParam) {
|
||||||
super(skinParam);
|
super(skinParam);
|
||||||
|
setNamespaceSeparator(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
|
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
|
||||||
return getOrCreateLeafDefault(code, type, symbol);
|
checkNotNull(ident);
|
||||||
|
// final Ident idNewLong = buildLeafIdent(id);
|
||||||
|
return getOrCreateLeafDefault(ident, code, type, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAutoBranch() {
|
private String getAutoBranch() {
|
||||||
return "#" + UniqueSequence.getValue();
|
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 IEntity result;
|
||||||
|
// final Ident idNewLong = buildLeafIdent(id);
|
||||||
if (leafExist(code)) {
|
if (leafExist(code)) {
|
||||||
result = getOrCreateLeafDefault(code, type, null);
|
result = getOrCreateLeafDefault(idNewLong, code, type, null);
|
||||||
if (result.getLeafType() != type) {
|
if (result.getLeafType() != type) {
|
||||||
// throw new IllegalArgumentException("Already known: " + code + " " + result.getType() + " " + type);
|
// throw new IllegalArgumentException("Already known: " + code + " " + result.getType() + " " + type);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = createLeaf(code, display, type, null);
|
result = createLeaf(idNewLong, code, display, type, null);
|
||||||
}
|
}
|
||||||
updateLasts(result);
|
updateLasts(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startIf(Code optionalCode) {
|
public void startIf(String optionalCodeString) {
|
||||||
final IEntity br = createLeaf(optionalCode == null ? Code.of(getAutoBranch()) : optionalCode,
|
final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString;
|
||||||
Display.create(""), LeafType.BRANCH, null);
|
final Ident idNewLong = buildLeafIdent(idShort);
|
||||||
|
final IEntity br = createLeaf(idNewLong, buildCode(idShort), Display.create(""),
|
||||||
|
LeafType.BRANCH, null);
|
||||||
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
|
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,12 +104,14 @@ public class ActivityDiagram extends CucaDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ILeaf getStart() {
|
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) {
|
public ILeaf getEnd(String suppId) {
|
||||||
final Code code = suppId == null ? Code.of("end") : Code.of("end$" + suppId);
|
final String tmp = suppId == null ? "end" : "end$" + suppId;
|
||||||
return (ILeaf) getOrCreate(code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
|
final Code code = buildCode(tmp);
|
||||||
|
return (ILeaf) getOrCreate(buildLeafIdent(tmp), code, Display.getWithNewlines("end"), LeafType.CIRCLE_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLasts(final IEntity result) {
|
private void updateLasts(final IEntity result) {
|
||||||
@ -116,14 +125,17 @@ public class ActivityDiagram extends CucaDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
|
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
|
||||||
final ILeaf result = super.createLeaf(code, display, type, symbol);
|
checkNotNull(idNewLong);
|
||||||
|
final ILeaf result = super.createLeaf(idNewLong, code, display, type, symbol);
|
||||||
updateLasts(result);
|
updateLasts(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEntity createNote(Code code, Display display) {
|
public IEntity createNote(Ident idNewLong, Code code, Display display) {
|
||||||
return super.createLeaf(code, display, LeafType.NOTE, null);
|
checkNotNull(idNewLong);
|
||||||
|
// final Ident idNewLong = buildLeafIdent(id);
|
||||||
|
return super.createLeaf(idNewLong, code, display, LeafType.NOTE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected List<String> getDotStrings() {
|
final protected List<String> getDotStrings() {
|
||||||
@ -159,8 +171,10 @@ public class ActivityDiagram extends CucaDiagram {
|
|||||||
|
|
||||||
public IEntity createInnerActivity() {
|
public IEntity createInnerActivity() {
|
||||||
// Log.println("createInnerActivity A");
|
// Log.println("createInnerActivity A");
|
||||||
final Code code = Code.of("##" + UniqueSequence.getValue());
|
final String idShort = "##" + UniqueSequence.getValue();
|
||||||
gotoGroup2(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
|
final Code code = buildCode(idShort);
|
||||||
|
final Ident idNewLong = buildLeafIdent(idShort);
|
||||||
|
gotoGroup(idNewLong, code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(),
|
||||||
NamespaceStrategy.SINGLE);
|
NamespaceStrategy.SINGLE);
|
||||||
final IEntity g = getCurrentGroup();
|
final IEntity g = getCurrentGroup();
|
||||||
// g.setRankdir(Rankdir.LEFT_TO_RIGHT);
|
// g.setRankdir(Rankdir.LEFT_TO_RIGHT);
|
||||||
@ -177,12 +191,14 @@ public class ActivityDiagram extends CucaDiagram {
|
|||||||
endGroup();
|
endGroup();
|
||||||
// Log.println("endgroup");
|
// Log.println("endgroup");
|
||||||
}
|
}
|
||||||
|
final String idShort = "##" + UniqueSequence.getValue();
|
||||||
// Log.println("concurrentActivity A name=" + name+" "+getCurrentGroup());
|
// 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) {
|
if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) {
|
||||||
throw new IllegalStateException("type=" + getCurrentGroup().getGroupType());
|
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);
|
NamespaceStrategy.SINGLE);
|
||||||
lastEntityConsulted = null;
|
lastEntityConsulted = null;
|
||||||
lastEntityBrancheConsulted = null;
|
lastEntityBrancheConsulted = null;
|
||||||
|
@ -48,7 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
|||||||
import net.sourceforge.plantuml.command.regex.RegexOptional;
|
import net.sourceforge.plantuml.command.regex.RegexOptional;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexOr;
|
import net.sourceforge.plantuml.command.regex.RegexOr;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
@ -107,7 +106,7 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
|
|||||||
ifCode = null;
|
ifCode = null;
|
||||||
ifLabel = arg.get("IF2", 0);
|
ifLabel = arg.get("IF2", 0);
|
||||||
}
|
}
|
||||||
diagram.startIf(Code.of(ifCode));
|
diagram.startIf(ifCode);
|
||||||
|
|
||||||
int lenght = 2;
|
int lenght = 2;
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
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 suf = start ? "" : "2";
|
||||||
|
|
||||||
final String openBracket2 = arg.get("OPENBRACKET" + suf, 0);
|
final String openBracket2 = arg.get("OPENBRACKET" + suf, 0);
|
||||||
if (openBracket2 != null) {
|
if (openBracket2 != null) {
|
||||||
return system.createInnerActivity();
|
return diagram.createInnerActivity();
|
||||||
}
|
}
|
||||||
if (arg.get("STAR" + suf, 0) != null) {
|
if (arg.get("STAR" + suf, 0) != null) {
|
||||||
final String suppId = arg.get("STAR" + suf, 1);
|
final String suppId = arg.get("STAR" + suf, 1);
|
||||||
if (start) {
|
if (start) {
|
||||||
if (suppId != null) {
|
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);
|
String partition = arg.get("PARTITION" + suf, 0);
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
|
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
|
||||||
}
|
}
|
||||||
final Code code = Code.of(arg.get("CODE" + suf, 0));
|
final String idShort = arg.get("CODE" + suf, 0);
|
||||||
if (code != null) {
|
if (idShort != null) {
|
||||||
|
final Code code = diagram.buildCode(idShort);
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
|
final Ident idNewLong = diagram.buildLeafIdent(partition);
|
||||||
system.getRootGroup(), NamespaceStrategy.SINGLE);
|
diagram.gotoGroup(idNewLong, diagram.buildCode(partition), Display.getWithNewlines(partition),
|
||||||
|
GroupType.PACKAGE, diagram.getRootGroup(), NamespaceStrategy.SINGLE);
|
||||||
}
|
}
|
||||||
final IEntity result = system.getOrCreate(code, Display.getWithNewlines(code),
|
final LeafType type = getTypeIfExisting(diagram, code);
|
||||||
CommandLinkActivity.getTypeIfExisting(system, code));
|
final IEntity result = diagram.getOrCreate(diagram.buildLeafIdent(idShort), code,
|
||||||
|
Display.getWithNewlines(code), type);
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
system.endGroup();
|
diagram.endGroup();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
final String bar = arg.get("BAR" + suf, 0);
|
final String bar = arg.get("BAR" + suf, 0);
|
||||||
if (bar != null) {
|
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);
|
final RegexPartialMatch quoted = arg.get("QUOTED" + suf);
|
||||||
if (quoted.get(0) != null) {
|
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) {
|
if (partition != null) {
|
||||||
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
|
final Ident idNewLong = diagram.buildLeafIdent(partition);
|
||||||
system.getRootGroup(), NamespaceStrategy.SINGLE);
|
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)),
|
final LeafType type = getTypeIfExisting(diagram, quotedCode);
|
||||||
CommandLinkActivity.getTypeIfExisting(system, quotedCode));
|
final IEntity result = diagram.getOrCreate(diagram.buildLeafIdent(quotedString), quotedCode,
|
||||||
|
Display.getWithNewlines(quoted.get(0)), type);
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
system.endGroup();
|
diagram.endGroup();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
final Code quotedInvisible = Code.of(arg.get("QUOTED_INVISIBLE" + suf, 0));
|
final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0);
|
||||||
if (quotedInvisible != null) {
|
if (quoteInvisibleString != null) {
|
||||||
|
final Code quotedInvisible = diagram.buildCode(quoteInvisibleString);
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE,
|
final Ident idNewLong = diagram.buildLeafIdent(partition);
|
||||||
system.getRootGroup(), NamespaceStrategy.SINGLE);
|
diagram.gotoGroup(idNewLong, diagram.buildCode(partition), Display.getWithNewlines(partition),
|
||||||
|
GroupType.PACKAGE, diagram.getRootGroup(), NamespaceStrategy.SINGLE);
|
||||||
}
|
}
|
||||||
final IEntity result = system.getOrCreate(quotedInvisible, Display.getWithNewlines(quotedInvisible),
|
final IEntity result = diagram.getOrCreate(diagram.buildLeafIdent(quoteInvisibleString), quotedInvisible,
|
||||||
LeafType.ACTIVITY);
|
Display.getWithNewlines(quotedInvisible), LeafType.ACTIVITY);
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
system.endGroup();
|
diagram.endGroup();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
final String first = arg.get("FIRST" + suf, 0);
|
final String first = arg.get("FIRST" + suf, 0);
|
||||||
if (first == null) {
|
if (first == null) {
|
||||||
return system.getLastEntityConsulted();
|
return diagram.getLastEntityConsulted();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
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)) {
|
if (system.leafExist(code)) {
|
||||||
final IEntity ent = system.getLeafsget(code);
|
final IEntity ent = system.getLeaf(code);
|
||||||
if (ent.getLeafType() == LeafType.BRANCH) {
|
if (ent.getLeafType() == LeafType.BRANCH) {
|
||||||
return LeafType.BRANCH;
|
return LeafType.BRANCH;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
@ -166,7 +167,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String display = sb.toString();
|
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;
|
String partition = null;
|
||||||
if (lineLast.get(3) != null) {
|
if (lineLast.get(3) != null) {
|
||||||
@ -174,10 +176,12 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
|||||||
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
|
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
|
||||||
}
|
}
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
diagram.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null,
|
final Ident idNewLong = diagram.buildLeafIdent(partition);
|
||||||
NamespaceStrategy.SINGLE);
|
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) {
|
if (entity2 == null) {
|
||||||
return CommandExecutionResult.error("No such entity");
|
return CommandExecutionResult.error("No such entity");
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
@ -84,9 +85,11 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
|
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();
|
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);
|
NamespaceStrategy.SINGLE);
|
||||||
final IEntity p = diagram.getCurrentGroup();
|
final IEntity p = diagram.getCurrentGroup();
|
||||||
|
|
||||||
|
@ -222,8 +222,10 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleabl
|
|||||||
if (back != null) {
|
if (back != null) {
|
||||||
final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back))
|
final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back))
|
||||||
.apply(new UTranslate(x2, 0));
|
.apply(new UTranslate(x2, 0));
|
||||||
background.draw(new URectangle(swimlane.getActualWidth(), dimensionFull.getHeight()
|
final URectangle rectangle = new URectangle(swimlane.getActualWidth(), dimensionFull.getHeight()
|
||||||
+ titleHeightTranslate.getDy()));
|
+ titleHeightTranslate.getDy());
|
||||||
|
rectangle.setIgnoreForCompression(true);
|
||||||
|
background.draw(rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane).apply(swimlane.getTranslate()).apply(
|
full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane).apply(swimlane.getTranslate()).apply(
|
||||||
|
@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
|||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -83,6 +84,14 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
|
|
||||||
private final Rainbow arrowColor;
|
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,
|
private FtileIfLongVertical(List<Ftile> diamonds, List<Ftile> tiles, Ftile tile2, Rainbow arrowColor,
|
||||||
Ftile lastDiamond) {
|
Ftile lastDiamond) {
|
||||||
super(tiles.get(0).skinParam());
|
super(tiles.get(0).skinParam());
|
||||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.EntityUtils;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
@ -63,83 +64,81 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
|
|||||||
super(skinParam);
|
super(skinParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String getNamespace(Code fullyCode) {
|
private Code getShortName1972(Code code) {
|
||||||
return getNamespace(fullyCode, fullyCode.getSeparator());
|
final String separator = getNamespaceSeparator();
|
||||||
}
|
|
||||||
|
|
||||||
public final Code getShortName(Code code) {
|
|
||||||
final String separator = code.getSeparator();
|
|
||||||
if (separator == null) {
|
if (separator == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
final String codeString = code.getFullName();
|
final String codeString = code.getName();
|
||||||
final String namespace = getNamespace(code);
|
final String namespace = getNamespace1972(code, getNamespaceSeparator());
|
||||||
if (namespace == null) {
|
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
|
@Override
|
||||||
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
|
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
|
||||||
if (getNamespaceSeparator() != null) {
|
checkNotNull(ident);
|
||||||
code = code.withSeparator(getNamespaceSeparator());
|
|
||||||
}
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
|
code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
|
||||||
if (getNamespaceSeparator() == null) {
|
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)) {
|
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) {
|
if (getNamespaceSeparator() == null) {
|
||||||
return getOrCreateLeafDefault(code, type, symbol);
|
return getOrCreateLeafDefault(ident, code, type, symbol);
|
||||||
}
|
}
|
||||||
code = getFullyQualifiedCode(code);
|
code = getFullyQualifiedCode1972(code);
|
||||||
if (super.leafExist(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
|
@Override
|
||||||
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
|
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
|
||||||
if (getNamespaceSeparator() != null) {
|
checkNotNull(idNewLong);
|
||||||
code = code.withSeparator(getNamespaceSeparator());
|
|
||||||
}
|
|
||||||
if (type != LeafType.ABSTRACT_CLASS && type != LeafType.ANNOTATION && type != LeafType.CLASS
|
if (type != LeafType.ABSTRACT_CLASS && type != LeafType.ANNOTATION && type != LeafType.CLASS
|
||||||
&& type != LeafType.INTERFACE && type != LeafType.ENUM && type != LeafType.LOLLIPOP_FULL
|
&& type != LeafType.INTERFACE && type != LeafType.ENUM && type != LeafType.LOLLIPOP_FULL
|
||||||
&& type != LeafType.LOLLIPOP_HALF && type != LeafType.NOTE) {
|
&& 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) {
|
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)) {
|
if (super.leafExist(code)) {
|
||||||
throw new IllegalArgumentException("Already known: " + 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 backupCurrentGroup = getCurrentGroup();
|
||||||
final IGroup group = backupCurrentGroup;
|
final IGroup group = backupCurrentGroup;
|
||||||
final String namespace = getNamespace(fullyCode, getNamespaceSeparator());
|
final String namespaceString = getNamespace1972(fullyCode, getNamespaceSeparator());
|
||||||
if (namespace != null
|
if (namespaceString != null
|
||||||
&& (EntityUtils.groupRoot(group) || group.getCode().getFullName().equals(namespace) == false)) {
|
&& (EntityUtils.groupRoot(group) || group.getCodeGetName().equals(namespaceString) == false)) {
|
||||||
final Code namespace2 = Code.of(namespace);
|
final Code namespace = buildCode(namespaceString);
|
||||||
gotoGroupInternal(namespace2, Display.getWithNewlines(namespace), namespace2, GroupType.PACKAGE,
|
final Display tmp = Display.getWithNewlines(namespaceString);
|
||||||
getRootGroup());
|
final Ident newIdLong = buildLeafIdentSpecial(namespaceString);
|
||||||
|
gotoGroupExternal(newIdLong, namespace, tmp, namespace, GroupType.PACKAGE, getRootGroup());
|
||||||
}
|
}
|
||||||
final ILeaf result = createLeafInternal(
|
final Display tmpDisplay;
|
||||||
fullyCode,
|
if (Display.isNull(display)) {
|
||||||
Display.isNull(display) ? Display.getWithNewlines(getShortName(fullyCode)).withCreoleMode(
|
tmpDisplay = Display.getWithNewlines(getShortName1972(fullyCode)).withCreoleMode(CreoleMode.SIMPLE_LINE);
|
||||||
CreoleMode.SIMPLE_LINE) : display, type, symbol);
|
} else {
|
||||||
|
tmpDisplay = display;
|
||||||
|
}
|
||||||
|
final ILeaf result = createLeafInternal(id, fullyCode, tmpDisplay, type, symbol);
|
||||||
gotoThisGroup(backupCurrentGroup);
|
gotoThisGroup(backupCurrentGroup);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -149,8 +148,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
|
|||||||
if (getNamespaceSeparator() == null) {
|
if (getNamespaceSeparator() == null) {
|
||||||
return super.leafExist(code);
|
return super.leafExist(code);
|
||||||
}
|
}
|
||||||
code = code.withSeparator(getNamespaceSeparator());
|
return super.leafExist(getFullyQualifiedCode1972(code));
|
||||||
return super.leafExist(getFullyQualifiedCode(code));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -198,7 +196,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
|
|||||||
|
|
||||||
private RowLayout getRawLayout(int raw) {
|
private RowLayout getRawLayout(int raw) {
|
||||||
final RowLayout rawLayout = new RowLayout();
|
final RowLayout rawLayout = new RowLayout();
|
||||||
for (ILeaf leaf : entityFactory.getLeafsvalues()) {
|
for (ILeaf leaf : entityFactory.leafs()) {
|
||||||
if (leaf.getRawLayout() == raw) {
|
if (leaf.getRawLayout() == raw) {
|
||||||
rawLayout.addLeaf(getEntityImageClass(leaf));
|
rawLayout.addLeaf(getEntityImageClass(leaf));
|
||||||
}
|
}
|
||||||
|
@ -64,12 +64,14 @@ public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram system, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final IEntity entity = system.getOrCreateLeaf(Code.of(arg.get("NAME", 0)), null, null);
|
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);
|
final String field = arg.get("DATA", 0);
|
||||||
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {
|
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {
|
||||||
system.setVisibilityModifierPresent(true);
|
diagram.setVisibilityModifierPresent(true);
|
||||||
}
|
}
|
||||||
entity.getBodier().addFieldOrMethod(field, entity);
|
entity.getBodier().addFieldOrMethod(field, entity);
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
|
@ -53,6 +53,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
@ -125,7 +126,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
|||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
|
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 display = arg.getLazzy("DISPLAY", 0);
|
||||||
final String genericOption = arg.getLazzy("DISPLAY", 1);
|
final String genericOption = arg.getLazzy("DISPLAY", 1);
|
||||||
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
|
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
|
||||||
@ -133,12 +135,13 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
|||||||
final String stereotype = arg.get("STEREO", 0);
|
final String stereotype = arg.get("STEREO", 0);
|
||||||
final ILeaf entity;
|
final ILeaf entity;
|
||||||
if (diagram.leafExist(code)) {
|
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) {
|
if (entity.muteToType(type, null) == false) {
|
||||||
return CommandExecutionResult.error("Bad name");
|
return CommandExecutionResult.error("Bad name");
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if (stereotype != null) {
|
||||||
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
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) {
|
// public static void manageExtends(ClassDiagram system, RegexResult arg, final IEntity entity) {
|
||||||
// if (arg.get("EXTENDS", 1) != null) {
|
// if (arg.get("EXTENDS", 1) != null) {
|
||||||
// final Mode mode = arg.get("EXTENDS", 1).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;
|
// 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;
|
// LeafType type2 = LeafType.CLASS;
|
||||||
// if (mode == Mode.IMPLEMENTS) {
|
// if (mode == Mode.IMPLEMENTS) {
|
||||||
// type2 = LeafType.INTERFACE;
|
// type2 = LeafType.INTERFACE;
|
||||||
|
@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
@ -205,8 +206,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
}
|
}
|
||||||
final String codes = arg.get(keyword, 1);
|
final String codes = arg.get(keyword, 1);
|
||||||
for (String s : codes.split(",")) {
|
for (String s : codes.split(",")) {
|
||||||
final Code other = Code.of(StringUtils.trin(s));
|
final String idShort = StringUtils.trin(s);
|
||||||
final IEntity cl2 = diagram.getOrCreateLeaf(other, type2, null);
|
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);
|
LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS);
|
||||||
if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE) {
|
if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE) {
|
||||||
typeLink = typeLink.goDashed();
|
typeLink = typeLink.goDashed();
|
||||||
@ -228,7 +230,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false);
|
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 display = arg.getLazzy("DISPLAY", 0);
|
||||||
final String genericOption = arg.getLazzy("DISPLAY", 1);
|
final String genericOption = arg.getLazzy("DISPLAY", 1);
|
||||||
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
|
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
|
||||||
@ -237,12 +241,13 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
|
|
||||||
final ILeaf result;
|
final ILeaf result;
|
||||||
if (diagram.leafExist(code)) {
|
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) {
|
if (result.muteToType(type, null) == false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
result.setVisibilityModifier(visibilityModifier);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
|
@ -176,7 +176,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
|||||||
|
|
||||||
if (symbol == null) {
|
if (symbol == null) {
|
||||||
type = LeafType.DESCRIPTION;
|
type = LeafType.DESCRIPTION;
|
||||||
usymbol = USymbol.ACTOR;
|
usymbol = diagram.getSkinParam().getActorStyle().getUSymbol();
|
||||||
} else if (symbol.equalsIgnoreCase("usecase")) {
|
} else if (symbol.equalsIgnoreCase("usecase")) {
|
||||||
type = LeafType.USECASE;
|
type = LeafType.USECASE;
|
||||||
usymbol = null;
|
usymbol = null;
|
||||||
@ -185,20 +185,21 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
|||||||
usymbol = null;
|
usymbol = null;
|
||||||
} else {
|
} else {
|
||||||
type = LeafType.DESCRIPTION;
|
type = LeafType.DESCRIPTION;
|
||||||
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().useUml2ForComponent());
|
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam());
|
||||||
if (usymbol == null) {
|
if (usymbol == null) {
|
||||||
throw new IllegalStateException();
|
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;
|
String display = displayRaw;
|
||||||
if (display == null) {
|
if (display == null) {
|
||||||
display = code.getFullName();
|
display = code.getName();
|
||||||
}
|
}
|
||||||
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
||||||
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
|
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.setDisplay(Display.getWithNewlines(display));
|
||||||
entity.setUSymbol(usymbol);
|
entity.setUSymbol(usymbol);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
|||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
|
|
||||||
public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram> {
|
public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram> {
|
||||||
@ -63,11 +64,13 @@ public class CommandDiamondAssociation extends SingleLineCommand2<ClassDiagram>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
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)) {
|
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();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
} else if (arg1.startsWith("<<")) {
|
} else if (arg1.startsWith("<<")) {
|
||||||
gender = EntityGenderUtils.byStereotype(arg1);
|
gender = EntityGenderUtils.byStereotype(arg1);
|
||||||
} else {
|
} 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);
|
gender = EntityGenderUtils.byEntityAlone(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
return CommandExecutionResult.ok();
|
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));
|
final EntityPortion portion = getEntityPortion(arg.get("PORTION", 0));
|
||||||
|
|
||||||
@ -167,7 +168,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
} else if (arg1.startsWith("<<")) {
|
} else if (arg1.startsWith("<<")) {
|
||||||
gender = EntityGenderUtils.byStereotype(arg1);
|
gender = EntityGenderUtils.byStereotype(arg1);
|
||||||
} else {
|
} 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);
|
gender = EntityGenderUtils.byEntityAlone(entity);
|
||||||
}
|
}
|
||||||
if (gender != null) {
|
if (gender != null) {
|
||||||
@ -176,17 +178,17 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
if (empty == true && emptyMembers == false) {
|
if (empty == true && emptyMembers == false) {
|
||||||
gender = EntityGenderUtils.and(gender, emptyByGender(portion));
|
gender = EntityGenderUtils.and(gender, emptyByGender(portion));
|
||||||
}
|
}
|
||||||
if (EntityUtils.groupRoot(classDiagram.getCurrentGroup()) == false) {
|
if (EntityUtils.groupRoot(diagram.getCurrentGroup()) == false) {
|
||||||
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(classDiagram.getCurrentGroup()));
|
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emptyMembers) {
|
if (emptyMembers) {
|
||||||
classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)), EntityPortion.FIELD, arg
|
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)),
|
||||||
.get("COMMAND", 0).equalsIgnoreCase("show"));
|
EntityPortion.FIELD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
||||||
classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.METHOD)), EntityPortion.METHOD,
|
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.METHOD)),
|
||||||
arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
EntityPortion.METHOD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
||||||
} else {
|
} else {
|
||||||
classDiagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
diagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
|
@ -66,7 +66,7 @@ public class CommandHideShowSpecificClass extends SingleLineCommand2<CucaDiagram
|
|||||||
// } else if (codeString.equals("interface")) {
|
// } else if (codeString.equals("interface")) {
|
||||||
// diagram.hideOrShow(LeafType.INTERFACE, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
// diagram.hideOrShow(LeafType.INTERFACE, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
||||||
// } else {
|
// } else {
|
||||||
// final Code code = Code.of(codeString);
|
// final Code code = diagram.buildCode(codeString);
|
||||||
// IEntity hidden = diagram.getEntityFactory().getLeafsget(code);
|
// IEntity hidden = diagram.getEntityFactory().getLeafsget(code);
|
||||||
// if (hidden == null) {
|
// if (hidden == null) {
|
||||||
// hidden = diagram.getEntityFactory().getGroupsget(code);
|
// hidden = diagram.getEntityFactory().getGroupsget(code);
|
||||||
|
@ -108,11 +108,12 @@ public class CommandImport extends SingleLineCommand2<ClassDiagram> {
|
|||||||
private void includeFileJava(ClassDiagram diagram, final File f) throws IOException {
|
private void includeFileJava(ClassDiagram diagram, final File f) throws IOException {
|
||||||
final JavaFile javaFile = new JavaFile(f);
|
final JavaFile javaFile = new JavaFile(f);
|
||||||
for (JavaClass cl : javaFile.getJavaClasses()) {
|
for (JavaClass cl : javaFile.getJavaClasses()) {
|
||||||
final Code name = Code.of(cl.getName());
|
final String idShort = cl.getName();
|
||||||
final IEntity ent1 = diagram.getOrCreateLeaf(name, cl.getType(), null);
|
final Code name = diagram.buildCode(idShort);
|
||||||
|
final IEntity ent1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), name, cl.getType(), null);
|
||||||
|
|
||||||
for (String p : cl.getParents()) {
|
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,
|
final Link link = new Link(ent2, ent1, new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS), Display.NULL,
|
||||||
2, diagram.getSkinParam().getCurrentStyleBuilder());
|
2, diagram.getSkinParam().getCurrentStyleBuilder());
|
||||||
diagram.addLink(link);
|
diagram.addLink(link);
|
||||||
|
@ -55,6 +55,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
|
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
@ -127,66 +128,48 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
return "(?:\\.|::|\\\\|\\\\\\\\)";
|
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
|
@Override
|
||||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||||
RegexResult arg) {
|
RegexResult arg) {
|
||||||
|
|
||||||
Code ent1 = Code.of(arg.get("ENT1", 0));
|
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
|
||||||
Code ent2 = Code.of(arg.get("ENT2", 0));
|
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
|
||||||
if (ent1 == null && ent2 == null) {
|
if (ent1String == null && ent2String == null) {
|
||||||
return executeArgSpecial3(diagram, arg);
|
return executeArgSpecial3(diagram, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent1 == null) {
|
if (ent1String == null) {
|
||||||
return executeArgSpecial1(diagram, arg);
|
return executeArgSpecial1(diagram, arg);
|
||||||
}
|
}
|
||||||
if (ent2 == null) {
|
if (ent2String == null) {
|
||||||
return executeArgSpecial2(diagram, arg);
|
return executeArgSpecial2(diagram, arg);
|
||||||
}
|
}
|
||||||
ent1 = ent1.eventuallyRemoveStartingAndEndingDoubleQuote("\"");
|
|
||||||
ent2 = ent2.eventuallyRemoveStartingAndEndingDoubleQuote("\"");
|
Code code1 = diagram.buildCode(ent1String);
|
||||||
if (isGroupButNotTheCurrentGroup(diagram, ent1) && isGroupButNotTheCurrentGroup(diagram, ent2)) {
|
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);
|
return executePackageLink(diagram, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
String port1 = null;
|
String port1 = null;
|
||||||
String port2 = null;
|
String port2 = null;
|
||||||
|
|
||||||
if (removeMemberPart(diagram, ent1) != null) {
|
if (removeMemberPart(diagram, ident1) != null) {
|
||||||
port1 = ent1.getPortMember();
|
port1 = ident1.getPortMember();
|
||||||
ent1 = removeMemberPart(diagram, ent1);
|
code1 = removeMemberPart(diagram, ident1);
|
||||||
|
ident1 = ident1.removeMemberPart();
|
||||||
}
|
}
|
||||||
if (removeMemberPart(diagram, ent2) != null) {
|
if (removeMemberPart(diagram, ident2) != null) {
|
||||||
port2 = ent2.getPortMember();
|
port2 = ident2.getPortMember();
|
||||||
ent2 = removeMemberPart(diagram, ent2);
|
code2 = removeMemberPart(diagram, ident2);
|
||||||
|
ident2 = ident2.removeMemberPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
final IEntity cl1 = isGroupButNotTheCurrentGroup(diagram, ent1) ? diagram.getGroup(Code.of(StringUtils
|
final IEntity cl1 = getFoo1(diagram, code1, ident1);
|
||||||
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""))) : diagram.getOrCreateLeaf(
|
final IEntity cl2 = getFoo1(diagram, code2, ident2);
|
||||||
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 LinkType linkType = getLinkType(arg);
|
final LinkType linkType = getLinkType(arg);
|
||||||
final Direction dir = getDirection(arg);
|
final Direction dir = getDirection(arg);
|
||||||
@ -277,33 +260,36 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code) {
|
private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) {
|
||||||
if (diagram.getCurrentGroup().getCode().equals(code)) {
|
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 false;
|
||||||
}
|
}
|
||||||
return diagram.isGroup(code);
|
return diagram.isGroup(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Code removeMemberPart(AbstractClassOrObjectDiagram diagram, Code code) {
|
private Code removeMemberPart(AbstractClassOrObjectDiagram diagram, Ident ident) {
|
||||||
if (diagram.leafExist(code)) {
|
if (diagram.leafExist(ident)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Code before = code.removeMemberPart();
|
final Ident before2 = ident.removeMemberPart();
|
||||||
if (before == null) {
|
if (before2 == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
final Code before = before2.toCode();
|
||||||
if (diagram.leafExist(before) == false) {
|
if (diagram.leafExist(before) == false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return before;
|
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) {
|
private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) {
|
||||||
diagram.addLink(link);
|
diagram.addLink(link);
|
||||||
if (weight == null) {
|
if (weight == null) {
|
||||||
@ -327,10 +313,10 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
||||||
final IEntity cl1 = diagram.getGroup(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(
|
final IEntity cl1 = diagram.getGroup(diagram.buildCode(StringUtils
|
||||||
arg.get("ENT1", 0), "\"")));
|
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"")));
|
||||||
final IEntity cl2 = diagram.getGroup(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(
|
final IEntity cl2 = diagram.getGroup(diagram.buildCode(StringUtils
|
||||||
arg.get("ENT2", 0), "\"")));
|
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"")));
|
||||||
|
|
||||||
final LinkType linkType = getLinkType(arg);
|
final LinkType linkType = getLinkType(arg);
|
||||||
final Direction dir = getDirection(arg);
|
final Direction dir = getDirection(arg);
|
||||||
@ -357,8 +343,10 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
||||||
final Code clName1A = Code.of(arg.get("COUPLE1", 0));
|
final String name1A = arg.get("COUPLE1", 0);
|
||||||
final Code clName1B = Code.of(arg.get("COUPLE1", 1));
|
final String name1B = arg.get("COUPLE1", 1);
|
||||||
|
final Code clName1A = diagram.buildCode(name1A);
|
||||||
|
final Code clName1B = diagram.buildCode(name1B);
|
||||||
if (diagram.leafExist(clName1A) == false) {
|
if (diagram.leafExist(clName1A) == false) {
|
||||||
return CommandExecutionResult.error("No class " + clName1A);
|
return CommandExecutionResult.error("No class " + clName1A);
|
||||||
}
|
}
|
||||||
@ -366,13 +354,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
return CommandExecutionResult.error("No class " + clName1B);
|
return CommandExecutionResult.error("No class " + clName1B);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Code ent2 = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""));
|
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
|
||||||
final IEntity cl2 = diagram.getOrCreateLeaf(ent2, null, null);
|
final Code ent2 = diagram.buildCode(idShort);
|
||||||
|
final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent2, null, null);
|
||||||
|
|
||||||
final LinkType linkType = getLinkType(arg);
|
final LinkType linkType = getLinkType(arg);
|
||||||
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
|
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) {
|
if (result == false) {
|
||||||
return CommandExecutionResult.error("Cannot have more than 2 assocications");
|
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) {
|
private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
||||||
final Code clName1A = Code.of(arg.get("COUPLE1", 0));
|
final String name1A = arg.get("COUPLE1", 0);
|
||||||
final Code clName1B = Code.of(arg.get("COUPLE1", 1));
|
final String name1B = arg.get("COUPLE1", 1);
|
||||||
final Code clName2A = Code.of(arg.get("COUPLE2", 0));
|
final String name2A = arg.get("COUPLE2", 0);
|
||||||
final Code clName2B = Code.of(arg.get("COUPLE2", 1));
|
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) {
|
if (diagram.leafExist(clName1A) == false) {
|
||||||
return CommandExecutionResult.error("No class " + clName1A);
|
return CommandExecutionResult.error("No class " + clName1A);
|
||||||
}
|
}
|
||||||
@ -401,12 +394,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
final LinkType linkType = getLinkType(arg);
|
final LinkType linkType = getLinkType(arg);
|
||||||
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
|
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) {
|
private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
||||||
final Code clName2A = Code.of(arg.get("COUPLE2", 0));
|
final String name2A = arg.get("COUPLE2", 0);
|
||||||
final Code clName2B = Code.of(arg.get("COUPLE2", 1));
|
final String name2B = arg.get("COUPLE2", 1);
|
||||||
|
final Code clName2A = diagram.buildCode(name2A);
|
||||||
|
final Code clName2B = diagram.buildCode(name2B);
|
||||||
if (diagram.leafExist(clName2A) == false) {
|
if (diagram.leafExist(clName2A) == false) {
|
||||||
return CommandExecutionResult.error("No class " + clName2A);
|
return CommandExecutionResult.error("No class " + clName2A);
|
||||||
}
|
}
|
||||||
@ -414,13 +409,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
return CommandExecutionResult.error("No class " + clName2B);
|
return CommandExecutionResult.error("No class " + clName2B);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Code ent1 = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""));
|
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
|
||||||
final IEntity cl1 = diagram.getOrCreateLeaf(ent1, null, null);
|
final Code ent1 = diagram.buildCode(idShort);
|
||||||
|
final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent1, null, null);
|
||||||
|
|
||||||
final LinkType linkType = getLinkType(arg);
|
final LinkType linkType = getLinkType(arg);
|
||||||
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
|
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) {
|
if (result == false) {
|
||||||
return CommandExecutionResult.error("Cannot have more than 2 assocications");
|
return CommandExecutionResult.error("Cannot have more than 2 assocications");
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
@ -113,8 +114,10 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
|
|||||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||||
RegexResult arg) {
|
RegexResult arg) {
|
||||||
|
|
||||||
final Code ent1 = Code.of(arg.get("ENT1", 1));
|
final String ent1 = arg.get("ENT1", 1);
|
||||||
final Code ent2 = Code.of(arg.get("ENT2", 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 cl1;
|
||||||
final IEntity cl2;
|
final IEntity cl2;
|
||||||
@ -123,13 +126,15 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
|
|||||||
final String suffix = "lol" + UniqueSequence.getValue();
|
final String suffix = "lol" + UniqueSequence.getValue();
|
||||||
if (arg.get("LOL_THEN_ENT", 1) == null) {
|
if (arg.get("LOL_THEN_ENT", 1) == null) {
|
||||||
assert arg.get("ENT_THEN_LOL", 0) != null;
|
assert arg.get("ENT_THEN_LOL", 0) != null;
|
||||||
cl1 = diagram.getOrCreateLeaf(ent1, null, null);
|
cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent1), ent1code, null, null);
|
||||||
cl2 = diagram.createLeaf(cl1.getCode().addSuffix(suffix), Display.getWithNewlines(ent2),
|
final Ident idNewLong = diagram.buildLeafIdent(ent1 + suffix);
|
||||||
|
cl2 = diagram.createLeaf(idNewLong, idNewLong.toCode(), Display.getWithNewlines(ent2code),
|
||||||
getType(arg.get("ENT_THEN_LOL", 1)), null);
|
getType(arg.get("ENT_THEN_LOL", 1)), null);
|
||||||
normalEntity = cl1;
|
normalEntity = cl1;
|
||||||
} else {
|
} else {
|
||||||
cl2 = diagram.getOrCreateLeaf(ent2, null, null);
|
cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent2), ent2code, null, null);
|
||||||
cl1 = diagram.createLeaf(cl2.getCode().addSuffix(suffix), Display.getWithNewlines(ent1),
|
final Ident idNewLong = diagram.buildLeafIdent(ent2 + suffix);
|
||||||
|
cl1 = diagram.createLeaf(idNewLong, idNewLong.toCode(), Display.getWithNewlines(ent1code),
|
||||||
getType(arg.get("LOL_THEN_ENT", 0)), null);
|
getType(arg.get("LOL_THEN_ENT", 0)), null);
|
||||||
normalEntity = cl2;
|
normalEntity = cl2;
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,10 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
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 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
|
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
||||||
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
|
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
|
||||||
.getIHtmlColorSet()));
|
.getIHtmlColorSet()));
|
||||||
|
@ -72,11 +72,12 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
|
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 String urlString = arg.get("URL", 0);
|
||||||
final IEntity entity;
|
final IEntity entity;
|
||||||
if (diagram.leafExist(code)) {
|
if (diagram.leafExist(code)) {
|
||||||
entity = diagram.getOrCreateLeaf(code, null, null);
|
entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, null, null);
|
||||||
} else if (diagram.isGroup(code)) {
|
} else if (diagram.isGroup(code)) {
|
||||||
entity = diagram.getGroup(code);
|
entity = diagram.getGroup(code);
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
@ -77,10 +78,12 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
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 IGroup currentPackage = diagram.getCurrentGroup();
|
||||||
final Display display = Display.getWithNewlines(code);
|
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 IEntity p = diagram.getCurrentGroup();
|
||||||
final String stereotype = arg.get("STEREOTYPE", 0);
|
final String stereotype = arg.get("STEREOTYPE", 0);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
@ -85,11 +86,13 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
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 IGroup currentPackage = diagram.getCurrentGroup();
|
||||||
final String disp = arg.getLazzy("DISPLAY", 0);
|
final String disp = arg.getLazzy("DISPLAY", 0);
|
||||||
final Display display = Display.getWithNewlines(disp);
|
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 IEntity p = diagram.getCurrentGroup();
|
||||||
final String stereotype = arg.get("STEREOTYPE", 0);
|
final String stereotype = arg.get("STEREOTYPE", 0);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
@ -80,10 +81,12 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
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 IGroup currentPackage = diagram.getCurrentGroup();
|
||||||
final Display display = Display.getWithNewlines(code);
|
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 IEntity p = diagram.getCurrentGroup();
|
||||||
final String stereotype = arg.get("STEREOTYPE", 0);
|
final String stereotype = arg.get("STEREOTYPE", 0);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
|
@ -52,6 +52,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
@ -102,30 +103,35 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
|
|||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final Code code;
|
final Code code;
|
||||||
|
final String idShort;
|
||||||
final String display;
|
final String display;
|
||||||
final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
|
final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
|
||||||
if (arg.get("AS", 0) == null) {
|
if (arg.get("AS", 0) == null) {
|
||||||
if (name.length() == 0) {
|
if (name.length() == 0) {
|
||||||
code = Code.of("##" + UniqueSequence.getValue());
|
idShort = "##" + UniqueSequence.getValue();
|
||||||
|
code = diagram.buildCode(idShort);
|
||||||
display = null;
|
display = null;
|
||||||
} else {
|
} else {
|
||||||
code = Code.of(name);
|
idShort = name;
|
||||||
display = code.getFullName();
|
code = diagram.buildCode(idShort);
|
||||||
|
display = code.getName();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
display = name;
|
display = name;
|
||||||
code = Code.of(arg.get("AS", 0));
|
idShort = arg.get("AS", 0);
|
||||||
|
code = diagram.buildCode(idShort);
|
||||||
}
|
}
|
||||||
final IGroup currentPackage = diagram.getCurrentGroup();
|
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);
|
NamespaceStrategy.SINGLE);
|
||||||
final IEntity p = diagram.getCurrentGroup();
|
final IEntity p = diagram.getCurrentGroup();
|
||||||
final String stereotype = arg.get("STEREOTYPE", 0);
|
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) {
|
if (type == USymbol.TOGETHER) {
|
||||||
p.setUSymbol(type);
|
p.setUSymbol(type);
|
||||||
} else if (stereotype != null) {
|
} else if (stereotype != null) {
|
||||||
final USymbol usymbol = USymbol.getFromString(stereotype);
|
final USymbol usymbol = USymbol.getFromString(stereotype, diagram.getSkinParam().getActorStyle());
|
||||||
if (usymbol == null) {
|
if (usymbol == null) {
|
||||||
p.setStereotype(new Stereotype(stereotype));
|
p.setStereotype(new Stereotype(stereotype));
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||||
@ -82,21 +83,26 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
|
|||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final Code code;
|
final Code code;
|
||||||
|
final String idShort;
|
||||||
final String display;
|
final String display;
|
||||||
if (arg.get("CODE", 0) == null) {
|
if (arg.get("CODE", 0) == null) {
|
||||||
if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)).length() == 0) {
|
if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)).length() == 0) {
|
||||||
code = Code.of("##" + UniqueSequence.getValue());
|
idShort = "##" + UniqueSequence.getValue();
|
||||||
|
code = diagram.buildCode(idShort);
|
||||||
display = null;
|
display = null;
|
||||||
} else {
|
} else {
|
||||||
code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)));
|
idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0));
|
||||||
display = code.getFullName();
|
code = diagram.buildCode(idShort);
|
||||||
|
display = code.getName();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0));
|
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();
|
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);
|
NamespaceStrategy.SINGLE);
|
||||||
final IEntity p = diagram.getCurrentGroup();
|
final IEntity p = diagram.getCurrentGroup();
|
||||||
final String color = arg.get("COLOR", 0);
|
final String color = arg.get("COLOR", 0);
|
||||||
|
@ -52,8 +52,10 @@ import net.sourceforge.plantuml.command.regex.IRegex;
|
|||||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
@ -96,7 +98,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
|
|||||||
return "(?i)^[%s]*end[%s]?note$";
|
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);
|
// StringUtils.trim(lines, true);
|
||||||
final RegexResult arg = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
|
final RegexResult arg = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
|
||||||
lines = lines.subExtract(1, 1);
|
lines = lines.subExtract(1, 1);
|
||||||
@ -106,7 +108,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
|
|||||||
|
|
||||||
Url url = null;
|
Url url = null;
|
||||||
if (strings.size() > 0) {
|
if (strings.size() > 0) {
|
||||||
final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"),
|
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"),
|
||||||
ModeUrl.STRICT);
|
ModeUrl.STRICT);
|
||||||
url = urlBuilder.getUrl(strings.get(0).toString());
|
url = urlBuilder.getUrl(strings.get(0).toString());
|
||||||
}
|
}
|
||||||
@ -116,11 +118,14 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
|
|||||||
|
|
||||||
// final String s = StringUtils.getMergedLines(strings);
|
// 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) {
|
if (url != null) {
|
||||||
note.addUrl(url);
|
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()) {
|
return new SingleLineCommand2<ActivityDiagram>(getRegexConcatSingleLine()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(final ActivityDiagram system, LineLocation location,
|
protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location,
|
||||||
RegexResult arg) {
|
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)));
|
Display.getWithNewlines(arg.get("NOTE", 0)));
|
||||||
return executeInternal(system, arg, note);
|
return executeInternal(diagram, arg, note);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
|||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
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) {
|
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)) {
|
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;
|
assert entity != null;
|
||||||
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
|
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
|
||||||
|
@ -57,6 +57,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
@ -197,21 +198,26 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
|
|||||||
|
|
||||||
final String pos = line0.get("POSITION", 0);
|
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;
|
final IEntity cl1;
|
||||||
if (code == null) {
|
if (idShort == null) {
|
||||||
cl1 = diagram.getLastEntity();
|
cl1 = diagram.getLastEntity();
|
||||||
if (cl1 == null) {
|
if (cl1 == null) {
|
||||||
return CommandExecutionResult.error("Nothing to note to");
|
return CommandExecutionResult.error("Nothing to note to");
|
||||||
}
|
}
|
||||||
} else if (diagram.isGroup(code)) {
|
|
||||||
cl1 = diagram.getGroup(code);
|
|
||||||
} else {
|
} 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
|
final String tmp = UniqueSequence.getString("GMN");
|
||||||
.createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null);
|
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());
|
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
|
||||||
note.setColors(colors);
|
note.setColors(colors);
|
||||||
|
@ -53,6 +53,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
@ -143,19 +144,22 @@ public final class FactoryTipOnEntityCommand implements SingleMultiFactoryComman
|
|||||||
|
|
||||||
final String pos = line0.get("POSITION", 0);
|
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));
|
final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1));
|
||||||
if (code == null) {
|
if (codeShort == null) {
|
||||||
return CommandExecutionResult.error("Nothing to note to");
|
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(
|
final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir(
|
||||||
diagram.getSkinParam().getRankdir());
|
diagram.getSkinParam().getRankdir());
|
||||||
|
|
||||||
final Code codeTip = code.addSuffix("$$$" + position.name());
|
final Ident identTip = diagram.buildLeafIdent(idShort + "$$$" + position.name());
|
||||||
IEntity tips = diagram.getLeafsget(codeTip);
|
IEntity tips = diagram.getLeaf(identTip);
|
||||||
if (tips == null) {
|
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 LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
|
||||||
final Link link;
|
final Link link;
|
||||||
if (position == Position.RIGHT) {
|
if (position == Position.RIGHT) {
|
||||||
|
@ -61,27 +61,7 @@ public abstract class MyPattern {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String transformAndCheck(String p) {
|
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);
|
p = transform(p);
|
||||||
// if (p.contains(" ") || p.contains("%")) {
|
|
||||||
// Thread.dumpStack();
|
|
||||||
// System.err.println(p);
|
|
||||||
// System.exit(0);
|
|
||||||
// }
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,10 +73,6 @@ public abstract class MyPattern {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static boolean mtches(String input, String regex) {
|
|
||||||
// return cmpile(regex).matcher(input).matches();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
public static boolean mtches(CharSequence input, String regex) {
|
public static boolean mtches(CharSequence input, String regex) {
|
||||||
return cmpile(regex).matcher(input).matches();
|
return cmpile(regex).matcher(input).matches();
|
||||||
}
|
}
|
||||||
|
@ -77,17 +77,6 @@ public class RegexLeaf implements IRegex {
|
|||||||
public RegexLeaf(String name, String regex) {
|
public RegexLeaf(String name, String regex) {
|
||||||
this.pattern = regex;
|
this.pattern = regex;
|
||||||
this.name = name;
|
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
|
@Override
|
||||||
|
@ -40,6 +40,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
|
|||||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
|
|
||||||
@ -50,14 +51,16 @@ public class CompositeDiagram extends AbstractEntityDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 (type == null) {
|
||||||
if (isGroup(code)) {
|
if (isGroup(code)) {
|
||||||
return getGroup(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
|
@Override
|
||||||
|
@ -71,11 +71,12 @@ public class CommandCreateBlock extends SingleLineCommand2<CompositeDiagram> {
|
|||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
String display = arg.get("DISPLAY", 0);
|
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) {
|
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));
|
ent.setDisplay(Display.getWithNewlines(display));
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
|
|
||||||
public class CommandCreatePackageBlock extends SingleLineCommand2<CompositeDiagram> {
|
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) {
|
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final IGroup currentPackage = diagram.getCurrentGroup();
|
final IGroup currentPackage = diagram.getCurrentGroup();
|
||||||
String display = arg.get("DISPLAY", 0);
|
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) {
|
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);
|
NamespaceStrategy.SINGLE);
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,12 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final IEntity cl1 = diagram.getOrCreateLeaf(Code.of(arg.get("ENT1", 0)), null, null);
|
final String ent1 = arg.get("ENT1", 0);
|
||||||
final IEntity cl2 = diagram.getOrCreateLeaf(Code.of(arg.get("ENT2", 0)), null, null);
|
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 deco1 = arg.get("DECO1", 0);
|
||||||
final String deco2 = arg.get("DECO2", 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 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);
|
diagram.addLink(link);
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -35,97 +35,9 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.cucadiagram;
|
package net.sourceforge.plantuml.cucadiagram;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
public interface Code {
|
||||||
|
|
||||||
public class Code implements Comparable<Code> {
|
public String getName();
|
||||||
|
|
||||||
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 Code eventuallyRemoveStartingAndEndingDoubleQuote(String format);
|
||||||
}
|
}
|
||||||
|
@ -36,57 +36,49 @@
|
|||||||
package net.sourceforge.plantuml.cucadiagram;
|
package net.sourceforge.plantuml.cucadiagram;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
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 name;
|
||||||
private final String separator;
|
|
||||||
|
|
||||||
private LongCode(String fullName, String separator) {
|
private CodeImpl(String name) {
|
||||||
if (fullName == null) {
|
if (name == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
this.fullName = fullName;
|
this.name = name;
|
||||||
this.separator = separator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNamespaceSeparator() {
|
public static Code of(String code) {
|
||||||
return separator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LongCode of(String code, String separator) {
|
|
||||||
if (code == null) {
|
if (code == null) {
|
||||||
throw new IllegalStateException();
|
EntityFactory.bigError();
|
||||||
}
|
}
|
||||||
return new LongCode(code, separator);
|
return new CodeImpl(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getFullName() {
|
public final String getName() {
|
||||||
return fullName;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return fullName + "(" + separator + ")";
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return fullName.hashCode();
|
return name.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
final LongCode other = (LongCode) obj;
|
final CodeImpl other = (CodeImpl) obj;
|
||||||
return this.fullName.equals(other.fullName);
|
return this.name.equals(other.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(LongCode other) {
|
|
||||||
return this.fullName.compareTo(other.fullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private LongCode eventuallyRemoveStartingAndEndingDoubleQuote() {
|
public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format) {
|
||||||
return LongCode.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(fullName), separator);
|
return CodeImpl.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(getName(), format));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -75,14 +75,25 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
private final List<HideOrShow2> removed = new ArrayList<HideOrShow2>();
|
private final List<HideOrShow2> removed = new ArrayList<HideOrShow2>();
|
||||||
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed);
|
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed);
|
||||||
private IGroup currentGroup = entityFactory.getRootGroup();
|
private IGroup currentGroup = entityFactory.getRootGroup();
|
||||||
|
private List<Ident> stacks2 = new ArrayList<Ident>();
|
||||||
private List<IGroup> stacks = new ArrayList<IGroup>();
|
private List<IGroup> stacks = new ArrayList<IGroup>();
|
||||||
|
|
||||||
private boolean visibilityModifierPresent;
|
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) {
|
public CucaDiagram(ISkinSimple orig) {
|
||||||
super(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 = ".";
|
private String namespaceSeparator = ".";
|
||||||
@ -102,7 +113,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (IEntity entity : entityFactory.getLeafsvalues()) {
|
for (IEntity entity : entityFactory.leafs()) {
|
||||||
if (entity.hasUrl()) {
|
if (entity.hasUrl()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -115,13 +126,14 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return false;
|
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) {
|
if (type == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
ILeaf result = entityFactory.getLeafsget(code);
|
ILeaf result = entityFactory.getLeaf(code);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = createLeafInternal(code, Display.getWithNewlines(code), type, symbol);
|
result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol);
|
||||||
result.setUSymbol(symbol);
|
result.setUSymbol(symbol);
|
||||||
}
|
}
|
||||||
if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT) {
|
if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT) {
|
||||||
@ -133,19 +145,21 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) {
|
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
|
||||||
if (entityFactory.getLeafsget(code) != null) {
|
checkNotNull(idNewLong);
|
||||||
|
if (entityFactory.getLeaf(idNewLong) != null) {
|
||||||
return null;
|
return null;
|
||||||
// throw new IllegalArgumentException("Already known: " + code);
|
// 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)) {
|
if (Display.isNull(display)) {
|
||||||
display = Display.getWithNewlines(code);
|
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());
|
getNamespaceSeparator());
|
||||||
entityFactory.addLeaf(leaf);
|
entityFactory.addLeaf(leaf);
|
||||||
this.lastEntity = leaf;
|
this.lastEntity = leaf;
|
||||||
@ -153,8 +167,35 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return leaf;
|
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) {
|
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) {
|
final public Collection<IGroup> getChildrenGroups(IGroup parent) {
|
||||||
@ -167,21 +208,24 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return Collections.unmodifiableCollection(result);
|
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 (strategy == NamespaceStrategy.MULTIPLE) {
|
||||||
if (getNamespaceSeparator() != null) {
|
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) {
|
} 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 {
|
} else {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final String getNamespace(Code fullyCode, String separator) {
|
protected final String getNamespace1972(Code fullyCode, String separator) {
|
||||||
String name = fullyCode.getFullName();
|
String name = fullyCode.getName();
|
||||||
if (separator == null) {
|
if (separator == null) {
|
||||||
throw new IllegalArgumentException(toString());
|
throw new IllegalArgumentException(toString());
|
||||||
}
|
}
|
||||||
@ -191,31 +235,31 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
name = name.substring(0, x);
|
name = name.substring(0, x);
|
||||||
} while (entityFactory.getLeafsget(Code.of(name, separator)) != null);
|
} while (entityFactory.getLeaf(buildCode(name)) != null);
|
||||||
return name;
|
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) {
|
GroupType type, IGroup parent) {
|
||||||
|
|
||||||
this.stacks.add(currentGroup);
|
this.stacks.add(currentGroup);
|
||||||
|
this.stacks2.add(idNewLong);
|
||||||
if (getNamespaceSeparator() == null) {
|
if (getNamespaceSeparator() == null) {
|
||||||
gotoGroupInternal(code, display, namespace2, type, parent);
|
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String namespace = getNamespace(code, getNamespaceSeparator());
|
final String namespaceCurrent = getNamespace1972(code, getNamespaceSeparator());
|
||||||
if (namespace == null) {
|
if (namespaceCurrent == null) {
|
||||||
gotoGroupInternal(code, display, namespace2, type, parent);
|
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final IGroup realParent = entityFactory.getGroupsget(Code.of(namespace));
|
final IGroup realParent = entityFactory.getGroup(buildCode(namespaceCurrent));
|
||||||
if (realParent == null) {
|
if (realParent == null) {
|
||||||
gotoGroupInternal(code, display, namespace2, type, parent);
|
gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
display = Display.create(code.getLastPart());
|
display = Display.create(idNewLong.getLast());
|
||||||
IGroup result = entityFactory.createGroup(code, display, namespace2, type, realParent, getHides(),
|
IGroup result = entityFactory.createGroup(idNewLong, code, display, namespaceNew, type, realParent, getHides(),
|
||||||
getNamespaceSeparator());
|
getNamespaceSeparator());
|
||||||
|
|
||||||
entityFactory.addGroup(result);
|
entityFactory.addGroup(result);
|
||||||
@ -224,6 +268,10 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void endGroup() {
|
public void endGroup() {
|
||||||
|
if (stacks2.size() > 0) {
|
||||||
|
// Thread.dumpStack();
|
||||||
|
stacks2.remove(stacks2.size() - 1);
|
||||||
|
}
|
||||||
if (EntityUtils.groupRoot(currentGroup)) {
|
if (EntityUtils.groupRoot(currentGroup)) {
|
||||||
Log.error("No parent group");
|
Log.error("No parent group");
|
||||||
return;
|
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,
|
private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace,
|
||||||
IGroup parent) {
|
GroupType type, IGroup parent) {
|
||||||
IGroup result = entityFactory.getGroupsget(code);
|
IGroup result = entityFactory.getGroup(code);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
currentGroup = result;
|
currentGroup = result;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entityFactory.getLeafsget(code) != null) {
|
if (entityFactory.getLeaf(idNewLong) != null) {
|
||||||
result = entityFactory.muteToGroup(code, namespace2, type, parent);
|
result = entityFactory.muteToGroup(code.getName(), namespace, type, parent);
|
||||||
result.setDisplay(display);
|
result.setDisplay(display);
|
||||||
} else {
|
} else {
|
||||||
result = entityFactory.createGroup(code, display, namespace2, type, parent, getHides(),
|
result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(),
|
||||||
getNamespaceSeparator());
|
getNamespaceSeparator());
|
||||||
}
|
}
|
||||||
entityFactory.addGroup(result);
|
entityFactory.addGroup(result);
|
||||||
currentGroup = 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) {
|
public final void gotoThisGroup(IGroup group) {
|
||||||
currentGroup = group;
|
currentGroup = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected Code getFullyQualifiedCode(Code code) {
|
final protected Code getFullyQualifiedCode1972(Code code) {
|
||||||
final String separator = code.getSeparator();
|
final String separator = getNamespaceSeparator();
|
||||||
if (separator == null) {
|
if (separator == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
final String full = code.getFullName();
|
final String full = code.getName();
|
||||||
if (full.startsWith(separator)) {
|
if (full.startsWith(separator)) {
|
||||||
return Code.of(full.substring(separator.length()), separator);
|
return buildCode(full.substring(separator.length()));
|
||||||
}
|
}
|
||||||
if (full.contains(separator)) {
|
if (full.contains(separator)) {
|
||||||
return Code.of(full, separator);
|
return buildCode(full);
|
||||||
}
|
}
|
||||||
if (EntityUtils.groupRoot(currentGroup)) {
|
if (EntityUtils.groupRoot(currentGroup)) {
|
||||||
return Code.of(full, separator);
|
return buildCode(full);
|
||||||
}
|
}
|
||||||
final Code namespace2 = currentGroup.getNamespace2();
|
final Code namespace = currentGroup.getNamespace();
|
||||||
if (namespace2 == null) {
|
if (namespace == null) {
|
||||||
return Code.of(full, separator);
|
return buildCode(full);
|
||||||
}
|
}
|
||||||
return Code.of(namespace2.getFullName() + separator + full, separator);
|
return buildCode(namespace.getName() + separator + full);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final IGroup getCurrentGroup() {
|
public final IGroup getCurrentGroup() {
|
||||||
@ -284,7 +351,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final IGroup getGroup(Code code) {
|
public final IGroup getGroup(Code code) {
|
||||||
final IGroup p = entityFactory.getGroupsget(code);
|
final IGroup p = entityFactory.getGroup(code);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
// return null;
|
// return null;
|
||||||
@ -293,16 +360,20 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isGroup(Code code) {
|
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) {
|
public final Collection<IGroup> getGroups(boolean withRootGroup) {
|
||||||
if (withRootGroup == false) {
|
if (withRootGroup == false) {
|
||||||
return entityFactory.getGroupsvalues();
|
return entityFactory.groups();
|
||||||
}
|
}
|
||||||
final Collection<IGroup> result = new ArrayList<IGroup>();
|
final Collection<IGroup> result = new ArrayList<IGroup>();
|
||||||
result.add(getRootGroup());
|
result.add(getRootGroup());
|
||||||
result.addAll(entityFactory.getGroupsvalues());
|
result.addAll(entityFactory.groups());
|
||||||
return Collections.unmodifiableCollection(result);
|
return Collections.unmodifiableCollection(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,16 +381,20 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return entityFactory.getRootGroup();
|
return entityFactory.getRootGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ILeaf> getLeafsvalues() {
|
public final Collection<ILeaf> getLeafsvalues() {
|
||||||
return entityFactory.getLeafsvalues();
|
return entityFactory.leafs2();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int getLeafssize() {
|
public final int getLeafssize() {
|
||||||
return getLeafsvalues().size();
|
return getLeafsvalues().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ILeaf getLeafsget(Code code) {
|
public final ILeaf getLeaf(Code code) {
|
||||||
return entityFactory.getLeafsget(code);
|
return entityFactory.getLeaf(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final ILeaf getLeaf(Ident ident) {
|
||||||
|
return entityFactory.getLeaf(ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
final public void addLink(Link link) {
|
final public void addLink(Link link) {
|
||||||
@ -355,17 +430,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return this.horizontalPages * this.verticalPages;
|
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();
|
abstract protected List<String> getDotStrings();
|
||||||
|
|
||||||
final public String[] getDotStringSkek() {
|
final public String[] getDotStringSkek() {
|
||||||
@ -424,9 +488,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// final CucaDiagramFileMaker maker = OptionFlags.USE_HECTOR ? new
|
|
||||||
// CucaDiagramFileMakerHectorC1(this)
|
|
||||||
// : new CucaDiagramFileMakerSvek(this);
|
|
||||||
final CucaDiagramFileMaker maker = this.isUseJDot() ? new CucaDiagramFileMakerJDot(this,
|
final CucaDiagramFileMaker maker = this.isUseJDot() ? new CucaDiagramFileMakerJDot(this,
|
||||||
fileFormatOption.getDefaultStringBounder()) : new CucaDiagramFileMakerSvek(this);
|
fileFormatOption.getDefaultStringBounder()) : new CucaDiagramFileMakerSvek(this);
|
||||||
final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption);
|
final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption);
|
||||||
@ -457,14 +518,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
maker.createFiles(os, index);
|
maker.createFiles(os, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public final Rankdir getRankdir() {
|
|
||||||
// return rankdir;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public final void setRankdir(Rankdir rankdir) {
|
|
||||||
// this.rankdir = rankdir;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean isAutarkic(IGroup g) {
|
public boolean isAutarkic(IGroup g) {
|
||||||
if (g.getGroupType() == GroupType.PACKAGE) {
|
if (g.getGroupType() == GroupType.PACKAGE) {
|
||||||
return false;
|
return false;
|
||||||
@ -638,14 +691,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
private ILeaf lastEntity = null;
|
private ILeaf lastEntity = null;
|
||||||
|
|
||||||
final public ILeaf getLastEntity() {
|
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;
|
return lastEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,7 +703,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
|
|
||||||
for (IGroup g : getGroups(true)) {
|
for (IGroup g : getGroups(true)) {
|
||||||
final List<ILeaf> standalones = new ArrayList<ILeaf>();
|
final List<ILeaf> standalones = new ArrayList<ILeaf>();
|
||||||
// final SingleStrategy singleStrategy = g.getSingleStrategy();
|
|
||||||
|
|
||||||
for (ILeaf ent : g.getLeafsDirect()) {
|
for (ILeaf ent : g.getLeafsDirect()) {
|
||||||
if (isStandalone(ent)) {
|
if (isStandalone(ent)) {
|
||||||
@ -671,10 +715,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
final Magma magma = new Magma(this, standalones);
|
final Magma magma = new Magma(this, standalones);
|
||||||
magma.putInSquare();
|
magma.putInSquare();
|
||||||
magmaList.add(magma);
|
magmaList.add(magma);
|
||||||
|
|
||||||
// for (Link link : singleStrategy.generateLinks(standalones)) {
|
|
||||||
// addLink(link);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IGroup g : getGroups(true)) {
|
for (IGroup g : getGroups(true)) {
|
||||||
|
@ -75,7 +75,6 @@ import net.sourceforge.plantuml.skin.VisibilityModifier;
|
|||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
import net.sourceforge.plantuml.wbs.WBSDiagram;
|
|
||||||
|
|
||||||
public class Display implements Iterable<CharSequence> {
|
public class Display implements Iterable<CharSequence> {
|
||||||
|
|
||||||
@ -147,7 +146,7 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Display getWithNewlines(Code s) {
|
public static Display getWithNewlines(Code s) {
|
||||||
return getWithNewlines(s.getFullName());
|
return getWithNewlines(s.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Display getWithNewlines(String s) {
|
public static Display getWithNewlines(String s) {
|
||||||
|
@ -39,6 +39,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -86,10 +87,11 @@ class Election {
|
|||||||
|
|
||||||
public Map<Member, String> getAllElected(Collection<String> shortNames) {
|
public Map<Member, String> getAllElected(Collection<String> shortNames) {
|
||||||
final Map<Member, String> memberWithPort = new HashMap<Member, String>();
|
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);
|
final Member m = getCandidate(shortName);
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
memberWithPort.put(m, shortName);
|
memberWithPort.put(m, shortName);
|
||||||
|
shortNames.remove(shortName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Collections.unmodifiableMap(memberWithPort);
|
return Collections.unmodifiableMap(memberWithPort);
|
||||||
|
@ -71,8 +71,8 @@ public class EntityPort {
|
|||||||
return this.uid.equals(other.uid);
|
return this.uid.equals(other.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPortName() {
|
// private String getPortName() {
|
||||||
return portName;
|
// return portName;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class GroupPrinter {
|
|||||||
pw.println("<table border=1 cellpadding=8 cellspacing=0>");
|
pw.println("<table border=1 cellpadding=8 cellspacing=0>");
|
||||||
pw.println("<tr>");
|
pw.println("<tr>");
|
||||||
pw.println("<td bgcolor=#DDDDDD>");
|
pw.println("<td bgcolor=#DDDDDD>");
|
||||||
pw.println(group.getCode());
|
pw.println(group.getCodeGetName());
|
||||||
pw.println("<tr>");
|
pw.println("<tr>");
|
||||||
pw.println("<td>");
|
pw.println("<td>");
|
||||||
if (group.getLeafsDirect().size() == 0) {
|
if (group.getLeafsDirect().size() == 0) {
|
||||||
@ -80,7 +80,7 @@ public class GroupPrinter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void printLeaf(ILeaf leaf) {
|
private void printLeaf(ILeaf leaf) {
|
||||||
pw.println("<li>" + leaf.getCode());
|
pw.println("<li>" + leaf.getCodeGetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void print(File f, IGroup rootGroup) {
|
public static void print(File f, IGroup rootGroup) {
|
||||||
|
@ -67,7 +67,7 @@ public class GroupRoot implements IGroup {
|
|||||||
|
|
||||||
public Collection<ILeaf> getLeafsDirect() {
|
public Collection<ILeaf> getLeafsDirect() {
|
||||||
final List<ILeaf> result = new ArrayList<ILeaf>();
|
final List<ILeaf> result = new ArrayList<ILeaf>();
|
||||||
for (ILeaf ent : entityFactory.getLeafsvalues()) {
|
for (ILeaf ent : entityFactory.leafs()) {
|
||||||
if (ent.getParentContainer() == this) {
|
if (ent.getParentContainer() == this) {
|
||||||
result.add(ent);
|
result.add(ent);
|
||||||
}
|
}
|
||||||
@ -120,11 +120,11 @@ public class GroupRoot implements IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Code getCode() {
|
public Code getCode() {
|
||||||
return Code.of("__ROOT__");
|
return CodeImpl.of("__ROOT__");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LongCode getLongCode() {
|
public String getCodeGetName() {
|
||||||
return null;
|
return getCode().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUrl(Url url) {
|
public void addUrl(Url url) {
|
||||||
@ -143,7 +143,7 @@ public class GroupRoot implements IGroup {
|
|||||||
|
|
||||||
public Collection<IGroup> getChildren() {
|
public Collection<IGroup> getChildren() {
|
||||||
final List<IGroup> result = new ArrayList<IGroup>();
|
final List<IGroup> result = new ArrayList<IGroup>();
|
||||||
for (IGroup ent : entityFactory.getGroupsvalues()) {
|
for (IGroup ent : entityFactory.groups()) {
|
||||||
if (ent.getParentContainer() == this) {
|
if (ent.getParentContainer() == this) {
|
||||||
result.add(ent);
|
result.add(ent);
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ public class GroupRoot implements IGroup {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Code getNamespace2() {
|
public Code getNamespace() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -269,4 +269,8 @@ public class GroupRoot implements IGroup {
|
|||||||
public DisplayPositionned getLegend() {
|
public DisplayPositionned getLegend() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Ident getIdent() {
|
||||||
|
return Ident.empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class HideOrShow2 {
|
|||||||
if (what.startsWith("<<") && what.endsWith(">>")) {
|
if (what.startsWith("<<") && what.endsWith(">>")) {
|
||||||
return isApplyableStereotype(leaf, what.substring(2, what.length() - 2).trim());
|
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);
|
// System.err.println("fullName=" + fullName);
|
||||||
return match(fullName, what);
|
return match(fullName, what);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,9 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
|
|||||||
|
|
||||||
public Code getCode();
|
public Code getCode();
|
||||||
|
|
||||||
public LongCode getLongCode();
|
public String getCodeGetName();
|
||||||
|
|
||||||
|
public Ident getIdent();
|
||||||
|
|
||||||
public USymbol getUSymbol();
|
public USymbol getUSymbol();
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public interface IGroup extends IEntity {
|
|||||||
|
|
||||||
public GroupType getGroupType();
|
public GroupType getGroupType();
|
||||||
|
|
||||||
public Code getNamespace2();
|
public Code getNamespace();
|
||||||
|
|
||||||
public PackageStyle getPackageStyle();
|
public PackageStyle getPackageStyle();
|
||||||
|
|
||||||
@ -74,4 +74,5 @@ public interface IGroup extends IEntity {
|
|||||||
public void setLegend(DisplayPositionned legend);
|
public void setLegend(DisplayPositionned legend);
|
||||||
|
|
||||||
public DisplayPositionned getLegend();
|
public DisplayPositionned getLegend();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,45 +35,205 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.cucadiagram;
|
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.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) {
|
private Ident(List<String> parts) {
|
||||||
if (ident == null) {
|
this.parts = parts;
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
this.ident = ident;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Ident of(String code) {
|
|
||||||
return new Ident(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ident;
|
return parts.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String forXmi() {
|
||||||
public int hashCode() {
|
final StringBuilder sb = new StringBuilder();
|
||||||
return ident.hashCode();
|
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
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
final Ident other = (Ident) obj;
|
final Ident other = (Ident) obj;
|
||||||
return this.ident.equals(other.ident);
|
return this.parts.equals(other.parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(Ident other) {
|
@Override
|
||||||
return this.ident.compareTo(other.ident);
|
public int hashCode() {
|
||||||
|
return parts.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ident eventuallyRemoveStartingAndEndingDoubleQuote() {
|
public String toString(String sep) {
|
||||||
return Ident.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ident));
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -102,24 +102,24 @@ public class Link extends WithLinkType implements Hideable, Removeable {
|
|||||||
|
|
||||||
public String idCommentForSvg() {
|
public String idCommentForSvg() {
|
||||||
if (type.looksLikeRevertedForSvg()) {
|
if (type.looksLikeRevertedForSvg()) {
|
||||||
final String comment = getEntity1().getCode().getFullName() + "<-" + getEntity2().getCode().getFullName();
|
final String comment = getEntity1().getCodeGetName() + "<-" + getEntity2().getCodeGetName();
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
if (type.looksLikeNoDecorAtAllSvg()) {
|
if (type.looksLikeNoDecorAtAllSvg()) {
|
||||||
final String comment = getEntity1().getCode().getFullName() + "-" + getEntity2().getCode().getFullName();
|
final String comment = getEntity1().getCodeGetName() + "-" + getEntity2().getCodeGetName();
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
final String comment = getEntity1().getCode().getFullName() + "->" + getEntity2().getCode().getFullName();
|
final String comment = getEntity1().getCodeGetName() + "->" + getEntity2().getCodeGetName();
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UComment commentForSvg() {
|
public UComment commentForSvg() {
|
||||||
if (type.looksLikeRevertedForSvg()) {
|
if (type.looksLikeRevertedForSvg()) {
|
||||||
return new UComment("reverse link " + getEntity1().getCode().getFullName() + " to "
|
return new UComment("reverse link " + getEntity1().getCodeGetName() + " to "
|
||||||
+ getEntity2().getCode().getFullName());
|
+ getEntity2().getCodeGetName());
|
||||||
}
|
}
|
||||||
return new UComment("link " + getEntity1().getCode().getFullName() + " to "
|
return new UComment("link " + getEntity1().getCodeGetName() + " to "
|
||||||
+ getEntity2().getCode().getFullName());
|
+ getEntity2().getCodeGetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, StyleBuilder styleBuilder) {
|
public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, StyleBuilder styleBuilder) {
|
||||||
|
@ -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),
|
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),
|
: 1.0), SQUARE(0, false, 0.5),
|
||||||
|
|
||||||
CIRCLE_CROSS(0, false, 0.5), PLUS(0, false, 1.5), SQUARRE_toberemoved(30, false, 0);
|
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) {
|
} else if (this == LinkDecor.COMPOSITION) {
|
||||||
return new ExtremityFactoryDiamond(true, backgroundColor);
|
return new ExtremityFactoryDiamond(true, backgroundColor);
|
||||||
} else if (this == LinkDecor.CIRCLE) {
|
} 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) {
|
} else if (this == LinkDecor.SQUARE) {
|
||||||
return new ExtremityFactorySquarre();
|
return new ExtremityFactorySquarre();
|
||||||
} else if (this == LinkDecor.PARENTHESIS) {
|
} else if (this == LinkDecor.PARENTHESIS) {
|
||||||
|
@ -55,6 +55,11 @@ public class MemberImpl implements Member {
|
|||||||
|
|
||||||
private final VisibilityModifier visibilityModifier;
|
private final VisibilityModifier visibilityModifier;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return super.toString() + " " + display;
|
||||||
|
}
|
||||||
|
|
||||||
public MemberImpl(String tmpDisplay, boolean isMethod, boolean manageModifier) {
|
public MemberImpl(String tmpDisplay, boolean isMethod, boolean manageModifier) {
|
||||||
tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", "");
|
tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", "");
|
||||||
if (manageModifier) {
|
if (manageModifier) {
|
||||||
@ -96,7 +101,8 @@ public class MemberImpl implements Member {
|
|||||||
this.visibilityModifier = null;
|
this.visibilityModifier = null;
|
||||||
this.abstractModifier = false;
|
this.abstractModifier = false;
|
||||||
tmpDisplay = StringUtils.trin(tmpDisplay);
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ final public class DotData implements PortionShower {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDegeneratedWithFewEntities(int nb) {
|
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() {
|
public final boolean isHideEmptyDescriptionForState() {
|
||||||
|
@ -52,16 +52,21 @@ import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LongCode;
|
|
||||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
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 List<Link> links = new ArrayList<Link>();
|
||||||
private final Map<Code, IGroup> groups = new LinkedHashMap<Code, IGroup>();
|
|
||||||
private int rawLayout;
|
private int rawLayout;
|
||||||
|
|
||||||
private final IGroup rootGroup = new GroupRoot(this);
|
private final IGroup rootGroup = new GroupRoot(this);
|
||||||
@ -89,42 +94,104 @@ public class EntityFactory {
|
|||||||
return result;
|
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) {
|
Set<VisibilityModifier> hides, String namespaceSeparator) {
|
||||||
if (entityType == null) {
|
if (entityType == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
// if (byIdents.containsKey(ident)) {
|
||||||
|
// throw new IllegalArgumentException();
|
||||||
|
// }
|
||||||
final Bodier bodier = new Bodier(entityType, hides);
|
final Bodier bodier = new Bodier(entityType, hides);
|
||||||
final LongCode longCode = getLongCode(code, namespaceSeparator);
|
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, entityType,
|
||||||
final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, entityType, longCode,
|
|
||||||
namespaceSeparator, rawLayout);
|
namespaceSeparator, rawLayout);
|
||||||
bodier.setLeaf(result);
|
bodier.setLeaf(result);
|
||||||
result.setDisplay(display);
|
result.setDisplay(display);
|
||||||
|
// System.err.println("adding1 "+ident);
|
||||||
|
// byIdents.put(ident, result);
|
||||||
|
// System.err.println("EntityFactory::createLeaf=" + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LongCode getLongCode(Code code, String namespaceSeparator) {
|
public IGroup createGroup(Ident ident, Code code, Display display, Code namespace, GroupType groupType,
|
||||||
final LongCode result = LongCode.of(code.getFullName(), namespaceSeparator);
|
IGroup parentContainer, Set<VisibilityModifier> hides, String 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) {
|
|
||||||
if (groupType == null) {
|
if (groupType == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
// if (byIdents.containsKey(ident)) {
|
||||||
|
// throw new IllegalArgumentException();
|
||||||
|
// }
|
||||||
final Bodier bodier = new Bodier(null, hides);
|
final Bodier bodier = new Bodier(null, hides);
|
||||||
final LongCode longCode = getLongCode(code, namespaceSeparator);
|
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, groupType, namespace,
|
||||||
final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, groupType, namespace2, longCode,
|
|
||||||
namespaceSeparator, rawLayout);
|
namespaceSeparator, rawLayout);
|
||||||
if (Display.isNull(display) == false) {
|
if (Display.isNull(display) == false) {
|
||||||
result.setDisplay(display);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,48 +199,61 @@ public class EntityFactory {
|
|||||||
return rootGroup;
|
return rootGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ILeaf getLeafsget(Code code) {
|
public final ILeaf getLeaf(Ident ident) {
|
||||||
return leafs.get(code);
|
return leafs2.get(ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Collection<ILeaf> getLeafsvalues() {
|
public final ILeaf getLeaf(Code code) {
|
||||||
return Collections.unmodifiableCollection(leafs.values());
|
final ILeaf result = leafsByCode.get(code.getName());
|
||||||
|
if (result != null && result != leafs2.get(result.getIdent())) {
|
||||||
|
bigError();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLeaf(ILeaf entity) {
|
public final IGroup getGroup(Code code) {
|
||||||
leafs.put(entity.getCode(), entity);
|
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() {
|
public void incRawLayout() {
|
||||||
rawLayout++;
|
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() {
|
public final List<Link> getLinks() {
|
||||||
return Collections.unmodifiableList(links);
|
return Collections.unmodifiableList(links);
|
||||||
}
|
}
|
||||||
@ -201,12 +281,21 @@ public class EntityFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGroup muteToGroup(Code code, Code namespace2, GroupType type, IGroup parent) {
|
public IGroup getParentContainer(Ident ident, IGroup parentContainer) {
|
||||||
final ILeaf leaf = leafs.get(code);
|
if (parentContainer == null) {
|
||||||
((EntityImpl) leaf).muteToGroup(namespace2, type, parent);
|
throw new IllegalArgumentException();
|
||||||
final IGroup result = (IGroup) leaf;
|
}
|
||||||
removeLeaf(code);
|
// if (parentContainer == null) {
|
||||||
return result;
|
// } 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,9 @@ import net.sourceforge.plantuml.cucadiagram.GroupRoot;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LongCode;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
|
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
|
||||||
@ -84,7 +84,7 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
|
|
||||||
// Entity
|
// Entity
|
||||||
private final Code code;
|
private final Code code;
|
||||||
private final LongCode longCode;
|
private final Ident ident;
|
||||||
|
|
||||||
private Url url;
|
private Url url;
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
private boolean top;
|
private boolean top;
|
||||||
|
|
||||||
// Group
|
// Group
|
||||||
private Code namespace2;
|
private Code namespace;
|
||||||
|
|
||||||
private GroupType groupType;
|
private GroupType groupType;
|
||||||
|
|
||||||
@ -136,30 +136,43 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
this.top = top;
|
this.top = top;
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
|
private EntityImpl(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
|
||||||
LongCode longCode, String namespaceSeparator, int rawLayout) {
|
String namespaceSeparator, int rawLayout) {
|
||||||
|
checkNotNull(ident);
|
||||||
if (code == null) {
|
if (code == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
this.ident = ident;
|
||||||
this.entityFactory = entityFactory;
|
this.entityFactory = entityFactory;
|
||||||
this.bodier = bodier;
|
this.bodier = bodier;
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.parentContainer = parentContainer;
|
this.parentContainer = parentContainer;
|
||||||
this.longCode = longCode;
|
|
||||||
this.rawLayout = rawLayout;
|
this.rawLayout = rawLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, LeafType leafType,
|
EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
|
||||||
LongCode longCode, String namespaceSeparator, int rawLayout) {
|
LeafType leafType, String namespaceSeparator, int rawLayout) {
|
||||||
this(entityFactory, code, bodier, parentContainer, longCode, namespaceSeparator, 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;
|
this.leafType = leafType;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, GroupType groupType,
|
EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
|
||||||
Code namespace2, LongCode longCode, String namespaceSeparator, int rawLayout) {
|
GroupType groupType, Code namespace, String namespaceSeparator, int rawLayout) {
|
||||||
this(entityFactory, code, bodier, parentContainer, longCode, namespaceSeparator, 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.groupType = groupType;
|
||||||
this.namespace2 = namespace2;
|
this.namespace = namespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkNotNull(Ident id) {
|
||||||
|
if (id == null) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContainer(IGroup container) {
|
public void setContainer(IGroup container) {
|
||||||
@ -206,6 +219,14 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCodeGetName() {
|
||||||
|
return getCode().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ident getIdent() {
|
||||||
|
return ident;
|
||||||
|
}
|
||||||
|
|
||||||
public Display getDisplay() {
|
public Display getDisplay() {
|
||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
@ -227,15 +248,18 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final IGroup getParentContainer() {
|
public final IGroup getParentContainer() {
|
||||||
if (parentContainer == null) {
|
return entityFactory.getParentContainer(ident, parentContainer);
|
||||||
throw new IllegalArgumentException();
|
// if (parentContainer == null) {
|
||||||
}
|
// throw new IllegalArgumentException();
|
||||||
return parentContainer;
|
// }
|
||||||
|
// return parentContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
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() {
|
public final Url getUrl99() {
|
||||||
@ -352,7 +376,7 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
public Collection<ILeaf> getLeafsDirect() {
|
public Collection<ILeaf> getLeafsDirect() {
|
||||||
checkGroup();
|
checkGroup();
|
||||||
final List<ILeaf> result = new ArrayList<ILeaf>();
|
final List<ILeaf> result = new ArrayList<ILeaf>();
|
||||||
for (ILeaf ent : entityFactory.getLeafsvalues()) {
|
for (ILeaf ent : entityFactory.leafs()) {
|
||||||
if (ent.isGroup()) {
|
if (ent.isGroup()) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -366,7 +390,7 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
public Collection<IGroup> getChildren() {
|
public Collection<IGroup> getChildren() {
|
||||||
checkGroup();
|
checkGroup();
|
||||||
final Collection<IGroup> result = new ArrayList<IGroup>();
|
final Collection<IGroup> result = new ArrayList<IGroup>();
|
||||||
for (IGroup g : entityFactory.getGroupsvalues()) {
|
for (IGroup g : entityFactory.groups()) {
|
||||||
if (g != this && g.getParentContainer() == this) {
|
if (g != this && g.getParentContainer() == this) {
|
||||||
result.add(g);
|
result.add(g);
|
||||||
}
|
}
|
||||||
@ -406,9 +430,9 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
return groupType;
|
return groupType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Code getNamespace2() {
|
public Code getNamespace() {
|
||||||
checkGroup();
|
checkGroup();
|
||||||
return namespace2;
|
return namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PackageStyle getPackageStyle() {
|
public PackageStyle getPackageStyle() {
|
||||||
@ -423,6 +447,7 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
if (groupType != null && leafType != null) {
|
if (groupType != null && leafType != null) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
assert groupType == null || leafType == null;
|
||||||
if (groupType != null) {
|
if (groupType != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -445,10 +470,10 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entityFactory.removeGroup(this.getCode());
|
entityFactory.removeGroup(getCodeGetName());
|
||||||
for (ILeaf ent : new ArrayList<ILeaf>(entityFactory.getLeafsvalues())) {
|
for (ILeaf ent : new ArrayList<ILeaf>(entityFactory.leafs())) {
|
||||||
if (this != ent && this == ent.getParentContainer()) {
|
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;
|
this.leafType = leafType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void muteToGroup(Code namespace2, GroupType groupType, IGroup parentContainer) {
|
void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
|
||||||
checkNotGroup();
|
checkNotGroup();
|
||||||
if (parentContainer.isGroup() == false) {
|
if (parentContainer.isGroup() == false) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
this.namespace2 = namespace2;
|
this.namespace = namespaceNew;
|
||||||
this.groupType = groupType;
|
this.groupType = groupType;
|
||||||
this.leafType = null;
|
this.leafType = null;
|
||||||
this.parentContainer = parentContainer;
|
this.parentContainer = parentContainer;
|
||||||
@ -559,10 +584,6 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LongCode getLongCode() {
|
|
||||||
return longCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
private FontParam getTitleFontParam() {
|
private FontParam getTitleFontParam() {
|
||||||
if (symbol != null) {
|
if (symbol != null) {
|
||||||
return symbol.getFontParam();
|
return symbol.getFontParam();
|
||||||
@ -629,7 +650,8 @@ final class EntityImpl implements ILeaf, IGroup {
|
|||||||
|
|
||||||
public Collection<String> getPortShortNames() {
|
public Collection<String> getPortShortNames() {
|
||||||
checkNotGroup();
|
checkNotGroup();
|
||||||
return Collections.unmodifiableCollection(portShortNames);
|
// return Collections.unmodifiableCollection(portShortNames);
|
||||||
|
return portShortNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPortShortName(String portShortName) {
|
public void addPortShortName(String portShortName) {
|
||||||
|
@ -52,6 +52,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
@ -94,7 +95,7 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
|
|||||||
|
|
||||||
final String stereotype = arg.get("STEREO", 0);
|
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);
|
return CommandExecutionResult.error("Object already exists : " + code);
|
||||||
}
|
}
|
||||||
Display d = Display.getWithNewlines(display);
|
Display d = Display.getWithNewlines(display);
|
||||||
@ -103,12 +104,15 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
|
|||||||
IEntity entity;
|
IEntity entity;
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
final IGroup currentGroup = diagram.getCurrentGroup();
|
final IGroup currentGroup = diagram.getCurrentGroup();
|
||||||
diagram.gotoGroup2(Code.of(code), d, type.equalsIgnoreCase("domain") ? GroupType.DOMAIN
|
final Ident idNewLong = diagram.buildLeafIdent(code);
|
||||||
: GroupType.REQUIREMENT, currentGroup, NamespaceStrategy.SINGLE);
|
diagram.gotoGroup(idNewLong, diagram.buildCode(code), d,
|
||||||
|
type.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT, currentGroup,
|
||||||
|
NamespaceStrategy.SINGLE);
|
||||||
entity = diagram.getCurrentGroup();
|
entity = diagram.getCurrentGroup();
|
||||||
} else {
|
} else {
|
||||||
entity = diagram.createLeaf(Code.of(code), d, type.equalsIgnoreCase("domain") ? LeafType.DOMAIN
|
final Ident idNewLong = diagram.buildLeafIdent(code);
|
||||||
: LeafType.REQUIREMENT, null);
|
entity = diagram.createLeaf(idNewLong, diagram.buildCode(code), d,
|
||||||
|
type.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT, null);
|
||||||
}
|
}
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
||||||
@ -139,7 +143,7 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
|
|||||||
type = "biddable";
|
type = "biddable";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
USymbol usymbol = USymbol.getFromString(type, diagram.getSkinParam().useUml2ForComponent());
|
USymbol usymbol = USymbol.getFromString(type, diagram.getSkinParam());
|
||||||
entity.setUSymbol(usymbol);
|
entity.setUSymbol(usymbol);
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -41,78 +41,49 @@ import net.sourceforge.plantuml.UmlDiagramType;
|
|||||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
|
|
||||||
public class DescriptionDiagram extends AbstractEntityDiagram {
|
public class DescriptionDiagram extends AbstractEntityDiagram {
|
||||||
|
|
||||||
public DescriptionDiagram(ISkinSimple skinParam) {
|
public DescriptionDiagram(ISkinSimple skinParam) {
|
||||||
super(skinParam);
|
super(skinParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
|
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
|
||||||
if (getNamespaceSeparator() != null) {
|
checkNotNull(ident);
|
||||||
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);
|
|
||||||
}
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
String code2 = code.getFullName();
|
String codeString = code.getName();
|
||||||
if (code2.startsWith("[") && code2.endsWith("]")) {
|
if (codeString.startsWith("[") && codeString.endsWith("]")) {
|
||||||
final USymbol sym = getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
|
final USymbol sym = getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
|
||||||
return getOrCreateLeafDefault(code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
|
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
|
||||||
LeafType.DESCRIPTION, sym);
|
return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(), LeafType.DESCRIPTION, sym);
|
||||||
}
|
}
|
||||||
if (code2.startsWith(":") && code2.endsWith(":")) {
|
if (codeString.startsWith(":") && codeString.endsWith(":")) {
|
||||||
return getOrCreateLeafDefault(code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
|
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
|
||||||
LeafType.DESCRIPTION, USymbol.ACTOR);
|
return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(), LeafType.DESCRIPTION, getSkinParam().getActorStyle()
|
||||||
|
.getUSymbol());
|
||||||
}
|
}
|
||||||
if (code2.startsWith("()")) {
|
if (codeString.startsWith("()")) {
|
||||||
code2 = StringUtils.trin(code2.substring(2));
|
codeString = StringUtils.trin(codeString.substring(2));
|
||||||
code2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code2);
|
codeString = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString);
|
||||||
return getOrCreateLeafDefault(Code.of(code2), LeafType.DESCRIPTION, USymbol.INTERFACE);
|
final Ident idNewLong = buildLeafIdent(codeString);
|
||||||
|
return getOrCreateLeafDefault(idNewLong, buildCode(codeString), LeafType.DESCRIPTION, USymbol.INTERFACE);
|
||||||
}
|
}
|
||||||
code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
|
code = buildCode(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code.getName(), "\"([:"));
|
||||||
return getOrCreateLeafDefault(code, LeafType.STILL_UNKNOWN, symbol);
|
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() {
|
private boolean isUsecase() {
|
||||||
for (ILeaf leaf : getLeafsvalues()) {
|
for (ILeaf leaf : getLeafsvalues()) {
|
||||||
final LeafType type = leaf.getLeafType();
|
final LeafType type = leaf.getLeafType();
|
||||||
final USymbol usymbol = leaf.getUSymbol();
|
final USymbol usymbol = leaf.getUSymbol();
|
||||||
if (type == LeafType.USECASE || usymbol == USymbol.ACTOR) {
|
if (type == LeafType.USECASE || usymbol == getSkinParam().getActorStyle().getUSymbol()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +94,7 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
|
|||||||
public void makeDiagramReady() {
|
public void makeDiagramReady() {
|
||||||
super.makeDiagramReady();
|
super.makeDiagramReady();
|
||||||
final LeafType defaultType = isUsecase() ? LeafType.DESCRIPTION : LeafType.DESCRIPTION;
|
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()) {
|
for (ILeaf leaf : getLeafsvalues()) {
|
||||||
if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) {
|
if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) {
|
||||||
leaf.muteToType(defaultType, defaultSymbol);
|
leaf.muteToType(defaultType, defaultSymbol);
|
||||||
|
@ -121,16 +121,17 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
|
|||||||
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final String codeRaw = arg.getLazzy("CODE", 0);
|
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 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);
|
final String displayRaw = arg.getLazzy("DISPLAY", 0);
|
||||||
|
|
||||||
String display = displayRaw;
|
String display = displayRaw;
|
||||||
if (display == null) {
|
if (display == null) {
|
||||||
display = code.getFullName();
|
display = code.getName();
|
||||||
}
|
}
|
||||||
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
||||||
|
|
||||||
|
@ -102,10 +102,11 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
|
|||||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
|
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
|
||||||
final String codeRaw = line0.getLazzy("CODE", 0);
|
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 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);
|
lines = lines.subExtract(1, 1);
|
||||||
Display display = lines.toDisplay();
|
Display display = lines.toDisplay();
|
||||||
|
@ -172,7 +172,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
|||||||
|
|
||||||
if (symbol == null) {
|
if (symbol == null) {
|
||||||
type = LeafType.DESCRIPTION;
|
type = LeafType.DESCRIPTION;
|
||||||
usymbol = USymbol.ACTOR;
|
usymbol = diagram.getSkinParam().getActorStyle().getUSymbol();
|
||||||
} else if (symbol.equalsIgnoreCase("usecase")) {
|
} else if (symbol.equalsIgnoreCase("usecase")) {
|
||||||
type = LeafType.USECASE;
|
type = LeafType.USECASE;
|
||||||
usymbol = null;
|
usymbol = null;
|
||||||
@ -181,26 +181,27 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
|||||||
usymbol = null;
|
usymbol = null;
|
||||||
} else {
|
} else {
|
||||||
type = LeafType.DESCRIPTION;
|
type = LeafType.DESCRIPTION;
|
||||||
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().useUml2ForComponent());
|
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam());
|
||||||
if (usymbol == null) {
|
if (usymbol == null) {
|
||||||
throw new IllegalStateException();
|
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)) {
|
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;
|
String display = displayRaw;
|
||||||
if (display == null) {
|
if (display == null) {
|
||||||
display = code.getFullName();
|
display = code.getName();
|
||||||
}
|
}
|
||||||
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
||||||
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
|
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
|
||||||
if (existsWithBadType(diagram, code, type, usymbol)) {
|
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.setDisplay(Display.getWithNewlines(display));
|
||||||
entity.setUSymbol(usymbol);
|
entity.setUSymbol(usymbol);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
@ -234,7 +235,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
|||||||
if (diagram.leafExist(code) == false) {
|
if (diagram.leafExist(code) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final ILeaf other = diagram.getLeafsget(code);
|
final ILeaf other = diagram.getLeaf(code);
|
||||||
if (other.getLeafType() != type) {
|
if (other.getLeafType() != type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
@ -132,14 +133,15 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
|
|||||||
type = LeafType.USECASE;
|
type = LeafType.USECASE;
|
||||||
usymbol = null;
|
usymbol = null;
|
||||||
} else {
|
} else {
|
||||||
usymbol = USymbol.getFromString(symbol);
|
usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().getActorStyle());
|
||||||
if (usymbol == null) {
|
if (usymbol == null) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
type = LeafType.DESCRIPTION;
|
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()
|
final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast499()
|
||||||
.getString());
|
.getString());
|
||||||
lines = lines.subExtract(1, 1);
|
lines = lines.subExtract(1, 1);
|
||||||
@ -156,11 +158,12 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
|
|||||||
final String stereotype = line0.get("STEREO", 0);
|
final String stereotype = line0.get("STEREO", 0);
|
||||||
|
|
||||||
if (CommandCreateElementFull.existsWithBadType(diagram, code, type, usymbol)) {
|
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) {
|
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);
|
result.setUSymbol(usymbol);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
|
@ -52,6 +52,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
|
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
|
||||||
@ -82,14 +83,14 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
|||||||
RegexLeaf.spaceZeroOrMore(), //
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
new RegexOptional(new RegexLeaf("LABEL1", "[%g]([^%g]+)[%g]")), //
|
new RegexOptional(new RegexLeaf("LABEL1", "[%g]([^%g]+)[%g]")), //
|
||||||
RegexLeaf.spaceZeroOrMore(), //
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
new RegexLeaf("HEAD2", "(0\\)|<<|[<^*+#0)]|<\\||[%s]+o)?"), //
|
new RegexLeaf("HEAD2", "(0\\)|<<|[<^*+#0@)]|<\\||[%s]+o)?"), //
|
||||||
new RegexLeaf("BODY1", "([-=.~]+)"), //
|
new RegexLeaf("BODY1", "([-=.~]+)"), //
|
||||||
new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + LINE_STYLE_MUTILPLES + ")\\])?"), //
|
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("DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)(?=[-=.~0()])")), //
|
||||||
new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), //
|
new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), //
|
||||||
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + LINE_STYLE + ")\\])?"), //
|
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + LINE_STYLE + ")\\])?"), //
|
||||||
new RegexLeaf("BODY2", "([-=.~]*)"), //
|
new RegexLeaf("BODY2", "([-=.~]*)"), //
|
||||||
new RegexLeaf("HEAD1", "(\\(0|>>|[>^*+#0(]|\\|>|o[%s]+)?"), //
|
new RegexLeaf("HEAD1", "(\\(0|>>|[>^*+#0@(]|\\|>|o[%s]+)?"), //
|
||||||
RegexLeaf.spaceZeroOrMore(), //
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
new RegexOptional(new RegexLeaf("LABEL2", "[%g]([^%g]+)[%g]")), //
|
new RegexOptional(new RegexLeaf("LABEL2", "[%g]([^%g]+)[%g]")), //
|
||||||
RegexLeaf.spaceZeroOrMore(), //
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
@ -117,6 +118,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
|||||||
d1 = LinkDecor.SQUARE;
|
d1 = LinkDecor.SQUARE;
|
||||||
} else if (head1.equals("0")) {
|
} else if (head1.equals("0")) {
|
||||||
d1 = LinkDecor.CIRCLE;
|
d1 = LinkDecor.CIRCLE;
|
||||||
|
} else if (head1.equals("@")) {
|
||||||
|
d1 = LinkDecor.CIRCLE_FILL;
|
||||||
} else if (head1.equals("(")) {
|
} else if (head1.equals("(")) {
|
||||||
d1 = LinkDecor.PARENTHESIS;
|
d1 = LinkDecor.PARENTHESIS;
|
||||||
} else if (head1.equals(">")) {
|
} else if (head1.equals(">")) {
|
||||||
@ -141,6 +144,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
|||||||
d2 = LinkDecor.SQUARE;
|
d2 = LinkDecor.SQUARE;
|
||||||
} else if (head2.equals("0")) {
|
} else if (head2.equals("0")) {
|
||||||
d2 = LinkDecor.CIRCLE;
|
d2 = LinkDecor.CIRCLE;
|
||||||
|
} else if (head2.equals("@")) {
|
||||||
|
d2 = LinkDecor.CIRCLE_FILL;
|
||||||
} else if (head2.equals(")")) {
|
} else if (head2.equals(")")) {
|
||||||
d2 = LinkDecor.PARENTHESIS;
|
d2 = LinkDecor.PARENTHESIS;
|
||||||
} else if (head2.equals("<")) {
|
} else if (head2.equals("<")) {
|
||||||
@ -223,7 +228,7 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
|||||||
if (firstLabel == null && secondLabel == null) {
|
if (firstLabel == null && secondLabel == null) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink);
|
labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink, "\"");
|
||||||
|
|
||||||
if ("<".equals(labelLink)) {
|
if ("<".equals(labelLink)) {
|
||||||
linkArrow = LinkArrow.BACKWARD;
|
linkArrow = LinkArrow.BACKWARD;
|
||||||
@ -282,24 +287,20 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final Code ent1 = Code.of(arg.get("ENT1", 0));
|
final String ent1String = arg.get("ENT1", 0);
|
||||||
final Code ent2 = Code.of(arg.get("ENT2", 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);
|
return executePackageLink(diagram, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
final IEntity cl1 = diagram.isGroup(ent1) ? diagram.getGroup(Code.of(arg.get("ENT1", 0))) : getOrCreateLeaf(
|
final Ident ident1 = diagram.buildLeafIdent(ent1String);
|
||||||
diagram, ent1);
|
final Ident ident2 = diagram.buildLeafIdent(ent2String);
|
||||||
final IEntity cl2 = diagram.isGroup(ent2) ? diagram.getGroup(Code.of(arg.get("ENT2", 0))) : getOrCreateLeaf(
|
|
||||||
diagram, ent2);
|
|
||||||
|
|
||||||
// if (arg.get("ENT1", 1) != null) {
|
final IEntity cl1 = getFoo1(diagram, code1, ident1);
|
||||||
// cl1.setStereotype(new Stereotype(arg.get("ENT1", 1)));
|
final IEntity cl2 = getFoo1(diagram, code2, ident2);
|
||||||
// }
|
|
||||||
// if (arg.get("ENT2", 1) != null) {
|
|
||||||
// cl2.setStereotype(new Stereotype(arg.get("ENT2", 1)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
final LinkType linkType = getLinkType(arg);
|
final LinkType linkType = getLinkType(arg);
|
||||||
final Direction dir = getDirection(arg);
|
final Direction dir = getDirection(arg);
|
||||||
@ -329,31 +330,39 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
|||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ILeaf getOrCreateLeaf(DescriptionDiagram diagram, final Code code2) {
|
private IEntity getFoo1(DescriptionDiagram diagram, Code code, Ident ident) {
|
||||||
final String code = code2.getFullName();
|
if (diagram.isGroup(code)) {
|
||||||
if (code.startsWith("()")) {
|
return diagram.getGroup(code);
|
||||||
return diagram.getOrCreateLeaf(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils
|
|
||||||
.trin(code.substring(2)))), LeafType.DESCRIPTION, USymbol.INTERFACE);
|
|
||||||
}
|
}
|
||||||
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 == '(') {
|
if (codeChar == '(') {
|
||||||
return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
|
return diagram.getOrCreateLeaf(ident3, code3, LeafType.USECASE, USymbol.USECASE);
|
||||||
LeafType.USECASE, USymbol.USECASE);
|
|
||||||
} else if (codeChar == ':') {
|
} else if (codeChar == ':') {
|
||||||
return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
|
return diagram.getOrCreateLeaf(ident3, code3, LeafType.DESCRIPTION, diagram.getSkinParam().getActorStyle()
|
||||||
LeafType.DESCRIPTION, USymbol.ACTOR);
|
.getUSymbol());
|
||||||
} else if (codeChar == '[') {
|
} else if (codeChar == '[') {
|
||||||
final USymbol sym = diagram.getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
|
final USymbol sym = diagram.getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
|
||||||
return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"),
|
return diagram.getOrCreateLeaf(ident3, code3, LeafType.DESCRIPTION, sym);
|
||||||
LeafType.DESCRIPTION, sym);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return diagram.getOrCreateLeaf(code2, null, null);
|
return diagram.getOrCreateLeaf(ident, code, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandExecutionResult executePackageLink(DescriptionDiagram diagram, RegexResult arg) {
|
private CommandExecutionResult executePackageLink(DescriptionDiagram diagram, RegexResult arg) {
|
||||||
final IEntity cl1 = diagram.getGroup(Code.of(arg.get("ENT1", 0)));
|
final IEntity cl1 = diagram.getGroup(diagram.buildCode(arg.get("ENT1", 0)));
|
||||||
final IEntity cl2 = diagram.getGroup(Code.of(arg.get("ENT2", 0)));
|
final IEntity cl2 = diagram.getGroup(diagram.buildCode(arg.get("ENT2", 0)));
|
||||||
|
|
||||||
final LinkType linkType = getLinkType(arg);
|
final LinkType linkType = getLinkType(arg);
|
||||||
final Direction dir = getDirection(arg);
|
final Direction dir = getDirection(arg);
|
||||||
|
@ -55,6 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
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 String displayRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0));
|
||||||
final Code code;
|
final Code code;
|
||||||
final String display;
|
final String display;
|
||||||
|
final String idShort;
|
||||||
if (codeRaw.length() == 0) {
|
if (codeRaw.length() == 0) {
|
||||||
code = UniqueSequence.getCode("##");
|
idShort = UniqueSequence.getString("##");
|
||||||
|
code = diagram.buildCode(idShort);
|
||||||
display = null;
|
display = null;
|
||||||
} else {
|
} else {
|
||||||
code = Code.of(codeRaw);
|
idShort = codeRaw;
|
||||||
|
code = diagram.buildCode(idShort);
|
||||||
if (displayRaw == null) {
|
if (displayRaw == null) {
|
||||||
display = code.getFullName();
|
display = code.getName();
|
||||||
} else {
|
} else {
|
||||||
display = displayRaw;
|
display = displayRaw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final IGroup currentPackage = diagram.getCurrentGroup();
|
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);
|
NamespaceStrategy.SINGLE);
|
||||||
final IEntity p = diagram.getCurrentGroup();
|
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);
|
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
p.setStereotype(new Stereotype(stereotype, false));
|
p.setStereotype(new Stereotype(stereotype, false));
|
||||||
@ -171,5 +176,4 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
|
|||||||
p.setColors(colors);
|
p.setColors(colors);
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,23 +71,23 @@ public class PSystemDonors extends AbstractPSystem {
|
|||||||
private static final int COLS = 6;
|
private static final int COLS = 6;
|
||||||
private static final int FREE_LINES = 6;
|
private static final int FREE_LINES = 6;
|
||||||
|
|
||||||
public static final String DONORS = "6wO902mFU3XMJYceJdotTlPGzS6YgH3yYpFbZw2FTx01CWIrH4crEd9zz1eWg82keQF7tBxJutuZ_KLq"
|
public static final String DONORS = "6ym902mFR3fSuLzO9ciEU-UTVLaMenKnfVRDznXLdPaQKLLXAao0mEOTctOFBc-_C0Zx6pfwpEqxFUut"
|
||||||
+ "fNlVD2FQiZN5UKPHB0Xwl4sk6RQvjmV2d2KlWZjJWfuF5n0bqTtfBCiTANQVa85C9s9S14-RrrZgP2tv"
|
+ "qbz4LxhtJJEYBLjJd6SKnOAWnzlacc6RUtjIPKW9Ogde_il4xUdMSI4sJgWGoY75FJja_dVfXBnNLM6M"
|
||||||
+ "1mcd-zyr5RAlgiAGBgiwVxf2SL807Z2x_5ETowPoBbUrwKqeGAVkNC5DLOUvTgAlJWmIOEBrR-TRrMHM"
|
+ "xbPr_dI5saaRsR46R3M7opy5BaNbN0u56eGQqwaxr-5GHQEyUk1h2qqoA5pv2dnBAcR5n0wHugiRH-2J"
|
||||||
+ "JF0GASwsS0HEepD3CnUjCx8Xi_OVzGzeip73Kf5RGd7KBedEFo-TsJRGVOu44nAxADWmvb3AOLgWUyYD"
|
+ "pWnghTCwnoVIQlzI5z1Hvt9DYPI4yZnA95gtbVQE0tHVm6GIYKSTiC4ve9B3VeAftPw88N6hGOFAd8p6"
|
||||||
+ "cCGcWeRwB4PZipLRdkXXS4CB-_AFHbBZaShCuMYJsDq31KxVnW58hzJK96RxDmFAH4QB6KjITM7SX3ld"
|
+ "fcgsFB70H02Qs8u_bA9cyvJCd8PE91vBe8JFht42i5UggOZPaSs0afxHegT9GfVNA-7cUB4qHUgWuJOm"
|
||||||
+ "OJ4LwGSDDuB2pe9Ma1g2l0bTyEan-rEJMrqD1Lxo3CczsIxKATi6jCsClirrIAByxpRDjF4UKowHwcpz"
|
+ "uE6aJT1AGVu7Ek7NxgikcInZLzHCUGhprMmUYeSKNQnFPlJjh8M9yd-p8JFLyuhQvYcTnxhQ-9_DeTWq"
|
||||||
+ "UQxtSGx8tL8hp_XZj3784TpxoOiALfvQ03y2lLGBbUJdf-mR2oaGzzRjYJmwLwxSHn4Ocp9CBFOgjbYB"
|
+ "PTNmcz76FEVWFhqjfD1neG3RIw3dUaV5_9cdZOLq2CzZwOLic8jNbb44pXgdYiLVnPRMoBzrXHfR5ylD"
|
||||||
+ "_5YNjx4LMLOO2_helYuq8GCjTELoD_HjMfaqTBvGafPMBXzwT5gz369DnaplFFqP7NCv_xzIlCDCYXle"
|
+ "ZGLzpD-GMyb09rOX5aCVqqfcPUSJ9KrJu_EGHqF7Pn9hacRr3kbRYdCj__UsiAAPPXZeUXTpcgwDA1L6"
|
||||||
+ "IedPfci4HUGSMaqN6nE1QQ77Gsu2iWBbxheLk_SF-NK-8FEMPGGYjpcZVL_nGjrr4M8wrdGrnGnW_fJI"
|
+ "GTMTR9e8J0kz6WeBo1selKnkrPVLG_phV43chOaa8hSvWNwcUaAzoyKgp1rhkjJ4363nb6Wd4gyRYI2h"
|
||||||
+ "5ed3WWW5xOBUHfL-fAqKknwkdkaJO-w-w9F7NJDZ40SwHMCHldeHtDqme-hDaGtjUymXU8Wlowkl-_0T"
|
+ "BkXrG9b5fYFqsqrwfYsEXQTERtZSj1c3-g9ELqx2Lmk1TpTCohoP76pVuPo2n_7bUVLz7-5Z5S1Qt7lR"
|
||||||
+ "gm3MuTuR_aZDds0Wd-c54P568nhRrlsfSBU24bdK9HShybt5prmyT2TudScYGyoysXo7B0oL1qbQwfyC"
|
+ "HMe-Wu5sImj6H5gEACTHTaburq0PMOmbBnhYpnxMk7ZePl0-aqNxc7ctEGvP0YhFceTMkiMuTKs6lYCc"
|
||||||
+ "FomPVFjCDkolIf4tu7bfc8PmP7mCBXzDUjJa4edDT9PZPYS0bofUiTzymdMXwfQQaoriYCd3Lnz29lWn"
|
+ "cx1NiMXh8FYIc0Mg8-DzmEM2v84gBY5ncy4AE7W1mgyFNh4H5kxMGTKj8oT7rodCrdrr6cW9VjpMWQMo"
|
||||||
+ "le2bCXMU1jQwUr6SGOmIvyIyLrOjAsjLyR60YbaXw4iBfMggADBdD3BYh47FGUjW-yt25kYbNdl3c51u"
|
+ "3pnLk7Nth3Y3D4gTLynxOSsRnZwa-5X0kHmKpAI9ie-Kefgsbf5HOmnwzhg3vtQgsmAxZMyrZ1KARrDq"
|
||||||
+ "6wAx6XkmJH7JLKp_Q0AUY2gA9NefayG0lkR3hzL3Onry_6Pq7n47oEwI4485QewUE2tDjsDO1-ij-l_p"
|
+ "qs83jYbgkehjHXFpH5HHgH6NFXP6mCyy_2OyDDOXnj_qiXbnfhaXJ4c54vvVd2qDsnujibwZrstRzhPo"
|
||||||
+ "PJbv3_xytslQmQaLztnM0NI2aF_hA1W7JLtjCmflNJwSE1om0gasJcBbfQMdGG91v9QTFdMTPgHtOaIv"
|
+ "_lo_rsG7ftfSvrK5q1M4_DzCcTo81TSrFON-tkMBFfWpMIsgrJY9bUUMdWMO32AtRFQcVPgHtQapokrg"
|
||||||
+ "BLdqZkD3PRvI8Gv8OyFoYtwAeiQKaxwSh3YL3_lE6-4aXyZhdwBAcXHNfP6Q6C4cTdOKvsdiLhlXheih"
|
+ "WpxhyQ6IlwaS9wZh4vPVp59KXoznDjlU6auLvhxvHZZ9eV3-fwYoAJ-uAYKrCO9DxEGepkDuhgCKTrrS"
|
||||||
+ "yA0UN12e-_NZqyqiTuqrNq1g61uqvESZSkZGmxMWfgQ5iIom8iRwtYVzKAR7RyQcW5qbW3dJ0000";
|
+ "GGJq3HS5ndxpisBDbum-NpJdC1mPyjCHTZdStRMW2casfmKMwQplhTkwP7R_IqRmXL6JTbOFQurZX5IB" + "G57DXFeu3000";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special thanks to our sponsors and donors:
|
* Special thanks to our sponsors and donors:
|
||||||
|
@ -326,7 +326,12 @@ public class QuoteUtils {
|
|||||||
"Gnxr zr guebhtu gur qnexarff gb gur oernx bs gur qnl",
|
"Gnxr zr guebhtu gur qnexarff gb gur oernx bs gur qnl",
|
||||||
"Vg znxrf gur gehgu rira zber vapbzcerurafvoyr orpnhfr rirelguvat vf arj",
|
"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",
|
"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() {
|
private QuoteUtils() {
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,10 @@ import java.util.Map;
|
|||||||
import net.sourceforge.plantuml.ColorParam;
|
import net.sourceforge.plantuml.ColorParam;
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.FontParam;
|
import net.sourceforge.plantuml.FontParam;
|
||||||
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.creole.Stencil;
|
import net.sourceforge.plantuml.creole.Stencil;
|
||||||
|
import net.sourceforge.plantuml.skin.ActorStyle;
|
||||||
|
|
||||||
public abstract class USymbol {
|
public abstract class USymbol {
|
||||||
|
|
||||||
@ -68,7 +70,10 @@ public abstract class USymbol {
|
|||||||
public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS, new USymbolCollections(
|
public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS, new USymbolCollections(
|
||||||
SkinParameter.RECTANGLE));
|
SkinParameter.RECTANGLE));
|
||||||
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT));
|
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 USECASE = null;
|
||||||
public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1());
|
public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1());
|
||||||
public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2());
|
public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2());
|
||||||
@ -104,10 +109,13 @@ public abstract class USymbol {
|
|||||||
return getSkinParameter().getColorParamBorder();
|
return getSkinParameter().getColorParamBorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static USymbol getFromString(String s) {
|
public static USymbol getFromString(String s, ActorStyle actorStyle) {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (s.equalsIgnoreCase("actor")) {
|
||||||
|
return actorStyle.getUSymbol();
|
||||||
|
}
|
||||||
final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", "")));
|
final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", "")));
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
if (s.equalsIgnoreCase("component")) {
|
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;
|
USymbol usymbol = null;
|
||||||
if (symbol.equalsIgnoreCase("artifact")) {
|
if (symbol.equalsIgnoreCase("artifact")) {
|
||||||
usymbol = USymbol.ARTIFACT;
|
usymbol = USymbol.ARTIFACT;
|
||||||
@ -221,9 +229,9 @@ public abstract class USymbol {
|
|||||||
} else if (symbol.equalsIgnoreCase("agent")) {
|
} else if (symbol.equalsIgnoreCase("agent")) {
|
||||||
usymbol = USymbol.AGENT;
|
usymbol = USymbol.AGENT;
|
||||||
} else if (symbol.equalsIgnoreCase("actor")) {
|
} else if (symbol.equalsIgnoreCase("actor")) {
|
||||||
usymbol = USymbol.ACTOR;
|
usymbol = skinParam.getActorStyle().getUSymbol();
|
||||||
} else if (symbol.equalsIgnoreCase("component")) {
|
} else if (symbol.equalsIgnoreCase("component")) {
|
||||||
usymbol = useUml2ForComponent ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
|
usymbol = skinParam.useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
|
||||||
} else if (symbol.equalsIgnoreCase("boundary")) {
|
} else if (symbol.equalsIgnoreCase("boundary")) {
|
||||||
usymbol = USymbol.BOUNDARY;
|
usymbol = USymbol.BOUNDARY;
|
||||||
} else if (symbol.equalsIgnoreCase("control")) {
|
} else if (symbol.equalsIgnoreCase("control")) {
|
||||||
|
@ -35,21 +35,28 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.graphic;
|
package net.sourceforge.plantuml.graphic;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.skin.StickMan;
|
import net.sourceforge.plantuml.skin.ActorStyle;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
|
|
||||||
class USymbolActor extends USymbolSimpleAbstract {
|
class USymbolActor extends USymbolSimpleAbstract {
|
||||||
|
|
||||||
|
private final ActorStyle actorStyle;
|
||||||
|
|
||||||
|
public USymbolActor(ActorStyle actorStyle) {
|
||||||
|
this.actorStyle = actorStyle;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SkinParameter getSkinParameter() {
|
public SkinParameter getSkinParameter() {
|
||||||
return SkinParameter.ACTOR;
|
return SkinParameter.ACTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TextBlock getDrawing(SymbolContext symbolContext) {
|
protected TextBlock getDrawing(SymbolContext symbolContext) {
|
||||||
final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -39,6 +39,8 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
|
|
||||||
abstract class USymbolSimpleAbstract extends USymbol {
|
abstract class USymbolSimpleAbstract extends USymbol {
|
||||||
@ -54,7 +56,7 @@ abstract class USymbolSimpleAbstract extends USymbol {
|
|||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
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 dimStereo = stereotype.calculateDimension(stringBounder);
|
||||||
final Dimension2D dimStickMan = stickman.calculateDimension(stringBounder);
|
final Dimension2D dimStickMan = stickman.calculateDimension(stringBounder);
|
||||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||||
@ -62,8 +64,12 @@ abstract class USymbolSimpleAbstract extends USymbol {
|
|||||||
final double stickmanY = dimStereo.getHeight();
|
final double stickmanY = dimStereo.getHeight();
|
||||||
ug = symbolContext.apply(ug);
|
ug = symbolContext.apply(ug);
|
||||||
stickman.drawU(ug.apply(new UTranslate(stickmanX, stickmanY)));
|
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();
|
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)));
|
label.drawU(ug.apply(new UTranslate(labelX, labelY)));
|
||||||
|
|
||||||
final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2;
|
final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2;
|
||||||
@ -71,10 +77,10 @@ abstract class USymbolSimpleAbstract extends USymbol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
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 dimStereo = stereotype.calculateDimension(stringBounder);
|
||||||
final Dimension2D dimActor = stickman.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
|
@Override
|
||||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, TextBlock stereotype,
|
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();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public final class CucaDiagramHtmlMaker {
|
|||||||
final File f = new File(dir, LinkHtmlPrinter.urlOf(entity));
|
final File f = new File(dir, LinkHtmlPrinter.urlOf(entity));
|
||||||
final PrintWriter pw = new PrintWriter(f);
|
final PrintWriter pw = new PrintWriter(f);
|
||||||
pw.println("<html>");
|
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>");
|
pw.println("<h2>" + entity.getLeafType().toHtml() + "</h2>");
|
||||||
for (CharSequence s : entity.getDisplay()) {
|
for (CharSequence s : entity.getDisplay()) {
|
||||||
pw.println(StringUtils.unicodeForHtml(s.toString()));
|
pw.println(StringUtils.unicodeForHtml(s.toString()));
|
||||||
|
@ -65,9 +65,9 @@ public final class LinkHtmlPrinter {
|
|||||||
final String ent2h;
|
final String ent2h;
|
||||||
if (chiral) {
|
if (chiral) {
|
||||||
ent1h = htmlLink(link.getEntity1());
|
ent1h = htmlLink(link.getEntity1());
|
||||||
ent2h = "<i>" + StringUtils.unicodeForHtml(link.getEntity2().getCode().getFullName()) + "</i>";
|
ent2h = "<i>" + StringUtils.unicodeForHtml(link.getEntity2().getCodeGetName()) + "</i>";
|
||||||
} else {
|
} else {
|
||||||
ent1h = "<i>" + StringUtils.unicodeForHtml(link.getEntity1().getCode().getFullName()) + "</i>";
|
ent1h = "<i>" + StringUtils.unicodeForHtml(link.getEntity1().getCodeGetName()) + "</i>";
|
||||||
ent2h = htmlLink(link.getEntity2());
|
ent2h = htmlLink(link.getEntity2());
|
||||||
}
|
}
|
||||||
String label = link.getLabel() == null ? null : StringUtils.unicodeForHtml(link.getLabel());
|
String label = link.getLabel() == null ? null : StringUtils.unicodeForHtml(link.getLabel());
|
||||||
@ -170,7 +170,7 @@ public final class LinkHtmlPrinter {
|
|||||||
sb.append("<a href=\"");
|
sb.append("<a href=\"");
|
||||||
sb.append(urlOf(ent));
|
sb.append(urlOf(ent));
|
||||||
sb.append("\">");
|
sb.append("\">");
|
||||||
sb.append(StringUtils.unicodeForHtml(ent.getCode().getFullName()));
|
sb.append(StringUtils.unicodeForHtml(ent.getCodeGetName()));
|
||||||
sb.append("</a>");
|
sb.append("</a>");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@ -179,8 +179,8 @@ public final class LinkHtmlPrinter {
|
|||||||
if (ent.getLeafType() == LeafType.NOTE) {
|
if (ent.getLeafType() == LeafType.NOTE) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
if (ent.getCode().getFullName().matches("[-\\w_ .]+")) {
|
if (ent.getCodeGetName().matches("[-\\w_ .]+")) {
|
||||||
return StringUtils.unicodeForHtml(ent.getCode().getFullName()) + ".html";
|
return StringUtils.unicodeForHtml(ent.getCodeGetName()) + ".html";
|
||||||
}
|
}
|
||||||
return StringUtils.unicodeForHtml(ent.getUid()) + ".html";
|
return StringUtils.unicodeForHtml(ent.getUid()) + ".html";
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) {
|
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());
|
LeafType.EMPTY_PACKAGE, g.getParentContainer(), null, diagram.getNamespaceSeparator());
|
||||||
emptyGroups.put(g, folder);
|
emptyGroups.put(g, folder);
|
||||||
final USymbol symbol = g.getUSymbol();
|
final USymbol symbol = g.getUSymbol();
|
||||||
|
@ -73,7 +73,7 @@ public class MDADiagramImpl implements MDADiagram {
|
|||||||
private MDADiagramImpl(ClassDiagram classDiagram) {
|
private MDADiagramImpl(ClassDiagram classDiagram) {
|
||||||
final EntityFactory entityFactory = classDiagram.getEntityFactory();
|
final EntityFactory entityFactory = classDiagram.getEntityFactory();
|
||||||
packages.add(new MDAPackageImpl(entityFactory.getRootGroup()));
|
packages.add(new MDAPackageImpl(entityFactory.getRootGroup()));
|
||||||
for (IGroup group : entityFactory.getGroupsvalues()) {
|
for (IGroup group : entityFactory.groups()) {
|
||||||
packages.add(new MDAPackageImpl(group));
|
packages.add(new MDAPackageImpl(group));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class MDAEntityImpl implements MDAEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return leaf.getCode().getFullName();
|
return leaf.getCodeGetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class MDAPackageImpl implements MDAPackage {
|
|||||||
if (group instanceof GroupRoot) {
|
if (group instanceof GroupRoot) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return group.getCode().getFullName();
|
return group.getCodeGetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
|
|||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
|
import net.sourceforge.plantuml.skin.ActorStyle;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
|
|
||||||
public class DiagElement {
|
public class DiagElement {
|
||||||
@ -87,8 +88,8 @@ public class DiagElement {
|
|||||||
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
|
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
|
||||||
ColorParam.activityBorder.getDefaultValue()).withShadow(3);
|
ColorParam.activityBorder.getDefaultValue()).withShadow(3);
|
||||||
final TextBlock desc = toTextBlock(description);
|
final TextBlock desc = toTextBlock(description);
|
||||||
final TextBlock box = shape
|
final TextBlock box = shape.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0),
|
||||||
.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER);
|
symbolContext, HorizontalAlignment.CENTER);
|
||||||
return new LinkedElement(ad1, box, ad2, mainNetwork, this);
|
return new LinkedElement(ad1, box, ad2, mainNetwork, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ public class DiagElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void setShape(String shapeName) {
|
public final void setShape(String shapeName) {
|
||||||
final USymbol shapeFromString = USymbol.getFromString(shapeName);
|
final USymbol shapeFromString = USymbol.getFromString(shapeName, ActorStyle.STICKMAN);
|
||||||
if (shapeFromString != null) {
|
if (shapeFromString != null) {
|
||||||
this.shape = shapeFromString;
|
this.shape = shapeFromString;
|
||||||
}
|
}
|
||||||
|
@ -105,20 +105,26 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
|||||||
|
|
||||||
private final List<Association> associations = new ArrayList<Association>();
|
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) {
|
LinkType linkType, Display label) {
|
||||||
final IEntity entity1A = getOrCreateLeaf(clName1A, null, null);
|
final IEntity entity1A = getOrCreateLeaf(buildLeafIdent(name1A), buildCode(name1A),
|
||||||
final IEntity entity1B = getOrCreateLeaf(clName1B, null, null);
|
null, null);
|
||||||
final IEntity entity2A = getOrCreateLeaf(clName2A, null, null);
|
final IEntity entity1B = getOrCreateLeaf(buildLeafIdent(name1B), buildCode(name1B),
|
||||||
final IEntity entity2B = getOrCreateLeaf(clName2B, null, null);
|
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> same1 = getExistingAssociatedPoints(entity1A, entity1B);
|
||||||
final List<Association> same2 = getExistingAssociatedPoints(entity2A, entity2B);
|
final List<Association> same2 = getExistingAssociatedPoints(entity2A, entity2B);
|
||||||
if (same1.size() == 0 && same2.size() == 0) {
|
if (same1.size() == 0 && same2.size() == 0) {
|
||||||
|
|
||||||
final IEntity point1 = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION,
|
final String tmp1 = UniqueSequence.getString("apoint");
|
||||||
null);
|
final IEntity point1 = getOrCreateLeaf(buildLeafIdent(tmp1), buildCode(tmp1),
|
||||||
final IEntity point2 = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION,
|
LeafType.POINT_FOR_ASSOCIATION, null);
|
||||||
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(entity1A, entity1B, point1);
|
||||||
insertPointBetween(entity2A, entity2B, point2);
|
insertPointBetween(entity2A, entity2B, point2);
|
||||||
@ -168,10 +174,12 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
|||||||
addLink(pointToEntity2);
|
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) {
|
Display label) {
|
||||||
final IEntity entity1 = getOrCreateLeaf(clName1, null, null);
|
final IEntity entity1 = getOrCreateLeaf(buildLeafIdent(name1), buildCode(name1), null,
|
||||||
final IEntity entity2 = getOrCreateLeaf(clName2, null, null);
|
null);
|
||||||
|
final IEntity entity2 = getOrCreateLeaf(buildLeafIdent(name2), buildCode(name2), null,
|
||||||
|
null);
|
||||||
final List<Association> same = getExistingAssociatedPoints(entity1, entity2);
|
final List<Association> same = getExistingAssociatedPoints(entity1, entity2);
|
||||||
if (same.size() > 1) {
|
if (same.size() > 1) {
|
||||||
return false;
|
return false;
|
||||||
@ -218,7 +226,9 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
|||||||
this.entity1 = entity1;
|
this.entity1 = entity1;
|
||||||
this.entity2 = entity2;
|
this.entity2 = entity2;
|
||||||
this.associed = associed;
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import net.sourceforge.plantuml.ISkinSimple;
|
|||||||
import net.sourceforge.plantuml.UmlDiagramType;
|
import net.sourceforge.plantuml.UmlDiagramType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
|
|
||||||
@ -49,11 +50,12 @@ public class ObjectDiagram extends AbstractClassOrObjectDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) {
|
public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
type = LeafType.OBJECT;
|
type = LeafType.OBJECT;
|
||||||
}
|
}
|
||||||
return getOrCreateLeafDefault(code, type, symbol);
|
// final Ident idNewLong = buildLeafIdent(id);
|
||||||
|
return getOrCreateLeafDefault(ident, code, type, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,7 +65,9 @@ public class CommandAddData extends SingleLineCommand2<AbstractClassOrObjectDiag
|
|||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||||
RegexResult arg) {
|
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);
|
final String field = arg.get("DATA", 0);
|
||||||
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {
|
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) {
|
||||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
@ -77,13 +78,16 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
|
|||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||||
RegexResult arg) {
|
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 display = arg.get("NAME", 0);
|
||||||
final String stereotype = arg.get("STEREO", 0);
|
final String stereotype = arg.get("STEREO", 0);
|
||||||
if (diagram.leafExist(code)) {
|
if (diagram.leafExist(code)) {
|
||||||
return CommandExecutionResult.error("Object already exists : " + 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) {
|
if (stereotype != null) {
|
||||||
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
||||||
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
|
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
|
||||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
@ -103,13 +104,15 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Abst
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) {
|
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 display = line0.get("NAME", 0);
|
||||||
final String stereotype = line0.get("STEREO", 0);
|
final String stereotype = line0.get("STEREO", 0);
|
||||||
if (diagram.leafExist(code)) {
|
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) {
|
if (stereotype != null) {
|
||||||
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
||||||
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
|
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
|
||||||
|
111
src/net/sourceforge/plantuml/skin/ActorAwesome.java
Normal file
111
src/net/sourceforge/plantuml/skin/ActorAwesome.java
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
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.UEllipse;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
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 armsY = 8;
|
||||||
private final double armsLenght = 13;
|
private final double armsLenght = 13;
|
||||||
@ -61,19 +59,10 @@ public class StickMan extends AbstractTextBlock implements TextBlock {
|
|||||||
|
|
||||||
private final SymbolContext symbolContext;
|
private final SymbolContext symbolContext;
|
||||||
|
|
||||||
public StickMan(SymbolContext symbolContext) {
|
ActorStickMan(SymbolContext symbolContext) {
|
||||||
this.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) {
|
public void drawU(UGraphic ug) {
|
||||||
|
|
||||||
final double startX = Math.max(armsLenght, legsX) - headDiam / 2.0 + thickness();
|
final double startX = Math.max(armsLenght, legsX) - headDiam / 2.0 + thickness();
|
@ -33,32 +33,32 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.graphic;
|
package net.sourceforge.plantuml.skin;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UChange;
|
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
import net.sourceforge.plantuml.ugraphic.UText;
|
|
||||||
|
|
||||||
public class UGraphicAddAriaLabel extends UGraphicDelegator {
|
public enum ActorStyle {
|
||||||
|
|
||||||
private final String ariaLabel;
|
STICKMAN, AWESOME;
|
||||||
|
|
||||||
public UGraphicAddAriaLabel(UGraphic ug, String ariaLabel) {
|
public USymbol getUSymbol() {
|
||||||
super(ug);
|
if (this == STICKMAN) {
|
||||||
this.ariaLabel = ariaLabel;
|
return USymbol.ACTOR_STICKMAN;
|
||||||
}
|
} else if (this == AWESOME) {
|
||||||
|
return USymbol.ACTOR_AWESOME;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -35,11 +35,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.skin;
|
package net.sourceforge.plantuml.skin;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
import net.sourceforge.plantuml.style.Styleable;
|
|
||||||
import net.sourceforge.plantuml.style.StyleSignature;
|
import net.sourceforge.plantuml.style.StyleSignature;
|
||||||
|
import net.sourceforge.plantuml.style.Styleable;
|
||||||
|
|
||||||
public enum ComponentType implements Styleable {
|
public enum ComponentType implements Styleable {
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ package net.sourceforge.plantuml.skin.rose;
|
|||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
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.SymbolContext;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
|
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.Area;
|
||||||
import net.sourceforge.plantuml.skin.StickMan;
|
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
@ -61,15 +61,17 @@ public class ComponentRoseActor extends AbstractTextualComponent {
|
|||||||
private final TextBlock stickman;
|
private final TextBlock stickman;
|
||||||
private final boolean head;
|
private final boolean head;
|
||||||
|
|
||||||
public ComponentRoseActor(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay,
|
public ComponentRoseActor(ActorStyle actorStyle, Style style, Style stereo, SymbolContext biColor,
|
||||||
boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer,
|
||||||
|
UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||||
super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0,
|
super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0,
|
||||||
spriteContainer, false, fontForStereotype, htmlColorForStereotype);
|
spriteContainer, false, fontForStereotype, htmlColorForStereotype);
|
||||||
this.head = head;
|
this.head = head;
|
||||||
if (SkinParam.USE_STYLES()) {
|
if (SkinParam.USE_STYLES()) {
|
||||||
biColor = style.getSymbolContext(getIHtmlColorSet());
|
biColor = style.getSymbolContext(getIHtmlColorSet());
|
||||||
}
|
}
|
||||||
this.stickman = new StickMan(biColor);
|
// this.stickman = new ActorStickMan(biColor);
|
||||||
|
this.stickman = actorStyle.getTextBlock(biColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,6 @@ import java.awt.geom.Point2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
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.ArrowDressing;
|
||||||
import net.sourceforge.plantuml.skin.ArrowHead;
|
import net.sourceforge.plantuml.skin.ArrowHead;
|
||||||
import net.sourceforge.plantuml.skin.ArrowPart;
|
import net.sourceforge.plantuml.skin.ArrowPart;
|
||||||
import net.sourceforge.plantuml.style.PName;
|
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
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.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
|
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
|
||||||
import net.sourceforge.plantuml.skin.Area;
|
import net.sourceforge.plantuml.skin.Area;
|
||||||
import net.sourceforge.plantuml.style.PName;
|
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
import net.sourceforge.plantuml.svek.Boundary;
|
import net.sourceforge.plantuml.svek.Boundary;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.SkinParamBackcolored;
|
import net.sourceforge.plantuml.SkinParamBackcolored;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
|
@ -37,7 +37,6 @@ package net.sourceforge.plantuml.skin.rose;
|
|||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
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.AbstractComponent;
|
||||||
import net.sourceforge.plantuml.skin.Area;
|
import net.sourceforge.plantuml.skin.Area;
|
||||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
|
||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
|
import net.sourceforge.plantuml.style.Style;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
package net.sourceforge.plantuml.skin.rose;
|
package net.sourceforge.plantuml.skin.rose;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.OptionFlags;
|
|
||||||
import net.sourceforge.plantuml.SkinParam;
|
import net.sourceforge.plantuml.SkinParam;
|
||||||
import net.sourceforge.plantuml.creole.Stencil;
|
import net.sourceforge.plantuml.creole.Stencil;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user