FileDocCategorySizeDatePackage
ElementNode.javaAPI DocphoneME MR2 API (J2ME)135967Wed May 02 18:00:34 BST 2007com.sun.perseus.model

ElementNode

public abstract class ElementNode extends CompositeNode implements org.w3c.dom.svg.SVGElement
ElementNode models ModelNodesA ElementNode can have either ElementNode children and text content children (see the {@link #appendTextChild} appendTextChild} method).

In addition, Elements can have proxies (see {@link com.sun.perseus.model.ElementNodeProxy ElementNodeProxy}). The proxies are used for implementing the behavior of the <use> element and the <text> element. The buildProxy and removeProxy methods are used to add or remove proxies from a node.

Finally, the ElementNode class provides support for the common XML attributes supported by elements, such as the id, uriBase and conditional attributes.

version
$Id: ElementNode.java,v 1.27 2006/06/29 10:47:30 ln156897 Exp $

Fields Summary
static final String
TRAIT_TYPE_STRING
String trait type.
static final String
TRAIT_TYPE_FLOAT
Float trait type.
static final String
TRAIT_TYPE_SVG_MATRIX
SVGMatrix trait type.
static final String
TRAIT_TYPE_SVG_PATH
SVGPath trait type.
static final String
TRAIT_TYPE_SVG_RECT
SVGRect trait type
static final String
TRAIT_TYPE_SVG_RGB_COLOR
SVGRGBColor trait type.
public static final int
XML_SPACE_PRESERVE
See the SVG 1.1 specification
public static final int
XML_SPACE_DEFAULT
See the SVG 1.1 specification
public static final int
XML_SPACE_INHERIT
Use the parent node's xml:space setting
static final String
NULL_NS
Constant used to identify the per-element partition (sometimes called anonymous) namespace.
protected String
id
This node's id
protected String
uriBase
This node's URI base
protected String[]
conditionalAttributes
This node's conditional attributes.
public static final int
REQUIRED_FEATURES_INDEX
Index for requiredFeatures in conditionalAttributes.
public static final int
REQUIRED_EXTENSIONS_INDEX
Index for requiredExtensions in conditionalAttributes
public static final int
SYSTEM_LANGUAGE_INDEX
Index for systemLanguage in conditionalAttributes
public static final int
CONDITIONAl_ATTRIBUTES_LENGTH
Number of conditional attributes.
protected int
xmlSpace
The node's text white space handling policy
protected boolean
paintNeedsLoad
Controls whether or not the node needs to be fully loaded before it can be painted.
protected ElementNodeProxy
firstProxy
First node proxy. May be null.
protected ElementNodeProxy
lastProxy
Last node proxy. May be null.
protected boolean
buildingProxy
Used to detect circular references when building proxy chains.
protected Hashtable
traitAnimsNS
Maps namespaces to a map of (localName, TraitAnim)
Constructors Summary
public ElementNode(DocumentNode ownerDocument)
Only constructor.

param
ownerDocument the document this node belongs to.
throws
IllegalArgumentException if the input ownerDocument is null


                           
        

        if (ownerDocument == null) {
            throw new IllegalArgumentException();
        }

        this.ownerDocument = ownerDocument;
    
Methods Summary
public voidadd(com.sun.perseus.model.ElementNode element)
Appends an element at the end of the list

param
element the node to add to this CompositeNode
throws
NullPointerException if the input argument is null.

        super.add(element);

        ElementNodeProxy proxy = firstProxy;
        while (proxy != null) {
            proxy.proxiedChildAdded(element);
            proxy = proxy.nextProxy;
        }
    
protected voidaddProxy(ElementNodeProxy proxy)
Adds a proxy to this node. When this node is modified, the ElementNodeProxy's corresponding modification methods will be called so that modifications also gets reported on the proxy.

param
proxy new ElementNodeProxy
throws
NullPointerException if the input proxy is null.
see
UpdateListener#modifiedNode
see
UpdateListener#modifyingNode
see
UpdateListener#nodeInserted


        if (proxy == null) {
            throw new NullPointerException();
        }

        if (firstProxy == null) {
            firstProxy = proxy;
            lastProxy = proxy;
        } else {
            lastProxy.nextProxy = proxy;
            proxy.prevProxy = lastProxy;
            lastProxy = proxy;
        }
    
protected static java.lang.StringalignToStringTrait(int align)
Converts an align value to a preserveAspectRatio string trait value.

param
align one of StructureNode.ALIGN_NONE, StructureNode.ALIGN_XMIDYMID

        switch (align) {
        case StructureNode.ALIGN_XMIDYMID:
            return SVGConstants.SVG_IMAGE_PRESERVE_ASPECT_RATIO_DEFAULT_VALUE;
        default:
            return SVGConstants.SVG_NONE_VALUE;
        }
    
protected org.w3c.dom.DOMExceptionanimationError(java.lang.String targetId, java.lang.String traitNamespace, java.lang.String traitName, java.lang.String targetNamespace, java.lang.String targetName, java.lang.String animationId, java.lang.String animationNamespace, java.lang.String animationLocalName, java.lang.String errorDescription)

param
targetId the target element's id (may be null)
param
traitNamespace the animated trait's namespace.
param
traitName the animated trait's name.
param
targetNamespace the target element's namespace.
param
targetName the target element's name
param
animationId the animation id (may be null)
param
animationNamespace the animation's namespace
param
animationLocalName the animation's local name.
param
errorDescription the animation error's description.

        return new DOMException(DOMException.INVALID_STATE_ERR,
                                Messages.formatMessage
                                (Messages.ERROR_INVALID_ANIMATION_CONFIGURATION,
                                 new String[] {targetId,
                                               traitNamespace,
                                               traitName,
                                               targetNamespace,
                                               targetName,
                                               animationId,
                                               animationNamespace,
                                               animationLocalName,
                                               animationLocalName,
                                               errorDescription}));
    
public voidappendTextChild(java.lang.String text)
By default, appending a text child does not do anything.

param
text the text child to append to this node.

    
protected ElementNodeProxybuildExpandedProxy()

return
an adequate ElementNodeProxy for this node and makes sure the content is expanded before returning.

        if (buildingProxy) {
            // We ran into a circular reference.
            throw new IllegalStateException();
        }
        buildingProxy = true;
        ElementNodeProxy proxy = buildProxy();
        proxy.expand();
        buildingProxy = false;
        return proxy;
    
ElementNodeProxybuildProxy()

return
an adequate ElementNodeProxy for this node.

        return new ElementNodeProxy(this);
    
final voidcheckNCName(java.lang.String name)
Checks if the input trait name is valid and throws a DOMException with error code NOT_SUPPORTED_ERR if not.

param
name the name whose syntax should be checked.
throws
DOMException with error code NOT_SUPPORTED_ERR if the trait name is syntactically incorrect (e.g., null or containing characters not conforming to the Namespaces in XML specification.
see
http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName

        if (name == null || name.length() == 0) {
            throw unsupportedTrait(name);
        }

        // We should really validate that the name has the conforming syntax
        // But this slows down the load time considerably.
        //
        // NCName        ::=  (Letter | '_') (NCNameChar)*
        // NCNameChar 	 ::=  Letter | Digit | '.' | '-' | '_' | CombiningChar 
        //                      | Extender
    
protected voidcheckPositive(java.lang.String name, float value)
Throws a DOMException if the input float trait value is strictly negative.

param
name the trait name.
param
value the trait float value.

        if (value < 0) {
            throw illegalTraitValue(name, Float.toString(value));
        }
    
protected voidcheckWriteLoading(java.lang.String name)
Throws a DOMException if the element is not loading, i.e., if its loaded field is set to true.

param
name the name of the trait that is accessed.

        if (loaded && isInDocumentTree()) {
            throw readOnlyTraitError(name);
        }
    
final booleanconditionEquals(int index, java.lang.String[] conditionValue)
Returns true if the condition at the given index is equal to the input value.

        if (conditionValue == null) {
            return (conditionalAttributes == null) 
                    ||
                   (conditionalAttributes[index] == null);
        } else {
            return (conditionalAttributes != null)
                    &&
                   (equal(conditionalAttributes[index], conditionValue));
        }
    
TraitAnimcreateTraitAnimImpl(java.lang.String traitName)
To be overridden by derived classes. Should create the proper TraitAnim type for the given trait in the anonymous namespace.

param
traitName the trait name.

        //
        // If the trait is supported but the element did not create
        // a TraitAnim in its implementation of createTraitAnimImpl,
        // it means the trait is not animatable.
        //
        if (supportsTrait(traitName)) {
            throw notAnimatable(null, 
                                traitName);
        }

        return new StringTraitAnim(this, NULL_NS, traitName);
    
TraitAnimcreateTraitAnimNS(java.lang.String traitNamespace, java.lang.String traitName)
Implementation method. Creates a TraitAnim for the requested trait. This method does not check whether or not there is an existing TraitAnim for the trait. Instead, it creates a new TraitAnim and associates it with the given trait. After this call, any call to getSafeTraitAnimNS or getTraitAnimNS will return this new object.

param
traitName the trait name.
param
traitNamespace the trait's namespace. Should not be null.

        if (traitNamespace == null || traitNamespace.length() == 0) {
            traitNamespace = NULL_NS;
        }

        TraitAnim traitAnim = null;
        if (NULL_NS == traitNamespace) {
            traitAnim = createTraitAnimImpl(traitName);
        } else {
            traitAnim = createTraitAnimNSImpl(traitNamespace, traitName);
        }

        if (traitAnimsNS == null) {
            traitAnimsNS = new Hashtable();
        }

        Hashtable nsTraitAnims = (Hashtable) traitAnimsNS.get(traitNamespace);
        if (nsTraitAnims == null) {
            nsTraitAnims = new Hashtable();
            traitAnimsNS.put(traitNamespace, nsTraitAnims);
        }

        nsTraitAnims.put(traitName, traitAnim);
        return traitAnim;
    
TraitAnimcreateTraitAnimNSImpl(java.lang.String traitNamespace, java.lang.String traitName)
To be overridden by derived classes. Should create the proper TraitAnim type for the given trait in the desired namespace.

param
traitName the trait name.

        //
        // If the trait is supported but the element did not create
        // a TraitAnim in its implementation of createTraitAnimImpl,
        // it means the trait is not animatable.
        //
        if (supportsTraitNS(traitNamespace, traitName)) {
            throw notAnimatable(traitNamespace, 
                                traitName);
        }

        return new StringTraitAnim(this, traitNamespace, traitName);
    
public static booleanequal(java.lang.Object objA, java.lang.Object objB)

param
objA first object to compare.
param
objB second object to compare.
return
true if the objects are both null or if they are Object.equals()

        if (objA == objB) {
            return true;
        }

        if (objA == null || objB == null) {
            return false;
        }

        return objA.equals(objB);
    
public static booleanequal(float[] faa, float[] fab)

param
faa first float array to compare
param
faab second float array to compare
return
true if the objects are both null or if they are equal

        if (faa == fab) {
            return true;
        }

        if (faa == null || fab == null || faa.length != fab.length) {
            return false;
        }

        int n = faa.length;
        for (int i = 0; i < n; i++) {
            if (faa[i] != fab[i]) {
                return false;
            }
        }

        return true;
    
public static booleanequal(java.lang.String[] saa, java.lang.String[] sab)

param
saa first string array to compare
param
sab second string array to compare
return
true if the objects are both null or if they are equal

        if (saa == sab) {
            return true;
        }

        if (saa == null || sab == null || saa.length != sab.length) {
            return false;
        }

        int n = saa.length;
        for (int i = 0; i < n; i++) {
            if (!equal(saa[i], sab[i])) {
                return false;
            }
        }

        return true;
    
public static booleanequal(int[][] iaa, int[][] iab)

param
iaa first int array to compare
param
iab second int array to compare
return
true if the objects are both null or if they are equal

        if (iaa == iab) {
            return true;
        }

        if (iaa == null || iab == null || iaa.length != iab.length) {
            return false;
        }

        int n = iaa.length;
        for (int i = 0; i < n; i++) {
            if (iaa[i] != iab[i]) {
                if (iaa[i] == null || iab[i] == null 
                        || iaa[i].length != iab[i].length) {
                    return false;
                }

                int m = iaa[i].length;
                for (int j = 0; j < m; j++) {
                    if (iaa[i][j] != iab[i][j]) {
                        return false;
                    }
                }
            }
        }

        return true;
    
public static booleanequal(float[][] faa, float[][] fab)

param
faa first float array to compare
param
fab second float array to compare
return
true if the objects are both null or if they are equal

        if (faa == fab) {
            return true;
        }

        if (faa == null || fab == null || faa.length != fab.length) {
            return false;
        }

        int n = faa.length;
        for (int i = 0; i < n; i++) {
            if (faa[i] != fab[i]) {
                if (faa[i] == null || fab[i] == null 
                        || faa[i].length != fab[i].length) {
                    return false;
                }

                int m = faa[i].length;
                for (int j = 0; j < m; j++) {
                    if (faa[i][j] != fab[i][j]) {
                        return false;
                    }
                }
            }
        }

        return true;
    
protected java.lang.StringfontStylesToStringTrait(int styles)
Converts a FontFace's font-styles to a String trait.

param
styles the FontFace type styles value.

        if (styles == FontFace.FONT_STYLE_ALL) {
            return SVGConstants.CSS_ALL_VALUE;
        }

        StringBuffer sb = new StringBuffer();
        
        if ((styles & TextNode.FONT_STYLE_NORMAL) != 0) {
            sb.append(SVGConstants.CSS_NORMAL_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((styles & TextNode.FONT_STYLE_ITALIC) != 0) {
            sb.append(SVGConstants.CSS_ITALIC_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((styles & TextNode.FONT_STYLE_OBLIQUE) != 0) {
            sb.append(SVGConstants.CSS_OBLIQUE_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if (sb.length() > 0) {
            return sb.toString().substring(0, sb.length() - 1);
        }
        
        return sb.toString();
    
protected java.lang.StringfontWeightsToStringTrait(int weight)
Converts an FontFace's font-weights to a String trait.

param
weight the FontFace type' weights value.

        if (weight == FontFace.FONT_WEIGHT_ALL) {
            return SVGConstants.CSS_ALL_VALUE;
        }

        StringBuffer sb = new StringBuffer();
        if ((weight & TextNode.FONT_WEIGHT_100) != 0) {
            sb.append(SVGConstants.CSS_100_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_200) != 0) {
            sb.append(SVGConstants.CSS_200_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_300) != 0) {
            sb.append(SVGConstants.CSS_300_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_400) != 0) {
            sb.append(SVGConstants.CSS_400_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_500) != 0) {
            sb.append(SVGConstants.CSS_500_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_600) != 0) {
            sb.append(SVGConstants.CSS_600_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_700) != 0) {
            sb.append(SVGConstants.CSS_700_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_800) != 0) {
            sb.append(SVGConstants.CSS_800_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if ((weight & TextNode.FONT_WEIGHT_900) != 0) {
            sb.append(SVGConstants.CSS_900_VALUE);
            sb.append(SVGConstants.COMMA);
        }

        if (sb.length() > 0) {
            return sb.toString().substring(0, sb.length() - 1);
        }
        
        return sb.toString();
    
public final java.lang.StringgetAttribute(java.lang.String name)
Returns the requested attribute.

param
name - the name of the attribute to add.
return
the attribute value or empty string if the attribute is not specified.
throws
DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

        checkNCName(name);

        name = name.intern();
        return getTraitImpl(name);
    
public final java.lang.StringgetAttributeNS(java.lang.String namespaceURI, java.lang.String name)
Returns the requested attribute in the specified namespace.

param
namespaceURI - the namespace URI of the attribute to create or alter.
param
name - the local name of the attribute to create or alter.
return
the attribute value as a string, or the empty string if the attribute was not specified.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.

        if (namespaceURI == null || namespaceURI.length() == 0) {
            return getAttribute(name);
        }

        checkNCName(name);

        namespaceURI = namespaceURI.intern();
        name = name.intern();

        return getTraitNSImpl(namespaceURI, name);
    
java.lang.String[]getConditionalAttribute(int index)
Returns the value of the conditional attribute with the given index.

param
index the conditional attribute index.
return
the conditional attribute value.

        if (conditionalAttributes != null) {
            return conditionalAttributes[index];
        } else {
            return null;
        }
    
public java.lang.String[][]getDefaultTraits()

return
an array of trait default values, used if this element requires that the default trait value be explicitly set through a setTrait call. This happens, for example, with the begin trait value on animation elements.

        return null;
    
public ModelNodegetFirstComputedExpandedChild()
Some node types (such as ElementNodeProxy) have expanded children that they compute in some specific way depending on the implementation.

return
a reference to the node's first expanded child, or null if there are no expanded children.

        return null;
    
public org.w3c.dom.ElementgetFirstElementChild()

return
the first child element node of this element. null if this element has no child elements.

        return (Element) firstChild;
    
ModelNodegetFirstExpandedChild()
By default, an ElementNode has no expanded content, so this returns null.

return
a reference to the node's first expanded child, or null if there are no expanded children. This forces the computation of expanded content if needed.

        return null;
    
public final floatgetFloatTrait(java.lang.String name)

param
name the requested trait's name.
return
the trait value as float.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a float

        
        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        TraitAnim anim = getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            return getFloatTraitImpl(name);
        }

        // Get the computed value from the trait animation.
        return parseFloatTrait(name, anim.getTrait(TRAIT_TYPE_FLOAT));
    
floatgetFloatTraitImpl(java.lang.String name)

param
name the requested trait's name.
return
the trait value as float.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a float

        throw unsupportedTraitType(name, TRAIT_TYPE_FLOAT);
    
public java.lang.StringgetId()

return
the node's identifier

        return id;
    
public org.w3c.dom.ElementgetLastElementChild()

return
the last child element node of this element. null if this element has no child elements.

        return (Element) lastChild;
    
ModelNodegetLastExpandedChild()
By default, an ElementNode has no expanded content, so this returns null.

return
a reference to the node's last expanded child, or null if there are no expanded children. This forces the computation of expanded content if needed.

        return null;
    
public final org.w3c.dom.svg.SVGMatrixgetMatrixTrait(java.lang.String name)
Returns the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. The returned object is a copy of the actual trait value and will not change ifthe corresponding trait changes.

param
name matrix trait name.
return
the trait value corresponding to name as SVGMatrix.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        TraitAnim anim = getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            return getMatrixTraitImpl(name);
        }

        // Get the computed value from the trait animation
        SVGMatrix m = 
            parseTransformTrait(name, anim.getTrait(TRAIT_TYPE_SVG_MATRIX));

        if (m == null) {
            m = new Transform(1, 0, 0, 1, 0, 0);
        }

        return m;
    
org.w3c.dom.svg.SVGMatrixgetMatrixTraitImpl(java.lang.String name)
Returns the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. The returned object is a copy of the actual trait value and will not change ifthe corresponding trait changes.

param
name matrix trait name.
return
the trait value corresponding to name as SVGMatrix.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_MATRIX);
    
public java.lang.StringgetNamespaceURI()

return
the namespace URI of the Node. By default, this returns SVGConstants.SVG_NAMESPACE_URI.

        return SVGConstants.SVG_NAMESPACE_URI;
    
public org.w3c.dom.ElementgetNextElementSibling()

return
the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree.

        // Casting is safe here because ElementNodes can only have ElementNode
        // siblings.
        return (Element) nextSibling;
    
public booleangetPaintNeedsLoad()

return
true if the node needs to be fully loaded before it can be painted

        return paintNeedsLoad;
    
public org.w3c.dom.NodegetParentNode()
Returns the parent Node of this Node.

return
the parent node or null if there is no parent (i.e. if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null).
throws
SecurityException if the application does not have the necessary privilege rights to access this (SVG) content.

        return (Node) parent;
    
public final org.w3c.dom.svg.SVGPathgetPathTrait(java.lang.String name)
Returns the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes.

param
name the trait's name.
return
the trait's value, as an SVGPath object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGPath SVGPath}

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        TraitAnim anim = getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            return getPathTraitImpl(name);
        }

        // Get the computed value from the trait animation.
        return parsePathTrait(name, anim.getTrait(TRAIT_TYPE_SVG_PATH));
    
org.w3c.dom.svg.SVGPathgetPathTraitImpl(java.lang.String name)
Returns the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes.

param
name the trait's name.
return
the trait's value, as an SVGPath object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGPath SVGPath}

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_PATH);
    
public org.w3c.dom.ElementgetPreviousElementSibling()

return
the previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.

        // Casting is safe here because ElementNodes can only have ElementNode
        // siblings.
        return (Element) prevSibling;
    
public final org.w3c.dom.svg.SVGRGBColorgetRGBColorTrait(java.lang.String name)
Returns the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}. The returned object is a copy of the trait value and will not change if the corresponding trait changes. If the actual trait value is not an RGBColor (i.e. "none"), this method will return null.

param
name the requested trait name.
return
the trait value, as an SVGRGBColor object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        TraitAnim anim = getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            return getRGBColorTraitImpl(name);
        }

        // Get the computed value from the trait animation
        return toSVGRGBColor(
                name, 
                parseColorTrait(name, anim.getTrait(TRAIT_TYPE_SVG_RGB_COLOR)));
    
org.w3c.dom.svg.SVGRGBColorgetRGBColorTraitImpl(java.lang.String name)
Returns the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}. The returned object is a copy of the trait value and will not change if the corresponding trait changes. If the actual trait value is not an RGBColor (i.e. "none"), this method will return null.

param
name the requested trait name.
return
the trait value, as an SVGRGBColor object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_RGB_COLOR);
    
public final org.w3c.dom.svg.SVGRectgetRectTrait(java.lang.String name)

param
name the trait's name.
return
the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRect SVGRect}

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        TraitAnim anim = getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            return getRectTraitImpl(name);
        }

        // Get the computed value from the trait animation.
        return toSVGRect(toViewBox(name, anim.getTrait(TRAIT_TYPE_SVG_RECT)));
    
