mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 19:09:03 +00:00
fix: multiple breaks in repeat
https://github.com/plantuml/plantuml/issues/1369
This commit is contained in:
parent
7062ec070b
commit
5600f0999e
@ -134,27 +134,27 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
for (Branch branch : thens) {
|
||||
for (Branch branch : thens)
|
||||
branch.updateFtile(factory);
|
||||
}
|
||||
|
||||
if (elseBranch == null)
|
||||
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, LinkRendering.none(),
|
||||
Display.NULL, null, LinkRendering.none());
|
||||
|
||||
elseBranch.updateFtile(factory);
|
||||
Ftile result = factory.createIf(swimlane, thens, elseBranch, outColor, topInlinkRendering, url);
|
||||
if (getPositionedNotes().size() > 0) {
|
||||
if (getPositionedNotes().size() > 0)
|
||||
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false,
|
||||
VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
final List<WeldingPoint> weldingPoints = new ArrayList<>();
|
||||
for (Branch branch : thens) {
|
||||
for (Branch branch : thens)
|
||||
weldingPoints.addAll(branch.getWeldingPoints());
|
||||
}
|
||||
|
||||
weldingPoints.addAll(elseBranch.getWeldingPoints());
|
||||
if (weldingPoints.size() > 0) {
|
||||
if (weldingPoints.size() > 0)
|
||||
result = new FtileDecorateWelding(result, weldingPoints);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -163,9 +163,9 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
}
|
||||
|
||||
public boolean swithToElse2(LinkRendering whenElse, LinkRendering nextLinkRenderer) {
|
||||
if (elseBranch != null) {
|
||||
if (elseBranch != null)
|
||||
return false;
|
||||
}
|
||||
|
||||
this.current.setInlinkRendering(nextLinkRenderer);
|
||||
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenElse, Display.NULL, null,
|
||||
LinkRendering.none());
|
||||
@ -175,9 +175,9 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
|
||||
public boolean elseIf(LinkRendering inlabel, Display test, LinkRendering whenThen, LinkRendering nextLinkRenderer,
|
||||
HColor color) {
|
||||
if (elseBranch != null) {
|
||||
if (elseBranch != null)
|
||||
return false;
|
||||
}
|
||||
|
||||
// this.current.setInlinkRendering(nextLinkRenderer);
|
||||
this.current.setSpecial(nextLinkRenderer);
|
||||
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, test, color, inlabel);
|
||||
@ -188,10 +188,10 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
|
||||
public void endif(LinkRendering nextLinkRenderer) {
|
||||
endifCalled = true;
|
||||
if (elseBranch == null) {
|
||||
if (elseBranch == null)
|
||||
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, LinkRendering.none(),
|
||||
Display.NULL, null, LinkRendering.none());
|
||||
}
|
||||
|
||||
this.elseBranch.setSpecial(nextLinkRenderer);
|
||||
this.current.setInlinkRendering(nextLinkRenderer);
|
||||
}
|
||||
@ -200,12 +200,12 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
final public boolean kill() {
|
||||
if (endifCalled) {
|
||||
for (Branch branch : thens) {
|
||||
if (branch.getLast() != null && branch.getLast().kill() == false) {
|
||||
if (branch.getLast() != null && branch.getLast().kill() == false)
|
||||
return false;
|
||||
}
|
||||
if (elseBranch != null && elseBranch.getLast() != null && elseBranch.getLast().kill() == false) {
|
||||
|
||||
if (elseBranch != null && elseBranch.getLast() != null && elseBranch.getLast().kill() == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -219,25 +219,25 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
|
||||
@Override
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
|
||||
if (endifCalled || current.isEmpty()) {
|
||||
if (endifCalled || current.isEmpty())
|
||||
return super.addNote(note, position, type, colors, swimlaneNote);
|
||||
} else {
|
||||
else
|
||||
return current.addNote(note, position, type, colors, swimlaneNote);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
if (swimlane != null) {
|
||||
if (swimlane != null)
|
||||
result.add(swimlane);
|
||||
}
|
||||
for (Branch branch : thens) {
|
||||
|
||||
for (Branch branch : thens)
|
||||
result.addAll(branch.getSwimlanes());
|
||||
}
|
||||
if (elseBranch != null) {
|
||||
|
||||
if (elseBranch != null)
|
||||
result.addAll(elseBranch.getSwimlanes());
|
||||
}
|
||||
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
@ -253,9 +253,9 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
|
||||
@Override
|
||||
public Instruction getLast() {
|
||||
if (elseBranch == null) {
|
||||
if (elseBranch == null)
|
||||
return thens.get(thens.size() - 1).getLast();
|
||||
}
|
||||
|
||||
return elseBranch.getLast();
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,9 @@ public class FtileUtils {
|
||||
}
|
||||
|
||||
public static Ftile addConnection(Ftile ftile, Collection<Connection> connections) {
|
||||
if (connections.size() == 0) {
|
||||
if (connections.size() == 0)
|
||||
return ftile;
|
||||
}
|
||||
|
||||
return new FtileWithConnection(ftile, connections);
|
||||
}
|
||||
|
||||
@ -59,23 +59,23 @@ public class FtileUtils {
|
||||
}
|
||||
|
||||
public static Ftile addVerticalMargin(Ftile ftile, double marginTop, double marginBottom) {
|
||||
if (marginTop == 0 && marginBottom == 0) {
|
||||
if (marginTop == 0 && marginBottom == 0)
|
||||
return ftile;
|
||||
}
|
||||
|
||||
return new FtileMargedVertically(ftile, marginTop, marginBottom);
|
||||
}
|
||||
|
||||
public static Ftile addHorizontalMargin(Ftile ftile, double margin1, double margin2) {
|
||||
if (margin1 == 0 && margin2 == 0) {
|
||||
if (margin1 == 0 && margin2 == 0)
|
||||
return ftile;
|
||||
}
|
||||
|
||||
return new FtileMarged(ftile, margin1, margin2);
|
||||
}
|
||||
|
||||
public static Ftile addHorizontalMargin(Ftile ftile, double margin) {
|
||||
if (margin == 0) {
|
||||
if (margin == 0)
|
||||
return ftile;
|
||||
}
|
||||
|
||||
return new FtileMarged(ftile, margin, margin);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
@ -95,37 +97,49 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
|
||||
|
||||
final List<WeldingPoint> weldingPoints = repeat.getWeldingPoints();
|
||||
if (weldingPoints.size() > 0) {
|
||||
// printAllChild(repeat);
|
||||
|
||||
final Ftile diamondBreak = new FtileDiamond(repeat.skinParam(), diamondColor, borderColor, swimlane);
|
||||
result = assembly(FtileUtils.addHorizontalMargin(result, 10, 0), diamondBreak);
|
||||
final Genealogy genealogy = new Genealogy(result);
|
||||
|
||||
final FtileBreak ftileBreak = (FtileBreak) weldingPoints.get(0);
|
||||
final Collection<Connection> connections = new ArrayList<Connection>();
|
||||
|
||||
result = FtileUtils.addConnection(result, new Connection() {
|
||||
public void drawU(UGraphic ug) {
|
||||
final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder());
|
||||
final UTranslate tr2 = genealogy.getTranslate(diamondBreak, ug.getStringBounder());
|
||||
final XDimension2D dimDiamond = diamondBreak.calculateDimension(ug.getStringBounder());
|
||||
for (int i = 0; i < weldingPoints.size(); i++) {
|
||||
final FtileBreak ftileBreak = (FtileBreak) weldingPoints.get(i);
|
||||
final boolean first = i == 0;
|
||||
connections.add(new Connection() {
|
||||
public void drawU(UGraphic ug) {
|
||||
final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder());
|
||||
final UTranslate tr2 = genealogy.getTranslate(diamondBreak, ug.getStringBounder());
|
||||
final XDimension2D dimDiamond = diamondBreak.calculateDimension(ug.getStringBounder());
|
||||
|
||||
final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToRight());
|
||||
snake.addPoint(tr1.getDx(), tr1.getDy());
|
||||
snake.addPoint(0, tr1.getDy());
|
||||
snake.addPoint(0, tr2.getDy() + dimDiamond.getHeight() / 2);
|
||||
snake.addPoint(tr2.getDx(), tr2.getDy() + dimDiamond.getHeight() / 2);
|
||||
ug.draw(snake);
|
||||
}
|
||||
final Snake snake;
|
||||
if (first) {
|
||||
snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToRight());
|
||||
snake.addPoint(tr1.getDx(), tr1.getDy());
|
||||
snake.addPoint(0, tr1.getDy());
|
||||
snake.addPoint(0, tr2.getDy() + dimDiamond.getHeight() / 2);
|
||||
snake.addPoint(tr2.getDx(), tr2.getDy() + dimDiamond.getHeight() / 2);
|
||||
} else {
|
||||
snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft());
|
||||
snake.addPoint(tr1.getDx(), tr1.getDy());
|
||||
snake.addPoint(0, tr1.getDy());
|
||||
}
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
public Ftile getFtile1() {
|
||||
return ftileBreak;
|
||||
}
|
||||
public Ftile getFtile1() {
|
||||
return ftileBreak;
|
||||
}
|
||||
|
||||
public Ftile getFtile2() {
|
||||
return diamondBreak;
|
||||
}
|
||||
public Ftile getFtile2() {
|
||||
return diamondBreak;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
result = FtileUtils.addConnection(result, connections);
|
||||
|
||||
}
|
||||
return result;
|
||||
|
@ -267,13 +267,15 @@ public class ArrowConfiguration {
|
||||
}
|
||||
|
||||
public final int getInclination1() {
|
||||
if (dressing2.getHead() == ArrowHead.NONE)
|
||||
if (dressing2.getHead() == ArrowHead.NONE || dressing2.getHead() == ArrowHead.CROSSX)
|
||||
return inclination;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final int getInclination2() {
|
||||
if (dressing1.getHead() == ArrowHead.NONE)
|
||||
if (dressing1.getHead() == ArrowHead.NONE || dressing1.getHead() == ArrowHead.CROSSX)
|
||||
return inclination;
|
||||
if (dressing1.getHead() == ArrowHead.NORMAL || dressing1.getHead() == ArrowHead.NORMAL)
|
||||
return inclination;
|
||||
return 0;
|
||||
}
|
||||
|
@ -63,8 +63,7 @@ public abstract class AbstractEntityImageBorder extends AbstractEntityImage {
|
||||
protected abstract StyleSignatureBasic getSignature();
|
||||
|
||||
final protected Style getStyle() {
|
||||
final Entity leaf = (Entity) getEntity();
|
||||
final Stereotype stereotype = leaf.getStereotype();
|
||||
final Stereotype stereotype = getEntity().getStereotype();
|
||||
return getSignature().withTOBECHANGED(stereotype).getMergedStyle(getSkinParam().getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
|
@ -58,17 +58,14 @@ import net.sourceforge.plantuml.svek.SvekNode;
|
||||
|
||||
public class EntityImageStateBorder extends AbstractEntityImageBorder {
|
||||
|
||||
private final SName sname;
|
||||
|
||||
public EntityImageStateBorder(Entity leaf, ISkinParam skinParam, Cluster stateParent, final Bibliotekon bibliotekon,
|
||||
SName sname) {
|
||||
super(leaf, skinParam, stateParent, bibliotekon, FontParam.STATE);
|
||||
this.sname = sname;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StyleSignatureBasic getSignature() {
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, sname);
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.stateDiagram, SName.state);
|
||||
}
|
||||
|
||||
private boolean upPosition() {
|
||||
|
@ -82,7 +82,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 1;
|
||||
final int beta = 2;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user