diff options
author | kitfox | 2012-01-01 04:35:30 +0100 |
---|---|---|
committer | kitfox | 2012-01-01 04:35:30 +0100 |
commit | 041e5a149ded1b80ec2d57e12f658130bc50815b (patch) | |
tree | 64d068d7a7776419b0f3ff4d4790e8c77fa26976 /src | |
parent | Adding TransformableElement.getXForm() (diff) | |
download | svg-salamander-core-041e5a149ded1b80ec2d57e12f658130bc50815b.tar.gz svg-salamander-core-041e5a149ded1b80ec2d57e12f658130bc50815b.tar.xz svg-salamander-core-041e5a149ded1b80ec2d57e12f658130bc50815b.zip |
Roots now automatically assigned a diagram when attached to SVGDiagram.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@103 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/kitfox/svg/SVGDiagram.java | 1 | ||||
-rw-r--r-- | src/main/java/com/kitfox/svg/SVGElement.java | 22 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/com/kitfox/svg/SVGDiagram.java b/src/main/java/com/kitfox/svg/SVGDiagram.java index c28e6e6..236de83 100644 --- a/src/main/java/com/kitfox/svg/SVGDiagram.java +++ b/src/main/java/com/kitfox/svg/SVGDiagram.java @@ -202,6 +202,7 @@ public class SVGDiagram implements Serializable public void setRoot(SVGRoot root)
{
this.root = root;
+ root.setDiagram(this);
}
public boolean ignoringClipHeuristic() { return ignoreClipHeuristic; }
diff --git a/src/main/java/com/kitfox/svg/SVGElement.java b/src/main/java/com/kitfox/svg/SVGElement.java index 08cb36c..08a801c 100644 --- a/src/main/java/com/kitfox/svg/SVGElement.java +++ b/src/main/java/com/kitfox/svg/SVGElement.java @@ -286,11 +286,14 @@ abstract public class SVGElement implements Serializable if (hasAttribute(name, attribType)) throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists");
//Alter layout for id attribute
- if ("id".equals(name) && diagram != null)
+ if ("id".equals(name))
{
- diagram.removeElement(this.id);
- this.id = name;
- diagram.setElement(this.id, this);
+ if (diagram != null)
+ {
+ diagram.removeElement(id);
+ diagram.setElement(value, this);
+ }
+ this.id = value;
}
switch (attribType)
@@ -354,7 +357,7 @@ abstract public class SVGElement implements Serializable }
}
- private void setDiagram(SVGDiagram diagram)
+ protected void setDiagram(SVGDiagram diagram)
{
this.diagram = diagram;
diagram.setElement(id, this);
@@ -510,9 +513,12 @@ abstract public class SVGElement implements Serializable //Alter layout for relevant attributes
if ("id".equals(styAttr.getName()))
{
- diagram.removeElement(this.id);
- this.id = name;
- diagram.setElement(this.id, this);
+ if (diagram != null)
+ {
+ diagram.removeElement(this.id);
+ diagram.setElement(value, this);
+ }
+ this.id = value;
}
styAttr.setStringValue(value);
|