org.w3c.dom.svg.SVGRectgetRectTraitImpl(java.lang.String name)

param
name the trait's name.
return
the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRect SVGRect}

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_RECT);
    
public java.lang.String[]getRequiredExtensions()
The node will only render if the required extension is supported by Perseus.

return
the extensions required to render this node
see
#setRequiredExtensions

        return getConditionalAttribute(REQUIRED_EXTENSIONS_INDEX);
    
public java.lang.String[]getRequiredFeatures()
The node will only render if the required feature is supported by Perseus.

return
the array of features required for this node to render.
see
#setRequiredFeatures

 
        return getConditionalAttribute(REQUIRED_FEATURES_INDEX);
    
public java.lang.String[]getRequiredTraits()

return
an array of traits that are required by this element.

        return null;
    
public java.lang.String[][]getRequiredTraitsNS()

return
an array of namespaceURI, localName trait pairs required by this element.

        return null;
    
TraitAnimgetSafeTraitAnimNS(java.lang.String traitNamespace, java.lang.String traitName)

param
traitNamespace the namespace of the trait for which a TraitAnim is requested.
param
traitName the trait for which there may be a TraitAnimation.
return
the TraitAnim for the requested trait name.

        TraitAnim traitAnim = getTraitAnimNS(traitNamespace, traitName);
        if (traitAnim == null) {
            traitAnim = createTraitAnimNS(traitNamespace, traitName);
        }

        return traitAnim;
    
