Methods Summary |
---|
com.sun.perseus.j2d.Box | addBBox(com.sun.perseus.j2d.Box bbox, com.sun.perseus.j2d.Transform t)
return proxy.addBBox(bbox, proxy.appendTransform(t, null));
|
protected com.sun.perseus.j2d.Transform | appendTransform(com.sun.perseus.j2d.Transform tx, com.sun.perseus.j2d.Transform workTx)Apply this node's x/y translation if it is not (0,0).
if (transform == null
&&
motion == null
&&
x == 0
&&
y == 0) {
return tx;
}
tx = recycleTransform(tx, workTx);
if (motion != null) {
tx.mMultiply(motion);
}
if (transform != null) {
tx.mMultiply(transform);
}
tx.mTranslate(x, y);
return tx;
|
ElementNodeProxy | buildProxy()
return new UseProxy(this);
|
protected void | clearLayouts()Clears the text layouts, if any exist. This is typically
called when the font selection has changed and nodes such
as Text should recompute their layouts.
This should recursively call clearLayouts on children
node or expanded content, if any.
clearLayouts(proxy);
|
TraitAnim | createTraitAnimImpl(java.lang.String traitName)
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName, TRAIT_TYPE_FLOAT);
} else {
return super.createTraitAnimImpl(traitName);
}
|
TraitAnim | createTraitAnimNSImpl(java.lang.String traitNamespace, java.lang.String traitName)
if (traitNamespace == SVGConstants.XLINK_NAMESPACE_URI
&&
traitName == SVGConstants.SVG_HREF_ATTRIBUTE) {
return new StringTraitAnim(this, traitNamespace, traitName);
}
return super.createTraitAnimNSImpl(traitNamespace, traitName);
|
public org.w3c.dom.svg.SVGRect | getBBox()
Transform t = null;
if (x != 0 || y != 0) {
t = new Transform(1, 0, 0, 1, x, y);
}
return addBBox(null, t);
|
public ModelNode | getFirstComputedExpandedChild()Some node types (such as ElementNodeProxy ) have
expanded children that they compute in some specific
way depending on the implementation.
return proxy;
|
protected ModelNode | getFirstExpandedChild()Some node types (such as ElementNodeProxy ) have
expanded children that they compute in some specific
way depending on the implementation.
return proxy;
|
float | getFloatTraitImpl(java.lang.String name)Use handles x and y traits.
Other attributes are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return getX();
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return getY();
} else {
return super.getFloatTraitImpl(name);
}
|
public java.lang.String | getIdRef()
return idRef;
|
protected ModelNode | getLastExpandedChild()Some node types (such as ElementNodeProxy ) have
expanded children that they compute in some specific
way depending on the implementation.
return proxy;
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_USE_TAG;
|
public java.lang.String[][] | getRequiredTraitsNS()
return REQUIRED_TRAITS_NS;
|
public org.w3c.dom.svg.SVGMatrix | getScreenCTM()
SVGMatrix m = super.getScreenCTM();
if (m != null) {
m = m.mTranslate(-x, -y);
}
return m;
|
public java.lang.String | getTraitImpl(java.lang.String name)Use handles x and y traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return Float.toString(getX());
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return Float.toString(getY());
} else {
return super.getTraitImpl(name);
}
|
java.lang.String | getTraitNSImpl(java.lang.String namespaceURI, java.lang.String name)Use handles the xlink href attribute
if (SVGConstants.XLINK_NAMESPACE_URI == namespaceURI
&&
SVGConstants.SVG_HREF_ATTRIBUTE == name) {
if (idRef == null) {
return "";
}
return "#" + idRef;
} else {
return super.getTraitNSImpl(namespaceURI, name);
}
|
public float | getX()
return x;
|
public float | getY()
return y;
|
public boolean | hasDescendants()
return super.hasDescendants()
||
proxy != null;
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype Use .
return new Use(doc);
|
public ModelNode | nodeHitAt(float[] pt)Returns the ModelNode , if any, hit by the
point at coordinate x/y.
// If a node does not render, it is never hit
if (canRenderState != 0) {
return null;
}
// Check for a hit on expanded content
return nodeHitAt(getLastExpandedChild(), pt);
|
void | nodeHookedInDocumentTree()When a Use element is hooked into the document tree, it may
expand immediately if its reference has already been set.
super.nodeHookedInDocumentTree();
if (ref != null) {
setProxy(ref.buildProxy());
}
|
final void | nodeUnhookedFromDocumentTree()When a Use in unhooked from the document tree, it needs to set its
proxy to null and cleanly remove references to itself.
super.nodeUnhookedFromDocumentTree();
if (proxy != null) {
unhookExpandedQuiet();
proxy = null;
}
|
public void | paint(com.sun.perseus.j2d.RenderGraphics rg)Paints this node into the input RenderGraphics .
if (canRenderState != 0) {
return;
}
paint(getFirstExpandedChild(), rg);
|
protected void | preValidate()This method is called before an element is hooked into the tree to
validate it is in a state where it can be added. For a Use element, the
reference must have been set and resolved or must still be null (i.e.,
not set).
if (loaded && proxy == null) {
if (ref == null && (idRef != null) && !"".equals(idRef)) {
throw new DOMException(DOMException.INVALID_STATE_ERR,
Messages.formatMessage
(Messages.ERROR_MISSING_REFERENCE,
new String[] {
getNamespaceURI(),
getLocalName(),
getId()}));
}
}
|
protected void | propagateFloatPropertyState(int propertyIndex, float parentPropertyValue)Called when the computed value of the given float property has changed.
On a use element, this propagates only to expanded content.
// Propagate to proxies.
if (firstProxy != null) {
ElementNodeProxy proxy = firstProxy;
while (proxy != null) {
((CompositeGraphicsNodeProxy) proxy)
.proxiedFloatPropertyStateChange(propertyIndex,
parentPropertyValue);
proxy = proxy.nextProxy;
}
}
// Propagate to expanded children.
ModelNode node = getFirstExpandedChild();
while (node != null) {
node.recomputeFloatPropertyState(propertyIndex,
parentPropertyValue);
node = node.nextSibling;
}
|
protected void | propagatePackedPropertyState(int propertyIndex, int parentPropertyValue)Called when the computed value of the given packed property has changed.
On a use element, this propagates only to expanded content.
// Propagate to proxies.
if (firstProxy != null) {
ElementNodeProxy proxy = firstProxy;
while (proxy != null) {
((CompositeGraphicsNodeProxy) proxy)
.proxiedPackedPropertyStateChange(propertyIndex,
parentPropertyValue);
proxy = proxy.nextProxy;
}
}
// Propagate to expanded children.
ModelNode node = getFirstExpandedChild();
while (node != null) {
node.recomputePackedPropertyState(propertyIndex,
parentPropertyValue);
node = node.nextSibling;
}
|
protected void | propagatePropertyState(int propertyIndex, java.lang.Object parentPropertyValue)Called when the computed value of the given property has changed.
On a use element, this propagates only to expanded content.
// Propagate to proxies.
if (firstProxy != null) {
ElementNodeProxy proxy = firstProxy;
while (proxy != null) {
((CompositeGraphicsNodeProxy) proxy)
.proxiedPropertyStateChange(propertyIndex,
parentPropertyValue);
proxy = proxy.nextProxy;
}
}
// Propagate to expanded children.
ModelNode node = getFirstExpandedChild();
while (node != null) {
node.recomputePropertyState(propertyIndex, parentPropertyValue);
node = node.nextSibling;
}
|
ModelNode | proxyNodeHitAt(float[] pt, ElementNodeProxy proxy)Returns the ModelNode , if any, hit by the
point at coordinate x/y in the proxy tree starting at
proxy.
// If a node does not render, it is never hit
if (canRenderState != 0) {
return null;
}
// Check for a hit on expanded content
return nodeHitAt(proxy.getLastExpandedChild(), pt);
|
protected void | recomputeTransformState(com.sun.perseus.j2d.Transform parentTransform)Recomputes the transform cache, if one exists. This should recursively
call recomputeTransformState on children node or expanded content, if
any.
By default, because a ModelNode has no transform and no cached transform,
this only does a pass down.
txf = appendTransform(parentTransform, txf);
inverseTxf = null;
computeCanRenderTransformBit(txf);
// inverseTxf = computeInverseTransform(txf, parentTransform,
// inverseTxf);
recomputeTransformState(txf, getFirstExpandedChild());
|
public void | resolveTo(ElementNode ref)IDRef implementation.
// Only set the proxy if the use is in the document tree.
if (isInDocumentTree()) {
setProxy(ref.buildProxy());
} else {
this.ref = ref;
}
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(value[0][0]);
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(value[0][0]);
} else {
super.setFloatArrayTrait(name, value);
}
|
public void | setFloatTraitImpl(java.lang.String name, float value)Use handles x and y traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(value);
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(value);
} else {
super.setFloatTraitImpl(name, value);
}
|
public void | setIdRef(java.lang.String idRef)Sets this Use element's idRef
if (idRef == this.idRef
||
(idRef != null && idRef.equals(this.idRef))) {
// No change
return;
}
this.idRef = idRef;
ownerDocument.resolveIDRef(this, idRef);
// If the node is hooked into the document tree and the idRef has not
// been resolved as a result of ownerDocument.resolveIDRef, then
// we go into error.
if (isInDocumentTree()) {
if (proxy == null && (idRef != null) && !"".equals(idRef)) {
throw new DOMException(DOMException.INVALID_ACCESS_ERR,
Messages.formatMessage
(Messages.ERROR_MISSING_REFERENCE,
new String[] {
getNamespaceURI(),
getLocalName(),
getId()}));
}
}
|
void | setProxy(ElementNodeProxy proxy)Sets the ElementNodeProxy as this use's expanded
content.
if (proxy == null) {
throw new IllegalArgumentException();
}
// If this node already had a proxy, make sure we remove that
// proxy from the node's expanded content.
if (this.proxy != null) {
modifyingNode();
unhookExpandedQuiet();
modifiedNode();
}
this.proxy = proxy;
this.proxy.setParentQuiet(this);
nodeInserted(this.proxy);
this.proxy.nextSibling = null;
// Now, notify potential proxies that the proxy has been set.
ElementNodeProxy useProxy = firstProxy;
while (useProxy != null) {
((UseProxy) useProxy).useProxySet();
useProxy = useProxy.nextProxy;
}
|
public void | setTraitImpl(java.lang.String name, java.lang.String value)Use handles x and y traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(parseFloatTrait(name, value));
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(parseFloatTrait(name, value));
} else {
super.setTraitImpl(name, value);
}
|
public void | setTraitNSImpl(java.lang.String namespaceURI, java.lang.String name, java.lang.String value)Use supports the xlink:href trait.
if (SVGConstants.XLINK_NAMESPACE_URI == namespaceURI
&&
SVGConstants.SVG_HREF_ATTRIBUTE == name) {
if (value == null || !value.startsWith("#")) {
throw illegalTraitValue(name, value);
}
setIdRef(value.substring(1));
} else {
super.setTraitNSImpl(namespaceURI, name, value);
}
|
public void | setX(float newX)
if (newX == x) {
return;
}
modifyingNode();
this.x = newX;
recomputeTransformState();
recomputeProxyTransformState();
modifiedNode();
|
public void | setY(float newY)
if (newY == y) {
return;
}
modifyingNode();
this.y = newY;
recomputeTransformState();
recomputeProxyTransformState();
modifiedNode();
|
boolean | supportsTrait(java.lang.String traitName)Supported traits: x, y
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
boolean | supportsTraitNS(java.lang.String namespaceURI, java.lang.String traitName)Supported traits: xlink:href
if (SVGConstants.XLINK_NAMESPACE_URI == namespaceURI
&&
SVGConstants.SVG_HREF_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTraitNS(namespaceURI, traitName);
}
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_X_ATTRIBUTE == name
||
SVGConstants.SVG_Y_ATTRIBUTE == name) {
return Float.toString(value[0][0]);
} else {
return super.toStringTrait(name, value);
}
|
protected void | unhookExpandedQuiet()Utility method. Unhooks the expanded content.
unhookQuiet(proxy);
proxy = null;
ElementNodeProxy p = firstProxy;
while (p != null) {
p.unhookExpandedQuiet();
p = p.nextProxy;
}
|
public float[][] | validateFloatArrayTrait(java.lang.String traitName, java.lang.String value, java.lang.String reqNamespaceURI, java.lang.String reqLocalName, java.lang.String reqTraitNamespace, java.lang.String reqTraitName)Validates the input trait value.
if (SVGConstants.SVG_X_ATTRIBUTE == traitName) {
return toAnimatedFloatArray(parseFloatTrait(traitName, value));
} else if (SVGConstants.SVG_Y_ATTRIBUTE == traitName) {
return toAnimatedFloatArray(parseFloatTrait(traitName, value));
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|
java.lang.String | validateTraitNS(java.lang.String namespaceURI, java.lang.String traitName, java.lang.String value, java.lang.String reqNamespaceURI, java.lang.String reqLocalName, java.lang.String reqTraitNamespace, java.lang.String reqTraitName)Validates the input trait value.
if (SVGConstants.XLINK_NAMESPACE_URI == namespaceURI
&&
SVGConstants.SVG_HREF_ATTRIBUTE == traitName) {
if (value == null || !value.startsWith("#")) {
throw illegalTraitValue(traitName, value);
}
return value;
} else {
return super.validateTraitNS(namespaceURI,
traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|