mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
fix: minor issues
https://github.com/plantuml/plantuml/issues/1515 https://forum.plantuml.net/18157/last-label-on-last-elseif-branch-does-not-get-rendered
This commit is contained in:
parent
a27ff9b7f2
commit
38c5765a99
@ -65,7 +65,7 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
|
|||||||
import net.sourceforge.plantuml.core.ImageData;
|
import net.sourceforge.plantuml.core.ImageData;
|
||||||
import net.sourceforge.plantuml.core.UmlSource;
|
import net.sourceforge.plantuml.core.UmlSource;
|
||||||
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
|
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
|
||||||
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
|
import net.sourceforge.plantuml.cucadiagram.HideOrShow;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkConstraint;
|
import net.sourceforge.plantuml.cucadiagram.LinkConstraint;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Magma;
|
import net.sourceforge.plantuml.cucadiagram.Magma;
|
||||||
@ -93,8 +93,8 @@ import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
|
|||||||
|
|
||||||
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower, ICucaDiagram {
|
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower, ICucaDiagram {
|
||||||
|
|
||||||
private final List<HideOrShow2> hides2 = new ArrayList<>();
|
private final List<HideOrShow> hides2 = new ArrayList<>();
|
||||||
private final List<HideOrShow2> removed = new ArrayList<>();
|
private final List<HideOrShow> removed = new ArrayList<>();
|
||||||
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
|
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
|
||||||
|
|
||||||
private List<Bag> stacks = new ArrayList<>();
|
private List<Bag> stacks = new ArrayList<>();
|
||||||
@ -516,7 +516,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
for (HideOrShow cmd : hideOrShows)
|
for (EntityHideOrShow cmd : hideOrShows)
|
||||||
if (cmd.portion == portion && cmd.gender.contains(entity))
|
if (cmd.portion == portion && cmd.gender.contains(entity))
|
||||||
result = cmd.show;
|
result = cmd.show;
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
|
|
||||||
public final void hideOrShow(EntityGender gender, EntityPortion portions, boolean show) {
|
public final void hideOrShow(EntityGender gender, EntityPortion portions, boolean show) {
|
||||||
for (EntityPortion portion : portions.asSet())
|
for (EntityPortion portion : portions.asSet())
|
||||||
this.hideOrShows.add(new HideOrShow(gender, portion, show));
|
this.hideOrShows.add(new EntityHideOrShow(gender, portion, show));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,22 +537,22 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void hideOrShow2(String what, boolean show) {
|
public void hideOrShow2(String what, boolean show) {
|
||||||
this.hides2.add(new HideOrShow2(what, show));
|
this.hides2.add(new HideOrShow(what, show));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeOrRestore(String what, boolean show) {
|
public void removeOrRestore(String what, boolean show) {
|
||||||
this.removed.add(new HideOrShow2(what, show));
|
this.removed.add(new HideOrShow(what, show));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<HideOrShow> hideOrShows = new ArrayList<>();
|
private final List<EntityHideOrShow> hideOrShows = new ArrayList<>();
|
||||||
private final Set<VisibilityModifier> hides = new HashSet<>();
|
private final Set<VisibilityModifier> hides = new HashSet<>();
|
||||||
|
|
||||||
static class HideOrShow {
|
static class EntityHideOrShow {
|
||||||
private final EntityGender gender;
|
private final EntityGender gender;
|
||||||
private final EntityPortion portion;
|
private final EntityPortion portion;
|
||||||
private final boolean show;
|
private final boolean show;
|
||||||
|
|
||||||
public HideOrShow(EntityGender gender, EntityPortion portion, boolean show) {
|
public EntityHideOrShow(EntityGender gender, EntityPortion portion, boolean show) {
|
||||||
this.gender = gender;
|
this.gender = gender;
|
||||||
this.portion = portion;
|
this.portion = portion;
|
||||||
this.show = show;
|
this.show = show;
|
||||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.cucadiagram.Bodier;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.BodierJSon;
|
import net.sourceforge.plantuml.cucadiagram.BodierJSon;
|
||||||
import net.sourceforge.plantuml.cucadiagram.BodierMap;
|
import net.sourceforge.plantuml.cucadiagram.BodierMap;
|
||||||
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
|
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
|
||||||
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
|
import net.sourceforge.plantuml.cucadiagram.HideOrShow;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
|
||||||
import net.sourceforge.plantuml.plasma.Plasma;
|
import net.sourceforge.plantuml.plasma.Plasma;
|
||||||
import net.sourceforge.plantuml.plasma.Quark;
|
import net.sourceforge.plantuml.plasma.Quark;
|
||||||
@ -64,12 +64,12 @@ public final class EntityFactory implements IEntityFactory {
|
|||||||
|
|
||||||
private final Entity rootGroup;
|
private final Entity rootGroup;
|
||||||
|
|
||||||
private final List<HideOrShow2> hides2;
|
private final List<HideOrShow> hides2;
|
||||||
private final List<HideOrShow2> removed;
|
private final List<HideOrShow> removed;
|
||||||
final private ICucaDiagram diagram;
|
final private ICucaDiagram diagram;
|
||||||
|
|
||||||
//
|
//
|
||||||
public EntityFactory(List<HideOrShow2> hides2, List<HideOrShow2> removed, ICucaDiagram diagram) {
|
public EntityFactory(List<HideOrShow> hides2, List<HideOrShow> removed, ICucaDiagram diagram) {
|
||||||
this.hides2 = hides2;
|
this.hides2 = hides2;
|
||||||
this.removed = removed;
|
this.removed = removed;
|
||||||
this.diagram = diagram;
|
this.diagram = diagram;
|
||||||
@ -84,7 +84,7 @@ public final class EntityFactory implements IEntityFactory {
|
|||||||
return isHidden(other);
|
return isHidden(other);
|
||||||
|
|
||||||
boolean hidden = false;
|
boolean hidden = false;
|
||||||
for (HideOrShow2 hide : hides2)
|
for (HideOrShow hide : hides2)
|
||||||
hidden = hide.apply(hidden, leaf);
|
hidden = hide.apply(hidden, leaf);
|
||||||
|
|
||||||
return hidden;
|
return hidden;
|
||||||
@ -92,7 +92,7 @@ public final class EntityFactory implements IEntityFactory {
|
|||||||
|
|
||||||
public boolean isRemoved(Stereotype stereotype) {
|
public boolean isRemoved(Stereotype stereotype) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (HideOrShow2 hide : removed)
|
for (HideOrShow hide : removed)
|
||||||
result = hide.apply(result, stereotype);
|
result = hide.apply(result, stereotype);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -104,7 +104,7 @@ public final class EntityFactory implements IEntityFactory {
|
|||||||
return isRemoved((Entity) other);
|
return isRemoved((Entity) other);
|
||||||
|
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (HideOrShow2 hide : removed)
|
for (HideOrShow hide : removed)
|
||||||
result = hide.apply(result, leaf);
|
result = hide.apply(result, leaf);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -133,7 +133,7 @@ public final class EntityFactory implements IEntityFactory {
|
|||||||
|
|
||||||
public boolean isRemovedIgnoreUnlinked(Entity leaf) {
|
public boolean isRemovedIgnoreUnlinked(Entity leaf) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (HideOrShow2 hide : removed)
|
for (HideOrShow hide : removed)
|
||||||
if (hide.isAboutUnlinked() == false)
|
if (hide.isAboutUnlinked() == false)
|
||||||
result = hide.apply(result, leaf);
|
result = hide.apply(result, leaf);
|
||||||
|
|
||||||
|
@ -45,12 +45,13 @@ public enum LinkStrategy {
|
|||||||
* We then retrieve tail/head in generated SVG to compute link decoration angle.
|
* We then retrieve tail/head in generated SVG to compute link decoration angle.
|
||||||
*
|
*
|
||||||
* Drawbacks: sometimes, GraphViz does NOT draw those decorations, which causes issues
|
* Drawbacks: sometimes, GraphViz does NOT draw those decorations, which causes issues
|
||||||
|
* This is to be removed
|
||||||
*/
|
*/
|
||||||
LEGACY,
|
LEGACY_toberemoved,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In simplier mode, there are no tail/head in GraphViz generated dot.
|
* In simplier mode, there are no tail/head in GraphViz generated dot.
|
||||||
* The decoration angle is retrieve using Bezier data.
|
* The decoration angle is retrieved using Bezier data.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
SIMPLIER
|
SIMPLIER
|
||||||
|
@ -162,6 +162,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean swithToElse2(LinkRendering whenElse, LinkRendering nextLinkRenderer) {
|
public boolean swithToElse2(LinkRendering whenElse, LinkRendering nextLinkRenderer) {
|
||||||
|
this.current.setSpecial(nextLinkRenderer);
|
||||||
|
|
||||||
if (elseBranch != null)
|
if (elseBranch != null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -177,7 +179,6 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
|||||||
if (elseBranch != null)
|
if (elseBranch != null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// this.current.setInlinkRendering(nextLinkRenderer);
|
|
||||||
this.current.setSpecial(nextLinkRenderer);
|
this.current.setSpecial(nextLinkRenderer);
|
||||||
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, test, color, inlabel);
|
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, test, color, inlabel);
|
||||||
this.thens.add(current);
|
this.thens.add(current);
|
||||||
|
@ -39,7 +39,7 @@ import net.sourceforge.plantuml.abel.Entity;
|
|||||||
import net.sourceforge.plantuml.stereo.Stereotag;
|
import net.sourceforge.plantuml.stereo.Stereotag;
|
||||||
import net.sourceforge.plantuml.stereo.Stereotype;
|
import net.sourceforge.plantuml.stereo.Stereotype;
|
||||||
|
|
||||||
public class HideOrShow2 {
|
public class HideOrShow {
|
||||||
|
|
||||||
private final String what;
|
private final String what;
|
||||||
private final boolean show;
|
private final boolean show;
|
||||||
@ -59,8 +59,8 @@ public class HideOrShow2 {
|
|||||||
if (isAboutUnlinked())
|
if (isAboutUnlinked())
|
||||||
return isApplyableUnlinked(leaf);
|
return isApplyableUnlinked(leaf);
|
||||||
|
|
||||||
final String fullName = leaf.getName();
|
final String fullName = leaf.getQuark().getQualifiedName();
|
||||||
// System.err.println("fullName=" + fullName);
|
// System.err.println("isApplyable leaf=" + leaf + " fullName=" + fullName);
|
||||||
return match(fullName, what);
|
return match(fullName, what);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public class HideOrShow2 {
|
|||||||
return s.equals(pattern);
|
return s.equals(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HideOrShow2(String what, boolean show) {
|
public HideOrShow(String what, boolean show) {
|
||||||
this.what = what;
|
this.what = what;
|
||||||
this.show = show;
|
this.show = show;
|
||||||
}
|
}
|
@ -60,9 +60,9 @@ public class CommandEndState extends SingleLineCommand2<StateDiagram> {
|
|||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
final Entity currentPackage = diagram.getCurrentGroup();
|
final Entity currentPackage = diagram.getCurrentGroup();
|
||||||
if (currentPackage == null) {
|
if (currentPackage == null || currentPackage.isRoot())
|
||||||
return CommandExecutionResult.error("No inner state defined");
|
return CommandExecutionResult.error("No inner state defined");
|
||||||
}
|
|
||||||
diagram.endGroup();
|
diagram.endGroup();
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -683,7 +683,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
|
|||||||
if (link.getEntity2().getLeafType() == LeafType.LOLLIPOP_HALF)
|
if (link.getEntity2().getLeafType() == LeafType.LOLLIPOP_HALF)
|
||||||
svekNode2.addImpact(dotPath.getEndAngle());
|
svekNode2.addImpact(dotPath.getEndAngle());
|
||||||
|
|
||||||
if (getLinkStrategy() == LinkStrategy.LEGACY && extremity1 instanceof Extremity
|
if (getLinkStrategy() == LinkStrategy.LEGACY_toberemoved && extremity1 instanceof Extremity
|
||||||
&& extremity2 instanceof Extremity) {
|
&& extremity2 instanceof Extremity) {
|
||||||
final XPoint2D p1 = ((Extremity) extremity1).somePoint();
|
final XPoint2D p1 = ((Extremity) extremity1).somePoint();
|
||||||
final XPoint2D p2 = ((Extremity) extremity2).somePoint();
|
final XPoint2D p2 = ((Extremity) extremity2).somePoint();
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
package net.sourceforge.plantuml;
|
package net.sourceforge.plantuml.url;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.CsvSource;
|
import org.junit.jupiter.params.provider.CsvSource;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.url.Url;
|
|
||||||
import net.sourceforge.plantuml.url.UrlBuilder;
|
|
||||||
import net.sourceforge.plantuml.url.UrlMode;
|
|
||||||
|
|
||||||
class UrlBuilderTest {
|
class UrlBuilderTest {
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@CsvSource(value = {
|
@CsvSource(value = {
|
||||||
|
Loading…
Reference in New Issue
Block a user