java.lang.StringgetSpecifiedTraitImpl(java.lang.String traitName)
Returns the specified 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.

param
traitName the requested trait name.
return
the trait value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).

        return getTraitImpl(traitName);
    
java.lang.StringgetSpecifiedTraitNSImpl(java.lang.String traitNamespace, java.lang.String traitName)
Returns the specified 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.

param
traitNamespace the requested trait's namespace.
param
traitName the requested trait name.
return
the trait value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).

        if (traitNamespace == null || traitNamespace == NULL_NS) {
            return getSpecifiedTraitImpl(traitName);
        }

        // Only xml:base behaves differently because the computed value
        // may be different from the specified value.
        if (SVGConstants.XML_NAMESPACE_URI == traitNamespace
            &&
            SVGConstants.XML_BASE_ATTRIBUTE_LOCAL_NAME == traitName) {
            return uriBase;
        }
        
        return getTraitNSImpl(traitNamespace, traitName);
    
public java.lang.String[]getSystemLanguage()
The node will only render if the Perseus user language matches one of the values in this comma separated list. A null value is a match.

return
the set of system languages.
see
#setSystemLanguage

        return getConditionalAttribute(SYSTEM_LANGUAGE_INDEX);
    
public final java.lang.StringgetTrait(java.lang.String traitName)
The traits supported by default are: externalResourcesRequired, xml:base, xml:space, requiredFeatures, requiredExtensions and systemLanguage. 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.

param
name the requested trait name.
return
the trait value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).

        traitName = intern(traitName);

        if (!supportsTrait(traitName)) {
            throw unsupportedTrait(traitName);
        }

        TraitAnim anim = getTraitAnimNS(NULL_NS, traitName);
        if (anim == null || !anim.active) {
            return getTraitImpl(traitName);
        }
        
        // Get the computed trait value from the trait animation.
        return anim.getTrait(TRAIT_TYPE_STRING);
    
public java.lang.String[][]getTraitAliases()

return
an array of trait aliases. These are used when the value of a trait can be used to set the value of another trait. For example, on a , if the rx trait is not specified in the original XML document, the value fot eh ry trait should be used.

        return null;
    
TraitAnimgetTraitAnimNS(java.lang.String traitNamespace, java.lang.String traitName)

param
traitNamespace the namespace of the trait for which a TraitAnim is requested.
param
traitName the trait for which there may be a TraitAnimation.
return
the TraitAnim for the requested trait name.

        if (traitName == null) {
            throw new NullPointerException();
        }

        if (traitAnimsNS == null) {
            return null;
        }

        if (traitNamespace == null || traitNamespace.length() == 0) {
            traitNamespace = NULL_NS;
        }
        
        Hashtable nsTraitAnims = (Hashtable) traitAnimsNS.get(traitNamespace);
        if (nsTraitAnims != null) {
            return (TraitAnim) nsTraitAnims.get(traitName);
        }
        return null;
    
public java.lang.StringgetTraitImpl(java.lang.String name)
The traits supported by default are: externalResourcesRequired, xml:base, xml:space, requiredFeatures, requiredExtensions and systemLanguage. 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.

param
name the requested trait name.
return
the trait value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).

        if (SVGConstants.SVG_ID_ATTRIBUTE == name) {
            return getId();
        } else 
            if (SVGConstants.SVG_REQUIRED_FEATURES_ATTRIBUTE == name) {
                return toStringTrait(getRequiredFeatures(), " ");
        } else 
            if (SVGConstants.SVG_REQUIRED_EXTENSIONS_ATTRIBUTE == name) {
                return toStringTrait(getRequiredExtensions(), " ");
        } else 
            if (SVGConstants.SVG_SYSTEM_LANGUAGE_ATTRIBUTE == name) {
                return toStringTrait(getSystemLanguage(), ",");
        } else {
            if (!supportsTrait(name)) {
                if (name == null) {
                    throw unsupportedTrait(name);
                }

                String unknownTraitValue =
                    ownerDocument.getUnknownTraitsNS(this, NULL_NS, name);
                if (unknownTraitValue != null) {
                    return unknownTraitValue;
                } else {
                    return "";
                }
            } else {
                throw unsupportedTraitType(name, TRAIT_TYPE_STRING);
            }
        }
    
public final java.lang.StringgetTraitNS(java.lang.String namespaceURI, java.lang.String name)
Same as {@link org.w3c.dom.svg.SVGElement#getTrait getTrait}, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.

param
namespaceURI the requested trait's namespace.
param
name the requested trait's local name (un-prefixed, e.g, 'href')
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).
throws
SecurityException if the application does not have the necessary privilege rights to access this (SVG) content.

        if (namespaceURI == null) {
            return getTrait(name);
        }

        name = intern(name);
        namespaceURI = intern(namespaceURI);

        if (!supportsTraitNS(namespaceURI, name)) {
            throw unsupportedTraitNS(name, namespaceURI);
        }

        StringTraitAnim anim = (StringTraitAnim) getTraitAnimNS(namespaceURI, 
                                                                name);
        if (anim == null || !anim.active) {
            return getTraitNSImpl(namespaceURI, name);
        } 

        return anim.getTrait(TRAIT_TYPE_STRING);
    
java.lang.StringgetTraitNSImpl(java.lang.String namespaceURI, java.lang.String name)
Same as {@link org.w3c.dom.svg.SVGElement#getTrait getTrait}, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.

param
namespaceURI the requested trait's namespace.
param
name the requested trait's local name (un-prefixed, e.g, 'href')
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).
throws
SecurityException if the application does not have the necessary privilege rights to access this (SVG) content.

        if (SVGConstants.PERSEUS_NAMESPACE_URI == namespaceURI) {
            if (SVGConstants.PERSEUS_CHILDREN_REQUIRED_ATTRIBUTE == name) {
                if (paintNeedsLoad) {
                    return SVGConstants.SVG_TRUE_VALUE;
                } else {
                    return SVGConstants.SVG_FALSE_VALUE;
                }
            }
        } else if (SVGConstants.XML_NAMESPACE_URI == namespaceURI) {
            if (SVGConstants.XML_BASE_ATTRIBUTE_LOCAL_NAME == name) {
                return getURIBase();
            } else 
                if (SVGConstants.XML_SPACE_ATTRIBUTE_LOCAL_NAME == name) {
                switch (getXMLSpace()) {
                case XML_SPACE_DEFAULT:
                    return SVGConstants.XML_DEFAULT_VALUE;
                case XML_SPACE_PRESERVE:
                default:
                    return SVGConstants.XML_PRESERVE_VALUE;
                }
            }
        } 

        if (!supportsTraitNS(namespaceURI, name)) {
            String unknownTraitValue = 
                ownerDocument.getUnknownTraitsNS(this, namespaceURI, name);
            
            if (unknownTraitValue != null) {
                return unknownTraitValue;
            }
            
            return "";
        } else {
            throw unsupportedTraitTypeNS(name, namespaceURI, TRAIT_TYPE_STRING);
        }
    
public java.lang.StringgetURIBase()
The node's URI base to use to resolve URI references If a URI base value was set on this node, then that value is returned. Otherwise, this method returns the parent's URI base.

