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

Merge commit '89406657e7a26c74119a87637f8f96c94055b45b' into patch/1580

This commit is contained in:
Dietrich Travkin 2023-10-30 10:45:34 +01:00
commit 7a7f59f00b
2 changed files with 44 additions and 21 deletions

View File

@ -85,6 +85,11 @@ public class EntityGenderUtils {
public String getGender() {
return stereotype;
}
@Override
public String getGender() {
return stereotype;
}
};
}
@ -163,4 +168,17 @@ public class EntityGenderUtils {
};
}
static public EntityGender byClassName(String className) {
return new EntityGender() {
@Override
public boolean contains(Entity test) {
return className.equals(test.getName());
}
@Override
public String getGender() {
return className;
}
};
}
}

View File

@ -190,30 +190,35 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else {
arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(arg1));
Entity entity = quark.getData();
if (entity == null)
return CommandExecutionResult.error("No such element " + quark.getName());
gender = EntityGenderUtils.byEntityAlone(entity);
}
if (gender != null) {
final boolean empty = arg.get("EMPTY", 0) != null;
final boolean emptyMembers = empty && portion == EntityPortion.MEMBER;
if (empty == true && emptyMembers == false)
gender = EntityGenderUtils.and(gender, emptyByGender(portion));
if (diagram.getCurrentGroup().isRoot() == false)
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
if (emptyMembers) {
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)),
EntityPortion.FIELD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.METHOD)),
EntityPortion.METHOD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
if (quark == null) {
return CommandExecutionResult.error("No such quark " + arg1);
}
if (portion == EntityPortion.METHOD) {
gender = EntityGenderUtils.byClassName(arg1);
} else {
diagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
Entity entity = quark.getData();
if (entity == null)
return CommandExecutionResult.error("No such element " + quark.getName());
gender = EntityGenderUtils.byEntityAlone(entity);
}
}
return CommandExecutionResult.ok();
final boolean empty = arg.get("EMPTY", 0) != null;
final boolean emptyMembers = empty && portion == EntityPortion.MEMBER;
if (empty && !emptyMembers)
gender = EntityGenderUtils.and(gender, emptyByGender(portion));
if (!diagram.getCurrentGroup().isRoot())
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
if (emptyMembers) {
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)),
EntityPortion.FIELD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.METHOD)),
EntityPortion.METHOD, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
} else {
diagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
}
return CommandExecutionResult.ok();
}
private EntityPortion getEntityPortion(String s) {