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.DoublyIndexedTable;
023: import org.apache.batik.util.SVGTypes;
024:
025: import org.w3c.dom.svg.SVGAnimatedLengthList;
026: import org.w3c.dom.svg.SVGAnimatedNumberList;
027: import org.w3c.dom.svg.SVGTextPositioningElement;
028:
029: /**
030: * This class implements {@link org.w3c.dom.svg.SVGTextPositioningElement}.
031: *
032: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
033: * @version $Id: SVGOMTextPositioningElement.java 489964 2006-12-24 01:30:23Z cam $
034: */
035: public abstract class SVGOMTextPositioningElement extends
036: SVGOMTextContentElement implements SVGTextPositioningElement {
037:
038: /**
039: * Table mapping XML attribute names to TraitInformation objects.
040: */
041: protected static DoublyIndexedTable xmlTraitInformation;
042: static {
043: DoublyIndexedTable t = new DoublyIndexedTable(
044: SVGOMTextContentElement.xmlTraitInformation);
045: t.put(null, SVG_X_ATTRIBUTE, new TraitInformation(true,
046: SVGTypes.TYPE_LENGTH_LIST, PERCENTAGE_VIEWPORT_WIDTH));
047: t.put(null, SVG_Y_ATTRIBUTE, new TraitInformation(true,
048: SVGTypes.TYPE_LENGTH_LIST, PERCENTAGE_VIEWPORT_HEIGHT));
049: t.put(null, SVG_DX_ATTRIBUTE, new TraitInformation(true,
050: SVGTypes.TYPE_LENGTH_LIST, PERCENTAGE_VIEWPORT_WIDTH));
051: t.put(null, SVG_DY_ATTRIBUTE, new TraitInformation(true,
052: SVGTypes.TYPE_LENGTH_LIST, PERCENTAGE_VIEWPORT_HEIGHT));
053: t.put(null, SVG_ROTATE_ATTRIBUTE, new TraitInformation(true,
054: SVGTypes.TYPE_NUMBER_LIST));
055: xmlTraitInformation = t;
056: }
057:
058: /**
059: * The 'x' attribute value.
060: */
061: protected SVGOMAnimatedLengthList x;
062:
063: /**
064: * The 'y' attribute value.
065: */
066: protected SVGOMAnimatedLengthList y;
067:
068: /**
069: * The 'dx' attribute value.
070: */
071: protected SVGOMAnimatedLengthList dx;
072:
073: /**
074: * The 'dy' attribute value.
075: */
076: protected SVGOMAnimatedLengthList dy;
077:
078: /**
079: * The 'rotate' attribute value.
080: */
081: protected SVGOMAnimatedNumberList rotate;
082:
083: /**
084: * Creates a new SVGOMTextPositioningElement object.
085: */
086: protected SVGOMTextPositioningElement() {
087: }
088:
089: /**
090: * Creates a new SVGOMTextPositioningElement object.
091: * @param prefix The namespace prefix.
092: * @param owner The owner document.
093: */
094: protected SVGOMTextPositioningElement(String prefix,
095: AbstractDocument owner) {
096: super (prefix, owner);
097: initializeLiveAttributes();
098: }
099:
100: /**
101: * Initializes all live attributes for this element.
102: */
103: protected void initializeAllLiveAttributes() {
104: super .initializeAllLiveAttributes();
105: initializeLiveAttributes();
106: }
107:
108: /**
109: * Initializes the live attribute values of this element.
110: */
111: private void initializeLiveAttributes() {
112: x = createLiveAnimatedLengthList(null, SVG_X_ATTRIBUTE,
113: getDefaultXValue(), true,
114: SVGOMAnimatedLength.HORIZONTAL_LENGTH);
115: y = createLiveAnimatedLengthList(null, SVG_Y_ATTRIBUTE,
116: getDefaultYValue(), true,
117: SVGOMAnimatedLength.VERTICAL_LENGTH);
118: dx = createLiveAnimatedLengthList(null, SVG_DX_ATTRIBUTE, "",
119: true, SVGOMAnimatedLength.HORIZONTAL_LENGTH);
120: dy = createLiveAnimatedLengthList(null, SVG_DY_ATTRIBUTE, "",
121: true, SVGOMAnimatedLength.VERTICAL_LENGTH);
122: rotate = createLiveAnimatedNumberList(null,
123: SVG_ROTATE_ATTRIBUTE, "", true);
124: }
125:
126: /**
127: * <b>DOM</b>: Implements {@link SVGTextPositioningElement#getX()}.
128: */
129: public SVGAnimatedLengthList getX() {
130: return x;
131: }
132:
133: /**
134: * <b>DOM</b>: Implements {@link SVGTextPositioningElement#getY()}.
135: */
136: public SVGAnimatedLengthList getY() {
137: return y;
138: }
139:
140: /**
141: * <b>DOM</b>: Implements {@link SVGTextPositioningElement#getDx()}.
142: */
143: public SVGAnimatedLengthList getDx() {
144: return dx;
145: }
146:
147: /**
148: * <b>DOM</b>: Implements {@link SVGTextPositioningElement#getDy()}.
149: */
150: public SVGAnimatedLengthList getDy() {
151: return dy;
152: }
153:
154: /**
155: * <b>DOM</b>: Implements {@link SVGTextPositioningElement#getRotate()}.
156: */
157: public SVGAnimatedNumberList getRotate() {
158: return rotate;
159: }
160:
161: /**
162: * Returns the default value of the 'x' attribute.
163: */
164: protected String getDefaultXValue() {
165: return "";
166: }
167:
168: /**
169: * Returns the default value of the 'y' attribute.
170: */
171: protected String getDefaultYValue() {
172: return "";
173: }
174:
175: /**
176: * Returns the table of TraitInformation objects for this element.
177: */
178: protected DoublyIndexedTable getTraitInformationTable() {
179: return xmlTraitInformation;
180: }
181: }
|