return
the node's URI base to use to resolve relative URI references.

        if (uriBase == null) {
            if (parent != null) {
                return parent.getURIBase();
            }
            return null;
        } else {
            if (uriBase.indexOf(":") != -1 || parent == null) {
                // This is not a relative URI, we can return this
                // value
                // - or -
                // There is no parent, return this relative URI
                // as the baseURI
                return uriBase;
            } else {
                // There is no scheme in this node's uri base. 
                // We concatenate the uriBase to the one of the 
                // parent. 
                // This is done according to RFC 2396 
                // (http://www.faqs.org/rfcs/rfc2396.html)
                String parentURIBase = parent.getURIBase();
                if (parentURIBase != null) {
                    int lastSlashIndex = parentURIBase.lastIndexOf('/");
                    if (lastSlashIndex != -1) {
                        parentURIBase 
                            = parentURIBase.substring(0, lastSlashIndex);
                    }
                    return parentURIBase + '/" + uriBase;
                } else {
                    return uriBase;
                }
            }
        }
    
public intgetXMLSpace()
Defines how the node handles white spaces. Note that if the value is set to null, the node should return the value of its parent, as the xml:space attribute is inherited.

return
one of XML_SPACE_DEFAULT, XML_SPACE_PRESERVE

        if (xmlSpace != XML_SPACE_INHERIT) {
            return xmlSpace;
        } else {
            ModelNode ancestor = parent;
            while (ancestor != null) {
                if (ancestor instanceof ElementNode) {
                    return ((ElementNode) parent).getXMLSpace();
                }
                ancestor = ancestor.parent;
            }
            return XML_SPACE_DEFAULT;
        }
    
org.w3c.dom.DOMExceptionillegalTraitValue(java.lang.String name, java.lang.String value)

param
name the name of the trait
param
value the illegal value.
return
a DOMException describing an illegal trait value

        return new DOMException(
                DOMException.INVALID_ACCESS_ERR,
                Messages.formatMessage(
                    Messages.ERROR_INVALID_TRAIT_VALUE,
                    new String[] {
                        name,
                        value,
                        getLocalName() + "(" + getId() + ")",
                        getNamespaceURI()
                    }));
    
protected org.w3c.dom.DOMExceptionillegalTraitValue(java.lang.String name, java.lang.String namespaceURI, java.lang.String value)

param
name the name of the trait
param
namespaceURI the trait's namespace URI.
param
value the illegal value.
return
a DOMException describing an illegal trait value

        return illegalTraitValue(name + "(" + namespaceURI + ")",
                                 value);
    
public static java.lang.Stringintern(java.lang.String str)
Utility method.

param
str the String object to intern.
return
null if the input string is null. The interned string otherwise.

        if (str == null) {
            return null;
        }

        return str.intern();
    
protected voidmodifiedNode()
Used to notify the UpdateListener, if any, of a completed node modification

        UpdateListener updateListener = getUpdateListener();
        if (updateListener != null) {
            updateListener.modifiedNode(this);
        }
        
        // See comment in #modifyingNode.
        ElementNodeProxy proxy = firstProxy;
        while (proxy != null) {
            proxy.modifiedProxied();
            proxy = proxy.nextProxy;
        }
    
protected voidmodifyingNode()
Used to notify the UpdateListener, if any, of an upcoming node modification

        UpdateListener updateListener = getUpdateListener();
        if (updateListener != null) {
            updateListener.modifyingNode(this);
        }
        
        // During progressive rendering, a proxy may be hooked into
        // the tree while the referenced node is not. This is why we
        // need to notify proxies even if the node is not hooked into 
        // the tree yet.
        ElementNodeProxy proxy = firstProxy;
        while (proxy != null) {
            proxy.modifyingProxied();
            proxy = proxy.nextProxy;
        }
    
public abstract com.sun.perseus.model.ElementNodenewInstance(DocumentNode doc)
Used by DocumentNode to create a new instance from a prototype ElementNode.

param
doc the DocumentNode for which a new node is should be created.
return
a new ElementNode for the requested document.

voidnodeHookedInDocumentTree()
When an Element is hooked into the document tree, it needs to register as an identified node if it does have an id.

        super.nodeHookedInDocumentTree();

        if (id != null) {
            ownerDocument.addIdentifiedNode(this);
        }
    
org.w3c.dom.DOMExceptionnotAnimatable(java.lang.String traitNamespace, java.lang.String traitName)

param
name the name of the trait
param
value the illegal value.
return
a DOMException describing an illegal trait value

        return new DOMException(DOMException.NOT_SUPPORTED_ERR,
                                Messages.formatMessage
                                (Messages.ERROR_TRAIT_NOT_ANIMATABLE,
                                 new String[] {traitNamespace,
                                               traitName,
                                               getLocalName(),
                                               getNamespaceURI()}));
    
protected final TimeparseClockTrait(java.lang.String traitName, java.lang.String value)
Parses the input value and converts it to a Time value.

param
traitName the name of the clock trait being parsed.
param
value the value to convert to a Time instance.
return
the value converted to a Time object.
throws
DOMException if the input value is invalid.

        if (SVGConstants.SVG_INDEFINITE_VALUE.equals(value)) {
            return Time.INDEFINITE;
        }

        try {
            return new Time(ownerDocument.clockParser.parseClock(value));
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(traitName, value);
        }
    
protected final com.sun.perseus.j2d.RGBparseColorTrait(java.lang.String traitName, java.lang.String value)
Parses the input value and converts it to an RGB value

param
traitName the name of the color trait being parsed.
param
value the value to convert to an RGB
return
the value converted to a RGB object
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid color trait value.

        try {
            return ownerDocument.colorParser.parseColor(value);
        } catch (IllegalArgumentException e) {
            throw illegalTraitValue(traitName, value);
        }
    
public final float[]parseFloatArrayTrait(java.lang.String traitName, java.lang.String value)
Utility method. This should be used for XML attribute values converted to float arrays.

param
traitName the name of the trait to parse
param
ctx the build context
return
the attribute value, converted to float
throws
DOMException if the value represents an invalid floating point array value.

        return parseFloatArrayTrait(traitName, value, ',");
    
public final float[]parseFloatArrayTrait(java.lang.String traitName, java.lang.String value, char sep)
Utility method. This should be used for XML attribute values converted to float arrays.

param
traitName the name of the trait to parse
param
value the value to parse
param
sep the number separator in the input value list of numbers.
return
the attribute value, converted to float
throws
DOMException if the value represents an invalid floating point array value.

        try {
            return ownerDocument.numberListParser.parseNumberList(value, sep);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            throw illegalTraitValue(traitName, value);
        }
    
protected final floatparseFloatTrait(java.lang.String name, java.lang.String value)
Parses the input value and converts it to a float value.

param
name the name of the trait to convert to a float.
param
value the value to convert to a float.
return
the value converted to a float value.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid float value or null.

        try {
            return ownerDocument.lengthParser.parseNumber(value);
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(name, value);
        }
    
public java.lang.String[]parseFontFamilyTrait(java.lang.String name, java.lang.String value)
Parses the input value assuming it has the folloing syntax: Value: [ | ] [, [ | ]]*

param
name the name of the trait being parsed.
param
value the font family value to be parsed. Should not be null.
return
an array of font-family strings

        if (value == null) {
            throw illegalTraitValue(name, value);
        }

        SimpleTokenizer st = new SimpleTokenizer(value, SVGConstants.COMMA_STR);
        String[] fontFamily = new String[st.countTokens()];
        int i = 0;
        while (st.hasMoreTokens()) {
            fontFamily[i] = st.nextToken();
            
            // Remove leading and trailing white spaces
            fontFamily[i] = fontFamily[i].trim();
            
            //
            // Now, take care of quotes
            //
            
            // <!> NOTE
            //
            // According to the CSS spec., if font family values are not 
            // quoted, then the spaces should be consolidated. The following
            // code does not do that. 
            //
            if (fontFamily[i].length() > 0) {
                if (fontFamily[i].charAt(0) == '\'") {
                    // If there is a trailing quote, remove the quotes
                    if (fontFamily[i].charAt(fontFamily[i].length() - 1) 
                        == 
                        '\'") {
                        fontFamily[i] = 
                            fontFamily[i].substring(1,
                                                    fontFamily[i].length() - 1);
                    }
                }
            } 
            i++;
        }

        return fontFamily;
    
public final intparseFontStylesTrait(java.lang.String name, java.lang.String value)
CSS 2 Specification (section 15.3.2) and SVG 1.1 specification (20.8.3): all | [ normal | italic | oblique ] [, [normal | italic | oblique] ]*

param
name the name of the trait to parse
param
value the trait value
return
the font style in the FontFace.FONT_STYLE_XXX value set.
throws
DOMException if the value is not a legal one for this trait.

        if (value == null) {
            throw illegalTraitValue(name, value);
        }

        if (SVGConstants.CSS_ALL_VALUE.equals(value)) {
            return FontFace.FONT_STYLE_ALL;
        }

        SimpleTokenizer st = new SimpleTokenizer(value, SVGConstants.COMMA_STR);

        if (st.countTokens() < 1) {
            throw illegalTraitValue(name, value);
        }

        int styles = 0;
        while (st.hasMoreTokens()) {
            String t = st.nextToken().trim();
            if (SVGConstants.CSS_NORMAL_VALUE.equals(t)) {
                styles |= TextNode.FONT_STYLE_NORMAL;
            } else if (SVGConstants.CSS_ITALIC_VALUE.equals(t)) {
                styles |= TextNode.FONT_STYLE_ITALIC;
            } else if (SVGConstants.CSS_OBLIQUE_VALUE.equals(t)) {
                styles |= TextNode.FONT_STYLE_OBLIQUE;
            } else {
                throw illegalTraitValue(name, value);
            }
        }

        return styles;
    
protected final intparseFontWeightsTrait(java.lang.String name, java.lang.String value)
CSS 2 specification ((section 15.3.2) and SVG 1.1 specification (20.8.3): all | [normal | bold |100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900] [, [normal | bold |100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900]]*

param
name the name of the trait to parse
param
value the trait value.
return
the font weight as an int value in the FontFace.FONT_WEIGHT_XXX set.
throws
DOMException if the value is not a legal one for this trait.

        if (value == null) {
            throw illegalTraitValue(name, value);
        }

        if (SVGConstants.CSS_ALL_VALUE.equals(value)) {
            return FontFace.FONT_WEIGHT_ALL;
        }

        SimpleTokenizer st = new SimpleTokenizer(value, SVGConstants.COMMA_STR);

        if (st.countTokens() < 1) {
            throw illegalTraitValue(name, value);
        }

        int weights = 0;
        while (st.hasMoreTokens()) {
            String t = st.nextToken().trim();
            if (SVGConstants.CSS_NORMAL_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_NORMAL;
            } else if (SVGConstants.CSS_BOLD_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_BOLD;
            } else if (SVGConstants.CSS_100_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_100;
            } else if (SVGConstants.CSS_200_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_200;
            } else if (SVGConstants.CSS_300_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_300;
            } else if (SVGConstants.CSS_400_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_400;
            } else if (SVGConstants.CSS_500_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_500;
            } else if (SVGConstants.CSS_600_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_600;
            } else if (SVGConstants.CSS_700_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_700;
            } else if (SVGConstants.CSS_800_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_800;
            } else if (SVGConstants.CSS_900_VALUE.equals(t)) {
                weights |= TextNode.FONT_WEIGHT_900;
            } else {
                throw illegalTraitValue(name, value);
            }
        }

        return weights;
    
protected final floatparseLengthTrait(java.lang.String name, java.lang.String value, boolean isHorizontal)
Parses the input value and converts it to a float.

param
name the trait name.
param
value the value to convert to a float.
param
isHorizontal controls whether this is a horizontal length or not.
return
the value converted to a float.
throws
DOMException if the trait value is invalid.

        try {
            Length l = ownerDocument.lengthParser.parseLength(value);
            switch (l.unit) {
            case Length.SVG_LENGTHTYPE_NUMBER:
                return l.value;
            case Length.SVG_LENGTHTYPE_IN:
                return (l.value * 25.4f / ownerDocument.getPixelMMSize());
            case Length.SVG_LENGTHTYPE_CM:
                return (l.value * 10f / ownerDocument.getPixelMMSize());
            case Length.SVG_LENGTHTYPE_MM:
                return (l.value / ownerDocument.getPixelMMSize());
            case Length.SVG_LENGTHTYPE_PT:
                return (l.value * 25.4f / 
                        (72f * ownerDocument.getPixelMMSize()));
            case Length.SVG_LENGTHTYPE_PC:
                return (l.value * 25.4f / 
                        (6f * ownerDocument.getPixelMMSize()));
            case Length.SVG_LENGTHTYPE_PERCENTAGE:
                if (isHorizontal) {
                    return ownerDocument.width * l.value / 100f;
                } else {
                    return ownerDocument.height * l.value / 100f;
                } 
            default:
                // This should never happen.
                throw new Error();
            }
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(name, value);
        }
    
protected final TimeparseMinMaxClock(java.lang.String traitName, java.lang.String value, boolean isMin)
Parses the input value and converts it to a Time value. If there is a syntax error or if the value is invalid for the given usage (has to be [0, infinite[ for min, and ]0, infinite[ for max, then the default is used. For min, the default is 0. For max, the default is 'indefinite'

param
traitName the name of the clock trait being parsed.
param
value the value to convert to a Time instance.
param
isMin should
return
the value converted to a Time object.
throws
DOMException if the input value is invalid.

        if (SVGConstants.SVG_INDEFINITE_VALUE.equals(value)) {
            return Time.INDEFINITE;
        }

        if (value == null) {
            throw illegalTraitValue(traitName, value);
        }

        try {
            long v = ownerDocument.clockParser.parseClock(value);
            if (v < 0) {
                throw new IllegalArgumentException();
            }

            if (v == 0 && !isMin) {
                throw new IllegalArgumentException();
            }

            return new Time(v);
        } catch (IllegalArgumentException iae) {
            if (isMin) {
                return new Time(0);
            }
            return Time.INDEFINITE;
        }
    
protected final com.sun.perseus.j2d.PaintServerparsePaintTrait(java.lang.String traitName, com.sun.perseus.j2d.PaintTarget paintTarget, java.lang.String value)
Parses the input value and converts it to a Paint value

param
traitName the name of the color trait being parsed.
param
paintTarget the PaintTarget requesting the PaintServer.
param
value the value to convert to a Paint
return
the value converted to a Paint object
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid color trait value.

        if (value == null) {
            throw illegalTraitValue(traitName, value);
        }

        if (value.startsWith("url(#")) {
            if (value.length() < 7 
                || 
                value.charAt(value.length() - 1) != ')") {
                throw illegalTraitValue(traitName, value);
            }
            
            String idRef = value.substring(5, value.length() - 1);

            return PaintServerReference.resolve(ownerDocument,
                                                paintTarget,
                                                traitName,
                                                idRef);
        } else {
            try {
                return ownerDocument.colorParser.parseColor(value);
            } catch (IllegalArgumentException e) {
                throw illegalTraitValue(traitName, value);
            }
        } 
    
protected final com.sun.perseus.j2d.PathparsePathTrait(java.lang.String name, java.lang.String value)
Parses the input value and converts it to a Path value.

param
name the trait name.
param
value the value to convert.
throws
DOMException if the input value is invalid.

        try {
            return ownerDocument.pathParser.parsePath(value);
        } catch (IllegalArgumentException iae) {
            DOMException de = illegalTraitValue(name, value);
            if (!loaded) {
                ownerDocument.setDelayedException(de);
                return ownerDocument.pathParser.getPath();
            } else {
                throw de;
            }
        }
    
protected final com.sun.perseus.j2d.PathparsePointsTrait(java.lang.String name, java.lang.String value)
Parses the input points value and converts it to a Path value.

param
name the trait name.
param
value the value to convert.
throws
DOMException if the input value is invalid.

        try {
            return ownerDocument.pathParser.parsePoints(value);
        } catch (IllegalArgumentException iae) {
            DOMException de = illegalTraitValue(name, value);
            if (!loaded) {
                ownerDocument.setDelayedException(de);
                return ownerDocument.pathParser.getPath();
            } else {
                throw de;
            }
        }
    
protected final float[]parsePositiveFloatArrayTrait(java.lang.String name, java.lang.String value)
Parses the input value and converts it to a float array value.

param
name the name of the trait to convert to a float array.
param
value the value to convert to a float.
return
the value converted to a float array value.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid float value or null.

        try {
            SimpleTokenizer st = new SimpleTokenizer(value, ", ");
            float[] da = null;
            int n = st.countTokens();
            float totalLength = 0;
            
            if ((n % 2) == 0) {
                da = new float[n];
                for (int i = 0; i < da.length; i++) {
                    da[i] = ownerDocument
                        .lengthParser.parseNumber(st.nextToken());
                    
                    if (Float.isNaN(da[i]) || da[i] < 0) {
                        // The CSS number was invalid. 
                        // Do not set the value
                        throw new IllegalArgumentException();
                    }
                    
                    totalLength += da[i];
                }
            } else {
                da = new float[2 * n];
                for (int i = 0; i < n; i++) {
                    da[i] = ownerDocument
                        .lengthParser.parseNumber(st.nextToken());
                    da[n + i] = da[i];
                    
                    if (Float.isNaN(da[i]) || da[i] < 0) {
                        // The CSS number was invalid. 
                        // Do not set the value
                        throw new IllegalArgumentException();
                    }
                    
                    totalLength += da[i];
                }
            }
            
            if (totalLength > 0) {
                return da;
            } else {
                return null;
            }
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(name, value);
        } catch (NullPointerException iae) {
            throw illegalTraitValue(name, value);
        }
    
protected final floatparsePositiveFloatTrait(java.lang.String name, java.lang.String value)
Parses the input value and converts it to a positive float value.

param
name the trait name.
param
value the value to convert to a float.
return
the value converted to a float value.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid positive float value or null.

        try {
            float v = ownerDocument.lengthParser.parseNumber(value);
            if (v < 0) {
                throw new IllegalArgumentException();
            }
            return v;
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(name, value);
        }
    
protected final floatparsePositiveLengthTrait(java.lang.String name, java.lang.String value, boolean isHorizontal)
Parses the input value and converts it to a float.

param
name the trait name.
param
value the value to convert to a float.
param
isHorizontal controls whether this is a horizontal length or not.
return
the value converted to a float.
throws
DOMException if the trait value is invalid.

        float v = parseLengthTrait(name, value, isHorizontal);
        if (v < 0) {
            throw illegalTraitValue(name, value);
        }
        return v;
    
protected final java.lang.String[]parseStringArrayTrait(java.lang.String name, java.lang.String value, java.lang.String seperators)
Parses the input value and converts it to a String array.

param
value the value to convert to a String array
param
name the name of the trait being converted.
param
seperators the string of characters which are seperators between array values.

        // Don't accept null trait values.
        if (value == null) {
            throw illegalTraitValue(name, value);
        }

        SimpleTokenizer st = new SimpleTokenizer(value, seperators);
        int n = st.countTokens();
        String[] result = new String[n];
        for (int i = 0; i < n; i++) {
            result[i] = st.nextToken().trim().intern();
        }

        return result;        
    
protected final com.sun.perseus.j2d.TransformparseTransformTrait(java.lang.String name, java.lang.String value)
Parses the input value and converts it to an Transform value.

param
name the trait's name.
param
value the value to convert to a transform.
return
the value converted to an Transform object.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid transform trait value.

        try {
            return ownerDocument.transformListParser.parseTransformList(value);
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(name, value);
        }
    
protected final int[][]parseUnicodeRangeTrait(java.lang.String name, java.lang.String value)
Parses the input value, assuming a unicode range syntax, as for the <hkern> element's u1 and u2 attributes.

param
name the trait name.
param
value the trait value.
return
an array of unicode range pairs, as integer pairs.
throws
DOMException if the input trait value is invalid.

        try {
            return ownerDocument.unicodeParser.parseUnicode(value);
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(name, value);
        }
    
protected voidpreValidate()
Invoked before an element is added to the document tree, to let the element perform any validation it needs. For example, the use element overrides this method to check that its reference is resolved. Note that the validate() method defined in some element implementations is meant to perform validation after the nodes has been inserted into the document tree.

        // By default, do nothing.
    
ModelNodeproxyNodeHitAt(float[] pt, ElementNodeProxy proxy)
Returns the ModelNode, if any, hit by the point at coordinate x/y in the proxy tree starting at proxy.

param
pt the x/y coordinate. Should never be null and be of size two. If not, the behavior is unspecified. The coordinates are in viewport space.
param
proxy the root of the proxy tree to test.
return
the ModelNode hit at the given point or null if none was hit.

        return null;
    
protected org.w3c.dom.DOMExceptionreadOnlyTraitError(java.lang.String name)

param
name the trait name.
return
DOMException describing the write error on a read-only attribute.

        return new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                Messages.formatMessage
                                (Messages.ERROR_READ_ONLY_TRAIT,
                                 new String[] {name,
                                               getLocalName(),
                                               getNamespaceURI()}));
    
protected voidrecomputeProxyTransformState()
Recomputes the transform cache on proxy nodes.

        ElementNodeProxy proxy = firstProxy;
        while (proxy != null) {
            proxy.recomputeTransformState();
            proxy = proxy.nextProxy;
        }
    
voidremoveProxy(ElementNodeProxy proxy)
Removes a proxy from this node. If the input proxy is null, or is not an existing proxy, this does nothing.

param
proxy the ElementNodeProxy to remove.
see
#addProxy

        if (proxy == null || firstProxy == null) {
            return;
        }

        // The proxy may be the first one, the last
        // one, or in the middle
        if (proxy == firstProxy) {
            firstProxy = proxy.nextProxy;
        }
        if (proxy == lastProxy) {
            lastProxy = proxy.prevProxy;
        }
        if (proxy.prevProxy != null) {
            proxy.prevProxy.nextProxy = proxy.nextProxy;
        }
        if (proxy.nextProxy != null) {
            proxy.nextProxy.prevProxy = proxy.prevProxy;
        }
    
public final voidsetAttribute(java.lang.String name, java.lang.String value)
Adds a new attribute.

param
name - the name of the attribute to add.
param
value - the value to set.
throws
DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

        checkNCName(name);

        if (value == null) {
            throw illegalTraitValue(name, value);
        }

        name = name.intern();
        setTraitImpl(name, value);
    
public final voidsetAttributeNS(java.lang.String namespaceURI, java.lang.String name, java.lang.String value)
Adds a new attribute.

param
namespaceURI - the namespace URI of the attribute to create or alter.
param
name - the local name of the attribute to create or alter.
param
value - the value to set in string form.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
throws
DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.

        if (namespaceURI == null || namespaceURI.length() == 0) {
            setAttribute(name, value);
            return;
        }

        checkNCName(name);

        if (value == null) {
            throw illegalTraitValue(name, namespaceURI, value);
        }

        namespaceURI = namespaceURI.intern();
        name = name.intern();

        setTraitNSImpl(namespaceURI, name, value);
    
voidsetConditionalAttribute(int index, java.lang.String[] newValue)
Sets the new value for the given conditional attribute.

param
index the conditional attribute index.
param
value the new conditional attribute value.

        if (conditionEquals(index, newValue)) {
            return;
        }
        modifyingNode();
        
        if (newValue == null) {
            if (conditionalAttributes != null) {
                conditionalAttributes[index] = null;
            }
        } else {
            if (conditionalAttributes == null) {
                conditionalAttributes = 
                    new String[CONDITIONAl_ATTRIBUTES_LENGTH][];
            }
            conditionalAttributes[index] 
                = newValue;
        }
        
        switch (index) {
            case REQUIRED_FEATURES_INDEX: 
            {
                computeCanRenderRequiredFeaturesBit(newValue);
                ElementNodeProxy p = firstProxy;
                while (p != null) {
                    p.computeCanRenderRequiredFeaturesBit(newValue);
                    p = p.nextProxy;
                }
            }
                break;
            case REQUIRED_EXTENSIONS_INDEX:   
            {
                computeCanRenderRequiredExtensionsBit(newValue);
                ElementNodeProxy p = firstProxy;
                while (p != null) {
                    p.computeCanRenderRequiredExtensionsBit(newValue);
                    p = p.nextProxy;
                }
            }
                break;
            default:     
            {
                computeCanRenderSystemLanguageBit(newValue);
                ElementNodeProxy p = firstProxy;
                while (p != null) {
                    p.computeCanRenderSystemLanguageBit(newValue);
                    p = p.nextProxy;
                }
            }
                break;
        }
        
        modifiedNode();
    
voidsetFloatArrayTrait(java.lang.String name, float[][] value)
Set the trait value as float.

param
name the trait's name.
param
value the trait's value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a float
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait.

        throw new Error(name);
    
public final voidsetFloatTrait(java.lang.String name, float value)
Set the trait value as float.

param
name the trait's name.
param
value the trait's value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a float
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait.

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        TraitAnim anim = (TraitAnim) getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            setFloatTraitImpl(name, value);
        } else {
            anim.setTrait(Float.toString(value), TRAIT_TYPE_FLOAT);
        }
    
voidsetFloatTraitImpl(java.lang.String name, float value)
Set the trait value as a float.

param
name the trait's name.
param
value the trait's value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a float
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait.

        throw unsupportedTraitType(name, TRAIT_TYPE_FLOAT);
    
public voidsetId(java.lang.String newId)

param
newId the node's identifier
throws
DOMException - with error code NO_MODIFICATION_ALLOWED_ERR is raised if an attempt is made to change an existing Id.
throws
DOMException - with error code INVALID_ACCESS_ERR is raised if the Id is not unique i.e. if this Id already exists in the document.
throws
java.lang.NullPointerException - if Id is null.

        // Null ids are disallowed.
        if (newId == null) {
            throw new NullPointerException();
        }

        // If the id was already set, we cannot let it be modified.
        if (id != null) {
            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                   Messages.formatMessage
                                   (Messages.ERROR_CANNOT_MODIFY_ID,
                                    new String[] {newId,
                                                  id,
                                                  getLocalName(),
                                                  getNamespaceURI()}));
        }

        // Now, check if there is any element with that id already.
        if (ownerDocument.getElementByIdAll(newId) != null) {
            ElementNode duplicateElement = 
                (ElementNode) ownerDocument.getElementByIdAll(newId);
            throw new DOMException(
                    DOMException.INVALID_ACCESS_ERR,
                    Messages.formatMessage(
                        Messages.ERROR_DUPLICATE_ID_VALUE,
                        new String[] {
                            newId,
                            getLocalName(),
                            getNamespaceURI(),
                            duplicateElement.getLocalName(),
                            duplicateElement.getNamespaceURI()
                        }));
        }

        modifyingNode();
        id = newId;

        // We only declare the id in the global document
        // scope, i.e., we only consider the id to be
        // resolved, once the element is loaded, i.e., ready
        // to render. If the element is not loaded, 
        // see the buildComplete method: it adds the element
        // to the list of identified nodes when loaded is
        // set to true.
        if (loaded && isInDocumentTree()) {
            ownerDocument.addIdentifiedNode(this);
        } else {
            ownerDocument.reserveId(this);
        }
        modifiedNode();
    
public final voidsetMatrixTrait(java.lang.String name, org.w3c.dom.svg.SVGMatrix matrix)
Set the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. Values in SVGMarix are copied in the trait so subsequent changes to the givenSVGMatrix have no effect on the value of the trait.

param
name name of trait to set
param
matrix SVGMatrix value of trait
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
throws
DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        if (matrix == null) {
            throw illegalTraitValue(name, null);
        }

        TraitAnim anim = (TraitAnim) getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            setMatrixTraitImpl(name, new Transform(matrix));
        } else {
            anim.setTrait(toStringTrait((Transform) matrix), 
                          TRAIT_TYPE_SVG_MATRIX);
        }
    
voidsetMatrixTraitImpl(java.lang.String name, com.sun.perseus.j2d.Transform matrix)
Set the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. Values in SVGMarix are copied in the trait so subsequent changes to the givenSVGMatrix have no effect on the value of the trait.

param
name name of trait to set
param
matrix Transform value of trait
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
throws
DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_MATRIX);
    
public final voidsetPathTrait(java.lang.String name, org.w3c.dom.svg.SVGPath path)
Set the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. Values in SVGPath are copied in the trait so subsequent changes to the given SVGPath have no effect on the value of the trait.

param
name the trait name.
param
path the trait value, as an SVGPath object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGPath SVGPath}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null. SVGPath is invalid if it does not begin with a MOVE_TO segment.

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        if (path == null) {
            throw illegalTraitValue(name, null);
        }

        TraitAnim anim = (TraitAnim) getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            setPathTraitImpl(name, path);
        } else {
            if (path == null) {
                throw illegalTraitValue(name, null);
            }
            anim.setTrait(((Path) path).toString(), 
                          TRAIT_TYPE_SVG_PATH);
        }
    
