mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-26 06:46:45 +00:00
wip
This commit is contained in:
parent
285c21492f
commit
e801884415
@ -179,7 +179,8 @@ public class AnnotatedWorker {
|
||||
|
||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.caption)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam);
|
||||
return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam,
|
||||
Style.ID_CAPTION);
|
||||
|
||||
}
|
||||
|
||||
@ -191,7 +192,7 @@ public class AnnotatedWorker {
|
||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
final TextBlock block = style.createTextBlockBordered(title.getDisplay(), skinParam.getIHtmlColorSet(),
|
||||
skinParam);
|
||||
skinParam, Style.ID_TITLE);
|
||||
|
||||
return DecorateEntityImage.addTop(original, block, HorizontalAlignment.CENTER);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class EntityImageLegend {
|
||||
final Style style = StyleSignatureBasic
|
||||
.of(SName.root, SName.root, SName.document, skinParam.getUmlDiagramType().getStyleName(), SName.legend)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
return style.createTextBlockBordered(note, skinParam.getIHtmlColorSet(), skinParam);
|
||||
return style.createTextBlockBordered(note, skinParam.getIHtmlColorSet(), skinParam, Style.ID_LEGEND);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.creole.Stencil;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
@ -135,23 +134,6 @@ public class FtileBoxOld extends AbstractFtile {
|
||||
|
||||
}
|
||||
|
||||
public static FtileBoxOld create(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle,
|
||||
Stereotype stereotype) {
|
||||
final Style style = getDefaultStyleDefinitionActivity().withTOBECHANGED(stereotype)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
|
||||
return new FtileBoxOld(skinParam, label, swimlane, boxStyle, style, styleArrow);
|
||||
}
|
||||
|
||||
public static TextBlock createWbs(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
|
||||
StyleSignatureBasic styleDefinition) {
|
||||
final Style style = styleDefinition.getMergedStyle(styleBuilder);
|
||||
final Style styleArrow = style;
|
||||
|
||||
return new FtileBoxOld(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
}
|
||||
|
||||
public static TextBlock createWbs(Style style, ISkinParam skinParam, Display label) {
|
||||
final Style styleArrow = style;
|
||||
return new FtileBoxOld(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
@ -232,8 +214,7 @@ public class FtileBoxOld extends AbstractFtile {
|
||||
tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - tbWidth(stringBounder) - padding.getRight(),
|
||||
padding.getBottom())));
|
||||
else if (horizontalAlignment == HorizontalAlignment.CENTER)
|
||||
tb.drawU(ug.apply(new UTranslate(padding.getRight() + (dimTotal.getWidth() - tbWidth(stringBounder)) / 2,
|
||||
padding.getBottom())));
|
||||
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - tbWidth(stringBounder)) / 2, padding.getBottom())));
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,8 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
private static IRegex getRegexConcat() {
|
||||
return RegexConcat.build(CommandCreateClassMultilines.class.getName(), RegexLeaf.start(), //
|
||||
new RegexLeaf("VISIBILITY", "(" + VisibilityModifier.regexForVisibilityCharacterInClassName() + ")?"), //
|
||||
new RegexLeaf("TYPE", "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct)"), //
|
||||
new RegexLeaf("TYPE",
|
||||
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct)"), //
|
||||
RegexLeaf.spaceOneOrMore(), //
|
||||
new RegexOr(//
|
||||
new RegexConcat(//
|
||||
@ -147,9 +148,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
lines = lines.trimSmart(1);
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
final IEntity entity = executeArg0(diagram, line0);
|
||||
if (entity == null) {
|
||||
if (entity == null)
|
||||
return CommandExecutionResult.error("No such entity");
|
||||
}
|
||||
|
||||
if (lines.size() > 1) {
|
||||
entity.setCodeLine(lines.getAt(0).getLocation());
|
||||
lines = lines.subExtract(1, 1);
|
||||
@ -165,9 +166,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
// lines = lines.subExtract(1, 0);
|
||||
// }
|
||||
for (StringLocated s : lines) {
|
||||
if (s.getString().length() > 0 && VisibilityModifier.isVisibilityCharacter(s.getString())) {
|
||||
if (s.getString().length() > 0 && VisibilityModifier.isVisibilityCharacter(s.getString()))
|
||||
diagram.setVisibilityModifierPresent(true);
|
||||
}
|
||||
|
||||
entity.getBodier().addFieldOrMethod(s.getString());
|
||||
}
|
||||
// if (url != null) {
|
||||
@ -183,9 +184,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
}
|
||||
|
||||
public static void addTags(IEntity entity, String tags) {
|
||||
if (tags == null) {
|
||||
if (tags == null)
|
||||
return;
|
||||
}
|
||||
|
||||
for (String tag : tags.split("[ ]+")) {
|
||||
assert tag.startsWith("$");
|
||||
tag = tag.substring(1);
|
||||
@ -197,12 +198,12 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
if (arg.get(keyword, 0) != null) {
|
||||
final Mode mode = arg.get(keyword, 0).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;
|
||||
LeafType type2 = LeafType.CLASS;
|
||||
if (mode == Mode.IMPLEMENTS) {
|
||||
if (mode == Mode.IMPLEMENTS)
|
||||
type2 = LeafType.INTERFACE;
|
||||
}
|
||||
if (mode == Mode.EXTENDS && entity.getLeafType() == LeafType.INTERFACE) {
|
||||
|
||||
if (mode == Mode.EXTENDS && entity.getLeafType() == LeafType.INTERFACE)
|
||||
type2 = LeafType.INTERFACE;
|
||||
}
|
||||
|
||||
final String codes = arg.get(keyword, 1);
|
||||
for (String s : codes.split(",")) {
|
||||
final String idShort = StringUtils.trin(s);
|
||||
@ -210,9 +211,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
final Code other = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||
final IEntity cl2 = diagram.getOrCreateLeaf(ident, other, type2, null);
|
||||
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();
|
||||
}
|
||||
|
||||
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null,
|
||||
diagram.getLabeldistance(), diagram.getLabelangle(),
|
||||
diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
@ -221,24 +222,23 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
}
|
||||
}
|
||||
|
||||
private IEntity executeArg0(ClassDiagram diagram, RegexResult arg) throws NoSuchColorException {
|
||||
private IEntity executeArg0(ClassDiagram diagram, RegexResult line0) throws NoSuchColorException {
|
||||
|
||||
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
|
||||
final String visibilityString = arg.get("VISIBILITY", 0);
|
||||
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(line0.get("TYPE", 0)));
|
||||
final String visibilityString = line0.get("VISIBILITY", 0);
|
||||
VisibilityModifier visibilityModifier = null;
|
||||
if (visibilityString != null) {
|
||||
if (visibilityString != null)
|
||||
visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false);
|
||||
}
|
||||
|
||||
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0),
|
||||
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.getLazzy("CODE", 0),
|
||||
"\"([:");
|
||||
final Ident ident = diagram.buildLeafIdent(idShort);
|
||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||
final String display = arg.getLazzy("DISPLAY", 0);
|
||||
final String genericOption = arg.getLazzy("DISPLAY", 1);
|
||||
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
|
||||
final String display = line0.getLazzy("DISPLAY", 0);
|
||||
final String genericOption = line0.getLazzy("DISPLAY", 1);
|
||||
final String generic = genericOption != null ? genericOption : line0.get("GENERIC", 0);
|
||||
|
||||
final String stereotype = arg.get("STEREO", 0);
|
||||
final String stereotype = line0.get("STEREO", 0);
|
||||
|
||||
/* final */ILeaf result;
|
||||
if (diagram.V1972()) {
|
||||
@ -246,18 +246,18 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
if (result != null) {
|
||||
// result = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||
diagram.setLastEntity(result);
|
||||
if (result.muteToType(type, null) == false) {
|
||||
if (result.muteToType(type, null) == false)
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
|
||||
}
|
||||
} else {
|
||||
if (diagram.leafExist(code)) {
|
||||
result = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||
if (result.muteToType(type, null) == false) {
|
||||
if (result.muteToType(type, null) == false)
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
|
||||
}
|
||||
@ -269,38 +269,30 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
}
|
||||
|
||||
final String urlString = arg.get("URL", 0);
|
||||
final String urlString = line0.get("URL", 0);
|
||||
if (urlString != null) {
|
||||
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
|
||||
final Url url = urlBuilder.getUrl(urlString);
|
||||
result.addUrl(url);
|
||||
}
|
||||
|
||||
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
|
||||
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
|
||||
diagram.getSkinParam().getIHtmlColorSet());
|
||||
final String s = arg.get("LINECOLOR", 1);
|
||||
final String s = line0.get("LINECOLOR", 1);
|
||||
|
||||
final HColor lineColor = s == null ? null
|
||||
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
|
||||
if (lineColor != null) {
|
||||
if (lineColor != null)
|
||||
colors = colors.add(ColorType.LINE, lineColor);
|
||||
}
|
||||
if (arg.get("LINECOLOR", 0) != null) {
|
||||
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
|
||||
}
|
||||
|
||||
if (line0.get("LINECOLOR", 0) != null)
|
||||
colors = colors.addLegacyStroke(line0.get("LINECOLOR", 0));
|
||||
|
||||
result.setColors(colors);
|
||||
|
||||
// result.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
|
||||
// 0)));
|
||||
// result.setSpecificColorTOBEREMOVED(ColorType.LINE,
|
||||
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR",
|
||||
// 1)));
|
||||
// result.applyStroke(arg.get("LINECOLOR", 0));
|
||||
|
||||
if (generic != null) {
|
||||
if (generic != null)
|
||||
result.setGeneric(generic);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public abstract class MyPattern {
|
||||
p = p.replace("%pLN", "\\p{L}0-9"); // Unicode Letter, digit
|
||||
p = p.replace("%s", "\\s\u00A0"); // space
|
||||
p = p.replace("%q", "'\u2018\u2019"); // quote
|
||||
p = p.replace("%g", "\"\u201c\u201d\u00ab\u00bb"); // double quote
|
||||
p = p.replace("%g", "\"\u201c\u201d"); // double quote
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class DisplaySection {
|
||||
return null;
|
||||
|
||||
if (style != null)
|
||||
return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer);
|
||||
return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer, null);
|
||||
|
||||
return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer);
|
||||
}
|
||||
|
@ -146,9 +146,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
private EntityImpl(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
|
||||
String namespaceSeparator, int rawLayout) {
|
||||
this.ident = Objects.requireNonNull(ident);
|
||||
if (entityFactory.namespaceSeparator.V1972()) {
|
||||
if (entityFactory.namespaceSeparator.V1972())
|
||||
code = ident;
|
||||
}
|
||||
|
||||
this.code = Objects.requireNonNull(code);
|
||||
this.entityFactory = entityFactory;
|
||||
this.bodier = bodier;
|
||||
@ -188,9 +188,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
checkNotGroup();
|
||||
Objects.requireNonNull(newType);
|
||||
if (leafType != LeafType.STILL_UNKNOWN) {
|
||||
if (newType == this.leafType) {
|
||||
if (newType == this.leafType)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (leafType != LeafType.ANNOTATION && leafType != LeafType.ABSTRACT_CLASS && leafType != LeafType.CLASS
|
||||
&& leafType != LeafType.ENUM && leafType != LeafType.INTERFACE) {
|
||||
return false;
|
||||
@ -202,9 +202,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
// throw new IllegalArgumentException("newtype=" + newType);
|
||||
}
|
||||
}
|
||||
if (leafType == LeafType.CLASS && newType == LeafType.OBJECT) {
|
||||
if (leafType == LeafType.CLASS && newType == LeafType.OBJECT)
|
||||
bodier.muteClassToObject();
|
||||
}
|
||||
|
||||
this.leafType = newType;
|
||||
this.symbol = newSymbol;
|
||||
return true;
|
||||
@ -223,9 +223,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public Display getDisplay() {
|
||||
if (intricated) {
|
||||
if (intricated)
|
||||
return entityFactory.getIntricatedDisplay(ident);
|
||||
}
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
@ -266,12 +266,12 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public boolean hasUrl() {
|
||||
if (Display.isNull(display) == false && display.hasUrl()) {
|
||||
if (Display.isNull(display) == false && display.hasUrl())
|
||||
return true;
|
||||
}
|
||||
if (bodier.hasUrl()) {
|
||||
|
||||
if (bodier.hasUrl())
|
||||
return true;
|
||||
}
|
||||
|
||||
return url != null;
|
||||
}
|
||||
|
||||
@ -325,25 +325,25 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
|
||||
public EntityPosition getEntityPosition() {
|
||||
checkNotGroup();
|
||||
if (leafType == LeafType.PORT) {
|
||||
if (leafType == LeafType.PORT)
|
||||
return EntityPosition.PORT;
|
||||
}
|
||||
if (leafType == LeafType.PORTIN) {
|
||||
|
||||
if (leafType == LeafType.PORTIN)
|
||||
return EntityPosition.PORTIN;
|
||||
}
|
||||
if (leafType == LeafType.PORTOUT) {
|
||||
|
||||
if (leafType == LeafType.PORTOUT)
|
||||
return EntityPosition.PORTOUT;
|
||||
}
|
||||
if (leafType != LeafType.STATE) {
|
||||
|
||||
if (leafType != LeafType.STATE)
|
||||
return EntityPosition.NORMAL;
|
||||
}
|
||||
if (getParentContainer() instanceof GroupRoot) {
|
||||
|
||||
if (getParentContainer() instanceof GroupRoot)
|
||||
return EntityPosition.NORMAL;
|
||||
}
|
||||
|
||||
final Stereotype stereotype = getStereotype();
|
||||
if (stereotype == null) {
|
||||
if (stereotype == null)
|
||||
return EntityPosition.NORMAL;
|
||||
}
|
||||
|
||||
return EntityPosition.fromStereotype(stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
|
||||
|
||||
}
|
||||
@ -351,30 +351,29 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
// ----------
|
||||
|
||||
private void checkGroup() {
|
||||
if (isGroup() == false) {
|
||||
if (isGroup() == false)
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkNotGroup() {
|
||||
if (isGroup()) {
|
||||
if (isGroup())
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean containsLeafRecurse(ILeaf leaf) {
|
||||
if (Objects.requireNonNull(leaf).isGroup()) {
|
||||
if (Objects.requireNonNull(leaf).isGroup())
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
checkGroup();
|
||||
if (leaf.getParentContainer() == this) {
|
||||
if (leaf.getParentContainer() == this)
|
||||
return true;
|
||||
}
|
||||
for (IGroup child : getChildren()) {
|
||||
if (child.containsLeafRecurse(leaf)) {
|
||||
|
||||
for (IGroup child : getChildren())
|
||||
if (child.containsLeafRecurse(leaf))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -382,12 +381,12 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
checkGroup();
|
||||
final List<ILeaf> result = new ArrayList<>();
|
||||
for (ILeaf ent : entityFactory.leafs()) {
|
||||
if (ent.isGroup()) {
|
||||
if (ent.isGroup())
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (ent.getParentContainer() == this) {
|
||||
|
||||
if (ent.getParentContainer() == this)
|
||||
result.add(ent);
|
||||
}
|
||||
|
||||
}
|
||||
return Collections.unmodifiableCollection(result);
|
||||
}
|
||||
@ -395,11 +394,10 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
public Collection<IGroup> getChildren() {
|
||||
checkGroup();
|
||||
final Collection<IGroup> result = new ArrayList<>();
|
||||
for (IGroup g : entityFactory.groups()) {
|
||||
if (g != this && g.getParentContainer() == this) {
|
||||
for (IGroup g : entityFactory.groups())
|
||||
if (g != this && g.getParentContainer() == this)
|
||||
result.add(g);
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.unmodifiableCollection(result);
|
||||
}
|
||||
|
||||
@ -409,21 +407,20 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
return;
|
||||
}
|
||||
checkGroup();
|
||||
if (dest.isGroup() == false) {
|
||||
if (dest.isGroup() == false)
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
for (ILeaf ent : getLeafsDirect()) {
|
||||
|
||||
for (ILeaf ent : getLeafsDirect())
|
||||
((EntityImpl) ent).parentContainer = dest;
|
||||
}
|
||||
for (IGroup g : dest.getChildren()) {
|
||||
|
||||
for (IGroup g : dest.getChildren())
|
||||
// ((EntityImpl) g).parentContainer = dest;
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
for (IGroup g : getChildren()) {
|
||||
if (g == dest) {
|
||||
if (g == dest)
|
||||
continue;
|
||||
}
|
||||
|
||||
((EntityImpl) g).parentContainer = dest;
|
||||
}
|
||||
|
||||
@ -510,23 +507,23 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
|
||||
public PackageStyle getPackageStyle() {
|
||||
checkGroup();
|
||||
if (stereotype == null) {
|
||||
if (stereotype == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
return stereotype.getPackageStyle();
|
||||
}
|
||||
|
||||
public boolean isGroup() {
|
||||
if (groupType != null && leafType != null) {
|
||||
if (groupType != null && leafType != null)
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
assert groupType == null || leafType == null;
|
||||
if (groupType != null) {
|
||||
if (groupType != null)
|
||||
return true;
|
||||
}
|
||||
if (leafType != null) {
|
||||
|
||||
if (leafType != null)
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@ -537,27 +534,22 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
this.svekImage = img;
|
||||
this.url = null;
|
||||
|
||||
for (final Link link : new ArrayList<>(entityFactory.getLinks())) {
|
||||
if (EntityUtils.isPureInnerLink12(this, link)) {
|
||||
for (final Link link : new ArrayList<>(entityFactory.getLinks()))
|
||||
if (EntityUtils.isPureInnerLink12(this, link))
|
||||
entityFactory.removeLink(link);
|
||||
}
|
||||
}
|
||||
|
||||
if (entityFactory.namespaceSeparator.V1972()) {
|
||||
entityFactory.removeGroup(getIdent());
|
||||
for (ILeaf ent : new ArrayList<>(entityFactory.leafs())) {
|
||||
if (this != ent && getIdent().equals(ent.getIdent().parent())) {
|
||||
for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
|
||||
if (this != ent && getIdent().equals(ent.getIdent().parent()))
|
||||
entityFactory.removeLeaf(ent.getIdent());
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
entityFactory.removeGroup(getCodeGetName());
|
||||
for (ILeaf ent : new ArrayList<>(entityFactory.leafs())) {
|
||||
if (this != ent && this == ent.getParentContainer()) {
|
||||
for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
|
||||
if (this != ent && this == ent.getParentContainer())
|
||||
entityFactory.removeLeaf(ent.getCodeGetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entityFactory.addLeaf(this);
|
||||
this.groupType = null;
|
||||
@ -566,9 +558,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
|
||||
void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
|
||||
checkNotGroup();
|
||||
if (parentContainer.isGroup() == false) {
|
||||
if (parentContainer.isGroup() == false)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.namespace = namespaceNew;
|
||||
this.groupType = groupType;
|
||||
this.leafType = null;
|
||||
@ -576,9 +568,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public USymbol getUSymbol() {
|
||||
if (getLeafType() == LeafType.CIRCLE) {
|
||||
if (getLeafType() == LeafType.CIRCLE)
|
||||
return USymbols.INTERFACE;
|
||||
}
|
||||
|
||||
// if (symbol != null && stereotype != null && stereotype.getSprite() != null) {
|
||||
// return symbol.withStereoAlignment(HorizontalAlignment.RIGHT);
|
||||
// }
|
||||
@ -594,74 +586,69 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
if (parentContainer != null && parentContainer.isHidden()) {
|
||||
if (parentContainer != null && parentContainer.isHidden())
|
||||
return true;
|
||||
}
|
||||
|
||||
return isHiddenInternal();
|
||||
}
|
||||
|
||||
private boolean isHiddenInternal() {
|
||||
if (isGroup()) {
|
||||
if (entityFactory.isHidden(this)) {
|
||||
if (entityFactory.isHidden(this))
|
||||
return true;
|
||||
}
|
||||
if (getLeafsDirect().size() == 0) {
|
||||
|
||||
if (getLeafsDirect().size() == 0)
|
||||
return false;
|
||||
}
|
||||
for (ILeaf leaf : getLeafsDirect()) {
|
||||
if (((EntityImpl) leaf).isHiddenInternal() == false) {
|
||||
|
||||
for (ILeaf leaf : getLeafsDirect())
|
||||
if (((EntityImpl) leaf).isHiddenInternal() == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (IGroup g : getChildren()) {
|
||||
if (((EntityImpl) g).isHiddenInternal() == false) {
|
||||
|
||||
for (IGroup g : getChildren())
|
||||
if (((EntityImpl) g).isHiddenInternal() == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return entityFactory.isHidden(this);
|
||||
}
|
||||
|
||||
public boolean isRemoved() {
|
||||
if (parentContainer != null && parentContainer.isRemoved()) {
|
||||
if (parentContainer != null && parentContainer.isRemoved())
|
||||
return true;
|
||||
}
|
||||
|
||||
return isRemovedInternal();
|
||||
}
|
||||
|
||||
private boolean isRemovedInternal() {
|
||||
if (isGroup()) {
|
||||
if (entityFactory.isRemoved(this)) {
|
||||
if (entityFactory.isRemoved(this))
|
||||
return true;
|
||||
}
|
||||
if (getLeafsDirect().size() == 0 && getChildren().size() == 0) {
|
||||
|
||||
if (getLeafsDirect().size() == 0 && getChildren().size() == 0)
|
||||
return false;
|
||||
}
|
||||
for (ILeaf leaf : getLeafsDirect()) {
|
||||
if (((EntityImpl) leaf).isRemovedInternal() == false) {
|
||||
|
||||
for (ILeaf leaf : getLeafsDirect())
|
||||
if (((EntityImpl) leaf).isRemovedInternal() == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (IGroup g : getChildren()) {
|
||||
if (((EntityImpl) g).isRemovedInternal() == false) {
|
||||
|
||||
for (IGroup g : getChildren())
|
||||
if (((EntityImpl) g).isRemovedInternal() == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return entityFactory.isRemoved(this);
|
||||
}
|
||||
|
||||
public boolean isAloneAndUnlinked() {
|
||||
if (isGroup()) {
|
||||
if (isGroup())
|
||||
return false;
|
||||
}
|
||||
for (Link link : entityFactory.getLinks()) {
|
||||
if (link.contains(this) && link.getType().isInvisible() == false) {
|
||||
|
||||
for (Link link : entityFactory.getLinks())
|
||||
if (link.contains(this) && link.getType().isInvisible() == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -721,9 +708,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) {
|
||||
if (color != null) {
|
||||
if (color != null)
|
||||
this.colors = colors.add(type, color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Collection<String> getPortShortNames() {
|
||||
@ -780,9 +767,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public String getCodeLine() {
|
||||
if (this.codeLine == null) {
|
||||
if (this.codeLine == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
return "" + this.codeLine.getPosition();
|
||||
}
|
||||
|
||||
|
@ -110,6 +110,7 @@ import net.sourceforge.plantuml.graphic.QuoteUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.USymbolFolder;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
@ -310,8 +311,16 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker {
|
||||
// Unfortunately, we have to translate "edge" in its own "cluster" coordinate
|
||||
final Point2D translate = getPosition(edge.getContainingNode());
|
||||
|
||||
final double magicY2 = 0;
|
||||
final IEntity dest = link.getEntity2();
|
||||
if (dest.getUSymbol() instanceof USymbolFolder) {
|
||||
// System.err.println("dest=" + dest);
|
||||
// final IEntityImage image = printEntityInternal((ILeaf) dest);
|
||||
// System.err.println("image=" + image);
|
||||
|
||||
}
|
||||
final ElkPath elkPath = new ElkPath(diagram, SName.classDiagram, link, edge, getLabel(link),
|
||||
getQualifier(link, 1), getQualifier(link, 2));
|
||||
getQualifier(link, 1), getQualifier(link, 2), magicY2);
|
||||
elkPath.drawU(ug.apply(new UTranslate(translate)));
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,6 @@ import net.sourceforge.plantuml.elk.proxy.graph.ElkLabel;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
@ -94,11 +93,13 @@ public class ElkPath implements UDrawable {
|
||||
private final TextBlock centerLabel;
|
||||
private final TextBlock headLabel;
|
||||
private final TextBlock tailLabel;
|
||||
private final Rose rose = new Rose();
|
||||
|
||||
private final SName styleName;
|
||||
|
||||
private final double magicY2;
|
||||
|
||||
public ElkPath(CucaDiagram diagram, SName styleName, Link link, ElkEdge edge, TextBlock centerLabel,
|
||||
TextBlock tailLabel, TextBlock headLabel) {
|
||||
TextBlock tailLabel, TextBlock headLabel, double magicY2) {
|
||||
this.link = link;
|
||||
this.edge = edge;
|
||||
|
||||
@ -107,6 +108,7 @@ public class ElkPath implements UDrawable {
|
||||
this.tailLabel = tailLabel;
|
||||
this.headLabel = headLabel;
|
||||
this.styleName = styleName;
|
||||
this.magicY2 = magicY2;
|
||||
|
||||
}
|
||||
|
||||
@ -170,13 +172,13 @@ public class ElkPath implements UDrawable {
|
||||
|
||||
private UDrawable getDecors(LinkDecor decors, double angle, HColor backColor) {
|
||||
// For legacy reason, extends are treated differently
|
||||
if (decors == LinkDecor.EXTENDS) {
|
||||
if (decors == LinkDecor.EXTENDS)
|
||||
return new ExtremityFactoryExtends(backColor).createUDrawable(new Point2D.Double(), angle, null);
|
||||
}
|
||||
|
||||
final ExtremityFactory extremityFactory = decors.getExtremityFactory(backColor);
|
||||
if (extremityFactory == null) {
|
||||
if (extremityFactory == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
return extremityFactory.createUDrawable(new Point2D.Double(), angle, null);
|
||||
}
|
||||
|
||||
@ -213,12 +215,11 @@ public class ElkPath implements UDrawable {
|
||||
y1 = pt.getY();
|
||||
}
|
||||
|
||||
drawLine(ug, x1, y1, section.getEndX(), section.getEndY());
|
||||
|
||||
drawLine(ug, x1, y1, section.getEndX(), section.getEndY() + magicY2);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawLine(UGraphic ug, final double x1, final double y1, final double x2, final double y2) {
|
||||
private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) {
|
||||
final ULine line = new ULine(x2 - x1, y2 - y1);
|
||||
ug.apply(new UTranslate(x1, y1)).draw(line);
|
||||
}
|
||||
|
@ -58,25 +58,11 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
||||
private final double left;
|
||||
private final UStroke stroke;
|
||||
private final boolean withShadow;
|
||||
|
||||
private final String id;
|
||||
private final TextBlock textBlock;
|
||||
|
||||
TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||
double cornersize, double marginX, double marginY) {
|
||||
this.top = marginY;
|
||||
this.right = marginX;
|
||||
this.bottom = marginY;
|
||||
this.left = marginX;
|
||||
this.cornersize = cornersize;
|
||||
this.textBlock = textBlock;
|
||||
this.withShadow = false;
|
||||
this.stroke = stroke;
|
||||
this.borderColor = borderColor;
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||
double cornersize, ClockwiseTopRightBottomLeft margins) {
|
||||
double cornersize, ClockwiseTopRightBottomLeft margins, String id) {
|
||||
this.top = margins.getTop();
|
||||
this.right = margins.getRight();
|
||||
this.bottom = margins.getBottom();
|
||||
@ -87,11 +73,7 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
||||
this.stroke = stroke;
|
||||
this.borderColor = borderColor;
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||
double cornersize) {
|
||||
this(textBlock, stroke, borderColor, backgroundColor, cornersize, 6, 5);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private double getTextHeight(StringBounder stringBounder) {
|
||||
@ -115,16 +97,16 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
||||
}
|
||||
|
||||
private UGraphic applyStroke(UGraphic ug) {
|
||||
if (stroke == null) {
|
||||
if (stroke == null)
|
||||
return ug;
|
||||
}
|
||||
|
||||
return ug.apply(stroke);
|
||||
}
|
||||
|
||||
private boolean noBorder() {
|
||||
if (stroke == null) {
|
||||
if (stroke == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
return stroke.getThickness() == 0;
|
||||
}
|
||||
|
||||
@ -132,32 +114,32 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Shadowable polygon = getPolygonNormal(stringBounder);
|
||||
final UGraphic ugOriginal = ug;
|
||||
if (withShadow) {
|
||||
if (withShadow)
|
||||
polygon.setDeltaShadow(4);
|
||||
}
|
||||
if (backgroundColor == null) {
|
||||
|
||||
if (backgroundColor == null)
|
||||
ug = ug.apply(new HColorNone().bg());
|
||||
} else {
|
||||
else
|
||||
ug = ug.apply(backgroundColor.bg());
|
||||
}
|
||||
|
||||
HColor color = noBorder() ? backgroundColor : borderColor;
|
||||
if (color == null) {
|
||||
if (color == null)
|
||||
color = new HColorNone();
|
||||
}
|
||||
|
||||
ug = ug.apply(color);
|
||||
ug = applyStroke(ug);
|
||||
ug.draw(polygon);
|
||||
TextBlock toDraw = textBlock;
|
||||
if (textBlock instanceof SheetBlock2) {
|
||||
if (textBlock instanceof SheetBlock2)
|
||||
toDraw = ((SheetBlock2) textBlock).enlargeMe(left, right);
|
||||
}
|
||||
|
||||
toDraw.drawU(ugOriginal.apply(color).apply(new UTranslate(left, top)));
|
||||
}
|
||||
|
||||
private Shadowable getPolygonNormal(final StringBounder stringBounder) {
|
||||
final double height = getTextHeight(stringBounder);
|
||||
final double width = getTextWidth(stringBounder);
|
||||
return new URectangle(width, height).rounded(cornersize);
|
||||
return new URectangle(width, height).rounded(cornersize).withCommentAndCodeLine(id, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,9 +42,7 @@ import java.awt.geom.Rectangle2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.posimo.Positionable;
|
||||
import net.sourceforge.plantuml.posimo.PositionableImpl;
|
||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||
@ -63,22 +61,8 @@ public class TextBlockUtils {
|
||||
public static final TextBlock EMPTY_TEXT_BLOCK = TextBlockUtils.empty(0, 0);
|
||||
|
||||
public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||
double cornersize) {
|
||||
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize);
|
||||
}
|
||||
|
||||
public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||
double cornersize, double marginX, double marginY) {
|
||||
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, marginX, marginY);
|
||||
}
|
||||
|
||||
public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||
double cornersize, ClockwiseTopRightBottomLeft margins) {
|
||||
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, margins);
|
||||
}
|
||||
|
||||
public static TextBlock title(FontConfiguration font, Display stringsToDisplay, ISkinParam skinParam) {
|
||||
throw new UnsupportedOperationException();
|
||||
double cornersize, ClockwiseTopRightBottomLeft margins, String id) {
|
||||
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, margins, id);
|
||||
}
|
||||
|
||||
public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) {
|
||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.MultilinesStrategy;
|
||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexOptional;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.BodierMap;
|
||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
@ -59,7 +60,9 @@ import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandCreateMap extends CommandMultilines2<AbstractClassOrObjectDiagram> {
|
||||
@ -78,12 +81,19 @@ public class CommandCreateMap extends CommandMultilines2<AbstractClassOrObjectDi
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
ColorParser.exp1(), //
|
||||
color().getRegex(), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexOptional(new RegexConcat(new RegexLeaf("##"),
|
||||
new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexLeaf("\\{"), //
|
||||
RegexLeaf.end());
|
||||
}
|
||||
|
||||
private static ColorParser color() {
|
||||
return ColorParser.simpleColor(ColorType.BACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPatternEnd() {
|
||||
return "^[%s]*\\}[%s]*$";
|
||||
@ -143,9 +153,20 @@ public class CommandCreateMap extends CommandMultilines2<AbstractClassOrObjectDi
|
||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
|
||||
final String s = line0.get("COLOR", 0);
|
||||
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
|
||||
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
|
||||
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
|
||||
diagram.getSkinParam().getIHtmlColorSet());
|
||||
final String s = line0.get("LINECOLOR", 1);
|
||||
|
||||
final HColor lineColor = s == null ? null
|
||||
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
|
||||
if (lineColor != null)
|
||||
colors = colors.add(ColorType.LINE, lineColor);
|
||||
|
||||
if (line0.get("LINECOLOR", 0) != null)
|
||||
colors = colors.addLegacyStroke(line0.get("LINECOLOR", 0));
|
||||
|
||||
entity.setColors(colors);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,6 @@ public class PngTitler {
|
||||
if (display == null)
|
||||
return null;
|
||||
|
||||
return style.createTextBlockBordered(display, set, spriteContainer);
|
||||
return style.createTextBlockBordered(display, set, spriteContainer, Style.ID_TITLE);
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ public class ReadLineReader implements ReadLine {
|
||||
private final String description;
|
||||
|
||||
private ReadLineReader(Reader reader, String description, LineLocation parent) {
|
||||
if (description == null) {
|
||||
if (description == null)
|
||||
description = "?";
|
||||
}
|
||||
|
||||
this.br = new BufferedReader(reader);
|
||||
this.location = new LineLocationImpl(description, parent);
|
||||
this.description = description;
|
||||
@ -80,16 +80,16 @@ public class ReadLineReader implements ReadLine {
|
||||
public StringLocated readLine() throws IOException {
|
||||
String s = br.readLine();
|
||||
location = location.oneLineRead();
|
||||
if (s == null) {
|
||||
if (s == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
// if (s.length() > LIMIT) {
|
||||
// Log.debug("Line truncated from " + s.length() + " to " + LIMIT);
|
||||
// s = s.substring(0, LIMIT);
|
||||
// }
|
||||
if (s.startsWith("\uFEFF")) {
|
||||
if (s.startsWith("\uFEFF"))
|
||||
s = s.substring(1);
|
||||
}
|
||||
|
||||
s = s.replace('\u2013', '-');
|
||||
// s = BackSlash.convertHiddenNewLine(s);
|
||||
// s = s.replace('\u00A0', ' ');
|
||||
|
@ -244,7 +244,7 @@ public class SURL {
|
||||
}
|
||||
|
||||
private boolean forbiddenURL(String full) {
|
||||
if (full.matches("^https?://[.0-9]+/.*"))
|
||||
if (full.matches("^https?://[-#.0-9:\\[\\]+]+/.*"))
|
||||
return true;
|
||||
if (full.matches("^https?://[^.]+/.*"))
|
||||
return true;
|
||||
|
@ -149,7 +149,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
compTitle = style.createTextBlockBordered(page.getTitle(), diagram.getSkinParam().getIHtmlColorSet(),
|
||||
diagram.getSkinParam());
|
||||
diagram.getSkinParam(), Style.ID_TITLE);
|
||||
final Dimension2D dimTitle = compTitle.calculateDimension(stringBounder);
|
||||
area.setTitleArea(dimTitle.getWidth(), dimTitle.getHeight());
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.legend)
|
||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
legendBlock = style.createTextBlockBordered(diagram.getLegend().getDisplay(),
|
||||
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam());
|
||||
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam(), Style.ID_LEGEND);
|
||||
}
|
||||
final Dimension2D dimLegend = legendBlock.calculateDimension(stringBounder);
|
||||
area.setLegend(dimLegend, isLegendTop(), diagram.getLegend().getHorizontalAlignment());
|
||||
|
@ -209,7 +209,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
final TextBlock compTitle = style.createTextBlockBordered(diagram.getTitle().getDisplay(),
|
||||
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam());
|
||||
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam(), Style.ID_TITLE);
|
||||
return compTitle;
|
||||
|
||||
}
|
||||
|
@ -150,11 +150,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
|
||||
if (inclination1 == 0 && inclination2 == 0)
|
||||
getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(new ULine(len, 0));
|
||||
else if (inclination1 != 0) {
|
||||
else if (inclination1 != 0)
|
||||
drawLine(getArrowConfiguration().applyStroke(ug), start + len, posArrow, 0, posArrow + inclination1);
|
||||
} else if (inclination2 != 0) {
|
||||
else if (inclination2 != 0)
|
||||
drawLine(getArrowConfiguration().applyStroke(ug), start, posArrow, pos2, posArrow + inclination2);
|
||||
}
|
||||
|
||||
final ArrowDirection direction2 = getDirection2();
|
||||
final double textPos;
|
||||
@ -203,10 +202,12 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
|
||||
if (dressing.getHead() == ArrowHead.ASYNC) {
|
||||
if (dressing.getPart() != ArrowPart.BOTTOM_PART)
|
||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY()));
|
||||
getArrowConfiguration().applyThicknessOnly(ug).draw(
|
||||
new ULine(getArrowDeltaX(), -getArrowDeltaY()).rotate(Math.atan2(-inclination1, lenFull)));
|
||||
|
||||
if (dressing.getPart() != ArrowPart.TOP_PART)
|
||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(getArrowDeltaX(), getArrowDeltaY()));
|
||||
getArrowConfiguration().applyThicknessOnly(ug)
|
||||
.draw(new ULine(getArrowDeltaX(), getArrowDeltaY()).rotate(Math.atan2(-inclination1, lenFull)));
|
||||
|
||||
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
||||
ug = ug.apply(new UStroke(2));
|
||||
@ -237,10 +238,12 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
|
||||
if (dressing.getHead() == ArrowHead.ASYNC) {
|
||||
if (dressing.getPart() != ArrowPart.BOTTOM_PART)
|
||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY()));
|
||||
getArrowConfiguration().applyThicknessOnly(ug).draw(
|
||||
new ULine(-getArrowDeltaX(), -getArrowDeltaY()).rotate(Math.atan2(inclination2, lenFull)));
|
||||
|
||||
if (dressing.getPart() != ArrowPart.TOP_PART)
|
||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(-getArrowDeltaX(), getArrowDeltaY()));
|
||||
getArrowConfiguration().applyThicknessOnly(ug)
|
||||
.draw(new ULine(-getArrowDeltaX(), getArrowDeltaY()).rotate(Math.atan2(inclination2, lenFull)));
|
||||
|
||||
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
||||
ug = ug.apply(new UStroke(2));
|
||||
|
@ -270,7 +270,11 @@ public class Style {
|
||||
return display.create(fc, alignment, spriteContainer);
|
||||
}
|
||||
|
||||
public TextBlock createTextBlockBordered(Display note, HColorSet set, ISkinSimple spriteContainer) {
|
||||
public static final String ID_TITLE = "_title";
|
||||
public static final String ID_CAPTION = "_caption";
|
||||
public static final String ID_LEGEND = "_legend";
|
||||
|
||||
public TextBlock createTextBlockBordered(Display note, HColorSet set, ISkinSimple spriteContainer, String id) {
|
||||
final HorizontalAlignment alignment = this.getHorizontalAlignment();
|
||||
final TextBlock textBlock = this.createTextBlockInternal(note, set, spriteContainer, alignment);
|
||||
|
||||
@ -281,7 +285,7 @@ public class Style {
|
||||
final ClockwiseTopRightBottomLeft margin = this.getMargin();
|
||||
final ClockwiseTopRightBottomLeft padding = this.getPadding();
|
||||
final TextBlock result = TextBlockUtils.bordered(textBlock, stroke, lineColor, backgroundColor, cornersize,
|
||||
padding);
|
||||
padding, id);
|
||||
return TextBlockUtils.withMargin(result, margin);
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,9 @@ public class ClusterDecoration {
|
||||
}
|
||||
|
||||
private static USymbol guess(USymbol symbol, PackageStyle style) {
|
||||
if (symbol != null) {
|
||||
if (symbol != null)
|
||||
return symbol;
|
||||
}
|
||||
|
||||
return style.toUSymbol();
|
||||
}
|
||||
|
||||
|
@ -169,14 +169,14 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
||||
|
||||
double shadow = 0;
|
||||
|
||||
HColor classBorder = lineConfig.getColors().getColor(ColorType.LINE);
|
||||
HColor borderColor = lineConfig.getColors().getColor(ColorType.LINE);
|
||||
HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER);
|
||||
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
||||
|
||||
shadow = getStyle().value(PName.Shadowing).asDouble();
|
||||
|
||||
if (classBorder == null)
|
||||
classBorder = getStyle().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
if (borderColor == null)
|
||||
borderColor = getStyle().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
|
||||
if (headerBackcolor == null)
|
||||
@ -189,7 +189,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
||||
|
||||
rect.setDeltaShadow(shadow);
|
||||
|
||||
ug = ug.apply(classBorder);
|
||||
ug = ug.apply(borderColor);
|
||||
ug = ug.apply(backcolor.bg());
|
||||
|
||||
final UStroke stroke = getStyle().getStroke(lineConfig.getColors());
|
||||
|
@ -156,11 +156,14 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner);
|
||||
|
||||
HColor borderColor = lineConfig.getColors().getColor(ColorType.LINE);
|
||||
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
||||
HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER);
|
||||
|
||||
final Style style = getStyle();
|
||||
final HColor borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
|
||||
if (borderColor == null)
|
||||
borderColor = getStyle().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||
getSkinParam().getIHtmlColorSet());
|
||||
|
||||
if (headerBackcolor == null)
|
||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.ugraphic.UBackground;
|
||||
import net.sourceforge.plantuml.ugraphic.UChange;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicNo;
|
||||
@ -111,6 +112,8 @@ public class Footprint {
|
||||
drawPath(x, y, (UPath) shape);
|
||||
} else if (shape instanceof URectangle) {
|
||||
drawRectangle(x, y, (URectangle) shape);
|
||||
} else if (shape instanceof UEllipse) {
|
||||
drawEllipse(x, y, (UEllipse) shape);
|
||||
} else if (shape instanceof UEmpty) {
|
||||
drawEmpty(x, y, (UEmpty) shape);
|
||||
} else {
|
||||
@ -153,6 +156,11 @@ public class Footprint {
|
||||
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
||||
}
|
||||
|
||||
private void drawEllipse(double x, double y, UEllipse rect) {
|
||||
addPoint(x, y);
|
||||
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
||||
}
|
||||
|
||||
private void drawEmpty(double x, double y, UEmpty rect) {
|
||||
addPoint(x, y);
|
||||
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
||||
|
@ -38,6 +38,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import net.sourceforge.plantuml.AFile;
|
||||
@ -114,7 +115,11 @@ public class EaterTheme extends Eater {
|
||||
|
||||
try {
|
||||
final FileWithSuffix file = context.getFileWithSuffix(from, realName);
|
||||
return ReadLineReader.create(file.getReader(UTF_8), "theme " + realName);
|
||||
final Reader tmp = file.getReader(UTF_8);
|
||||
if (tmp == null)
|
||||
throw EaterException.located("No such theme " + realName);
|
||||
|
||||
return ReadLineReader.create(tmp, "theme " + realName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw EaterException.located("Cannot load " + realName);
|
||||
|
@ -151,7 +151,8 @@ public class Ribbon implements PDrawing {
|
||||
private void drawNotes(UGraphic ug, final Position position) {
|
||||
for (TimingNote note : notes)
|
||||
if (note.getPosition() == position) {
|
||||
final double x = ruler.getPosInPixel(note.getWhen());
|
||||
final TimeTick when = note.getWhen();
|
||||
final double x = when == null ? 0 : ruler.getPosInPixel(when);
|
||||
note.drawU(ug.apply(UTranslate.dx(x)));
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
public class ULine extends AbstractShadowable implements UShapeSized {
|
||||
@ -51,6 +52,14 @@ public class ULine extends AbstractShadowable implements UShapeSized {
|
||||
this.dy = dy;
|
||||
}
|
||||
|
||||
public ULine rotate(double theta) {
|
||||
if (theta == 0)
|
||||
return this;
|
||||
final AffineTransform rot = AffineTransform.getRotateInstance(theta);
|
||||
final Point2D result = rot.transform(new Point2D.Double(dx, dy), null);
|
||||
return new ULine(result.getX(), result.getY());
|
||||
}
|
||||
|
||||
public static ULine hline(double dx) {
|
||||
return new ULine(dx, 0);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 0;
|
||||
final int beta = 1;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
@ -44,15 +44,15 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class YamlLines implements Iterable<String> {
|
||||
|
||||
public static final String KEY = "([^:\\s]+)";
|
||||
public static final String KEY = "([^:]+)";
|
||||
|
||||
private List<String> lines = new ArrayList<>();
|
||||
|
||||
public YamlLines(List<String> rawLines) {
|
||||
for (String s : rawLines) {
|
||||
if (s.startsWith("#")) {
|
||||
if (s.startsWith("#"))
|
||||
continue;
|
||||
}
|
||||
|
||||
s = removeDiese(s);
|
||||
if (s.trim().length() == 0)
|
||||
continue;
|
||||
@ -79,9 +79,9 @@ public class YamlLines implements Iterable<String> {
|
||||
|
||||
private String removeDiese(String s) {
|
||||
final int idx = s.indexOf(" #");
|
||||
if (idx == -1) {
|
||||
if (idx == -1)
|
||||
return s;
|
||||
}
|
||||
|
||||
return s.substring(0, idx);
|
||||
}
|
||||
|
||||
@ -104,9 +104,9 @@ public class YamlLines implements Iterable<String> {
|
||||
}
|
||||
|
||||
private void removeFirstCols(int startingEmptyCols) {
|
||||
if (startingEmptyCols == 0) {
|
||||
if (startingEmptyCols == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
for (ListIterator<String> it = lines.listIterator(); it.hasNext();) {
|
||||
final String s = it.next().substring(startingEmptyCols);
|
||||
it.set(s);
|
||||
@ -117,19 +117,18 @@ public class YamlLines implements Iterable<String> {
|
||||
int result = Integer.MAX_VALUE;
|
||||
for (String s : lines) {
|
||||
result = Math.min(result, startingSpaces(s));
|
||||
if (result == 0) {
|
||||
if (result == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int startingSpaces(String s) {
|
||||
final Pattern p1 = Pattern.compile("^(\\s*).*");
|
||||
final Matcher m1 = p1.matcher(s);
|
||||
if (m1.matches()) {
|
||||
if (m1.matches())
|
||||
return m1.group(1).length();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user