diff --git a/src/net/sourceforge/plantuml/svek/SvekNode.java b/src/net/sourceforge/plantuml/svek/SvekNode.java index 722d7963c..649f272e5 100644 --- a/src/net/sourceforge/plantuml/svek/SvekNode.java +++ b/src/net/sourceforge/plantuml/svek/SvekNode.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.abel.Entity; import net.sourceforge.plantuml.abel.EntityPosition; import net.sourceforge.plantuml.abel.Hideable; +import net.sourceforge.plantuml.abel.Link; import net.sourceforge.plantuml.abel.Together; import net.sourceforge.plantuml.klimt.Shadowable; import net.sourceforge.plantuml.klimt.UTranslate; @@ -145,7 +146,7 @@ public class SvekNode implements Positionable, Hideable { SvekUtils.println(sb); return; } - if (type == ShapeType.RECTANGLE && shield().isZero() == false) { + if (type == ShapeType.RECTANGLE && isShielded()) { appendHtml(sb); SvekUtils.println(sb); return; @@ -222,7 +223,7 @@ public class SvekNode implements Positionable, Hideable { private Margins shield() { if (shield == null) { this.shield = image.getShield(stringBounder); - if (shield.isZero() == false && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS + if (!shield.isZero() && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS && type != ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE) throw new IllegalStateException(); } @@ -325,7 +326,7 @@ public class SvekNode implements Positionable, Hideable { } private void appendShapeInternal(StringBuilder sb) { - if (type == ShapeType.RECTANGLE && shield().isZero() == false) + if (type == ShapeType.RECTANGLE && isShielded()) throw new UnsupportedOperationException(); else if (type == ShapeType.RECTANGLE || type == ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE || type == ShapeType.FOLDER) @@ -382,17 +383,22 @@ public class SvekNode implements Positionable, Hideable { public boolean isShielded() { if (this.shield != null) { - return this.shield.isZero() == false; + return !this.shield.isZero(); } // Avoid calculating "shield" size through this.shield() before finishing creation of all SvekLines (#1467) // Instead, only check if we will have a shield (size is irrelevant here) // This node will have a shield if it is target of a qualified association (will have a qualifier label // placed besides this type's bounding box.) - return this.leaf.getDiagram().getLinks().stream() - .filter(link -> link.getEntity1() == this.leaf || link.getEntity2() == this.leaf) - .anyMatch(link -> (this.leaf == link.getEntity1() && link.hasKal1()) - || (this.leaf == link.getEntity2() && link.hasKal2())); + for (Link link: this.leaf.getDiagram().getLinks()) { + if (link.getEntity1() == this.leaf || link.getEntity2() == this.leaf) { + if ((this.leaf == link.getEntity1() && link.hasKal1()) + || (this.leaf == link.getEntity2() && link.hasKal2())) { + return true; + } + } + } + return false; } public void resetMoveSvek() {