voidsetPathTraitImpl(java.lang.String name, org.w3c.dom.svg.SVGPath path)
Set the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. Values in SVGPath are copied in the trait so subsequent changes to the given SVGPath have no effect on the value of the trait.

param
name the trait name.
param
path the trait value, as an SVGPath object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGPath SVGPath}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null. SVGPath is invalid if it does not begin with a MOVE_TO segment.

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_PATH);
    
public voidsetPreferedPaintNeedsLoad(boolean paintNeedsLoad)

param
paintNeedsLoad if true, the node can only be painted after its children have been loaded. This can be used by a renderer implementing progressive rendering of an SVG document.

        this.paintNeedsLoad = paintNeedsLoad;
    
public final voidsetRGBColorTrait(java.lang.String name, org.w3c.dom.svg.SVGRGBColor color)
Set the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}.

param
name the trait name.
param
color the trait value, as a color.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is null.

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        if (color == null) {
            throw illegalTraitValue(name, null);
        }

        TraitAnim anim = (TraitAnim) getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            setRGBColorTraitImpl(name, color);
        } else {
            anim.setTrait(color.toString(),
                          TRAIT_TYPE_SVG_RGB_COLOR);
        }
 
    
voidsetRGBColorTraitImpl(java.lang.String name, org.w3c.dom.svg.SVGRGBColor color)
Set the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}.

