Setpublic final class Set extends Animation Set represents an SVG Tiny <set>
element. |
Fields Summary |
---|
static final String[] | REQUIRED_TRAITSRequired Set traits | String[] | toThe target Set value. | RefValues | refValuesThe RefValues corresponding to this <set> element. A <set>
element has a single segment with the same begin and end value. | String | traitQNameThe trait's qualified name. |
Constructors Summary |
---|
public Set(DocumentNode ownerDocument)Builds a new Set element that belongs to the given
document. This Set will belong
to the DocumentNode 's time container.
super(ownerDocument, SVGConstants.SVG_SET_TAG);
|
Methods Summary |
---|
java.lang.Object[] | f(long t)This is the Set element's animation function. It is very
simple as it simply returns the 'to' value, no matter
what time t is.
return refValues.getSegment(0).getStart();
| public java.lang.String[] | getRequiredTraits()
return REQUIRED_TRAITS;
| public java.lang.String | getTraitImpl(java.lang.String name)Set supports the to and attributeName traits.
Returns the trait value as String. In SVG Tiny only certain traits can be
obtained as a String value. Syntax of the returned String matches the
syntax of the corresponding attribute. This element is exactly equivalent
to {@link org.w3c.dom.svg.SVGElement#getTraitNS getTraitNS} with
namespaceURI set to null.
The method is meant to be overridden by derived classes. The
implementation pattern is that derived classes will override the method
and call their super class' implementation. If the ElementNode
implementation is called, it means that the trait is either not supported
or that it cannot be seen as a String.
if (SVGConstants.SVG_TO_ATTRIBUTE == name) {
return to[0];
} else if (SVGConstants.SVG_ATTRIBUTE_NAME_ATTRIBUTE == name) {
return traitQName;
} else {
return super.getTraitImpl(name);
}
| public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype TimedElementNode .
return new Set(doc);
| public void | setTraitImpl(java.lang.String name, java.lang.String value)Set supports the attributeName and to traits.
if (SVGConstants.SVG_TO_ATTRIBUTE == name) {
checkWriteLoading(name);
if (value == null) {
throw illegalTraitValue(name, value);
}
to[0] = value;
} else if (SVGConstants.SVG_ATTRIBUTE_NAME_ATTRIBUTE == name) {
checkWriteLoading(name);
if (value == null) {
throw illegalTraitValue(name, value);
}
// Now, if this is a QName, we need to use the namespace prefix map.
int i = value.indexOf(':");
if (i == -1) {
this.traitName = value.intern();
this.traitQName = value.intern();
} else {
if (i == value.length() - 1) {
// ':' is the last character, this is invalid.
throw illegalTraitValue(name, value);
}
String prefix = value.substring(0, i);
String tName = value.substring(i+1);
String ns = ownerDocument.toNamespace(prefix, this);
if (ns == null) {
throw illegalTraitValue(name, value);
}
traitName = tName.intern();
traitNamespace = ns.intern();
traitQName = value;
}
} else {
super.setTraitImpl(name, value);
}
| boolean | supportsTrait(java.lang.String traitName)Supported traits: to, attributeName
if (SVGConstants.SVG_TO_ATTRIBUTE == traitName
||
SVGConstants.SVG_ATTRIBUTE_NAME_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
| void | validate()Validating a Set consists in:
a) Setting its target element. If there was no idRef, then targetElement
is still null and will be positioned to the parent node.
b) Validating the to value with the targetElement, using the target trait
name, namespace and value.
// a) Set the target element.
if (targetElement == null) {
targetElement = (ElementNode) parent;
}
// b) Validate the to value with the target element.
traitAnim = targetElement.getSafeTraitAnimNS(traitNamespace, traitName);
if (to[0] != null) {
refValues = traitAnim.toRefValues(this,
to,
null,
SVGConstants.SVG_TO_ATTRIBUTE);
} else {
hasNoEffect = true;
}
|
|