]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/SVGNode.java
Support for dynamic transforms for both elements and terminals
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / nodes / SVGNode.java
index cdd6a26458f578d4b30fbe3e5b8099a6191f6550..2fc37b7d59ab6bc9179943ab80b60246118e08e3 100644 (file)
@@ -56,53 +56,7 @@ import com.kitfox.svg.animation.AnimationElement;
 @RasterOutputWidget
 public class SVGNode extends G2DNode implements InitValueSupport, LoaderNode {
 
-       public static class SVGNodeAssignment {
-               public String elementId;
-               public String attributeNameOrId;
-               public String value;
-               public SVGNodeAssignment(String elementId, String attributeNameOrId, String value) {
-                       this.elementId = elementId;
-                       this.attributeNameOrId = attributeNameOrId;
-                       this.value = value;
-               }
-               @Override
-               public int hashCode() {
-                       final int prime = 31;
-                       int result = 1;
-                       result = prime * result + ((attributeNameOrId == null) ? 0 : attributeNameOrId.hashCode());
-                       result = prime * result + ((elementId == null) ? 0 : elementId.hashCode());
-                       result = prime * result + ((value == null) ? 0 : value.hashCode());
-                       return result;
-               }
-               @Override
-               public boolean equals(Object obj) {
-                       if (this == obj)
-                               return true;
-                       if (obj == null)
-                               return false;
-                       if (getClass() != obj.getClass())
-                               return false;
-                       SVGNodeAssignment other = (SVGNodeAssignment) obj;
-                       if (attributeNameOrId == null) {
-                               if (other.attributeNameOrId != null)
-                                       return false;
-                       } else if (!attributeNameOrId.equals(other.attributeNameOrId))
-                               return false;
-                       if (elementId == null) {
-                               if (other.elementId != null)
-                                       return false;
-                       } else if (!elementId.equals(other.elementId))
-                               return false;
-                       if (value == null) {
-                               if (other.value != null)
-                                       return false;
-                       } else if (!value.equals(other.value))
-                               return false;
-                       return true;
-               }
-       }
-       
-    private static final long serialVersionUID = 8508750881358776559L;
+       private static final long serialVersionUID = 8508750881358776559L;
 
     protected String          data             = null;
     protected String          defaultData      = null;
@@ -278,7 +232,11 @@ public class SVGNode extends G2DNode implements InitValueSupport, LoaderNode {
                 if ("$text".equals(ass.attributeNameOrId)) {
                     if (e instanceof Tspan) {
                         Tspan t = (Tspan) e;
-                        t.setText(ass.value);
+                        if (ass.value.trim().isEmpty()) {
+                               t.setText("-");
+                        } else {
+                               t.setText(ass.value);
+                        }
                         SVGElement parent = t.getParent();
                         if (parent instanceof Text)
                             ((Text) parent).rebuild();