public TrackBase(SVGElement parent, String attribName, int attribType) throws SVGElementException { this.parent = parent; this.attribName = attribName; this.attribType = attribType; //Make sure parent has an attribute we will write to if (attribType == AnimationElement.AT_AUTO && !parent.hasAttribute(attribName, AnimationElement.AT_CSS) && !parent.hasAttribute(attribName, AnimationElement.AT_XML)) { parent.addAttribute(attribName, AnimationElement.AT_CSS, ""); } else if (!parent.hasAttribute(attribName, attribType)) { parent.addAttribute(attribName, attribType, ""); } }
public TrackBase(SVGElement parent, String attribName, int attribType) throws SVGElementException { this.parent = parent; this.attribName = attribName; this.attribType = attribType; //Make sure parent has an attribute we will write to if (attribType == AnimationElement.AT_AUTO && !parent.hasAttribute(attribName, AnimationElement.AT_CSS) && !parent.hasAttribute(attribName, AnimationElement.AT_XML)) { parent.addAttribute(attribName, AnimationElement.AT_CSS, ""); } else if (!parent.hasAttribute(attribName, attribType)) { parent.addAttribute(attribName, attribType, ""); } }
public TrackBase(SVGElement parent, String attribName, int attribType) throws SVGElementException { this.parent = parent; this.attribName = attribName; this.attribType = attribType; //Make sure parent has an attribute we will write to if (attribType == AnimationElement.AT_AUTO && !parent.hasAttribute(attribName, AnimationElement.AT_CSS) && !parent.hasAttribute(attribName, AnimationElement.AT_XML)) { parent.addAttribute(attribName, AnimationElement.AT_CSS, ""); } else if (!parent.hasAttribute(attribName, attribType)) { parent.addAttribute(attribName, attribType, ""); } }
public TrackBase(SVGElement parent, String attribName, int attribType) throws SVGElementException { this.parent = parent; this.attribName = attribName; this.attribType = attribType; //Make sure parent has an attribute we will write to if (attribType == AnimationElement.AT_AUTO && !parent.hasAttribute(attribName, AnimationElement.AT_CSS) && !parent.hasAttribute(attribName, AnimationElement.AT_XML)) { parent.addAttribute(attribName, AnimationElement.AT_CSS, ""); } else if (!parent.hasAttribute(attribName, attribType)) { parent.addAttribute(attribName, attribType, ""); } }
private void setStroke(Color fromColor, String toColor, SVGElement node) throws SVGException { if (node.hasAttribute("stroke", AnimationElement.AT_CSS)) { StyleAttribute abs = node.getStyleAbsolute("stroke"); Color was = abs.getColorValue(); if (was.equals(fromColor)) { abs.setStringValue(toColor); } } for (int i = 0; i < node.getNumChildren(); ++i) { setStroke(fromColor, toColor, node.getChild(i)); } } private String getHexString(Color color) { return String.format("#%06x", (0xFFFFFF & color.getRGB())); }
public void addAttribute(String name, int attribType, String value) throws SVGElementException { if (hasAttribute(name, attribType)) { throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists"); } //Alter layout for id attribute if ("id".equals(name)) { if (diagram != null) { diagram.removeElement(id); diagram.setElement(value, this); } this.id = value; } switch (attribType) { case AnimationElement.AT_CSS: inlineStyles.put(name, new StyleAttribute(name, value)); return; case AnimationElement.AT_XML: presAttribs.put(name, new StyleAttribute(name, value)); return; } throw new SVGElementException(this, "Invalid attribute type " + attribType); }
public void addAttribute(String name, int attribType, String value) throws SVGElementException { if (hasAttribute(name, attribType)) { throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists"); } //Alter layout for id attribute if ("id".equals(name)) { if (diagram != null) { diagram.removeElement(id); diagram.setElement(value, this); } this.id = value; } switch (attribType) { case AnimationElement.AT_CSS: inlineStyles.put(name, new StyleAttribute(name, value)); return; case AnimationElement.AT_XML: presAttribs.put(name, new StyleAttribute(name, value)); return; } throw new SVGElementException(this, "Invalid attribute type " + attribType); }
public void addAttribute(String name, int attribType, String value) throws SVGElementException { if (hasAttribute(name, attribType)) throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists"); //Alter layout for id attribute if ("id".equals(name)) { if (diagram != null) { diagram.removeElement(id); diagram.setElement(value, this); } this.id = value; } switch (attribType) { case AnimationElement.AT_CSS: inlineStyles.put(name, new StyleAttribute(name, value)); return; case AnimationElement.AT_XML: presAttribs.put(name, new StyleAttribute(name, value)); return; } throw new SVGElementException(this, "Invalid attribute type " + attribType); }
public void addAttribute(String name, int attribType, String value) throws SVGElementException { if (hasAttribute(name, attribType)) { throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists"); } //Alter layout for id attribute if ("id".equals(name)) { if (diagram != null) { diagram.removeElement(id); diagram.setElement(value, this); } this.id = value; } switch (attribType) { case AnimationElement.AT_CSS: inlineStyles.put(name, new StyleAttribute(name, value)); return; case AnimationElement.AT_XML: presAttribs.put(name, new StyleAttribute(name, value)); return; } throw new SVGElementException(this, "Invalid attribute type " + attribType); }