param
name the trait name.
param
color the trait value, as a color.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is null.

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_RGB_COLOR);
    
public final voidsetRectTrait(java.lang.String name, org.w3c.dom.svg.SVGRect rect)
Set the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. Values in SVGRect are copied in the trait so subsequent changes to the given SVGRect have no effect on the value of the trait.

param
name the trait name.
param
rect the trait value, as an SVGRect object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRect SVGRect}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null. SVGRect is invalid if the width or height values are set to negative.

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }
        
        TraitAnim anim = (TraitAnim) getTraitAnimNS(NULL_NS, name);
        if (anim == null || !anim.active) {
            setRectTraitImpl(name, rect);
        } else {
            if (rect == null) {
                throw illegalTraitValue(name, null);
            }
            
            float[] vb = 
                {rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()};
            
            anim.setTrait(toStringTrait(vb), TRAIT_TYPE_SVG_RECT);
        }
    
public voidsetRectTraitImpl(java.lang.String name, org.w3c.dom.svg.SVGRect rect)
Set the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. Values in SVGRect are copied in the trait so subsequent changes to the given SVGRect have no effect on the value of the trait.

param
name the trait name.
param
rect the trait value, as an SVGRect object.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRect SVGRect}
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null. SVGRect is invalid if the width or height values are set to negative.

        throw unsupportedTraitType(name, TRAIT_TYPE_SVG_RECT);
    
public voidsetRequiredExtensions(java.lang.String[] newRequiredExtensions)
The node will only render if the requiredExtensions string evaluates to true. A null value evaluates to true.

param
newRequiredExtensions the extensions which will be considered a match for any document required extension.
see
#getRequiredExtensions

        setConditionalAttribute(REQUIRED_EXTENSIONS_INDEX, 
                                newRequiredExtensions);
    
public voidsetRequiredFeatures(java.lang.String[] newRequiredFeatures)
The node will only render if the requiredFeatures string evaluates to true. A null value will evaluate to true.

param
newRequiredFeatures the set of features required for rendering this node.

        setConditionalAttribute(REQUIRED_FEATURES_INDEX, newRequiredFeatures);
    
public voidsetSystemLanguage(java.lang.String[] newSystemLanguage)
The node will only render if the Perseus user language matches one of the values in this comma separated list. A null value is a match.

param
newSystemLanguage an array of languages which will be matched against any document system language value

        setConditionalAttribute(SYSTEM_LANGUAGE_INDEX, newSystemLanguage);
    
public final voidsetTrait(java.lang.String name, java.lang.String value)
The traits supported by default are: externalResourcesRequired, xml:base, xml:space, requiredFeatures, requiredExtensions and systemLanguage.

param
name the trait's name.
param
value the trait's value.
throws
DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a String
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
throws
DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.

        name = intern(name);

        if (!supportsTrait(name)) {
            throw unsupportedTrait(name);
        }

        if (value == null) {
            throw illegalTraitValue(name, value);
        }


        TraitAnim anim = (TraitAnim) getTraitAnimNS(NULL_NS, name);

        if (anim == null || !anim.active) {
            setTraitImpl(name, value);
        } else {
            anim.setTrait(value, TRAIT_TYPE_STRING);
        }
    
public voidsetTraitImpl(java.lang.String name, java.lang.String value)
The traits supported by default are: externalResourcesRequired, xml:base, xml:space, requiredFeatures, requiredExtensions and systemLanguage.

