X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fui%2Fnodes%2FDistrictNetworkVertexNode.java;h=feb217b0ce8c9ac792d2ebc57acc435a7aa48fb4;hb=d99e6afb3299fd1bd7cdf150b7d5f950c61b1959;hp=b1bb1468dd63653ee1c423a9653fbc307088bc8e;hpb=ff5441dd6a85ef6fb92c6b3b0cf709bbce878e5e;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java index b1bb1468..feb217b0 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java @@ -7,6 +7,7 @@ import java.awt.RenderingHints; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; +import java.util.List; import java.util.Optional; import org.simantics.district.network.ui.adapters.DistrictNetworkVertex; @@ -45,6 +46,7 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti private Color color; private transient Color dynamicColor; + private transient Color eventColor; private Rectangle2D bounds; private transient Point2D point; @@ -92,7 +94,7 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti } Color oldColor = g2d.getColor(); - Color newColor = dynamicColor != null ? dynamicColor : color; + Color newColor = eventColor != null ? eventColor : dynamicColor != null ? dynamicColor : color; boolean changeColor = !oldColor.equals(newColor); double scaleRecip = viewScaleRecip * nodeSize; @@ -242,6 +244,11 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti this.dynamicColor = color; } + @PropertySetter(value = "eventColor") + public void setEventColor(Color colorr) { + this.eventColor = colorr; + } + @PropertySetter(value = "hidden") public void setHidden(Boolean value) { this.hidden = value; @@ -257,7 +264,7 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti child.setInfo(null); } } - + public void setInSimulation(Optional isInSimulation) { if (!isInSimulation.isPresent()) { removeNode(NotInSimulationNode.NODE_NAME); @@ -267,4 +274,16 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti child.setIsInSimulation(isInSimulation.get()); } } + + public void setConnectionLinePoints(List points) { + if (points == null) { + removeNode(ConnectionLineNode.NODE_NAME); + } else { + ConnectionLineNode child = getOrCreateNode(ConnectionLineNode.NODE_NAME, ConnectionLineNode.class); + child.setZIndex(0); + child.setStrokeWidth(2.f); + child.setPoints(points); + } + } + }