mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-25 06:17:33 +00:00
Improve stdlib versioning
This commit is contained in:
parent
db09c72834
commit
97d3281ec3
@ -44,6 +44,7 @@ import net.sourceforge.plantuml.AlignmentParam;
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
@ -245,5 +246,12 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
return opale.calculateDimension(stringBounder).getWidth() - opale.getMarginX1();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public LinkRendering getInLinkRendering() {
|
||||
return tile.getInLinkRendering();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
@ -147,12 +148,11 @@ public class FtileWithNotes extends AbstractFtile {
|
||||
}
|
||||
}
|
||||
|
||||
if (left == null) {
|
||||
if (left == null)
|
||||
left = TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
if (right == null) {
|
||||
|
||||
if (right == null)
|
||||
right = TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -204,10 +204,10 @@ public class FtileWithNotes extends AbstractFtile {
|
||||
final XDimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry orig = tile.calculateDimension(stringBounder);
|
||||
final UTranslate translate = getTranslate(stringBounder);
|
||||
if (orig.hasPointOut()) {
|
||||
if (orig.hasPointOut())
|
||||
return new FtileGeometry(dimTotal, orig.getLeft() + translate.getDx(), orig.getInY() + translate.getDy(),
|
||||
orig.getOutY() + translate.getDy());
|
||||
}
|
||||
|
||||
return new FtileGeometry(dimTotal, orig.getLeft() + translate.getDx(), orig.getInY() + translate.getDy());
|
||||
}
|
||||
|
||||
@ -219,4 +219,9 @@ public class FtileWithNotes extends AbstractFtile {
|
||||
return new XDimension2D(dimTile.getWidth() + dimLeft.getWidth() + dimRight.getWidth(), height);
|
||||
}
|
||||
|
||||
@Override
|
||||
final public LinkRendering getInLinkRendering() {
|
||||
return tile.getInLinkRendering();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,14 +101,15 @@ public class FtileBox extends AbstractFtile {
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
@Override
|
||||
final public LinkRendering getInLinkRendering() {
|
||||
return inRendering;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (swimlane == null) {
|
||||
if (swimlane == null)
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
return Collections.singleton(swimlane);
|
||||
}
|
||||
|
||||
|
@ -164,13 +164,9 @@ public class FtileBoxOld extends AbstractFtile {
|
||||
final LineBreakStrategy wrapWidth = style.wrapWidth();
|
||||
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
|
||||
|
||||
// final HorizontalAlignment alignment =
|
||||
// skinParam.getDefaultTextAlignment(horizontalAlignment);
|
||||
final Sheet sheet = skinParam.sheet(fc, horizontalAlignment, CreoleMode.FULL).createSheet(label);
|
||||
// this.tb = new SheetBlock1(sheet, wrapWidth, 0, this.padding.getLeft(), this.padding.getRight());
|
||||
// this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, 0, this.padding.getLeft(), this.padding.getRight()),
|
||||
// new MyStencil(), new UStroke(1));
|
||||
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, style.getPadding()), new MyStencil(),
|
||||
|
||||
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, style), new MyStencil(),
|
||||
new UStroke(1));
|
||||
this.print = label.toString();
|
||||
|
||||
|
@ -93,6 +93,8 @@ import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
|
||||
|
||||
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower, ICucaDiagram {
|
||||
|
||||
static public final boolean QUARK = false;
|
||||
|
||||
static private final boolean G1972 = false;
|
||||
|
||||
// private String namespaceSeparator = ".";
|
||||
@ -100,6 +102,14 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
private String namespaceSeparator = null;
|
||||
private boolean namespaceSeparatorHasBeenSet = false;
|
||||
|
||||
public Quark currentQuark() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public /*protected*/ Plasma getPlasma() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public final boolean V1972() {
|
||||
if (getPragma().backToLegacyPackage()) {
|
||||
return false;
|
||||
|
@ -113,13 +113,20 @@ public class Plasma {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
public Quark getIfExists(String name) {
|
||||
public Quark getIfExistsFromName(String name) {
|
||||
for (Quark quark : quarks.values())
|
||||
if (quark.getName().equals(name))
|
||||
return quark;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Quark getIfExistsFromFullPath(String full) {
|
||||
for (Quark quark : quarks.values())
|
||||
if (quark.toString(separator).equals(full))
|
||||
return quark;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Quark getIfExists(List<String> signature) {
|
||||
return quarks.get(signature);
|
||||
}
|
||||
|
@ -165,6 +165,12 @@ public class Quark extends Ident implements Code {
|
||||
return plasma.getIfExists(sig);
|
||||
}
|
||||
|
||||
public Quark parse(Quark path) {
|
||||
final List<String> sig = new ArrayList<>(getSignature());
|
||||
sig.addAll(path.getSignature());
|
||||
return plasma.ensurePresent(sig);
|
||||
}
|
||||
|
||||
public Quark child(String name) {
|
||||
return plasma.parse(this, name);
|
||||
}
|
||||
@ -182,13 +188,15 @@ public class Quark extends Ident implements Code {
|
||||
}
|
||||
|
||||
public void internalMove(Quark src, Quark dest) {
|
||||
System.err.print("Intermal move from " + this + " to ");
|
||||
if (src.getDepth() + 1 != dest.getDepth())
|
||||
throw new UnsupportedOperationException("to be finished");
|
||||
final String name = getName();
|
||||
final List<String> previous = this.getSignature();
|
||||
parts.clear();
|
||||
parts.addAll(dest.getSignature());
|
||||
parts.add(name);
|
||||
this.parent = dest;
|
||||
parts.addAll(previous.subList(src.getDepth(), previous.size()));
|
||||
this.parent = plasma.ensurePresent(parts.subList(0, parts.size() - 1));
|
||||
System.err.println(toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,10 @@ import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlMode;
|
||||
import net.sourceforge.plantuml.baraye.CucaDiagram;
|
||||
import net.sourceforge.plantuml.baraye.EntityImp;
|
||||
import net.sourceforge.plantuml.baraye.ILeaf;
|
||||
import net.sourceforge.plantuml.baraye.Quark;
|
||||
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
@ -113,9 +116,11 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
new RegexOptional(new RegexConcat(new RegexLeaf("##"),
|
||||
new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
|
||||
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(),
|
||||
new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
|
||||
new RegexLeaf("EXTENDS",
|
||||
"(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
|
||||
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(),
|
||||
new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
|
||||
new RegexLeaf("IMPLEMENTS",
|
||||
"(implements)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
|
||||
new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("\\{"),
|
||||
RegexLeaf.spaceZeroOrMore(), new RegexLeaf("\\}"))), //
|
||||
RegexLeaf.end());
|
||||
@ -137,26 +142,50 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
|
||||
|
||||
final String stereo = arg.get("STEREO", 0);
|
||||
final ILeaf entity;
|
||||
final Ident idNewLong = diagram.buildLeafIdent(idShort);
|
||||
if (diagram.V1972()) {
|
||||
if (diagram.leafExistSmart(idNewLong)) {
|
||||
entity = diagram.getOrCreateLeaf(idNewLong, idNewLong, type, null);
|
||||
if (entity.muteToType(type, null) == false)
|
||||
return CommandExecutionResult.error("Bad name");
|
||||
/* final */ ILeaf entity;
|
||||
|
||||
} else {
|
||||
if (CucaDiagram.QUARK) {
|
||||
final Quark current = diagram.currentQuark();
|
||||
final Quark idNewLong = (Quark) diagram.buildLeafIdent(idShort);
|
||||
if (idNewLong.getData() == null)
|
||||
entity = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null);
|
||||
else
|
||||
entity = (ILeaf) idNewLong.getData();
|
||||
if (entity == null || entity.isGroup()) {
|
||||
for (Quark tmp : diagram.getPlasma().quarks())
|
||||
if (tmp.getData() instanceof EntityImp) {
|
||||
final EntityImp tmp2 = (EntityImp) tmp.getData();
|
||||
if (tmp2 != null && tmp.getName().equals(idShort) && tmp2.isGroup() == false) {
|
||||
entity = (ILeaf) tmp.getData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (entity == null) {
|
||||
final Display withNewlines = Display.getWithNewlines(display);
|
||||
entity = diagram.createLeaf(idNewLong, idNewLong, withNewlines, type, null);
|
||||
}
|
||||
} else {
|
||||
final Code code = diagram.buildCode(idShort);
|
||||
if (diagram.leafExist(code)) {
|
||||
entity = diagram.getOrCreateLeaf(idNewLong, code, type, null);
|
||||
if (entity.muteToType(type, null) == false)
|
||||
return CommandExecutionResult.error("Bad name");
|
||||
final Ident idNewLong = diagram.buildLeafIdent(idShort);
|
||||
if (diagram.V1972()) {
|
||||
if (diagram.leafExistSmart(idNewLong)) {
|
||||
entity = diagram.getOrCreateLeaf(idNewLong, idNewLong, type, null);
|
||||
if (entity.muteToType(type, null) == false)
|
||||
return CommandExecutionResult.error("Bad name");
|
||||
|
||||
} else {
|
||||
entity = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null);
|
||||
}
|
||||
} else {
|
||||
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
|
||||
final Code code = diagram.buildCode(idShort);
|
||||
if (diagram.leafExist(code)) {
|
||||
entity = diagram.getOrCreateLeaf(idNewLong, code, type, null);
|
||||
if (entity.muteToType(type, null) == false)
|
||||
return CommandExecutionResult.error("Bad name");
|
||||
|
||||
} else {
|
||||
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stereo != null) {
|
||||
@ -179,8 +208,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
|
||||
final String s = arg.get("LINECOLOR", 1);
|
||||
|
||||
final HColor lineColor = s == null ? null
|
||||
: diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
if (lineColor != null)
|
||||
colors = colors.add(ColorType.LINE, lineColor);
|
||||
|
||||
|
@ -41,8 +41,11 @@ import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlMode;
|
||||
import net.sourceforge.plantuml.baraye.CucaDiagram;
|
||||
import net.sourceforge.plantuml.baraye.EntityImp;
|
||||
import net.sourceforge.plantuml.baraye.IEntity;
|
||||
import net.sourceforge.plantuml.baraye.ILeaf;
|
||||
import net.sourceforge.plantuml.baraye.Quark;
|
||||
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
|
||||
import net.sourceforge.plantuml.command.BlocLines;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
@ -249,7 +252,27 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
final String stereotype = line0.get("STEREO", 0);
|
||||
|
||||
/* final */ILeaf result;
|
||||
if (diagram.V1972()) {
|
||||
if (CucaDiagram.QUARK) {
|
||||
final Quark current = diagram.currentQuark();
|
||||
final Quark idNewLong = (Quark) diagram.buildLeafIdent(idShort);
|
||||
if (idNewLong.getData() == null)
|
||||
result = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
|
||||
else
|
||||
result = (ILeaf) idNewLong.getData();
|
||||
if (result == null || result.isGroup()) {
|
||||
for (Quark tmp : diagram.getPlasma().quarks())
|
||||
if (tmp.getData() instanceof EntityImp) {
|
||||
final EntityImp tmp2 = (EntityImp) tmp.getData();
|
||||
if (tmp2 != null && tmp.getName().equals(idShort) && tmp2.isGroup() == false) {
|
||||
result = (ILeaf) tmp.getData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result == null)
|
||||
result = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null);
|
||||
diagram.setLastEntity(result);
|
||||
} else if (diagram.V1972()) {
|
||||
result = diagram.getLeafSmart(ident);
|
||||
if (result != null) {
|
||||
// result = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||
@ -270,6 +293,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
|
||||
}
|
||||
}
|
||||
|
||||
result.setVisibilityModifier(visibilityModifier);
|
||||
if (stereotype != null) {
|
||||
result.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
|
@ -39,8 +39,10 @@ import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlMode;
|
||||
import net.sourceforge.plantuml.baraye.CucaDiagram;
|
||||
import net.sourceforge.plantuml.baraye.IEntity;
|
||||
import net.sourceforge.plantuml.baraye.IGroup;
|
||||
import net.sourceforge.plantuml.baraye.Quark;
|
||||
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
|
||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
@ -84,12 +86,20 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
final Code code;
|
||||
final IGroup currentPackage;
|
||||
final Display display;
|
||||
final Ident idNewLong = diagram.buildLeafIdent(idShort);
|
||||
if (diagram.V1972()) {
|
||||
final Ident idNewLong;
|
||||
if (CucaDiagram.QUARK) {
|
||||
final Quark current = diagram.currentQuark();
|
||||
code = current;
|
||||
display = Display.getWithNewlines(idShort);
|
||||
idNewLong = current.child(idShort);
|
||||
currentPackage = (IGroup) current.getData();
|
||||
} else if (diagram.V1972()) {
|
||||
idNewLong = diagram.buildLeafIdent(idShort);
|
||||
code = null;
|
||||
currentPackage = null;
|
||||
display = Display.getWithNewlines(idNewLong.getName());
|
||||
} else {
|
||||
idNewLong = diagram.buildLeafIdent(idShort);
|
||||
code = diagram.buildCode(idShort);
|
||||
currentPackage = diagram.getCurrentGroup();
|
||||
display = Display.getWithNewlines(code);
|
||||
@ -110,8 +120,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
final String color = arg.get("COLOR", 0);
|
||||
if (color != null) {
|
||||
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
|
||||
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(color));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -40,8 +40,10 @@ import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlMode;
|
||||
import net.sourceforge.plantuml.baraye.CucaDiagram;
|
||||
import net.sourceforge.plantuml.baraye.IEntity;
|
||||
import net.sourceforge.plantuml.baraye.IGroup;
|
||||
import net.sourceforge.plantuml.baraye.Quark;
|
||||
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
|
||||
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
|
||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
@ -123,30 +125,37 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
display = name;
|
||||
idShort = arg.get("AS", 0);
|
||||
}
|
||||
|
||||
final Ident ident;
|
||||
final Code code;
|
||||
|
||||
if (CucaDiagram.QUARK) {
|
||||
final Quark current = diagram.currentQuark();
|
||||
code = current;
|
||||
ident = current.child(idShort);
|
||||
} else {
|
||||
ident = diagram.buildLeafIdent(idShort);
|
||||
code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||
if (diagram.V1972() && override1972)
|
||||
display = ident.getLast();
|
||||
}
|
||||
final IGroup currentPackage = diagram.getCurrentGroup();
|
||||
// final Ident ident = diagram.buildLeafIdentSpecial(idShort);
|
||||
final Ident ident = diagram.buildLeafIdent(idShort);
|
||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||
if (diagram.V1972() && override1972)
|
||||
display = ident.getLast();
|
||||
|
||||
diagram.gotoGroup(ident, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
|
||||
NamespaceStrategy.SINGLE);
|
||||
|
||||
final IEntity p = diagram.getCurrentGroup();
|
||||
|
||||
final String stereotype = arg.get("STEREOTYPE", 0);
|
||||
// final USymbol type = USymbol.getFromString(arg.get("TYPE", 0),
|
||||
// diagram.getSkinParam().getActorStyle());
|
||||
// if (type == USymbol.TOGETHER) {
|
||||
// p.setUSymbol(type);
|
||||
// p.setThisIsTogether();
|
||||
// } else
|
||||
|
||||
if (stereotype != null) {
|
||||
final USymbol usymbol = USymbols.fromString(stereotype, diagram.getSkinParam().actorStyle(),
|
||||
diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle());
|
||||
if (usymbol == null) {
|
||||
if (usymbol == null)
|
||||
p.setStereotype(Stereotype.build(stereotype));
|
||||
} else {
|
||||
else
|
||||
p.setUSymbol(usymbol);
|
||||
}
|
||||
|
||||
}
|
||||
CommandCreateClassMultilines.addTags(p, arg.getLazzy("TAGS", 0));
|
||||
|
||||
|
@ -53,6 +53,8 @@ import net.sourceforge.plantuml.graphic.InnerStrategy;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
@ -74,14 +76,16 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S
|
||||
private final double marginX1;
|
||||
private final double marginX2;
|
||||
private Class<? extends StringBounder> lastCaller;
|
||||
private double minimumWidth;
|
||||
|
||||
@HaxeIgnored
|
||||
public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, double padding) {
|
||||
this(sheet, maxWidth, ClockwiseTopRightBottomLeft.same(padding), 0, 0);
|
||||
}
|
||||
|
||||
public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, ClockwiseTopRightBottomLeft padding) {
|
||||
this(sheet, maxWidth, padding, 0, 0);
|
||||
public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, Style style) {
|
||||
this(sheet, maxWidth, style.getPadding(), 0, 0);
|
||||
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
|
||||
}
|
||||
|
||||
public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, double padding, double marginX1, double marginX2) {
|
||||
@ -113,6 +117,10 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S
|
||||
return HorizontalAlignment.LEFT;
|
||||
}
|
||||
|
||||
public HorizontalAlignment getHorizontalAlignment() {
|
||||
return sheet.getHorizontalAlignment();
|
||||
}
|
||||
|
||||
private void initMap(StringBounder stringBounder) {
|
||||
final Class<? extends StringBounder> currentCaller = stringBounder.getClass();
|
||||
if (lastCaller == currentCaller)
|
||||
@ -210,4 +218,8 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S
|
||||
return calculateDimension(stringBounder).getWidth() + marginX2;
|
||||
}
|
||||
|
||||
public final double getMinimumWidth() {
|
||||
return minimumWidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.awt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.awt.geom.XRectangle2D;
|
||||
import net.sourceforge.plantuml.creole.atom.Atom;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.InnerStrategy;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -50,6 +51,7 @@ import net.sourceforge.plantuml.svek.WithPorts;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
final public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom, WithPorts {
|
||||
|
||||
@ -81,6 +83,10 @@ final public class SheetBlock2 extends AbstractTextBlock implements TextBlock, A
|
||||
this.defaultStroke = defaultStroke;
|
||||
}
|
||||
|
||||
private HorizontalAlignment getHorizontalAlignment() {
|
||||
return block.getHorizontalAlignment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return block.toString();
|
||||
@ -94,6 +100,11 @@ final public class SheetBlock2 extends AbstractTextBlock implements TextBlock, A
|
||||
if (stencil != null)
|
||||
ug = UGraphicStencil.create(ug, stencil, defaultStroke);
|
||||
|
||||
if (getHorizontalAlignment() == HorizontalAlignment.CENTER && block.getMinimumWidth() > 0) {
|
||||
final double width = calculateDimension(ug.getStringBounder()).getWidth();
|
||||
final double dx = (block.getMinimumWidth() - width) / 2;
|
||||
ug = ug.apply(UTranslate.dx(dx));
|
||||
}
|
||||
block.drawU(ug);
|
||||
}
|
||||
|
||||
|
@ -62,23 +62,23 @@ class Idea {
|
||||
|
||||
private StyleSignatureBasic getDefaultStyleDefinitionNode(int level) {
|
||||
final String depth = SName.depth(level);
|
||||
if (level == 0) {
|
||||
if (level == 0)
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode)
|
||||
.add(stereotype).add(depth);
|
||||
}
|
||||
if (shape == IdeaShape.NONE && children.size() == 0) {
|
||||
|
||||
if (shape == IdeaShape.NONE && children.size() == 0)
|
||||
return StyleSignatureBasic
|
||||
.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode, SName.boxless)
|
||||
.add(stereotype).add(depth);
|
||||
}
|
||||
if (shape == IdeaShape.NONE) {
|
||||
|
||||
if (shape == IdeaShape.NONE)
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.boxless)
|
||||
.add(stereotype).add(depth);
|
||||
}
|
||||
if (children.size() == 0) {
|
||||
|
||||
if (children.size() == 0)
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode)
|
||||
.add(stereotype).add(depth);
|
||||
}
|
||||
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).add(stereotype)
|
||||
.add(depth);
|
||||
}
|
||||
|
@ -68,12 +68,28 @@ public class Stdlib {
|
||||
|
||||
final String info = dataStream.readUTF();
|
||||
dataStream.close();
|
||||
result = new Stdlib(name, info);
|
||||
|
||||
final String link = getLinkFromInfo(info);
|
||||
if (link == null)
|
||||
result = new Stdlib(name, info);
|
||||
else
|
||||
result = retrieve(link);
|
||||
|
||||
all.put(name, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String getLinkFromInfo(String infoString) {
|
||||
for (String s : infoString.split("\n"))
|
||||
if (s.contains("=")) {
|
||||
final String data[] = s.split("=");
|
||||
if (data[0].equals("LINK"))
|
||||
return data[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String loadResource(String file) throws IOException {
|
||||
final SoftReference<String> cached = cache.get(file.toLowerCase());
|
||||
if (cached != null) {
|
||||
@ -194,7 +210,6 @@ public class Stdlib {
|
||||
final String data[] = s.split("=");
|
||||
this.info.put(data[0], data[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static DataInputStream getDataStream(String name) throws IOException {
|
||||
|
@ -36,7 +36,9 @@
|
||||
package net.sourceforge.plantuml.statediagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.baraye.CucaDiagram;
|
||||
import net.sourceforge.plantuml.baraye.IEntity;
|
||||
import net.sourceforge.plantuml.baraye.Quark;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
@ -66,9 +68,31 @@ public class CommandAddField extends SingleLineCommand2<StateDiagram> {
|
||||
new RegexLeaf("FIELD", "(.*)"), RegexLeaf.end());
|
||||
}
|
||||
|
||||
private CommandExecutionResult executeArgQuark(StateDiagram diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
final String codeString = arg.getLazzy("CODE", 0);
|
||||
|
||||
final Quark quark = diagram.currentQuark();
|
||||
Quark child = quark.childIfExists(codeString);
|
||||
if (child == null && quark.getName().equals(codeString))
|
||||
child = quark;
|
||||
if (child == null)
|
||||
child = quark.child(codeString);
|
||||
|
||||
final IEntity entity = diagram.getOrCreateLeaf(child, child, null, null);
|
||||
|
||||
final String field = arg.get("FIELD", 0);
|
||||
|
||||
entity.getBodier().addFieldOrMethod(field);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
if (CucaDiagram.QUARK)
|
||||
return executeArgQuark(diagram, location, arg);
|
||||
|
||||
final String codeString = arg.getLazzy("CODE", 0);
|
||||
final String field = arg.get("FIELD", 0);
|
||||
|
||||
|
@ -37,6 +37,7 @@ package net.sourceforge.plantuml.timingdiagram;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.awt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.awt.geom.XPoint2D;
|
||||
@ -108,14 +109,20 @@ public class TimeConstraint {
|
||||
final double x1 = ruler.getPosInPixel(tick1);
|
||||
final double x2 = ruler.getPosInPixel(tick2);
|
||||
ug = ug.apply(UTranslate.dx(x1));
|
||||
ug.apply(getUStroke()).draw(ULine.hline(x2 - x1));
|
||||
final double len = x2 - x1;
|
||||
ug.apply(getUStroke()).draw(ULine.hline(len));
|
||||
|
||||
ug.draw(getPolygon(-Math.PI / 2, new XPoint2D(0, 0)));
|
||||
ug.draw(getPolygon(Math.PI / 2, new XPoint2D(x2 - x1, 0)));
|
||||
if (len > 10) {
|
||||
ug.draw(getPolygon(Direction.LEFT, new XPoint2D(0, 0)));
|
||||
ug.draw(getPolygon(Direction.RIGHT, new XPoint2D(len, 0)));
|
||||
} else {
|
||||
ug.draw(getPolygon(Direction.RIGHT, new XPoint2D(0, 0)));
|
||||
ug.draw(getPolygon(Direction.LEFT, new XPoint2D(len, 0)));
|
||||
}
|
||||
|
||||
final TextBlock text = getTextBlock(label);
|
||||
final XDimension2D dimText = text.calculateDimension(ug.getStringBounder());
|
||||
final double x = (x2 - x1 - dimText.getWidth()) / 2;
|
||||
final double x = (len - dimText.getWidth()) / 2;
|
||||
text.drawU(ug.apply(new UTranslate(x, -getConstraintHeight(ug.getStringBounder()))));
|
||||
}
|
||||
|
||||
@ -149,15 +156,23 @@ public class TimeConstraint {
|
||||
return 5;
|
||||
}
|
||||
|
||||
private UPolygon getPolygon(final double angle, final XPoint2D end) {
|
||||
final double delta = 20.0 * Math.PI / 180.0;
|
||||
final XPoint2D pt1 = TimeArrow.onCircle(end, angle + delta);
|
||||
final XPoint2D pt2 = TimeArrow.onCircle(end, angle - delta);
|
||||
private UPolygon getPolygon(Direction dir, XPoint2D end) {
|
||||
final double dx = 8;
|
||||
final double dy = 4;
|
||||
final XPoint2D pt1;
|
||||
final XPoint2D pt2;
|
||||
if (dir == Direction.RIGHT) {
|
||||
pt1 = end.move(-dx, dy);
|
||||
pt2 = end.move(-dx, -dy);
|
||||
} else {
|
||||
pt1 = end.move(dx, dy);
|
||||
pt2 = end.move(dx, -dy);
|
||||
}
|
||||
|
||||
final UPolygon polygon = new UPolygon();
|
||||
polygon.addPoint(pt1.getX(), pt1.getY());
|
||||
polygon.addPoint(pt2.getX(), pt2.getY());
|
||||
polygon.addPoint(end.getX(), end.getY());
|
||||
polygon.addPoint(pt1);
|
||||
polygon.addPoint(pt2);
|
||||
polygon.addPoint(end);
|
||||
|
||||
return polygon;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 7;
|
||||
final int beta = 8;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user