param
name the trait's name.
param
value the trait's value.
throws
DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a String
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
throws
DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.

        if (SVGConstants.SVG_ID_ATTRIBUTE == name) {
            try {
                setId(value);
            } catch (IllegalArgumentException iae) {
                iae.printStackTrace();
                throw illegalTraitValue(name, value);
            }
        } else if (SVGConstants.SVG_REQUIRED_FEATURES_ATTRIBUTE == name) {
            if (value == null) {
                throw illegalTraitValue(name, value);
            }
            setRequiredFeatures(parseStringArrayTrait(name, value, " "));
        } else if (SVGConstants.SVG_REQUIRED_EXTENSIONS_ATTRIBUTE == name) {
            if (value == null) {
                throw illegalTraitValue(name, value);
            }
            setRequiredExtensions(parseStringArrayTrait(name, value, " "));
        } else if (SVGConstants.SVG_SYSTEM_LANGUAGE_ATTRIBUTE == name) {
            if (value == null) {
                throw illegalTraitValue(name, value);
            }
            setSystemLanguage(parseStringArrayTrait(name, value, ","));
        } else {
            // The trait is not handled by this element as a string.
            // There are two situations. If this trait is supported 
            // by the element, then it means that the String type is 
            // not supported for the trait, and the following throws an
            // exception. Otherwise, this means the trait is just unknown,
            // and it goes into the generic trait map.
            if (supportsTrait(name)) {
                throw unsupportedTraitType(name, TRAIT_TYPE_STRING);
            } else {
                if (name == null) {
                    throw unsupportedTrait(name);
                } 

                if (value == null) {
                    throw illegalTraitValue(name, value);
                }

                ownerDocument.setUnknownTraitsNS(this, NULL_NS, name, value);
            }
        }
    
public final voidsetTraitNS(java.lang.String namespaceURI, java.lang.String name, java.lang.String value)

        if (namespaceURI == null || namespaceURI.length() == 0) {
            setTrait(name, value);
            return;
        }

        namespaceURI = intern(namespaceURI);
        name = intern(name);

        if (!supportsTraitNS(namespaceURI, name)) {
            throw unsupportedTraitNS(name, namespaceURI);
        }

        StringTraitAnim anim = 
            (StringTraitAnim) getTraitAnimNS(namespaceURI, name);

        if (anim == null || !anim.active) {
            setTraitNSImpl(namespaceURI, name, value);
        } else {
            anim.setTrait(value, TRAIT_TYPE_STRING);
        }
    
