001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.dom.svg;
020:
021: import org.apache.batik.dom.AbstractDocument;
022: import org.apache.batik.dom.util.XLinkSupport;
023: import org.apache.batik.dom.util.XMLSupport;
024:
025: import org.w3c.dom.DOMException;
026: import org.w3c.dom.Node;
027: import org.w3c.dom.svg.SVGAltGlyphElement;
028:
029: /**
030: * This class implements {@link SVGAltGlyphElement}.
031: *
032: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
033: * @version $Id: SVGOMAltGlyphElement.java 489964 2006-12-24 01:30:23Z cam $
034: */
035: public class SVGOMAltGlyphElement extends
036: SVGURIReferenceTextPositioningElement implements
037: SVGAltGlyphElement {
038:
039: /**
040: * The attribute initializer.
041: */
042: protected static final AttributeInitializer attributeInitializer;
043: static {
044: attributeInitializer = new AttributeInitializer(4);
045: attributeInitializer.addAttribute(
046: XMLSupport.XMLNS_NAMESPACE_URI, null, "xmlns:xlink",
047: XLinkSupport.XLINK_NAMESPACE_URI);
048: attributeInitializer.addAttribute(
049: XLinkSupport.XLINK_NAMESPACE_URI, "xlink", "type",
050: "simple");
051: attributeInitializer.addAttribute(
052: XLinkSupport.XLINK_NAMESPACE_URI, "xlink", "show",
053: "other");
054: attributeInitializer.addAttribute(
055: XLinkSupport.XLINK_NAMESPACE_URI, "xlink", "actuate",
056: "onLoad");
057: }
058:
059: // /**
060: // * Table mapping XML attribute names to TraitInformation objects.
061: // */
062: // protected static DoublyIndexedTable xmlTraitInformation;
063: // static {
064: // DoublyIndexedTable t =
065: // new DoublyIndexedTable(SVGURIReferenceTextPositioningElement.xmlTraitInformation);
066: // t.put(null, SVG_FORMAT_ATTRIBUTE,
067: // new TraitInformation(false, SVGTypes.TYPE_CDATA));
068: // t.put(null, SVG_GLYPH_REF_ATTRIBUTE,
069: // new TraitInformation(false, SVGTypes.TYPE_CDATA));
070: // xmlTraitInformation = t;
071: // }
072:
073: /**
074: * Creates a new SVGOMAltGlyphElement object.
075: */
076: protected SVGOMAltGlyphElement() {
077: }
078:
079: /**
080: * Creates a new SVGOMAltGlyphElement object.
081: * @param prefix The namespace prefix.
082: * @param owner The owner document.
083: */
084: public SVGOMAltGlyphElement(String prefix, AbstractDocument owner) {
085: super (prefix, owner);
086: }
087:
088: /**
089: * <b>DOM</b>: Implements {@link Node#getLocalName()}.
090: */
091: public String getLocalName() {
092: return SVG_ALT_GLYPH_TAG;
093: }
094:
095: /**
096: * <b>DOM</b>: Implements {@link SVGAltGlyphElement#getGlyphRef()}.
097: */
098: public String getGlyphRef() {
099: return getAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE);
100: }
101:
102: /**
103: * <b>DOM</b>: Implements {@link SVGAltGlyphElement#setGlyphRef(String)}.
104: */
105: public void setGlyphRef(String glyphRef) throws DOMException {
106: setAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE, glyphRef);
107: }
108:
109: /**
110: * <b>DOM</b>: Implements {@link SVGAltGlyphElement#getFormat()}.
111: */
112: public String getFormat() {
113: return getAttributeNS(null, SVG_FORMAT_ATTRIBUTE);
114: }
115:
116: /**
117: * <b>DOM</b>: Implements {@link SVGAltGlyphElement#setFormat(String)}.
118: */
119: public void setFormat(String format) throws DOMException {
120: setAttributeNS(null, SVG_FORMAT_ATTRIBUTE, format);
121: }
122:
123: /**
124: * Returns the AttributeInitializer for this element type.
125: * @return null if this element has no attribute with a default value.
126: */
127: protected AttributeInitializer getAttributeInitializer() {
128: return attributeInitializer;
129: }
130:
131: /**
132: * Returns a new uninitialized instance of this object's class.
133: */
134: protected Node newNode() {
135: return new SVGOMAltGlyphElement();
136: }
137:
138: // /**
139: // * Returns the table of TraitInformation objects for this element.
140: // */
141: // protected DoublyIndexedTable getTraitInformationTable() {
142: // return xmlTraitInformation;
143: // }
144: }
|