mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
fix: improve notes on conditional
https://forum.plantuml.net/4696/notes-on-conditionnal-elements?show=18077#c18077
This commit is contained in:
parent
ef07e2cd1b
commit
85a6b1dada
@ -72,11 +72,10 @@ public class InstructionFork extends WithNote implements Instruction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsBreak() {
|
public boolean containsBreak() {
|
||||||
for (InstructionList fork : forks) {
|
for (InstructionList fork : forks)
|
||||||
if (fork.containsBreak()) {
|
if (fork.containsBreak())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,14 +121,13 @@ public class InstructionFork extends WithNote implements Instruction {
|
|||||||
@Override
|
@Override
|
||||||
public Ftile createFtile(FtileFactory factory) {
|
public Ftile createFtile(FtileFactory factory) {
|
||||||
final List<Ftile> all = new ArrayList<>();
|
final List<Ftile> all = new ArrayList<>();
|
||||||
for (InstructionList list : forks) {
|
for (InstructionList list : forks)
|
||||||
all.add(list.createFtile(factory));
|
all.add(list.createFtile(factory));
|
||||||
}
|
|
||||||
Ftile result = factory.createParallel(all, style, label, swimlaneIn, swimlaneOut);
|
Ftile result = factory.createParallel(all, style, label, swimlaneIn, swimlaneOut);
|
||||||
if (getPositionedNotes().size() > 0) {
|
if (getPositionedNotes().size() > 0)
|
||||||
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false,
|
result = FtileWithNoteOpale.create(result, getPositionedNotes(), false, VerticalAlignment.CENTER);
|
||||||
VerticalAlignment.CENTER);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,12 +152,12 @@ public class InstructionFork extends WithNote implements Instruction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
|
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
|
||||||
if (finished) {
|
if (finished)
|
||||||
return super.addNote(note, position, type, colors, swimlaneNote);
|
return super.addNote(note, position, type, colors, swimlaneNote);
|
||||||
}
|
|
||||||
if (getLastList().getLast() == null) {
|
if (getLastList().getLast() == null)
|
||||||
return getLastList().addNote(note, position, type, colors, swimlaneNote);
|
return getLastList().addNote(note, position, type, colors, swimlaneNote);
|
||||||
}
|
|
||||||
return getLastList().addNote(note, position, type, colors, swimlaneNote);
|
return getLastList().addNote(note, position, type, colors, swimlaneNote);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,12 +180,12 @@ public class InstructionFork extends WithNote implements Instruction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void manageOutRendering(LinkRendering nextLinkRenderer, boolean endFork) {
|
public void manageOutRendering(LinkRendering nextLinkRenderer, boolean endFork) {
|
||||||
if (endFork) {
|
if (endFork)
|
||||||
this.finished = true;
|
this.finished = true;
|
||||||
}
|
|
||||||
if (nextLinkRenderer == null) {
|
if (nextLinkRenderer == null)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
getLastList().setOutRendering(nextLinkRenderer);
|
getLastList().setOutRendering(nextLinkRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class InstructionGroup extends AbstractInstruction implements Instruction
|
|||||||
public Ftile createFtile(FtileFactory factory) {
|
public Ftile createFtile(FtileFactory factory) {
|
||||||
Ftile tmp = list.createFtile(factory);
|
Ftile tmp = list.createFtile(factory);
|
||||||
if (note != null)
|
if (note != null)
|
||||||
tmp = new FtileWithNotes(tmp, Collections.singleton(note), factory.skinParam(), VerticalAlignment.CENTER);
|
tmp = new FtileWithNotes(tmp, Collections.singleton(note), VerticalAlignment.CENTER);
|
||||||
|
|
||||||
return factory.createGroup(tmp, title, backColor, null, type, style);
|
return factory.createGroup(tmp, title, backColor, null, type, style);
|
||||||
}
|
}
|
||||||
|
@ -80,14 +80,13 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsBreak() {
|
public boolean containsBreak() {
|
||||||
for (Branch branch : thens) {
|
for (Branch branch : thens)
|
||||||
if (branch.containsBreak()) {
|
if (branch.containsBreak())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
if (elseBranch != null)
|
||||||
if (elseBranch != null) {
|
|
||||||
return elseBranch.containsBreak();
|
return elseBranch.containsBreak();
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,10 +141,10 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
|||||||
Display.NULL, null, LinkRendering.none());
|
Display.NULL, null, LinkRendering.none());
|
||||||
|
|
||||||
elseBranch.updateFtile(factory);
|
elseBranch.updateFtile(factory);
|
||||||
Ftile result = factory.createIf(swimlane, thens, elseBranch, outColor, topInlinkRendering, url);
|
Ftile result = factory.createIf(swimlane, thens, elseBranch, outColor, topInlinkRendering, url,
|
||||||
if (getPositionedNotes().size() > 0)
|
getPositionedNotes());
|
||||||
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false,
|
// if (getPositionedNotes().size() > 0)
|
||||||
VerticalAlignment.CENTER);
|
// result = FtileWithNoteOpale.create(result, getPositionedNotes(), false, VerticalAlignment.CENTER);
|
||||||
|
|
||||||
final List<WeldingPoint> weldingPoints = new ArrayList<>();
|
final List<WeldingPoint> weldingPoints = new ArrayList<>();
|
||||||
for (Branch branch : thens)
|
for (Branch branch : thens)
|
||||||
@ -198,7 +197,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
final public boolean kill() {
|
final public boolean kill() {
|
||||||
if (endifCalled) {
|
if (endifCalled)
|
||||||
for (Branch branch : thens) {
|
for (Branch branch : thens) {
|
||||||
if (branch.getLast() != null && branch.getLast().kill() == false)
|
if (branch.getLast() != null && branch.getLast().kill() == false)
|
||||||
return false;
|
return false;
|
||||||
@ -208,7 +207,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return current.kill();
|
return current.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
|
|||||||
Ftile tmp = repeatList.createFtile(factory);
|
Ftile tmp = repeatList.createFtile(factory);
|
||||||
tmp = factory.createWhile(outColor, swimlane, tmp, test, yes, color, specialOut, back, incoming1, incoming2);
|
tmp = factory.createWhile(outColor, swimlane, tmp, test, yes, color, specialOut, back, incoming1, incoming2);
|
||||||
if (getPositionedNotes().size() > 0)
|
if (getPositionedNotes().size() > 0)
|
||||||
tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), skinParam, false, VerticalAlignment.CENTER);
|
tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), false, VerticalAlignment.CENTER);
|
||||||
|
|
||||||
if (killed || specialOut != null)
|
if (killed || specialOut != null)
|
||||||
return new FtileKilled(tmp);
|
return new FtileKilled(tmp);
|
||||||
|
@ -89,7 +89,7 @@ public interface FtileFactory {
|
|||||||
HColor color, Instruction specialOut, Ftile backward, LinkRendering incoming1, LinkRendering incoming2);
|
HColor color, Instruction specialOut, Ftile backward, LinkRendering incoming1, LinkRendering incoming2);
|
||||||
|
|
||||||
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering outColor,
|
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering outColor,
|
||||||
LinkRendering topInlinkRendering, Url url);
|
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes);
|
||||||
|
|
||||||
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
|
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
|
||||||
LinkRendering topInlinkRendering, Display labelTest);
|
LinkRendering topInlinkRendering, Display labelTest);
|
||||||
|
@ -120,47 +120,58 @@ public class FtileFactoryDelegator implements FtileFactory {
|
|||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile start(Swimlane swimlane) {
|
public Ftile start(Swimlane swimlane) {
|
||||||
return factory.start(swimlane);
|
return factory.start(swimlane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile end(Swimlane swimlane) {
|
public Ftile end(Swimlane swimlane) {
|
||||||
return factory.end(swimlane);
|
return factory.end(swimlane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile stop(Swimlane swimlane) {
|
public Ftile stop(Swimlane swimlane) {
|
||||||
return factory.stop(swimlane);
|
return factory.stop(swimlane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile spot(Swimlane swimlane, String spot, HColor color) {
|
public Ftile spot(Swimlane swimlane, String spot, HColor color) {
|
||||||
return factory.spot(swimlane, spot, color);
|
return factory.spot(swimlane, spot, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors, Stereotype stereotype) {
|
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors, Stereotype stereotype) {
|
||||||
return factory.activity(label, swimlane, style, colors, stereotype);
|
return factory.activity(label, swimlane, style, colors, stereotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes,
|
public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes,
|
||||||
VerticalAlignment verticalAlignment) {
|
VerticalAlignment verticalAlignment) {
|
||||||
return factory.addNote(ftile, swimlane, notes, verticalAlignment);
|
return factory.addNote(ftile, swimlane, notes, verticalAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile addUrl(Ftile ftile, Url url) {
|
public Ftile addUrl(Ftile ftile, Url url) {
|
||||||
return factory.addUrl(ftile, url);
|
return factory.addUrl(ftile, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile decorateIn(Ftile ftile, LinkRendering linkRendering) {
|
public Ftile decorateIn(Ftile ftile, LinkRendering linkRendering) {
|
||||||
return factory.decorateIn(ftile, Objects.requireNonNull(linkRendering));
|
return factory.decorateIn(ftile, Objects.requireNonNull(linkRendering));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile decorateOut(Ftile ftile, LinkRendering linkRendering) {
|
public Ftile decorateOut(Ftile ftile, LinkRendering linkRendering) {
|
||||||
return factory.decorateOut(ftile, Objects.requireNonNull(linkRendering));
|
return factory.decorateOut(ftile, Objects.requireNonNull(linkRendering));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile assembly(Ftile tile1, Ftile tile2) {
|
public Ftile assembly(Ftile tile1, Ftile tile2) {
|
||||||
return factory.assembly(tile1, tile2);
|
return factory.assembly(tile1, tile2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
|
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
|
||||||
Display test, Display yes, Display out, Colors colors, Ftile backward, boolean noOut,
|
Display test, Display yes, Display out, Colors colors, Ftile backward, boolean noOut,
|
||||||
LinkRendering incoming1, LinkRendering incoming2) {
|
LinkRendering incoming1, LinkRendering incoming2) {
|
||||||
@ -168,31 +179,37 @@ public class FtileFactoryDelegator implements FtileFactory {
|
|||||||
noOut, incoming1, incoming2);
|
noOut, incoming1, incoming2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile createWhile(LinkRendering outColor, Swimlane swimlane, Ftile whileBlock, Display test, Display yes,
|
public Ftile createWhile(LinkRendering outColor, Swimlane swimlane, Ftile whileBlock, Display test, Display yes,
|
||||||
HColor color, Instruction specialOut, Ftile back, LinkRendering incoming1, LinkRendering incoming2) {
|
HColor color, Instruction specialOut, Ftile back, LinkRendering incoming1, LinkRendering incoming2) {
|
||||||
return factory.createWhile(outColor, swimlane, whileBlock, test, yes, color, specialOut, back, incoming1,
|
return factory.createWhile(outColor, swimlane, whileBlock, test, yes, color, specialOut, back, incoming1,
|
||||||
incoming2);
|
incoming2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
||||||
LinkRendering topInlinkRendering, Url url) {
|
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes) {
|
||||||
return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url);
|
return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url, notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
|
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
|
||||||
LinkRendering topInlinkRendering, Display labelTest) {
|
LinkRendering topInlinkRendering, Display labelTest) {
|
||||||
return factory.createSwitch(swimlane, branches, afterEndwhile, topInlinkRendering, labelTest);
|
return factory.createSwitch(swimlane, branches, afterEndwhile, topInlinkRendering, labelTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile createParallel(List<Ftile> all, ForkStyle style, String label, Swimlane in, Swimlane out) {
|
public Ftile createParallel(List<Ftile> all, ForkStyle style, String label, Swimlane in, Swimlane out) {
|
||||||
return factory.createParallel(all, style, label, in, out);
|
return factory.createParallel(all, style, label, in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ftile createGroup(Ftile list, Display name, HColor backColor, PositionedNote note, USymbol type,
|
public Ftile createGroup(Ftile list, Display name, HColor backColor, PositionedNote note, USymbol type,
|
||||||
Style style) {
|
Style style) {
|
||||||
return factory.createGroup(list, name, backColor, note, type, style);
|
return factory.createGroup(list, name, backColor, note, type, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBounder getStringBounder() {
|
public StringBounder getStringBounder() {
|
||||||
return factory.getStringBounder();
|
return factory.getStringBounder();
|
||||||
}
|
}
|
||||||
@ -201,6 +218,7 @@ public class FtileFactoryDelegator implements FtileFactory {
|
|||||||
return rose;
|
return rose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final ISkinParam skinParam() {
|
public final ISkinParam skinParam() {
|
||||||
return factory.skinParam();
|
return factory.skinParam();
|
||||||
}
|
}
|
||||||
|
@ -56,30 +56,30 @@ public class FtileGeometry extends XDimension2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public XPoint2D getPointB() {
|
public XPoint2D getPointB() {
|
||||||
if (outY == Double.MIN_NORMAL) {
|
if (outY == Double.MIN_NORMAL)
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
|
||||||
return new XPoint2D(width, (inY + outY) / 2);
|
return new XPoint2D(width, (inY + outY) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XPoint2D getPointC() {
|
public XPoint2D getPointC() {
|
||||||
if (outY == Double.MIN_NORMAL) {
|
if (outY == Double.MIN_NORMAL)
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
|
||||||
return new XPoint2D(left, outY);
|
return new XPoint2D(left, outY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XPoint2D getPointD() {
|
public XPoint2D getPointD() {
|
||||||
if (outY == Double.MIN_NORMAL) {
|
if (outY == Double.MIN_NORMAL)
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
|
||||||
return new XPoint2D(0, (inY + outY) / 2);
|
return new XPoint2D(0, (inY + outY) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XPoint2D getPointOut() {
|
public XPoint2D getPointOut() {
|
||||||
if (outY == Double.MIN_NORMAL) {
|
if (outY == Double.MIN_NORMAL)
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
|
||||||
return new XPoint2D(left, outY);
|
return new XPoint2D(left, outY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +134,10 @@ public class FtileGeometry extends XDimension2D {
|
|||||||
hasPointOut() ? outY + missing1 : outY);
|
hasPointOut() ? outY + missing1 : outY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FtileGeometry incInY(double missing) {
|
||||||
|
return new FtileGeometry(width, height, left, inY + missing, outY);
|
||||||
|
}
|
||||||
|
|
||||||
public FtileGeometry(XDimension2D dim, double left, double inY, double outY) {
|
public FtileGeometry(XDimension2D dim, double left, double inY, double outY) {
|
||||||
this(dim.getWidth(), dim.getHeight(), left, inY, outY);
|
this(dim.getWidth(), dim.getHeight(), left, inY, outY);
|
||||||
}
|
}
|
||||||
@ -149,9 +153,9 @@ public class FtileGeometry extends XDimension2D {
|
|||||||
public FtileGeometry translate(UTranslate translate) {
|
public FtileGeometry translate(UTranslate translate) {
|
||||||
final double dx = translate.getDx();
|
final double dx = translate.getDx();
|
||||||
final double dy = translate.getDy();
|
final double dy = translate.getDy();
|
||||||
if (this.outY == Double.MIN_NORMAL) {
|
if (this.outY == Double.MIN_NORMAL)
|
||||||
return new FtileGeometry(width, height, left + dx, inY + dy);
|
return new FtileGeometry(width, height, left + dx, inY + dy);
|
||||||
}
|
|
||||||
return new FtileGeometry(width, height, left + dx, inY + dy, outY + dy);
|
return new FtileGeometry(width, height, left + dx, inY + dy, outY + dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,19 +204,18 @@ public class FtileGeometry extends XDimension2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FtileGeometry ensureHeight(double newHeight) {
|
public FtileGeometry ensureHeight(double newHeight) {
|
||||||
if (this.height > newHeight) {
|
if (this.height > newHeight)
|
||||||
return this;
|
return this;
|
||||||
}
|
|
||||||
return fixedHeight(newHeight);
|
return fixedHeight(newHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FtileGeometry ensureRightStrange(double newRight) {
|
// private FtileGeometry ensureRightStrange(double newRight) {
|
||||||
final double right = this.width - this.left;
|
// final double right = this.width - this.left;
|
||||||
if (right > newRight) {
|
// if (right > newRight)
|
||||||
return this;
|
// return this;
|
||||||
}
|
//
|
||||||
// return addMarginX(0, newRight - right);
|
// return addMarginX(0, newRight);
|
||||||
return addMarginX(0, newRight);
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,6 @@ public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator {
|
|||||||
if (notes.size() == 0)
|
if (notes.size() == 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
|
||||||
// if (notes.size() > 1)
|
|
||||||
// throw new IllegalArgumentException();
|
|
||||||
|
|
||||||
ISkinParam skinParam = skinParam();
|
ISkinParam skinParam = skinParam();
|
||||||
if (ftile == null) {
|
if (ftile == null) {
|
||||||
final PositionedNote note = notes.iterator().next();
|
final PositionedNote note = notes.iterator().next();
|
||||||
@ -70,6 +67,6 @@ public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator {
|
|||||||
return new FtileNoteAlone(skinParam.shadowing(null), note.getDisplay(), skinParam,
|
return new FtileNoteAlone(skinParam.shadowing(null), note.getDisplay(), skinParam,
|
||||||
note.getType() == NoteType.NOTE, swimlane);
|
note.getType() == NoteType.NOTE, swimlane);
|
||||||
}
|
}
|
||||||
return FtileWithNoteOpale.create(ftile, notes, skinParam, true, verticalAlignment);
|
return FtileWithNoteOpale.create(ftile, notes, true, verticalAlignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator {
|
|||||||
Style style) {
|
Style style) {
|
||||||
Ftile result = new FtileGroup(list, name, backColor, skinParam(), type, style);
|
Ftile result = new FtileGroup(list, name, backColor, skinParam(), type, style);
|
||||||
if (note != null)
|
if (note != null)
|
||||||
result = new FtileWithNotes(result, Collections.singleton(note), skinParam(), VerticalAlignment.CENTER);
|
result = new FtileWithNotes(result, Collections.singleton(note), VerticalAlignment.CENTER);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,12 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
|
||||||
@ -63,7 +65,7 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
||||||
LinkRendering topInlinkRendering, Url url) {
|
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes) {
|
||||||
|
|
||||||
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
|
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
|
||||||
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
|
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
|
||||||
@ -84,7 +86,7 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
|
|||||||
topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
|
topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
|
||||||
}
|
}
|
||||||
return ConditionalBuilder.create(swimlane, backColor, getFactory(), conditionStyle, conditionEndStyle,
|
return ConditionalBuilder.create(swimlane, backColor, getFactory(), conditionStyle, conditionEndStyle,
|
||||||
thens.get(0), elseBranch, skinParam(), getStringBounder(), url, styleArrow, styleDiamond);
|
thens.get(0), elseBranch, skinParam(), getStringBounder(), url, styleArrow, styleDiamond, notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
@ -55,6 +56,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileIfWithDiamonds;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||||
import net.sourceforge.plantuml.decoration.Rainbow;
|
import net.sourceforge.plantuml.decoration.Rainbow;
|
||||||
@ -63,6 +65,8 @@ import net.sourceforge.plantuml.klimt.drawing.UGraphic;
|
|||||||
import net.sourceforge.plantuml.klimt.font.StringBounder;
|
import net.sourceforge.plantuml.klimt.font.StringBounder;
|
||||||
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
||||||
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
|
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
|
||||||
|
import net.sourceforge.plantuml.klimt.shape.TextBlock;
|
||||||
|
import net.sourceforge.plantuml.klimt.shape.TextBlockUtils;
|
||||||
import net.sourceforge.plantuml.klimt.shape.UEmpty;
|
import net.sourceforge.plantuml.klimt.shape.UEmpty;
|
||||||
import net.sourceforge.plantuml.svek.ConditionEndStyle;
|
import net.sourceforge.plantuml.svek.ConditionEndStyle;
|
||||||
import net.sourceforge.plantuml.utils.Direction;
|
import net.sourceforge.plantuml.utils.Direction;
|
||||||
@ -74,6 +78,7 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
private final Ftile diamond2;
|
private final Ftile diamond2;
|
||||||
private final Ftile optionalStop;
|
private final Ftile optionalStop;
|
||||||
private final ConditionEndStyle conditionEndStyle;
|
private final ConditionEndStyle conditionEndStyle;
|
||||||
|
final private TextBlock opale;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Ftile> getMyChildren() {
|
public Collection<Ftile> getMyChildren() {
|
||||||
@ -101,23 +106,30 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private FtileIfDown(Ftile thenBlock, Ftile diamond1, Ftile diamond2, Ftile optionalStop,
|
private FtileIfDown(Ftile thenBlock, Ftile diamond1, Ftile diamond2, Ftile optionalStop,
|
||||||
ConditionEndStyle conditionEndStyle) {
|
ConditionEndStyle conditionEndStyle, Collection<PositionedNote> notes) {
|
||||||
super(thenBlock.skinParam());
|
super(thenBlock.skinParam());
|
||||||
this.thenBlock = thenBlock;
|
this.thenBlock = thenBlock;
|
||||||
this.diamond1 = diamond1;
|
this.diamond1 = diamond1;
|
||||||
this.diamond2 = diamond2;
|
this.diamond2 = diamond2;
|
||||||
this.optionalStop = optionalStop;
|
this.optionalStop = optionalStop;
|
||||||
this.conditionEndStyle = conditionEndStyle;
|
this.conditionEndStyle = conditionEndStyle;
|
||||||
|
if (notes.size() == 1) {
|
||||||
|
final PositionedNote first = notes.iterator().next();
|
||||||
|
this.opale = FtileIfWithDiamonds.createOpale(first, skinParam());
|
||||||
|
} else {
|
||||||
|
this.opale = TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Ftile create(Ftile diamond1, Ftile diamond2, Swimlane swimlane, Ftile thenBlock, Rainbow arrowColor,
|
public static Ftile create(Ftile diamond1, Ftile diamond2, Swimlane swimlane, Ftile thenBlock, Rainbow arrowColor,
|
||||||
ConditionEndStyle conditionEndStyle, FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor) {
|
ConditionEndStyle conditionEndStyle, FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor,
|
||||||
|
Collection<PositionedNote> notes) {
|
||||||
|
|
||||||
elseColor = elseColor.withDefault(arrowColor);
|
elseColor = elseColor.withDefault(arrowColor);
|
||||||
|
|
||||||
final FtileIfDown result = new FtileIfDown(thenBlock, diamond1,
|
final FtileIfDown result = new FtileIfDown(thenBlock, diamond1,
|
||||||
optionalStop == null ? diamond2 : new FtileEmpty(ftileFactory.skinParam()), optionalStop,
|
optionalStop == null ? diamond2 : new FtileEmpty(ftileFactory.skinParam()), optionalStop,
|
||||||
conditionEndStyle);
|
conditionEndStyle, notes);
|
||||||
|
|
||||||
final List<Connection> conns = new ArrayList<>();
|
final List<Connection> conns = new ArrayList<>();
|
||||||
conns.add(result.new ConnectionIn(thenBlock.getInLinkRendering().getRainbow(arrowColor)));
|
conns.add(result.new ConnectionIn(thenBlock.getInLinkRendering().getRainbow(arrowColor)));
|
||||||
@ -511,6 +523,13 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
|
|
||||||
|
if (TextBlockUtils.isEmpty(opale, stringBounder) == false) {
|
||||||
|
final double xOpale = getTranslateDiamond1(stringBounder).getDx()
|
||||||
|
- opale.calculateDimension(stringBounder).getWidth();
|
||||||
|
opale.drawU(ug.apply(UTranslate.dx(xOpale)));
|
||||||
|
}
|
||||||
|
|
||||||
ug.apply(getTranslateForThen(stringBounder)).draw(thenBlock);
|
ug.apply(getTranslateForThen(stringBounder)).draw(thenBlock);
|
||||||
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
|
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
|
||||||
if (optionalStop == null)
|
if (optionalStop == null)
|
||||||
@ -522,17 +541,35 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||||
|
|
||||||
|
final XDimension2D dimOpale = opale.calculateDimension(stringBounder);
|
||||||
|
|
||||||
final FtileGeometry geoDiamond1 = diamond1.calculateDimension(stringBounder);
|
final FtileGeometry geoDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||||
final FtileGeometry geoThen = thenBlock.calculateDimension(stringBounder);
|
final FtileGeometry geoThen = thenBlock.calculateDimension(stringBounder);
|
||||||
final FtileGeometry geoDiamond2 = diamond2.calculateDimension(stringBounder);
|
final FtileGeometry geoDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||||
final FtileGeometry geo = geoDiamond1.appendBottom(geoThen).appendBottom(geoDiamond2);
|
final FtileGeometry geo = geoDiamond1.appendBottom(geoThen).appendBottom(geoDiamond2);
|
||||||
|
|
||||||
|
final double opaleWidth = dimOpale.getWidth();
|
||||||
|
final double opaleHeight = dimOpale.getHeight();
|
||||||
|
|
||||||
final double height = geo.getHeight() + 3 * Hexagon.hexagonHalfSize
|
final double height = geo.getHeight() + 3 * Hexagon.hexagonHalfSize
|
||||||
+ Math.max(Hexagon.hexagonHalfSize * 1, getSouthLabelHeight(stringBounder));
|
+ Math.max(Hexagon.hexagonHalfSize * 1, getSouthLabelHeight(stringBounder)) + opaleHeight;
|
||||||
double width = geo.getWidth() + Hexagon.hexagonHalfSize;
|
|
||||||
|
double supp = 0;
|
||||||
|
if (opaleWidth > geo.getLeft())
|
||||||
|
supp = opaleWidth - geo.getLeft();
|
||||||
|
|
||||||
|
double width = supp + geo.getWidth() + Hexagon.hexagonHalfSize;
|
||||||
if (optionalStop != null)
|
if (optionalStop != null)
|
||||||
width += optionalStop.calculateDimension(stringBounder).getWidth() + getAdditionalWidth(stringBounder);
|
width += optionalStop.calculateDimension(stringBounder).getWidth() + getAdditionalWidth(stringBounder);
|
||||||
|
|
||||||
final FtileGeometry result = new FtileGeometry(width, height, geo.getLeft(), geoDiamond1.getInY(), height);
|
final FtileGeometry result;
|
||||||
|
if (supp > 0)
|
||||||
|
result = new FtileGeometry(width, height, opaleWidth + geoDiamond1.getLeft(),
|
||||||
|
geoDiamond1.getInY() + opaleHeight, height);
|
||||||
|
else
|
||||||
|
result = new FtileGeometry(width, height, geo.getLeft(), geoDiamond1.getInY() + opaleHeight, height);
|
||||||
|
|
||||||
if (geoThen.hasPointOut() == false && optionalStop != null)
|
if (geoThen.hasPointOut() == false && optionalStop != null)
|
||||||
return result.withoutPointOut();
|
return result.withoutPointOut();
|
||||||
|
|
||||||
@ -591,8 +628,9 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
final FtileGeometry dimTotal = calculateDimension(stringBounder);
|
final FtileGeometry dimTotal = calculateDimension(stringBounder);
|
||||||
final FtileGeometry dimThen = thenBlock.calculateDimension(stringBounder);
|
final FtileGeometry dimThen = thenBlock.calculateDimension(stringBounder);
|
||||||
|
|
||||||
final double y = dimDiamond1.getHeight()
|
final double opaleHeight = opale.calculateDimension(stringBounder).getHeight();
|
||||||
+ (dimTotal.getHeight() - dimDiamond1.getHeight() - dimDiamond2.getHeight() - dimThen.getHeight()) / 2;
|
final double y = opaleHeight + dimDiamond1.getHeight() + (dimTotal.getHeight() - opaleHeight
|
||||||
|
- dimDiamond1.getHeight() - dimDiamond2.getHeight() - dimThen.getHeight()) / 2;
|
||||||
|
|
||||||
final double x = dimTotal.getLeft() - dimThen.getLeft();
|
final double x = dimTotal.getLeft() - dimThen.getLeft();
|
||||||
return new UTranslate(x, y);
|
return new UTranslate(x, y);
|
||||||
@ -602,7 +640,7 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
private UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
private UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
||||||
final FtileGeometry dimTotal = calculateDimension(stringBounder);
|
final FtileGeometry dimTotal = calculateDimension(stringBounder);
|
||||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||||
final double y1 = 0;
|
final double y1 = opale.calculateDimension(stringBounder).getHeight();
|
||||||
final double x1 = dimTotal.getLeft() - dimDiamond1.getLeft();
|
final double x1 = dimTotal.getLeft() - dimDiamond1.getLeft();
|
||||||
return new UTranslate(x1, y1);
|
return new UTranslate(x1, y1);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ import net.sourceforge.plantuml.klimt.shape.TextBlock;
|
|||||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||||
import net.sourceforge.plantuml.skin.AlignmentParam;
|
import net.sourceforge.plantuml.skin.AlignmentParam;
|
||||||
import net.sourceforge.plantuml.style.ISkinParam;
|
|
||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
@ -111,31 +110,28 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
|
|||||||
return Collections.singleton(tile);
|
return Collections.singleton(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Ftile create(Ftile tile, Collection<PositionedNote> notes, ISkinParam skinParam, boolean withLink,
|
public static Ftile create(Ftile tile, Collection<PositionedNote> notes, boolean withLink,
|
||||||
VerticalAlignment verticalAlignment) {
|
VerticalAlignment verticalAlignment) {
|
||||||
if (notes.size() > 1)
|
if (notes.size() > 1)
|
||||||
return new FtileWithNotes(tile, notes, skinParam, verticalAlignment);
|
return new FtileWithNotes(tile, notes, verticalAlignment);
|
||||||
|
|
||||||
if (notes.size() == 0)
|
if (notes.size() == 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
|
||||||
return new FtileWithNoteOpale(tile, notes.iterator().next(), skinParam, withLink, verticalAlignment);
|
return new FtileWithNoteOpale(tile, notes.iterator().next(), withLink, verticalAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FtileWithNoteOpale(Ftile tile, PositionedNote note, ISkinParam skinParam, boolean withLink,
|
private FtileWithNoteOpale(Ftile tile, PositionedNote note, boolean withLink, VerticalAlignment verticalAlignment) {
|
||||||
VerticalAlignment verticalAlignment) {
|
super(note.getColors() == null ? tile.skinParam() : note.getColors().mute(tile.skinParam()));
|
||||||
super(tile.skinParam());
|
|
||||||
this.verticalAlignment = verticalAlignment;
|
this.verticalAlignment = verticalAlignment;
|
||||||
this.swimlaneNote = note.getSwimlaneNote();
|
this.swimlaneNote = note.getSwimlaneNote();
|
||||||
if (note.getColors() != null)
|
|
||||||
skinParam = note.getColors().mute(skinParam);
|
|
||||||
|
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
this.notePosition = note.getNotePosition();
|
this.notePosition = note.getNotePosition();
|
||||||
if (note.getType() == NoteType.FLOATING_NOTE)
|
if (note.getType() == NoteType.FLOATING_NOTE)
|
||||||
withLink = false;
|
withLink = false;
|
||||||
|
|
||||||
final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder())
|
final Style style = getStyleSignature().getMergedStyle(skinParam().getCurrentStyleBuilder())
|
||||||
.eventuallyOverride(note.getColors());
|
.eventuallyOverride(note.getColors());
|
||||||
final HColor noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
|
final HColor noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
|
||||||
final HColor borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
|
final HColor borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
|
||||||
@ -144,10 +140,11 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
|
|||||||
final LineBreakStrategy wrapWidth = style.wrapWidth();
|
final LineBreakStrategy wrapWidth = style.wrapWidth();
|
||||||
final UStroke stroke = style.getStroke();
|
final UStroke stroke = style.getStroke();
|
||||||
|
|
||||||
final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null,
|
final HorizontalAlignment align = skinParam().getHorizontalAlignment(AlignmentParam.noteTextAlignment, null,
|
||||||
false, null);
|
false, null);
|
||||||
final Sheet sheet = skinParam.sheet(fc, align, CreoleMode.FULL).createSheet(note.getDisplay());
|
final Sheet sheet = skinParam().sheet(fc, align, CreoleMode.FULL).createSheet(note.getDisplay());
|
||||||
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this, stroke);
|
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam().getPadding()), this,
|
||||||
|
stroke);
|
||||||
opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, withLink, stroke);
|
opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, withLink, stroke);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,18 +96,17 @@ public class FtileWithNotes extends AbstractFtile {
|
|||||||
return tile.getSwimlaneOut();
|
return tile.getSwimlaneOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileWithNotes(Ftile tile, Collection<PositionedNote> notes, ISkinParam skinParam,
|
public FtileWithNotes(Ftile tile, Collection<PositionedNote> notes, VerticalAlignment verticalAlignment) {
|
||||||
VerticalAlignment verticalAlignment) {
|
|
||||||
super(tile.skinParam());
|
super(tile.skinParam());
|
||||||
this.verticalAlignment = verticalAlignment;
|
this.verticalAlignment = verticalAlignment;
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
|
|
||||||
for (PositionedNote note : notes) {
|
for (PositionedNote note : notes) {
|
||||||
ISkinParam skinParam2 = skinParam;
|
ISkinParam skinParam2 = skinParam();
|
||||||
if (note.getColors() != null)
|
if (note.getColors() != null)
|
||||||
skinParam2 = note.getColors().mute(skinParam2);
|
skinParam2 = note.getColors().mute(skinParam2);
|
||||||
|
|
||||||
final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder())
|
final Style style = getStyleSignature().getMergedStyle(skinParam().getCurrentStyleBuilder())
|
||||||
.eventuallyOverride(note.getColors());
|
.eventuallyOverride(note.getColors());
|
||||||
final HColor noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
|
final HColor noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
|
||||||
final HColor borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
|
final HColor borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
|
||||||
@ -116,10 +115,10 @@ public class FtileWithNotes extends AbstractFtile {
|
|||||||
final LineBreakStrategy wrapWidth = style.wrapWidth();
|
final LineBreakStrategy wrapWidth = style.wrapWidth();
|
||||||
final UStroke stroke = style.getStroke();
|
final UStroke stroke = style.getStroke();
|
||||||
|
|
||||||
final Sheet sheet = skinParam
|
final Sheet sheet = skinParam()
|
||||||
.sheet(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
|
.sheet(fc, skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
|
||||||
.createSheet(note.getDisplay());
|
.createSheet(note.getDisplay());
|
||||||
final SheetBlock1 sheet1 = new SheetBlock1(sheet, wrapWidth, skinParam.getPadding());
|
final SheetBlock1 sheet1 = new SheetBlock1(sheet, wrapWidth, skinParam().getPadding());
|
||||||
final SheetBlock2 sheet2 = new SheetBlock2(sheet1, new Stencil() {
|
final SheetBlock2 sheet2 = new SheetBlock2(sheet1, new Stencil() {
|
||||||
// -6 and 15 value comes from Opale: this is very ugly!
|
// -6 and 15 value comes from Opale: this is very ugly!
|
||||||
public double getStartingX(StringBounder stringBounder, double y) {
|
public double getStartingX(StringBounder stringBounder, double y) {
|
||||||
|
@ -177,7 +177,7 @@ public class VCompactFactory implements FtileFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
||||||
LinkRendering topInlinkRendering, Url url) {
|
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes) {
|
||||||
final List<Ftile> ftiles = new ArrayList<>();
|
final List<Ftile> ftiles = new ArrayList<>();
|
||||||
for (Branch branch : thens)
|
for (Branch branch : thens)
|
||||||
ftiles.add(branch.getFtile());
|
ftiles.add(branch.getFtile());
|
||||||
|
@ -35,7 +35,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
@ -92,6 +95,7 @@ public class ConditionalBuilder {
|
|||||||
private final Ftile tile1;
|
private final Ftile tile1;
|
||||||
private final Ftile tile2;
|
private final Ftile tile2;
|
||||||
private final Url url;
|
private final Url url;
|
||||||
|
private final Collection<PositionedNote> notes;
|
||||||
|
|
||||||
private StyleSignatureBasic getStyleSignatureDiamond() {
|
private StyleSignatureBasic getStyleSignatureDiamond() {
|
||||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||||
@ -103,7 +107,8 @@ public class ConditionalBuilder {
|
|||||||
|
|
||||||
public ConditionalBuilder(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
|
public ConditionalBuilder(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
|
||||||
ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
|
ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
|
||||||
ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond) {
|
ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond,
|
||||||
|
Collection<PositionedNote> notes) {
|
||||||
|
|
||||||
if (backColor == null)
|
if (backColor == null)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
@ -113,6 +118,7 @@ public class ConditionalBuilder {
|
|||||||
this.diamondLineBreak = styleDiamond.wrapWidth();
|
this.diamondLineBreak = styleDiamond.wrapWidth();
|
||||||
this.labelLineBreak = styleArrow.wrapWidth();
|
this.labelLineBreak = styleArrow.wrapWidth();
|
||||||
this.backColor = backColor;
|
this.backColor = backColor;
|
||||||
|
this.notes = notes;
|
||||||
|
|
||||||
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
||||||
this.arrowColor = Rainbow.build(styleArrow, skinParam.getIHtmlColorSet());
|
this.arrowColor = Rainbow.build(styleArrow, skinParam.getIHtmlColorSet());
|
||||||
@ -134,9 +140,10 @@ public class ConditionalBuilder {
|
|||||||
|
|
||||||
static public Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
|
static public Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
|
||||||
ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
|
ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
|
||||||
ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond) {
|
ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond,
|
||||||
|
Collection<PositionedNote> notes) {
|
||||||
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, backColor, ftileFactory, conditionStyle,
|
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, backColor, ftileFactory, conditionStyle,
|
||||||
conditionEndStyle, branch1, branch2, skinParam, stringBounder, url, styleArrow, styleDiamond);
|
conditionEndStyle, branch1, branch2, skinParam, stringBounder, url, styleArrow, styleDiamond, notes);
|
||||||
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false)
|
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false)
|
||||||
return builder.createDown(builder.branch1, builder.branch2);
|
return builder.createDown(builder.branch1, builder.branch2);
|
||||||
|
|
||||||
@ -167,18 +174,18 @@ public class ConditionalBuilder {
|
|||||||
final Ftile diamond2 = getShape2(branch1, branch2, true);
|
final Ftile diamond2 = getShape2(branch1, branch2, true);
|
||||||
if (branch2.isOnlySingleStopOrSpot())
|
if (branch2.isOnlySingleStopOrSpot())
|
||||||
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
|
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
|
||||||
arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(), branch2.getOut());
|
arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(), branch2.getOut(), notes);
|
||||||
|
|
||||||
if (branch1.isOnlySingleStopOrSpot())
|
if (branch1.isOnlySingleStopOrSpot())
|
||||||
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
|
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
|
||||||
arrowColor, conditionEndStyle, ftileFactory, branch1.getFtile(), branch1.getOut());
|
arrowColor, conditionEndStyle, ftileFactory, branch1.getFtile(), branch1.getOut(), notes);
|
||||||
|
|
||||||
if (branch1.isEmpty())
|
if (branch1.isEmpty())
|
||||||
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
|
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
|
||||||
arrowColor, conditionEndStyle, ftileFactory, null, null);
|
arrowColor, conditionEndStyle, ftileFactory, null, null, notes);
|
||||||
|
|
||||||
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor,
|
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor,
|
||||||
conditionEndStyle, ftileFactory, null, branch2.getOut());
|
conditionEndStyle, ftileFactory, null, branch2.getOut(), notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ftile createNude() {
|
private Ftile createNude() {
|
||||||
@ -190,7 +197,7 @@ public class ConditionalBuilder {
|
|||||||
final Ftile diamond1 = getDiamond1(true);
|
final Ftile diamond1 = getDiamond1(true);
|
||||||
final Ftile diamond2 = getShape2(branch1, branch2, false);
|
final Ftile diamond2 = getShape2(branch1, branch2, false);
|
||||||
final FtileIfWithDiamonds ftile = new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane,
|
final FtileIfWithDiamonds ftile = new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane,
|
||||||
stringBounder);
|
stringBounder, notes);
|
||||||
final XDimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
|
final XDimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
|
||||||
final XDimension2D label2 = getLabelPositive(branch2).calculateDimension(stringBounder);
|
final XDimension2D label2 = getLabelPositive(branch2).calculateDimension(stringBounder);
|
||||||
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
|
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
|
||||||
@ -210,7 +217,7 @@ public class ConditionalBuilder {
|
|||||||
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
|
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
|
||||||
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
|
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
|
||||||
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
|
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
|
||||||
conditionEndStyle, stringBounder);
|
conditionEndStyle, stringBounder, notes);
|
||||||
final XDimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
|
final XDimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
|
||||||
final XDimension2D label2 = getLabelPositive(branch2).calculateDimension(stringBounder);
|
final XDimension2D label2 = getLabelPositive(branch2).calculateDimension(stringBounder);
|
||||||
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
|
final double diff1 = ftile.computeMarginNeedForBranchLabe1(stringBounder, label1);
|
||||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
|
|||||||
import net.sourceforge.plantuml.style.ISkinParam;
|
import net.sourceforge.plantuml.style.ISkinParam;
|
||||||
|
|
||||||
public abstract class FtileDimensionMemoize extends AbstractFtile {
|
public abstract class FtileDimensionMemoize extends AbstractFtile {
|
||||||
// ::remove folder when __HAXE__
|
// ::remove folder when __HAXE__
|
||||||
|
|
||||||
public FtileDimensionMemoize(ISkinParam skinParam) {
|
public FtileDimensionMemoize(ISkinParam skinParam) {
|
||||||
super(skinParam);
|
super(skinParam);
|
||||||
@ -50,11 +50,15 @@ public abstract class FtileDimensionMemoize extends AbstractFtile {
|
|||||||
private FtileGeometry calculateDimensionInternal;
|
private FtileGeometry calculateDimensionInternal;
|
||||||
|
|
||||||
protected final FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
|
protected final FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
|
||||||
if (calculateDimensionInternal == null) {
|
if (calculateDimensionInternal == null)
|
||||||
calculateDimensionInternal = calculateDimensionInternalSlow(stringBounder);
|
calculateDimensionInternal = calculateDimensionInternalSlow(stringBounder);
|
||||||
}
|
|
||||||
return calculateDimensionInternal;
|
return calculateDimensionInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final void clearCacheDimensionInternal() {
|
||||||
|
calculateDimensionInternal = null;
|
||||||
|
}
|
||||||
|
|
||||||
abstract protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder);
|
abstract protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder);
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,9 @@ public class FtileIfNude extends FtileDimensionMemoize {
|
|||||||
protected final Ftile tile2;
|
protected final Ftile tile2;
|
||||||
private final Swimlane in;
|
private final Swimlane in;
|
||||||
|
|
||||||
|
protected double xDeltaNote = 0;
|
||||||
|
protected double yDeltaNote = 0;
|
||||||
|
|
||||||
FtileIfNude(Ftile tile1, Ftile tile2, Swimlane in) {
|
FtileIfNude(Ftile tile1, Ftile tile2, Swimlane in) {
|
||||||
super(tile1.skinParam());
|
super(tile1.skinParam());
|
||||||
this.tile1 = tile1;
|
this.tile1 = tile1;
|
||||||
@ -74,9 +77,9 @@ public class FtileIfNude extends FtileDimensionMemoize {
|
|||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
public Set<Swimlane> getSwimlanes() {
|
||||||
final Set<Swimlane> result = new HashSet<>();
|
final Set<Swimlane> result = new HashSet<>();
|
||||||
if (getSwimlaneIn() != null) {
|
if (getSwimlaneIn() != null)
|
||||||
result.add(getSwimlaneIn());
|
result.add(getSwimlaneIn());
|
||||||
}
|
|
||||||
result.addAll(tile1.getSwimlanes());
|
result.addAll(tile1.getSwimlanes());
|
||||||
result.addAll(tile2.getSwimlanes());
|
result.addAll(tile2.getSwimlanes());
|
||||||
return Collections.unmodifiableSet(result);
|
return Collections.unmodifiableSet(result);
|
||||||
@ -90,50 +93,47 @@ public class FtileIfNude extends FtileDimensionMemoize {
|
|||||||
return getSwimlaneIn();
|
return getSwimlaneIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UTranslate getTranslate1(StringBounder stringBounder) {
|
protected UTranslate getTranslateBranch1(StringBounder stringBounder) {
|
||||||
// final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
final double x1 = xDeltaNote;
|
||||||
// final Dimension2D dim1 = tile1.calculateDimension(stringBounder);
|
final double y1 = yDeltaNote;
|
||||||
|
|
||||||
final double x1 = 0;
|
|
||||||
final double y1 = 0;
|
|
||||||
return new UTranslate(x1, y1);
|
return new UTranslate(x1, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UTranslate getTranslate2(StringBounder stringBounder) {
|
protected UTranslate getTranslateBranch2(StringBounder stringBounder) {
|
||||||
final XDimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
final XDimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||||
final XDimension2D dim2 = tile2.calculateDimension(stringBounder);
|
final XDimension2D dim2 = tile2.calculateDimension(stringBounder);
|
||||||
|
|
||||||
final double x2 = dimTotal.getWidth() - dim2.getWidth();
|
final double x2 = dimTotal.getWidth() - dim2.getWidth();
|
||||||
final double y2 = 0;
|
final double y2 = yDeltaNote;
|
||||||
return new UTranslate(x2, y2);
|
return new UTranslate(x2, y2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||||
if (child == tile1) {
|
if (child == tile1)
|
||||||
return getTranslate1(stringBounder);
|
return getTranslateBranch1(stringBounder);
|
||||||
}
|
|
||||||
if (child == tile2) {
|
if (child == tile2)
|
||||||
return getTranslate2(stringBounder);
|
return getTranslateBranch2(stringBounder);
|
||||||
}
|
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
|
|
||||||
ug.apply(getTranslate1(stringBounder)).draw(tile1);
|
ug.apply(getTranslateBranch1(stringBounder)).draw(tile1);
|
||||||
ug.apply(getTranslate2(stringBounder)).draw(tile2);
|
ug.apply(getTranslateBranch2(stringBounder)).draw(tile2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||||
if (tile1.calculateDimension(stringBounder).hasPointOut()
|
if (tile1.calculateDimension(stringBounder).hasPointOut()
|
||||||
|| tile2.calculateDimension(stringBounder).hasPointOut()) {
|
|| tile2.calculateDimension(stringBounder).hasPointOut())
|
||||||
return dimTotal;
|
return dimTotal;
|
||||||
}
|
|
||||||
return dimTotal.withoutPointOut();
|
return dimTotal.withoutPointOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,11 +143,12 @@ public class FtileIfNude extends FtileDimensionMemoize {
|
|||||||
final FtileGeometry dim2 = tile2.calculateDimension(stringBounder);
|
final FtileGeometry dim2 = tile2.calculateDimension(stringBounder);
|
||||||
|
|
||||||
final double innerMargin = widthInner(stringBounder);
|
final double innerMargin = widthInner(stringBounder);
|
||||||
final double width = dim1.getLeft() + innerMargin + (dim2.getWidth() - dim2.getLeft());
|
final double width = xDeltaNote + dim1.getLeft() + innerMargin + (dim2.getWidth() - dim2.getLeft());
|
||||||
|
|
||||||
final XDimension2D dim12 = dim1.mergeLR(dim2);
|
final XDimension2D dim12 = dim1.mergeLR(dim2);
|
||||||
|
|
||||||
return new FtileGeometry(width, dim12.getHeight(), dim1.getLeft() + innerMargin / 2, 0);
|
final double height = yDeltaNote + dim12.getHeight();
|
||||||
|
return new FtileGeometry(width, height, xDeltaNote + dim1.getLeft() + innerMargin / 2, yDeltaNote, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double widthInner(StringBounder stringBounder) {
|
protected double widthInner(StringBounder stringBounder) {
|
||||||
|
@ -38,25 +38,81 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
|
import net.sourceforge.plantuml.klimt.LineBreakStrategy;
|
||||||
|
import net.sourceforge.plantuml.klimt.UStroke;
|
||||||
import net.sourceforge.plantuml.klimt.UTranslate;
|
import net.sourceforge.plantuml.klimt.UTranslate;
|
||||||
|
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||||
|
import net.sourceforge.plantuml.klimt.creole.CreoleMode;
|
||||||
|
import net.sourceforge.plantuml.klimt.creole.Sheet;
|
||||||
|
import net.sourceforge.plantuml.klimt.creole.SheetBlock1;
|
||||||
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
|
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
|
||||||
|
import net.sourceforge.plantuml.klimt.font.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.klimt.font.StringBounder;
|
import net.sourceforge.plantuml.klimt.font.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
||||||
|
import net.sourceforge.plantuml.klimt.shape.TextBlock;
|
||||||
|
import net.sourceforge.plantuml.klimt.shape.TextBlockUtils;
|
||||||
|
import net.sourceforge.plantuml.skin.AlignmentParam;
|
||||||
|
import net.sourceforge.plantuml.style.ISkinParam;
|
||||||
|
import net.sourceforge.plantuml.style.PName;
|
||||||
|
import net.sourceforge.plantuml.style.SName;
|
||||||
|
import net.sourceforge.plantuml.style.Style;
|
||||||
|
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||||
|
import net.sourceforge.plantuml.svek.image.Opale;
|
||||||
|
|
||||||
public class FtileIfWithDiamonds extends FtileIfNude {
|
public class FtileIfWithDiamonds extends FtileIfNude {
|
||||||
|
|
||||||
private static final double SUPP_WIDTH = 20;
|
private static final double SUPP_WIDTH = 20;
|
||||||
protected final Ftile diamond1;
|
protected final Ftile diamond1;
|
||||||
protected final Ftile diamond2;
|
protected final Ftile diamond2;
|
||||||
|
final private TextBlock opale;
|
||||||
|
|
||||||
public FtileIfWithDiamonds(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in,
|
public FtileIfWithDiamonds(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in,
|
||||||
StringBounder stringBounder) {
|
StringBounder stringBounder, Collection<PositionedNote> notes) {
|
||||||
super(tile1, tile2, in);
|
super(tile1, tile2, in);
|
||||||
this.diamond1 = diamond1;
|
this.diamond1 = diamond1;
|
||||||
this.diamond2 = diamond2;
|
this.diamond2 = diamond2;
|
||||||
|
if (notes.size() == 1) {
|
||||||
|
final PositionedNote first = notes.iterator().next();
|
||||||
|
this.opale = createOpale(first, skinParam());
|
||||||
|
final double pos1 = getTranslateDiamond1(stringBounder).getDx();
|
||||||
|
final XDimension2D dimOpale = opale.calculateDimension(stringBounder);
|
||||||
|
final double opaleWith = dimOpale.getWidth();
|
||||||
|
if (opaleWith > pos1)
|
||||||
|
xDeltaNote = opaleWith - pos1;
|
||||||
|
|
||||||
|
yDeltaNote = dimOpale.getHeight();
|
||||||
|
clearCacheDimensionInternal();
|
||||||
|
} else {
|
||||||
|
this.opale = TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Opale createOpale(final PositionedNote first, ISkinParam skinParam) {
|
||||||
|
final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder())
|
||||||
|
.eventuallyOverride(first.getColors());
|
||||||
|
final HColor noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
|
||||||
|
final HColor borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
||||||
|
final FontConfiguration fc = style.getFontConfiguration(skinParam.getIHtmlColorSet());
|
||||||
|
final double shadowing = style.value(PName.Shadowing).asDouble();
|
||||||
|
final LineBreakStrategy wrapWidth = style.wrapWidth();
|
||||||
|
final UStroke stroke = style.getStroke();
|
||||||
|
|
||||||
|
final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null,
|
||||||
|
false, null);
|
||||||
|
final Sheet sheet = skinParam.sheet(fc, align, CreoleMode.FULL).createSheet(first.getDisplay());
|
||||||
|
final SheetBlock1 tmp1 = new SheetBlock1(sheet, wrapWidth, skinParam.getPadding());
|
||||||
|
// final TextBlock text = new SheetBlock2(tmp1, this, stroke);
|
||||||
|
return new Opale(shadowing, borderColor, noteBackgroundColor, tmp1, false, stroke);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static StyleSignatureBasic getStyleSignature() {
|
||||||
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -95,36 +151,49 @@ public class FtileIfWithDiamonds extends FtileIfNude {
|
|||||||
|
|
||||||
final FtileGeometry all = dim1.appendBottom(dimNude).appendBottom(dim2);
|
final FtileGeometry all = dim1.appendBottom(dimNude).appendBottom(dim2);
|
||||||
|
|
||||||
return all.addDim(0,
|
final double deltaHeight = getYdelta1a(stringBounder) + getYdelta1b(stringBounder)
|
||||||
getYdelta1a(stringBounder) + getYdelta1b(stringBounder) + getYdeltaForLabels(stringBounder));
|
+ getYdeltaForLabels(stringBounder);
|
||||||
|
|
||||||
|
final FtileGeometry result = all.addDim(0, deltaHeight).incInY(yDeltaNote);
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// protected double getSuppWidthForNotes(StringBounder stringBounder) {
|
||||||
|
// return opale.calculateDimension(stringBounder).getWidth();
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
|
|
||||||
|
if (TextBlockUtils.isEmpty(opale, stringBounder) == false) {
|
||||||
|
final double xOpale = getTranslateDiamond1(stringBounder).getDx()
|
||||||
|
- opale.calculateDimension(stringBounder).getWidth();
|
||||||
|
opale.drawU(ug.apply(UTranslate.dx(xOpale)));
|
||||||
|
}
|
||||||
|
|
||||||
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
|
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
|
||||||
super.drawU(ug);
|
super.drawU(ug);
|
||||||
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
|
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected UTranslate getTranslate1(StringBounder stringBounder) {
|
protected UTranslate getTranslateBranch1(StringBounder stringBounder) {
|
||||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||||
return super.getTranslate1(stringBounder)
|
return super.getTranslateBranch1(stringBounder)
|
||||||
.compose(UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
.compose(UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected UTranslate getTranslate2(StringBounder stringBounder) {
|
protected UTranslate getTranslateBranch2(StringBounder stringBounder) {
|
||||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||||
return super.getTranslate2(stringBounder)
|
return super.getTranslateBranch2(stringBounder)
|
||||||
.compose(UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
.compose(UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
||||||
final double y1 = 0;
|
final double y1 = yDeltaNote;
|
||||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||||
final double x1 = dimTotal.getLeft() - dimDiamond1.getLeft();
|
final double x1 = dimTotal.getLeft() - dimDiamond1.getLeft();
|
||||||
@ -134,8 +203,8 @@ public class FtileIfWithDiamonds extends FtileIfNude {
|
|||||||
protected UTranslate getTranslateDiamond2(StringBounder stringBounder) {
|
protected UTranslate getTranslateDiamond2(StringBounder stringBounder) {
|
||||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||||
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||||
final double y2 = dimTotal.getHeight() - dimDiamond2.getHeight();
|
|
||||||
final double x2 = dimTotal.getLeft() - dimDiamond2.getWidth() / 2;
|
final double x2 = dimTotal.getLeft() - dimDiamond2.getWidth() / 2;
|
||||||
|
final double y2 = dimTotal.getHeight() - dimDiamond2.getHeight();
|
||||||
return new UTranslate(x2, y2);
|
return new UTranslate(x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +36,11 @@
|
|||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||||
@ -68,8 +70,8 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
private final Rainbow arrowColor;
|
private final Rainbow arrowColor;
|
||||||
|
|
||||||
public FtileIfWithLinks(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in, Rainbow arrowColor,
|
public FtileIfWithLinks(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in, Rainbow arrowColor,
|
||||||
ConditionEndStyle conditionEndStyle, StringBounder stringBounder) {
|
ConditionEndStyle conditionEndStyle, StringBounder stringBounder, Collection<PositionedNote> notes) {
|
||||||
super(diamond1, tile1, tile2, diamond2, in, stringBounder);
|
super(diamond1, tile1, tile2, diamond2, in, stringBounder, notes);
|
||||||
this.arrowColor = arrowColor;
|
this.arrowColor = arrowColor;
|
||||||
this.conditionEndStyle = conditionEndStyle;
|
this.conditionEndStyle = conditionEndStyle;
|
||||||
if (arrowColor.size() == 0)
|
if (arrowColor.size() == 0)
|
||||||
@ -135,10 +137,10 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
|
|
||||||
private UTranslate translate(StringBounder stringBounder) {
|
private UTranslate translate(StringBounder stringBounder) {
|
||||||
if (getFtile2() == tile1)
|
if (getFtile2() == tile1)
|
||||||
return getTranslate1(stringBounder);
|
return getTranslateBranch1(stringBounder);
|
||||||
|
|
||||||
if (getFtile2() == tile2)
|
if (getFtile2() == tile2)
|
||||||
return getTranslate2(stringBounder);
|
return getTranslateBranch2(stringBounder);
|
||||||
|
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -224,10 +226,10 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
|
|
||||||
private UTranslate translate(StringBounder stringBounder) {
|
private UTranslate translate(StringBounder stringBounder) {
|
||||||
if (getFtile1() == tile1)
|
if (getFtile1() == tile1)
|
||||||
return getTranslate1(stringBounder);
|
return getTranslateBranch1(stringBounder);
|
||||||
|
|
||||||
if (getFtile1() == tile2)
|
if (getFtile1() == tile2)
|
||||||
return getTranslate2(stringBounder);
|
return getTranslateBranch2(stringBounder);
|
||||||
|
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -353,10 +355,10 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
|
|
||||||
private UTranslate translate(StringBounder stringBounder) {
|
private UTranslate translate(StringBounder stringBounder) {
|
||||||
if (getFtile1() == tile1)
|
if (getFtile1() == tile1)
|
||||||
return getTranslate1(stringBounder);
|
return getTranslateBranch1(stringBounder);
|
||||||
|
|
||||||
if (getFtile1() == tile2)
|
if (getFtile1() == tile2)
|
||||||
return getTranslate2(stringBounder);
|
return getTranslateBranch2(stringBounder);
|
||||||
|
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -399,10 +401,10 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
|
|
||||||
private UTranslate translate(StringBounder stringBounder) {
|
private UTranslate translate(StringBounder stringBounder) {
|
||||||
if (getFtile1() == tile1)
|
if (getFtile1() == tile1)
|
||||||
return getTranslate1(stringBounder);
|
return getTranslateBranch1(stringBounder);
|
||||||
|
|
||||||
if (getFtile1() == tile2)
|
if (getFtile1() == tile2)
|
||||||
return getTranslate2(stringBounder);
|
return getTranslateBranch2(stringBounder);
|
||||||
|
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
|
|||||||
|
|
||||||
result = result.delta(xSeparation * (tiles.size() - 1), 100);
|
result = result.delta(xSeparation * (tiles.size() - 1), 100);
|
||||||
|
|
||||||
return new FtileGeometry(result, result.getWidth() / 2, 0);
|
return new FtileGeometry(result.getWidth(), result.getHeight(), result.getWidth() / 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -147,9 +147,9 @@ public class TextBlockUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmpty(TextBlock text, StringBounder dummyStringBounder) {
|
public static boolean isEmpty(TextBlock text, StringBounder dummyStringBounder) {
|
||||||
if (text == null) {
|
if (text == null || text == EMPTY_TEXT_BLOCK)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
final XDimension2D dim = text.calculateDimension(dummyStringBounder);
|
final XDimension2D dim = text.calculateDimension(dummyStringBounder);
|
||||||
return dim.getHeight() == 0 && dim.getWidth() == 0;
|
return dim.getHeight() == 0 && dim.getWidth() == 0;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,7 @@ public class LanguageDescriptor {
|
|||||||
keyword.add("rnote");
|
keyword.add("rnote");
|
||||||
keyword.add("hnote");
|
keyword.add("hnote");
|
||||||
keyword.add("legend");
|
keyword.add("legend");
|
||||||
|
keyword.add("endlegend");
|
||||||
keyword.add("group");
|
keyword.add("group");
|
||||||
keyword.add("left");
|
keyword.add("left");
|
||||||
keyword.add("right");
|
keyword.add("right");
|
||||||
|
@ -46,7 +46,7 @@ public class Version {
|
|||||||
|
|
||||||
// Warning, "version" should be the same in gradle.properties and Version.java
|
// Warning, "version" should be the same in gradle.properties and Version.java
|
||||||
// Any idea anyone how to magically synchronize those :-) ?
|
// Any idea anyone how to magically synchronize those :-) ?
|
||||||
private static final String version = "1.2023.10";
|
private static final String version = "1.2023.11beta1";
|
||||||
|
|
||||||
public static String versionString() {
|
public static String versionString() {
|
||||||
return version;
|
return version;
|
||||||
|
Loading…
Reference in New Issue
Block a user