public voidsetTraitNSImpl(java.lang.String namespaceURI, java.lang.String name, java.lang.String value)
Same as {@link org.w3c.dom.svg.SVGElement#setTrait setTrait}, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.

param
namespaceURI the trait's namespace.
param
name the trait's local name (un-prefixed).
param
value the trait's value.
throws
DOMException with error code NOT_SUPPORTED_ERROR if the requested trait is not supported on this element or null.
throws
DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a String
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
throws
DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.

        if (SVGConstants.PERSEUS_NAMESPACE_URI == namespaceURI) {
            if (SVGConstants.PERSEUS_CHILDREN_REQUIRED_ATTRIBUTE == name) {
                if (SVGConstants.SVG_TRUE_VALUE.equals(value)) {
                    setPreferedPaintNeedsLoad(true);
                    return;
                } else if (SVGConstants.SVG_FALSE_VALUE.equals(value)) {
                    setPreferedPaintNeedsLoad(false);
                    return;
                } else {
                    throw illegalTraitValue(namespaceURI, name, value);
                }
            }
        } else if (SVGConstants.XML_NAMESPACE_URI == namespaceURI) {
            if (SVGConstants.XML_BASE_ATTRIBUTE_LOCAL_NAME == name) {
                if (value == null) {
                    throw illegalTraitValue(name, value);
                }
                setURIBase(value);
            } else if (SVGConstants.XML_SPACE_ATTRIBUTE_LOCAL_NAME == name) {
                if (SVGConstants.XML_DEFAULT_VALUE.equals(value) 
                    || 
                    (value != null && value.length() == 0)) {
                    setXMLSpace(XML_SPACE_DEFAULT);
                    return;
                } else if (SVGConstants.XML_PRESERVE_VALUE.equals(value)) {
                    setXMLSpace(XML_SPACE_PRESERVE);
                    return;
                } else {
                    throw illegalTraitValue(name, value);
                }
            }
        }

        // The trait is not handled by this element as a string.
        // There are two situations. If this trait is supported 
        // by the element, then it means that the String type is 
        // not supported for the trait which should never happen
        // because all traits have to be supported as a string.
        // So that causes an internal error.
        // Otherwise, this means the trait is just unknown,
        // and it goes into the generic trait map.
        if (supportsTraitNS(name, value)) {
            throw new Error();
        } 
          
        // Trait is unknown, treat as a generic string trait.
        ownerDocument.setUnknownTraitsNS(this, namespaceURI, name, value);
    
public voidsetURIBase(java.lang.String newUriBase)

param
newUriBase the node's new URI base. The uriBase is used to resolve relative URIs

        if (equal(newUriBase, uriBase)) {
            return;
        }
        modifyingNode();
        uriBase = newUriBase;
        modifiedNode();
    
public voidsetXMLSpace(int newXmlSpace)
Controls how the node handles white spaces

param
newXmlSpace should be one of XML_SPACE_DEFAULT, XML_SPACE_PRESERVE, or XML_SPACE_INHERIT. Otherwise, an IllegalArgumentException is thrown.

        if (newXmlSpace == xmlSpace) {
            return;
        }
        switch (newXmlSpace) {
        case XML_SPACE_DEFAULT:
        case XML_SPACE_PRESERVE:
        case XML_SPACE_INHERIT:
            modifyingNode();
            xmlSpace = newXmlSpace;
            modifiedNode();
            break;
        default:
            throw new IllegalArgumentException();
        }
    
booleansupportsTrait(java.lang.String traitName)

param
traitName the name of the trait which the element may support.
return
true if this element supports the given trait in one of the trait accessor methods (such as getTrait or setFloatTrait.

        if (SVGConstants.SVG_ID_ATTRIBUTE == traitName
            ||
            SVGConstants.SVG_REQUIRED_FEATURES_ATTRIBUTE == traitName
            ||
            SVGConstants.SVG_REQUIRED_EXTENSIONS_ATTRIBUTE == traitName
            ||
            SVGConstants.SVG_SYSTEM_LANGUAGE_ATTRIBUTE == traitName) {
            return true;
        }

        return false;
    
booleansupportsTraitNS(java.lang.String namespaceURI, java.lang.String traitName)

param
namespaceURI the trait's namespace URI.
param
traitName the name of the trait which the element may support.
return
true if this element supports the given trait in one of the trait accessor methods.

        if (SVGConstants.PERSEUS_NAMESPACE_URI == namespaceURI
            &&
            SVGConstants.PERSEUS_CHILDREN_REQUIRED_ATTRIBUTE == traitName) {
            return true;
        } else if (SVGConstants.XML_NAMESPACE_URI == namespaceURI
                   &&
                   (SVGConstants.XML_BASE_ATTRIBUTE_LOCAL_NAME == traitName
                    || 
                    SVGConstants.XML_SPACE_ATTRIBUTE_LOCAL_NAME == traitName)) {
            return true;
        }

        if (namespaceURI == null) {
            return supportsTrait(traitName);
        } else {
            return false;
        }
    
float[][]toAnimatedFloatArray(float v)
Converts the input float value to an animated float array trait.

param
v the float value to wrap in a float[][] array.
return
the wrapped value.

        return new float[][] {{v}};
    
float[][]toAnimatedFloatArray(float[] a)
Converts the input float[] array to an animated float array trait.

param
a the float array to wrap in a float[][] array. Should not be null.
return
the wrapped value.

        float[][] v = new float[a.length][];
        // This assumes that each value in the input array are separate
        // components.
        for (int i = 0; i < a.length; i++) {
            v[i] = new float[] {a[i]};
        }
        return v;
    
float[][]toAnimatedFloatArray(com.sun.perseus.j2d.Path path)
Utility method to convert a Path to an animatable float array.

param
p the path to convert
return
the converted value.

        return new float[][] {path.getData()};
    
protected com.sun.perseus.j2d.RGBtoRGB(java.lang.String name, float[][] v)
Converts an animated float[][] value into an AWT color value.

param
name the trait's name.
param
value the float[][] to convert.
return
the color converted to an AWT Color object.

        if (v != null) {
            return new RGB((int) v[0][0], (int) v[0][1], (int) v[0][2]);
        } else {
            return null;
        }
    
protected java.lang.StringtoRGBString(java.lang.String name, float[][] v)
Converts an animated float[][] value into an String rgb value.

param
name the trait's name.
param
value the float[][] to convert.
return
the color converted to a string.

        if (v != null) {
            return "rgb(" + ((int) v[0][0]) + "," + ((int) v[0][1]) + "," 
                    + ((int) v[0][2]) + ")";
        } else {
            return "none";
        }
    
protected org.w3c.dom.svg.SVGMatrixtoSVGMatrixTrait(com.sun.perseus.j2d.Transform transform)
Helper method. Converts the input Transform to an SVGMatrix trait value.

param
transform the transform to convert.
return
the SVGMatrix equivalent value.

        if (transform == null) {
            return new Transform(1, 0, 0, 1, 0, 0);
        } else {
            return new Transform(transform);
        }
    
protected org.w3c.dom.svg.SVGRGBColortoSVGRGBColor(java.lang.String traitName, com.sun.perseus.j2d.PaintServer paint)
Converts an J2D RGB to an SVG DOM RGBColor

param
traitName the name of the trait whose value is convereted.
param
paint the PaintServer to convert. Should not be null.
return
the color, converted to an SVGRGBColor instance.
throws
DOMException with error code TYPE_MISMATCH_ERR if the paint is not an instance of Colorl

        if (paint == null) {
            return null;
        }
        
        if (!(paint instanceof SVGRGBColor)) {
            throw unsupportedTraitType(traitName, TRAIT_TYPE_SVG_RGB_COLOR);
        }

        return (SVGRGBColor) paint;
    
protected org.w3c.dom.svg.SVGRecttoSVGRect(float[][] viewBox)
Converts a viewBox array to an SVGRect value.

param
name the name of the trait.
param
viewBox the viewbox value to convet.

        if (viewBox == null) {
            return null;
        } 
        
        SVGRect r = new Box(viewBox[0][0],
                            viewBox[0][1],
                            viewBox[1][0],
                            viewBox[2][0]);

        return r;
    
public java.lang.StringtoString()

return
a text description of this node including the node ID if one was set.

        if (getId() != null && getId().length() > 0) {
            return "ElementNode[" + getId() + "] [" + super.toString() + "]";
        } else {
            return super.toString();
        }
    
java.lang.StringtoString(com.sun.perseus.j2d.PaintServer paintServer)
Conversts the input PaintServer value to a String trait value.

param
value the PaintServer value to convert.

        if (paintServer == null) {
            return SVGConstants.CSS_NONE_VALUE;
        }

        return paintServer.toString();
    
protected java.lang.StringtoStringTrait(java.lang.String[] array)
Converts a Java String array to a trait string array with the format: "str1, str2, .., strN"

param
array the string array to be converted.
return
a string with the value "" if the array is null or "float1,float2,..,floatN"

        return toStringTrait(array, ",");
    
protected java.lang.StringtoStringTrait(java.lang.String[] array, java.lang.String sep)
Converts a Java String array to a trait string array with the format: "str1, str2, .., strN"

param
array the string array to be converted.
param
sep seperator to use in the output string array.
return
a string with the value "" if the array is null or "float1,float2,..,floatN"

        if (array == null || array.length < 1) {
            return "";
        }

        StringBuffer sb = new StringBuffer();
        
        for (int i = 0; i < array.length - 1; i++) {
            sb.append(array[i]);
            sb.append(sep);
        }

        sb.append(array[array.length - 1]);
        return sb.toString();
    
protected java.lang.StringtoStringTrait(float[] array)
Helper method. Converts the input array value to a string trait value.

param
array the float array to be converted.
return
a string with the value "none" if the array is null or "float1,float2,..,floatN"

        return toStringTrait(array, ',");
    
protected java.lang.StringtoStringTrait(float[] array, char sep)
Helper method. Converts the input array value to a string trait value.

param
array the float array to be converted.
return
a string with the value "none" if the array is null or "float1,float2,..,floatN"

        if (array == null) {
            return SVGConstants.CSS_NONE_VALUE;
        }

        StringBuffer sb = new StringBuffer();
        
        for (int i = 0; i < array.length - 1; i++) {
            sb.append(array[i]);
            sb.append(sep);
        }

        sb.append(array[array.length - 1]);
        return sb.toString();
    
protected java.lang.StringtoStringTrait(float[][] array)
Helper method. Convertst the input array of float arrays into a string trait value.

param
array the array of float arrays to convert.
return
a string the the value "" if the array is null or "f01 f02 f03 f04; f11 f12 f13 f14; ...;fn1 fn2 fn3 fn4"
throws
NullPointerException if one of the array values is null
throws
ArrayIndexOutOfBoundsException if one of the array values is of length 0.

        if (array == null || array.length == 0) {
            return "";
        }

        StringBuffer sb = new StringBuffer();
        
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length - 1; j++) {
                sb.append(array[i][j]);
                sb.append(SVGConstants.COMMA);
            }
            sb.append(array[i][array[i].length - 1]);
            sb.append(SVGConstants.SEMI_COLON);
        }
        
        String value = sb.toString();

        // Trim trailing ';'
        return value.substring(0, value.length() - 1);
    
protected static java.lang.StringtoStringTrait(com.sun.perseus.j2d.Transform transform)
Helper method. Converts the input Transform to a string trait value.

param
transform the transform to convert.
return
the string trait value.

        if (transform == null) {
            return Transformable.IDENTITY_TRANSFORM_TRAIT;
        } else {
            StringBuffer sb = new StringBuffer();
            sb.append("matrix(");
            sb.append(transform.getComponent(0));
            sb.append(",");
            sb.append(transform.getComponent(1));
            sb.append(",");
            sb.append(transform.getComponent(2));
            sb.append(",");
            sb.append(transform.getComponent(3));
            sb.append(",");
            sb.append(transform.getComponent(4));
            sb.append(",");
            sb.append(transform.getComponent(5));
            sb.append(")");
            return sb.toString();
        }
    
java.lang.StringtoStringTrait(java.lang.String traitName, float[][] value)
Converts the input float array value to a String value.

param
traitName the name of the trait to convert.
param
value the float trait value to convert.

        throw new Error(traitName);
    
protected java.lang.StringtoStringTraitQuote(java.lang.String[] array)
Converts a Java String array to a trait string array with the format: "str1, str2, .., strN". In addition, the string values are put inside single quotes if there are spaces in the string values. This is needed for values such as the CSS 2 font-family attribute.

param
array the string array to be converted.
return
a string with the value "" if the array is null or "float1,float2,..,floatN"

        if (array == null || array.length < 1) {
            return "";
        }

        StringBuffer sb = new StringBuffer();
        
        for (int i = 0; i < array.length - 1; i++) {
            if (array[i].indexOf(' ") != -1) {
                sb.append('\'");
                sb.append(array[i]);
                sb.append('\'");
            } else {
                sb.append(array[i]);
            }
            sb.append(',");
        }

        if (array[array.length - 1].indexOf(' ") != -1) {
            sb.append('\'");            
            sb.append(array[array.length - 1]);
            sb.append('\'");            
        } else {
            sb.append(array[array.length - 1]);
        }

        return sb.toString();
    
float[]toTraitFloatArray(float[][] value)
Converts an animated float array to a trait float array value. This is used for multi-component trait values, such as stroke-dasharray, or the text's x, y or rotate values.

param
value the animated value to convert.
return
an float array trait value.

        float[] v = new float[value.length];
        for (int i = 0; i < v.length; i++) {
            v[i] = value[i][0];
        }
        
        return v;
    
protected float[][]toViewBox(java.lang.String name, java.lang.String value)
Converts an comma seperated list of floats to a viewBox array

param
name the trait name
param
value the trait value to be converted to an SVGRect. The expected syntax is "float comma-wsp float comma-wsp float comma-wsp float comma-wsp"
return
an array of four floats.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.

        if (value == null) {
            throw illegalTraitValue(name, value);
        }

        try {
            return ownerDocument.viewBoxParser.parseViewBox(value);
        } catch (IllegalArgumentException iae) {
            throw illegalTraitValue(name, value);
        }
    
protected voidunhookChildrenQuiet()
Utility method. Unhooks the children.

        super.unhookChildrenQuiet();

        // Need to clear the expanded content on proxies
        ElementNodeProxy proxy = firstProxy;
        while (proxy != null) {
            proxy.unhookExpandedQuiet();
            proxy = proxy.nextProxy;
        }
    
protected voidunhookExpandedQuiet()
Utility method. Unhooks the expanded content.

        // No expanded content by default.
    
protected java.lang.StringunicodeRangeToStringTrait(int[][] u)
Helper method. Converts the input unicode range into a String trait, with the following syntax: "U+b1-e1,U+b2-e2,...,U+bn-en"

param
u the unicode range to convert.
return
the string value with the unicode range syntax.

        if (u == null) {
            return null;
        }

        if (u.length == 0) {
            return SVGConstants.EMPTY;
        }

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < u.length - 1; i++) {
            if (u[i] == null || u[i].length != 2) {
                throw new IllegalArgumentException();
            }
            sb.append("U+");
            sb.append(Integer.toHexString(u[i][0]));
            sb.append('-");
            sb.append(Integer.toHexString(u[i][1]));
            sb.append(',");
        }

        if (u[u.length - 1] == null || u[u.length - 1].length != 2) {
            throw new IllegalArgumentException();
        }
        sb.append("U+");
        sb.append(Integer.toHexString(u[u.length - 1][0]));
        sb.append('-");
        sb.append(Integer.toHexString(u[u.length - 1][1]));
        
        return sb.toString();
    
protected org.w3c.dom.DOMExceptionunsupportedTrait(java.lang.String name)

param
name the trait name
return
a DOMException describing the unsupported trait error.

        return new DOMException(DOMException.NOT_SUPPORTED_ERR,
                                Messages.formatMessage
                                (Messages.ERROR_UNSUPPORTED_TRAIT,
                                 new String[] {name,
                                               null,
                                               getLocalName(),
                                               getNamespaceURI()}));
    
protected org.w3c.dom.DOMExceptionunsupportedTraitNS(java.lang.String name, java.lang.String namespaceURI)

param
name the trait name
param
namespaceURI the trait's namespace URI.
return
a DOMException describing the unsupported trait error.

        return new DOMException(DOMException.NOT_SUPPORTED_ERR,
                                Messages.formatMessage
                                (Messages.ERROR_UNSUPPORTED_TRAIT,
                                 new String[] {name,
                                               namespaceURI,
                                               getLocalName(),
                                               getNamespaceURI()}));
    
protected org.w3c.dom.DOMExceptionunsupportedTraitType(java.lang.String name, java.lang.String type)

param
name the trait name.
return
a DOMException describing the type mismatch error.

        if (name == null) {
            return unsupportedTrait(name);
        }

        return new DOMException(DOMException.TYPE_MISMATCH_ERR,
                                Messages.formatMessage
                                (Messages.ERROR_TRAIT_TYPE_MISMATCH,
                                 new String[] {name,
                                               type,
                                               getLocalName(),
                                               getNamespaceURI()}));
    
protected org.w3c.dom.DOMExceptionunsupportedTraitTypeNS(java.lang.String name, java.lang.String namespaceURI, java.lang.String type)

param
name the trait name.
return
a DOMException describing the type mismatch error.

        return new DOMException(DOMException.TYPE_MISMATCH_ERR,
                                Messages.formatMessage
                                (Messages.ERROR_TRAIT_TYPE_NS_MISMATCH,
                                 new String[] {name,
                                               namespaceURI,
                                               type,
                                               getLocalName(),
                                               getNamespaceURI()}));
    
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.

param
traitName the name of the trait to be validated.
param
value the value to be validated
param
reqNamespaceURI the namespace of the element requesting validation.
param
reqLocalName the local name of the element requesting validation.
param
reqTraitNamespace the namespace of the trait which has the values value on the requesting element.
param
reqTraitName the name of the trait which has the values value on the requesting element.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is incompatible with the given trait.

        // Throw an error because this should _never_ happen, as a float
        // array anim should only happen on a known trait. If validation is
        // requested, the element implementation should know the trait.
        throw new Error();
    
java.lang.StringvalidateTraitNS(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.

param
namespaceURI the trait's namespace URI.
param
traitName the name of the trait to be validated.
param
value the value to be validated
param
reqNamespaceURI the namespace of the element requesting validation.
param
reqLocalName the local name of the element requesting validation.
param
reqTraitNamespace the namespace of the trait which has the values value on the requesting element.
param
reqTraitName the name of the trait which has the values value on the requesting element.
throws
DOMException with error code INVALID_ACCESS_ERR if the input value is incompatible with the given trait.
return
the computed trait value.

        /* 
        throw new InternalError(
                "Trying to validate unknown trait: " + 
                "namespaceURI : " + namespaceURI + "\n" +
                "traitName : " + traitName + "\n" +
                "value : " + value + "\n" +
                "reqNamespaceURI : " + reqNamespaceURI + "\n" +
                "reqLocalName : " + reqLocalName + "\n" +
                "reqTraitNamespace : " + reqTraitNamespace + "\n" +
                "reqTraitName : " + reqTraitName); 
        */
        return value;