public abstract class SVGElement
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected long |
childrenChangeCounter |
protected java.lang.String |
cssClass
CSS class.
|
protected SVGDiagram |
diagram
The diagram this element belongs to
|
protected java.lang.String |
id |
protected static java.util.Set |
ignorePresAttrib
A list of presentation attributes to not include in the presentation
attribute set.
|
protected java.util.HashMap |
inlineStyles
Styles defined for this elemnt via the style attribute.
|
protected SVGElement |
parent |
protected java.util.HashMap |
presAttribs
Presentation attributes set for this element.
|
static long |
serialVersionUID |
static java.lang.String |
SVG_NS |
protected TrackManager |
trackManager
Link to the universe we reside in
|
protected java.net.URI |
xmlBase
This element may override the URI we resolve against with an xml:base
attribute.
|
Constructor and Description |
---|
SVGElement()
Creates a new instance of SVGElement
|
SVGElement(java.lang.String id,
java.lang.String cssClass,
SVGElement parent) |
SVGElement(java.lang.String id,
SVGElement parent) |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String name,
int attribType,
java.lang.String value) |
protected void |
addChild(SVGElement child) |
protected void |
addChildren(java.util.Collection<SVGElement> children) |
protected void |
build()
Called by internal processes to rebuild the geometry of this node from
it's presentation attributes, style attributes and animated tracks.
|
static java.awt.geom.GeneralPath |
buildPath(java.lang.String text,
int windingRule) |
SVGElement |
getChild(int i) |
SVGElement |
getChild(java.lang.String id) |
java.util.List<SVGElement> |
getChildren() |
java.util.List |
getChildren(java.util.List retVec) |
java.lang.String |
getId() |
java.util.Set |
getInlineAttributes() |
int |
getNumChildren() |
SVGElement |
getParent() |
protected SVGElement |
getParentContext() |
java.util.List |
getPath(java.util.List retVec) |
boolean |
getPres(StyleAttribute attrib)
Copies the presentation attribute into the passed one.
|
StyleAttribute |
getPresAbsolute(java.lang.String styName) |
java.util.Set |
getPresentationAttributes() |
SVGRoot |
getRoot() |
boolean |
getStyle(StyleAttribute attrib) |
boolean |
getStyle(StyleAttribute attrib,
boolean recursive) |
boolean |
getStyle(StyleAttribute attrib,
boolean recursive,
boolean evalAnimation)
Copies the current style into the passed style attribute.
|
StyleAttribute |
getStyleAbsolute(java.lang.String styName) |
abstract java.lang.String |
getTagName() |
java.net.URI |
getXMLBase() |
boolean |
hasAttribute(java.lang.String name,
int attribType) |
boolean |
hasChildren() |
int |
indexOfChild(SVGElement child)
Searches children for given element.
|
double |
lerp(double t0,
double t1,
double alpha) |
void |
loaderAddChild(SVGLoaderHelper helper,
SVGElement child)
Called after the start element but before the end element to indicate
each child tag that has been processed
|
void |
loaderAddText(SVGLoaderHelper helper,
java.lang.String text)
Called during load process to add text scanned within a tag
|
void |
loaderEndElement(SVGLoaderHelper helper)
Called to indicate that this tag and the tags it contains have been
completely processed, and that it should finish any load processes.
|
void |
loaderStartElement(SVGLoaderHelper helper,
org.xml.sax.Attributes attrs,
SVGElement parent)
Called during SAX load process to notify that this tag has begun the
process of being loaded
|
protected static float |
nextFloat(java.util.LinkedList l) |
static PathCommand[] |
parsePathList(java.lang.String list) |
static java.awt.geom.AffineTransform |
parseSingleTransform(java.lang.String val) |
protected static java.awt.geom.AffineTransform |
parseTransform(java.lang.String val) |
protected SVGElement |
popParentContext() |
protected void |
pushParentContext(SVGElement context)
Hack to allow nodes to temporarily change their parents.
|
void |
removeAttribute(java.lang.String name,
int attribType) |
void |
removeChild(SVGElement child) |
void |
setAttribute(java.lang.String name,
int attribType,
java.lang.String value) |
protected void |
setDiagram(SVGDiagram diagram) |
void |
swapChildren(int i,
int j)
Swaps 2 elements in children.
|
abstract boolean |
updateTime(double curTime)
Updates all attributes in this diagram associated with a time event.
|
public static final long serialVersionUID
public static final java.lang.String SVG_NS
protected SVGElement parent
protected long childrenChangeCounter
protected java.lang.String id
protected java.lang.String cssClass
protected final java.util.HashMap inlineStyles
protected final java.util.HashMap presAttribs
protected static final java.util.Set ignorePresAttrib
protected java.net.URI xmlBase
protected SVGDiagram diagram
protected final TrackManager trackManager
public SVGElement()
public SVGElement(java.lang.String id, SVGElement parent)
public SVGElement(java.lang.String id, java.lang.String cssClass, SVGElement parent)
public abstract java.lang.String getTagName()
public SVGElement getParent()
public java.util.List getPath(java.util.List retVec)
public java.util.List getChildren(java.util.List retVec)
retVec
- - A list to add all children to. If null, a new list is
created and children of this group are added.public SVGElement getChild(java.lang.String id)
id
- - Id of svg element to returnpublic int indexOfChild(SVGElement child)
public void swapChildren(int i, int j) throws SVGException
SVGException
public void loaderStartElement(SVGLoaderHelper helper, org.xml.sax.Attributes attrs, SVGElement parent) throws org.xml.sax.SAXException
attrs
- - Attributes of this taghelper
- - An object passed to all SVG elements involved in this
build process to aid in sharing information.org.xml.sax.SAXException
public void removeAttribute(java.lang.String name, int attribType)
public void addAttribute(java.lang.String name, int attribType, java.lang.String value) throws SVGElementException
SVGElementException
public boolean hasAttribute(java.lang.String name, int attribType) throws SVGElementException
SVGElementException
public java.util.Set getInlineAttributes()
public java.util.Set getPresentationAttributes()
public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
SVGElementException
protected void setDiagram(SVGDiagram diagram)
protected void addChild(SVGElement child)
protected void addChildren(java.util.Collection<SVGElement> children)
public void removeChild(SVGElement child) throws SVGElementException
SVGElementException
public void loaderAddText(SVGLoaderHelper helper, java.lang.String text)
public void loaderEndElement(SVGLoaderHelper helper) throws SVGParseException
SVGParseException
protected void build() throws SVGException
SVGException
public java.net.URI getXMLBase()
public java.lang.String getId()
protected void pushParentContext(SVGElement context)
protected SVGElement popParentContext()
protected SVGElement getParentContext()
public SVGRoot getRoot()
public boolean getStyle(StyleAttribute attrib) throws SVGException
SVGException
public void setAttribute(java.lang.String name, int attribType, java.lang.String value) throws SVGElementException
SVGElementException
public boolean getStyle(StyleAttribute attrib, boolean recursive) throws SVGException
SVGException
public boolean getStyle(StyleAttribute attrib, boolean recursive, boolean evalAnimation) throws SVGException
attrib
- - Attribute to write style data to. Must have it's name set
to the name of the style being queried.recursive
- - If true and this object does not contain the named
style attribute, checks attributes of parents back to root until one
found.SVGException
public StyleAttribute getStyleAbsolute(java.lang.String styName)
public boolean getPres(StyleAttribute attrib) throws SVGException
SVGException
public StyleAttribute getPresAbsolute(java.lang.String styName)
protected static java.awt.geom.AffineTransform parseTransform(java.lang.String val) throws SVGException
SVGException
public static java.awt.geom.AffineTransform parseSingleTransform(java.lang.String val) throws SVGException
SVGException
protected static float nextFloat(java.util.LinkedList l)
public static PathCommand[] parsePathList(java.lang.String list)
public static java.awt.geom.GeneralPath buildPath(java.lang.String text, int windingRule)
public abstract boolean updateTime(double curTime) throws SVGException
SVGException
public boolean hasChildren()
public java.util.List<SVGElement> getChildren()
public int getNumChildren()
public SVGElement getChild(int i)
public double lerp(double t0, double t1, double alpha)