You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2006/12/21 01:05:42 UTC
svn commit: r489226 [4/8] - in /xmlgraphics/batik/trunk:
sources/org/apache/batik/anim/timing/
sources/org/apache/batik/apps/rasterizer/
sources/org/apache/batik/apps/slideshow/
sources/org/apache/batik/apps/svgbrowser/ sources/org/apache/batik/bridge/...
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java Wed Dec 20 16:05:36 2006
@@ -21,6 +21,7 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.anim.values.AnimatableNumberOptionalNumberValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
@@ -40,6 +41,26 @@
implements SVGFETurbulenceElement {
/**
+ * Table mapping XML attribute names to TraitInformation objects.
+ */
+ protected static DoublyIndexedTable xmlTraitInformation;
+ static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGOMFilterPrimitiveStandardAttributes.xmlTraitInformation);
+ t.put(null, SVG_BASE_FREQUENCY_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_NUMBER_OPTIONAL_NUMBER));
+ t.put(null, SVG_NUM_OCTAVES_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_INTEGER));
+ t.put(null, SVG_SEED_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_NUMBER));
+ t.put(null, SVG_STITCH_TILES_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_IDENT));
+ t.put(null, SVG_TYPE_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_IDENT));
+ xmlTraitInformation = t;
+ }
+
+ /**
* The 'stitchTiles' attribute values.
*/
protected static final String[] STITCH_TILES_VALUES = {
@@ -58,6 +79,26 @@
};
/**
+ * The 'numOctaves' attribute value.
+ */
+ protected SVGOMAnimatedInteger numOctaves;
+
+ /**
+ * The 'seed' attribute value.
+ */
+ protected SVGOMAnimatedNumber seed;
+
+ /**
+ * The 'stitchTiles' attribute value.
+ */
+ protected SVGOMAnimatedEnumeration stitchTiles;
+
+ /**
+ * The 'type' attribute value.
+ */
+ protected SVGOMAnimatedEnumeration type;
+
+ /**
* Creates a new SVGOMFETurbulence object.
*/
protected SVGOMFETurbulenceElement() {
@@ -71,6 +112,31 @@
public SVGOMFETurbulenceElement(String prefix,
AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ numOctaves =
+ createLiveAnimatedInteger(null, SVG_NUM_OCTAVES_ATTRIBUTE, 1);
+ seed = createLiveAnimatedNumber(null, SVG_SEED_ATTRIBUTE, 0f);
+ stitchTiles =
+ createLiveAnimatedEnumeration
+ (null, SVG_STITCH_TILES_ATTRIBUTE, STITCH_TILES_VALUES,
+ (short) 2);
+ type =
+ createLiveAnimatedEnumeration
+ (null, SVG_TYPE_ATTRIBUTE, TYPE_VALUES, (short) 2);
}
/**
@@ -102,30 +168,28 @@
* <b>DOM</b>: Implements {@link SVGFETurbulenceElement#getNumOctaves()}.
*/
public SVGAnimatedInteger getNumOctaves() {
- return getAnimatedIntegerAttribute(null, SVG_NUM_OCTAVES_ATTRIBUTE, 1);
+ return numOctaves;
}
/**
* <b>DOM</b>: Implements {@link SVGFETurbulenceElement#getSeed()}.
*/
public SVGAnimatedNumber getSeed() {
- return getAnimatedNumberAttribute(null, SVG_SEED_ATTRIBUTE, 0f);
+ return seed;
}
/**
* <b>DOM</b>: Implements {@link SVGFETurbulenceElement#getStitchTiles()}.
*/
public SVGAnimatedEnumeration getStitchTiles() {
- return getAnimatedEnumerationAttribute
- (null, SVG_STITCH_TILES_ATTRIBUTE, STITCH_TILES_VALUES, (short)2);
+ return stitchTiles;
}
/**
* <b>DOM</b>: Implements {@link SVGFETurbulenceElement#getType()}.
*/
public SVGAnimatedEnumeration getType() {
- return getAnimatedEnumerationAttribute
- (null, SVG_TYPE_ATTRIBUTE, TYPE_VALUES, (short)2);
+ return type;
}
/**
@@ -135,41 +199,11 @@
return new SVGOMFETurbulenceElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
/**
- * Returns whether the given XML attribute is animatable.
+ * Returns the table of TraitInformation objects for this element.
*/
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_BASE_FREQUENCY_ATTRIBUTE)
- || ln.equals(SVG_NUM_OCTAVES_ATTRIBUTE)
- || ln.equals(SVG_SEED_ATTRIBUTE)
- || ln.equals(SVG_STITCH_TILES_ATTRIBUTE)
- || ln.equals(SVG_TYPE_ATTRIBUTE)) {
- return true;
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_BASE_FREQUENCY_ATTRIBUTE)) {
- return SVGTypes.TYPE_NUMBER_OPTIONAL_NUMBER;
- } else if (ln.equals(SVG_NUM_OCTAVES_ATTRIBUTE)) {
- return SVGTypes.TYPE_INTEGER;
- } else if (ln.equals(SVG_SEED_ATTRIBUTE)) {
- return SVGTypes.TYPE_NUMBER;
- } else if (ln.equals(SVG_STITCH_TILES_ATTRIBUTE)
- || ln.equals(SVG_TYPE_ATTRIBUTE)) {
- return SVGTypes.TYPE_IDENT;
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java Wed Dec 20 16:05:36 2006
@@ -21,6 +21,7 @@
import org.apache.batik.anim.values.AnimatableNumberOptionalNumberValue;
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.dom.util.XMLSupport;
import org.apache.batik.util.SVGTypes;
@@ -44,6 +45,30 @@
implements SVGFilterElement {
/**
+ * Table mapping XML attribute names to TraitInformation objects.
+ */
+ protected static DoublyIndexedTable xmlTraitInformation;
+ static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation);
+ t.put(null, SVG_FILTER_UNITS_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_IDENT));
+ t.put(null, SVG_PRIMITIVE_UNITS_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_IDENT));
+ t.put(null, SVG_X_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_Y_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_WIDTH_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_HEIGHT_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_FILTER_RES_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_NUMBER_OPTIONAL_NUMBER));
+ xmlTraitInformation = t;
+ }
+
+ /**
* The attribute initializer.
*/
protected static final AttributeInitializer attributeInitializer;
@@ -70,6 +95,46 @@
};
/**
+ * The 'filterUnits' attribute value.
+ */
+ protected SVGOMAnimatedEnumeration filterUnits;
+
+ /**
+ * The 'primitiveUnits' attribute value.
+ */
+ protected SVGOMAnimatedEnumeration primitiveUnits;
+
+ /**
+ * The 'x' attribute value.
+ */
+ protected SVGOMAnimatedLength x;
+
+ /**
+ * The 'y' attribute value.
+ */
+ protected SVGOMAnimatedLength y;
+
+ /**
+ * The 'width' attribute value.
+ */
+ protected SVGOMAnimatedLength width;
+
+ /**
+ * The 'height' attribute value.
+ */
+ protected SVGOMAnimatedLength height;
+
+ /**
+ * The 'xlink:href' attribute value.
+ */
+ protected SVGOMAnimatedString href;
+
+ /**
+ * The 'externalResourcesRequired' attribute value.
+ */
+ protected SVGOMAnimatedBoolean externalResourcesRequired;
+
+ /**
* Creates a new SVGOMFilterElement object.
*/
protected SVGOMFilterElement() {
@@ -82,6 +147,46 @@
*/
public SVGOMFilterElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ filterUnits =
+ createLiveAnimatedEnumeration
+ (null, SVG_FILTER_UNITS_ATTRIBUTE, UNITS_VALUES, (short) 2);
+ primitiveUnits =
+ createLiveAnimatedEnumeration
+ (null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, UNITS_VALUES, (short) 1);
+ x = createLiveAnimatedLength
+ (null, SVG_X_ATTRIBUTE, SVG_FILTER_X_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y = createLiveAnimatedLength
+ (null, SVG_Y_ATTRIBUTE, SVG_FILTER_Y_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ width =
+ createLiveAnimatedLength
+ (null, SVG_WIDTH_ATTRIBUTE, SVG_FILTER_WIDTH_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ height =
+ createLiveAnimatedLength
+ (null, SVG_HEIGHT_ATTRIBUTE, SVG_FILTER_HEIGHT_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ href =
+ createLiveAnimatedString(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE);
+ externalResourcesRequired =
+ createLiveAnimatedBoolean
+ (null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE, false);
}
/**
@@ -95,54 +200,42 @@
* <b>DOM</b>: Implements {@link SVGFilterElement#getFilterUnits()}.
*/
public SVGAnimatedEnumeration getFilterUnits() {
- return getAnimatedEnumerationAttribute
- (null, SVG_FILTER_UNITS_ATTRIBUTE, UNITS_VALUES,
- (short)2);
+ return filterUnits;
}
/**
* <b>DOM</b>: Implements {@link SVGFilterElement#getPrimitiveUnits()}.
*/
public SVGAnimatedEnumeration getPrimitiveUnits() {
- return getAnimatedEnumerationAttribute
- (null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, UNITS_VALUES,
- (short)1);
+ return primitiveUnits;
}
/**
* <b>DOM</b>: Implements {@link SVGFilterElement#getX()}.
*/
public SVGAnimatedLength getX() {
- return getAnimatedLengthAttribute
- (null, SVG_X_ATTRIBUTE, SVG_FILTER_X_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x;
}
/**
* <b>DOM</b>: Implements {@link SVGFilterElement#getY()}.
*/
public SVGAnimatedLength getY() {
- return getAnimatedLengthAttribute
- (null, SVG_Y_ATTRIBUTE, SVG_FILTER_Y_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y;
}
/**
* <b>DOM</b>: Implements {@link SVGFilterElement#getWidth()}.
*/
public SVGAnimatedLength getWidth() {
- return getAnimatedLengthAttribute
- (null, SVG_WIDTH_ATTRIBUTE, SVG_FILTER_WIDTH_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ return width;
}
/**
* <b>DOM</b>: Implements {@link SVGFilterElement#getHeight()}.
*/
public SVGAnimatedLength getHeight() {
- return getAnimatedLengthAttribute
- (null, SVG_HEIGHT_ATTRIBUTE, SVG_FILTER_HEIGHT_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ return height;
}
/**
@@ -175,7 +268,7 @@
* <b>DOM</b>: Implements {@link org.w3c.dom.svg.SVGURIReference#getHref()}.
*/
public SVGAnimatedString getHref() {
- return SVGURIReferenceSupport.getHref(this);
+ return href;
}
// SVGExternalResourcesRequired support /////////////////////////////
@@ -185,8 +278,14 @@
* org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
*/
public SVGAnimatedBoolean getExternalResourcesRequired() {
- return SVGExternalResourcesRequiredSupport.
- getExternalResourcesRequired(this);
+ return externalResourcesRequired;
+ }
+
+ /**
+ * Returns the table of TraitInformation objects for this element.
+ */
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// SVGLangSpace support //////////////////////////////////////////////////
@@ -234,63 +333,7 @@
return new SVGOMFilterElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns whether the given XML attribute is animatable.
- */
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE)
- || ln.equals(SVG_FILTER_UNITS_ATTRIBUTE)
- || ln.equals(SVG_PRIMITIVE_UNITS_ATTRIBUTE)
- || ln.equals(SVG_X_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_HEIGHT_ATTRIBUTE)
- || ln.equals(SVG_FILTER_RES_ATTRIBUTE)) {
- return true;
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_FILTER_UNITS_ATTRIBUTE)
- || ln.equals(SVG_PRIMITIVE_UNITS_ATTRIBUTE)) {
- return SVGTypes.TYPE_IDENT;
- } else if (ln.equals(SVG_X_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return SVGTypes.TYPE_LENGTH;
- } else if (ln.equals(SVG_FILTER_RES_ATTRIBUTE)) {
- return SVGTypes.TYPE_NUMBER_OPTIONAL_NUMBER;
- }
- }
- return super.getAttributeType(ns, ln);
- }
-
// AnimationTarget ///////////////////////////////////////////////////////
-
- /**
- * Gets how percentage values are interpreted by the given attribute.
- */
- protected short getAttributePercentageInterpretation(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_WIDTH;
- }
- if (ln.equals(SVG_Y_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_HEIGHT;
- }
- }
- return super.getAttributePercentageInterpretation(ns, ln);
- }
/**
* Updates an attribute value in this target.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java Wed Dec 20 16:05:36 2006
@@ -20,6 +20,7 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.svg.SVGAnimatedLength;
@@ -38,6 +39,51 @@
implements SVGFilterPrimitiveStandardAttributes {
/**
+ * Table mapping XML attribute names to TraitInformation objects.
+ */
+ protected static DoublyIndexedTable xmlTraitInformation;
+ static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation);
+ t.put(null, SVG_X_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_Y_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_WIDTH_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_HEIGHT_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_RESULT_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_CDATA));
+ xmlTraitInformation = t;
+ }
+
+ /**
+ * The 'x' attribute value.
+ */
+ protected SVGOMAnimatedLength x;
+
+ /**
+ * The 'y' attribute value.
+ */
+ protected SVGOMAnimatedLength y;
+
+ /**
+ * The 'width' attribute value.
+ */
+ protected SVGOMAnimatedLength width;
+
+ /**
+ * The 'height' attribute value.
+ */
+ protected SVGOMAnimatedLength height;
+
+ /**
+ * The 'result' attribute value.
+ */
+ protected SVGOMAnimatedString result;
+
+ /**
* Creates a new SVGOMFilterPrimitiveStandardAttributes object.
*/
protected SVGOMFilterPrimitiveStandardAttributes() {
@@ -51,6 +97,38 @@
protected SVGOMFilterPrimitiveStandardAttributes(String prefix,
AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ x = createLiveAnimatedLength
+ (null, SVG_X_ATTRIBUTE, SVG_FILTER_PRIMITIVE_X_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y = createLiveAnimatedLength
+ (null, SVG_Y_ATTRIBUTE, SVG_FILTER_PRIMITIVE_Y_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ width =
+ createLiveAnimatedLength
+ (null, SVG_WIDTH_ATTRIBUTE,
+ SVG_FILTER_PRIMITIVE_WIDTH_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ height =
+ createLiveAnimatedLength
+ (null, SVG_HEIGHT_ATTRIBUTE,
+ SVG_FILTER_PRIMITIVE_HEIGHT_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ result = createLiveAnimatedString(null, SVG_RESULT_ATTRIBUTE);
}
/**
@@ -58,9 +136,7 @@
* org.w3c.dom.svg.SVGFilterPrimitiveStandardAttributes#getX()}.
*/
public SVGAnimatedLength getX() {
- return getAnimatedLengthAttribute
- (null, SVG_X_ATTRIBUTE, SVG_FILTER_PRIMITIVE_X_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x;
}
/**
@@ -68,9 +144,7 @@
* org.w3c.dom.svg.SVGFilterPrimitiveStandardAttributes#getY()}.
*/
public SVGAnimatedLength getY() {
- return getAnimatedLengthAttribute
- (null, SVG_Y_ATTRIBUTE, SVG_FILTER_PRIMITIVE_Y_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y;
}
/**
@@ -78,10 +152,7 @@
* org.w3c.dom.svg.SVGFilterPrimitiveStandardAttributes#getWidth()}.
*/
public SVGAnimatedLength getWidth() {
- return getAnimatedLengthAttribute
- (null, SVG_WIDTH_ATTRIBUTE,
- SVG_FILTER_PRIMITIVE_WIDTH_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ return width;
}
/**
@@ -89,10 +160,7 @@
* org.w3c.dom.svg.SVGFilterPrimitiveStandardAttributes#getHeight()}.
*/
public SVGAnimatedLength getHeight() {
- return getAnimatedLengthAttribute
- (null, SVG_HEIGHT_ATTRIBUTE,
- SVG_FILTER_PRIMITIVE_HEIGHT_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ return height;
}
/**
@@ -100,56 +168,17 @@
* org.w3c.dom.svg.SVGFilterPrimitiveStandardAttributes#getResult()}.
*/
public SVGAnimatedString getResult() {
- return getAnimatedStringAttribute(null, SVG_RESULT_ATTRIBUTE);
+ return result;
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
/**
- * Returns whether the given XML attribute is animatable.
+ * Returns the table of TraitInformation objects for this element.
*/
- public boolean isAttributeAnimatable(String ns, String ln) {
- return ns == null
- && (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_RESULT_ATTRIBUTE))
- || super.isAttributeAnimatable(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return SVGTypes.TYPE_LENGTH;
- } else if (ln.equals(SVG_RESULT_ATTRIBUTE)) {
- return SVGTypes.TYPE_CDATA;
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
-
- /**
- * Gets how percentage values are interpreted by the given attribute.
- */
- protected short getAttributePercentageInterpretation(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_WIDTH;
- }
- if (ln.equals(SVG_Y_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_HEIGHT;
- }
- }
- return super.getAttributePercentageInterpretation(ns, ln);
- }
/**
* Updates an attribute value in this target.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontElement.java Wed Dec 20 16:05:36 2006
@@ -20,15 +20,13 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
import org.w3c.dom.svg.SVGAnimatedBoolean;
import org.w3c.dom.svg.SVGFontElement;
-import java.util.Map;
-import java.util.HashMap;
-
/**
* This class implements {@link SVGFontElement}.
*
@@ -39,32 +37,34 @@
extends SVGStylableElement
implements SVGFontElement {
-
-
/**
- * this map supports a fast lookup from svg-attribute-name string to
- * svgType-integer. It is faster than doing string-equals in a
- * lengthy if-else-statement.
- * This map is used only by {@link #getAttributeType }
+ * Table mapping XML attribute names to TraitInformation objects.
*/
- private static final Map typeMap = new HashMap();
-
-
+ protected static DoublyIndexedTable xmlTraitInformation;
static {
-
- Map map = typeMap;
-
- SVGOMAttributeInfo svgType = new SVGOMAttributeInfo( SVGTypes.TYPE_NUMBER, false );
-
- map.put( SVG_HORIZ_ORIGIN_X_ATTRIBUTE, svgType );
- map.put( SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, svgType );
- map.put( SVG_HORIZ_ADV_X_ATTRIBUTE, svgType );
- map.put( SVG_VERT_ORIGIN_X_ATTRIBUTE, svgType );
- map.put( SVG_VERT_ORIGIN_Y_ATTRIBUTE, svgType );
- map.put( SVG_VERT_ADV_Y_ATTRIBUTE, svgType );
-
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation);
+ t.put(null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_BOOLEAN));
+// t.put(null, SVG_HORIZ_ORIGIN_X_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_HORIZ_ORIGIN_Y_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_HORIZ_ADV_X_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_VERT_ORIGIN_X_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_VERT_ORIGIN_Y_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_VERT_ADV_Y_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+ xmlTraitInformation = t;
}
+ /**
+ * The 'externalResourcesRequired' attribute value.
+ */
+ protected SVGOMAnimatedBoolean externalResourcesRequired;
/**
* Creates a new SVGOMFontElement object.
@@ -79,6 +79,24 @@
*/
public SVGOMFontElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ externalResourcesRequired =
+ createLiveAnimatedBoolean
+ (null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE, false);
}
/**
@@ -95,8 +113,7 @@
* org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
*/
public SVGAnimatedBoolean getExternalResourcesRequired() {
- return SVGExternalResourcesRequiredSupport.
- getExternalResourcesRequired(this);
+ return externalResourcesRequired;
}
/**
@@ -106,52 +123,11 @@
return new SVGOMFontElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns whether the given XML attribute is animatable.
- * Because in this class only one attribute is animatable,
- * we dont use the lookup table for animatable.
- */
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE)) {
- return true;
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
/**
- * Returns the type of the given attribute.
+ * Returns the table of TraitInformation objects for this element.
*/
- public int OLDgetAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_HORIZ_ORIGIN_X_ATTRIBUTE)
- || ln.equals(SVG_HORIZ_ORIGIN_Y_ATTRIBUTE)
- || ln.equals(SVG_HORIZ_ADV_X_ATTRIBUTE)
- || ln.equals(SVG_VERT_ORIGIN_X_ATTRIBUTE)
- || ln.equals(SVG_VERT_ORIGIN_Y_ATTRIBUTE)
- || ln.equals(SVG_VERT_ADV_Y_ATTRIBUTE)) {
- return SVGTypes.TYPE_NUMBER;
- }
- }
- return super.getAttributeType(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
-
- if (ns == null) {
- SVGOMAttributeInfo typeCode = (SVGOMAttributeInfo)typeMap.get( ln );
- if ( typeCode != null ){
- // it is one of 'my' mappings..
- return typeCode.getSVGType();
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceElement.java Wed Dec 20 16:05:36 2006
@@ -19,6 +19,8 @@
package org.apache.batik.dom.svg;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
+import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
import org.w3c.dom.svg.SVGFontFaceElement;
@@ -32,6 +34,81 @@
extends SVGOMElement
implements SVGFontFaceElement {
+// /**
+// * Table mapping XML attribute names to TraitInformation objects.
+// */
+// protected static DoublyIndexedTable xmlTraitInformation;
+// static {
+// DoublyIndexedTable t = new DoublyIndexedTable(SVGOMElement.xmlTraitInformation);
+// t.put(null, SVG_FONT_FAMILY_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_FONT_STYLE_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_FONT_VARIANT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_FONT_WEIGHT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_FONT_STRETCH_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_FONT_SIZE_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_UNICODE_RANGE_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_UNITS_PER_EM_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_PANOSE_1_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_STEMV_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_STEMH_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_SLOPE_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_CAP_HEIGHT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_X_HEIGHT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_ACCENT_HEIGHT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_ASCENT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_DESCENT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_WIDTHS_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_BBOX_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_IDEOGRAPHIC_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_ALPHABETIC_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_MATHEMATICAL_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_HANGING_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_V_IDEOGRAPHIC_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_V_ALPHABETIC_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_V_MATHEMATICAL_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_V_HANGING_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_UNDERLINE_POSITION_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_UNDERLINE_THICKNESS_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_STRIKETHROUGH_POSITION_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_STRIKETHROUGH_THICKNESS_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_OVERLINE_POSITION_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_OVERLINE_THICKNESS_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// xmlTraitInformation = t;
+// }
+
/**
* Creates a new SVGOMFontFaceElement object.
*/
@@ -45,7 +122,6 @@
*/
public SVGOMFontFaceElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
-
}
/**
@@ -62,15 +138,10 @@
return new SVGOMFontFaceElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- // XXX Fill in these attributes.
- }
- return super.getAttributeType(ns, ln);
- }
+// /**
+// * Returns the table of TraitInformation objects for this element.
+// */
+// protected DoublyIndexedTable getTraitInformationTable() {
+// return xmlTraitInformation;
+// }
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceFormatElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceFormatElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceFormatElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceFormatElement.java Wed Dec 20 16:05:36 2006
@@ -19,6 +19,7 @@
package org.apache.batik.dom.svg;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
@@ -34,6 +35,18 @@
extends SVGOMElement
implements SVGFontFaceFormatElement {
+// /**
+// * Table mapping XML attribute names to TraitInformation objects.
+// */
+// protected static DoublyIndexedTable xmlTraitInformation;
+// static {
+// DoublyIndexedTable t =
+// new DoublyIndexedTable(SVGOMElement.xmlTraitInformation);
+// t.put(null, SVG_STRING_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// xmlTraitInformation = t;
+// }
+
/**
* Creates a new SVGOMFontFaceFormatElement object.
*/
@@ -47,7 +60,6 @@
*/
public SVGOMFontFaceFormatElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
-
}
/**
@@ -64,17 +76,10 @@
return new SVGOMFontFaceFormatElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_STRING_ATTRIBUTE)) {
- return SVGTypes.TYPE_CDATA;
- }
- }
- return super.getAttributeType(ns, ln);
- }
+// /**
+// * Returns the table of TraitInformation objects for this element.
+// */
+// protected DoublyIndexedTable getTraitInformationTable() {
+// return xmlTraitInformation;
+// }
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceNameElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceNameElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceNameElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceNameElement.java Wed Dec 20 16:05:36 2006
@@ -19,6 +19,7 @@
package org.apache.batik.dom.svg;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
@@ -34,6 +35,18 @@
extends SVGOMElement
implements SVGFontFaceNameElement {
+// /**
+// * Table mapping XML attribute names to TraitInformation objects.
+// */
+// protected static DoublyIndexedTable xmlTraitInformation;
+// static {
+// DoublyIndexedTable t =
+// new DoublyIndexedTable(SVGOMElement.xmlTraitInformation);
+// t.put(null, SVG_NAME_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// xmlTraitInformation = t;
+// }
+
/**
* Creates a new SVGOMFontFaceNameElement object.
*/
@@ -47,7 +60,6 @@
*/
public SVGOMFontFaceNameElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
-
}
/**
@@ -64,17 +76,10 @@
return new SVGOMFontFaceNameElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_NAME_ATTRIBUTE)) {
- return SVGTypes.TYPE_CDATA;
- }
- }
- return super.getAttributeType(ns, ln);
- }
+// /**
+// * Returns the table of TraitInformation objects for this element.
+// */
+// protected DoublyIndexedTable getTraitInformationTable() {
+// return xmlTraitInformation;
+// }
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceSrcElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceSrcElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceSrcElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceSrcElement.java Wed Dec 20 16:05:36 2006
@@ -45,7 +45,6 @@
*/
public SVGOMFontFaceSrcElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
-
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceUriElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceUriElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceUriElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMFontFaceUriElement.java Wed Dec 20 16:05:36 2006
@@ -45,7 +45,6 @@
*/
public SVGOMFontFaceUriElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
-
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java Wed Dec 20 16:05:36 2006
@@ -20,6 +20,7 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
@@ -37,6 +38,49 @@
implements SVGForeignObjectElement {
/**
+ * Table mapping XML attribute names to TraitInformation objects.
+ */
+ protected static DoublyIndexedTable xmlTraitInformation;
+ static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGGraphicsElement.xmlTraitInformation);
+ t.put(null, SVG_X_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_Y_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_WIDTH_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_HEIGHT_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ xmlTraitInformation = t;
+ }
+
+ /**
+ * The 'x' attribute value.
+ */
+ protected SVGOMAnimatedLength x;
+
+ /**
+ * The 'y' attribute value.
+ */
+ protected SVGOMAnimatedLength y;
+
+ /**
+ * The 'width' attribute value.
+ */
+ protected SVGOMAnimatedLength width;
+
+ /**
+ * The 'height' attribute value.
+ */
+ protected SVGOMAnimatedLength height;
+
+ /**
+ * The 'preserveAspectRatio' attribute value.
+ */
+ protected SVGOMAnimatedPreserveAspectRatio preserveAspectRatio;
+
+ /**
* Creates a new SVGOMForeignObjectElement object.
*/
protected SVGOMForeignObjectElement() {
@@ -49,6 +93,36 @@
*/
public SVGOMForeignObjectElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ x = createLiveAnimatedLength
+ (null, SVG_X_ATTRIBUTE, SVG_FOREIGN_OBJECT_X_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y = createLiveAnimatedLength
+ (null, SVG_Y_ATTRIBUTE, SVG_FOREIGN_OBJECT_Y_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ width =
+ createLiveAnimatedLength
+ (null, SVG_WIDTH_ATTRIBUTE, null,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ height =
+ createLiveAnimatedLength
+ (null, SVG_HEIGHT_ATTRIBUTE, null,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ preserveAspectRatio = createLiveAnimatedPreserveAspectRatio();
}
/**
@@ -62,36 +136,28 @@
* <b>DOM</b>: Implements {@link SVGForeignObjectElement#getX()}.
*/
public SVGAnimatedLength getX() {
- return getAnimatedLengthAttribute
- (null, SVG_X_ATTRIBUTE, SVG_FOREIGN_OBJECT_X_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x;
}
/**
* <b>DOM</b>: Implements {@link SVGForeignObjectElement#getY()}.
*/
public SVGAnimatedLength getY() {
- return getAnimatedLengthAttribute
- (null, SVG_Y_ATTRIBUTE, SVG_FOREIGN_OBJECT_Y_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y;
}
/**
* <b>DOM</b>: Implements {@link SVGForeignObjectElement#getWidth()}.
*/
public SVGAnimatedLength getWidth() {
- return getAnimatedLengthAttribute
- (null, SVG_WIDTH_ATTRIBUTE, "",
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ return width;
}
/**
* <b>DOM</b>: Implements {@link SVGForeignObjectElement#getHeight()}.
*/
public SVGAnimatedLength getHeight() {
- return getAnimatedLengthAttribute
- (null, SVG_HEIGHT_ATTRIBUTE, "",
- SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ return height;
}
/**
@@ -101,57 +167,14 @@
return new SVGOMForeignObjectElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
/**
- * Returns whether the given XML attribute is animatable.
+ * Returns the table of TraitInformation objects for this element.
*/
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE)
- || ln.equals(SVG_X_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return true;
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return SVGTypes.TYPE_LENGTH;
- } else if (ln.equals(SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE)) {
- return SVGTypes.TYPE_BOOLEAN;
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
-
- /**
- * Gets how percentage values are interpreted by the given attribute.
- */
- protected short getAttributePercentageInterpretation(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_WIDTH;
- }
- if (ln.equals(SVG_Y_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_HEIGHT;
- }
- }
- return super.getAttributePercentageInterpretation(ns, ln);
- }
/**
* Updates an attribute value in this target.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGElement.java Wed Dec 20 16:05:36 2006
@@ -44,7 +44,6 @@
*/
public SVGOMGElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
-
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphElement.java Wed Dec 20 16:05:36 2006
@@ -19,6 +19,8 @@
package org.apache.batik.dom.svg;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
+import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
import org.w3c.dom.svg.SVGGlyphElement;
@@ -32,6 +34,35 @@
extends SVGStylableElement
implements SVGGlyphElement {
+// /**
+// * Table mapping XML attribute names to TraitInformation objects.
+// */
+// protected static DoublyIndexedTable xmlTraitInformation;
+// static {
+// DoublyIndexedTable t = new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation);
+// t.put(null, SVG_UNICODE_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_GLYPH_NAME_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_D_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_PATH_DATA));
+// t.put(null, SVG_ORIENTATION_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_IDENT));
+// t.put(null, SVG_ARABIC_FORM_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_IDENT));
+// t.put(null, SVG_LANG_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_LANG_LIST));
+// t.put(null, SVG_HORIZ_ADV_X_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_VERT_ORIGIN_X_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_VERT_ORIGIN_Y_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_VERT_ADV_Y_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// xmlTraitInformation = t;
+// }
+
/**
* Creates a new SVGOMGlyphElement object.
*/
@@ -61,15 +92,10 @@
return new SVGOMGlyphElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- // XXX Fill in these attributes.
- }
- return super.getAttributeType(ns, ln);
- }
+// /**
+// * Returns the table of TraitInformation objects for this element.
+// */
+// protected DoublyIndexedTable getTraitInformationTable() {
+// return xmlTraitInformation;
+// }
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java Wed Dec 20 16:05:36 2006
@@ -19,8 +19,10 @@
package org.apache.batik.dom.svg;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.dom.util.XMLSupport;
+import org.apache.batik.util.SVGTypes;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.svg.SVGAnimatedString;
@@ -36,6 +38,29 @@
extends SVGStylableElement
implements SVGGlyphRefElement {
+// /**
+// * Table mapping XML attribute names to TraitInformation objects.
+// */
+// protected static DoublyIndexedTable xmlTraitInformation;
+// static {
+// DoublyIndexedTable t = new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation);
+// t.put(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_URI));
+// t.put(null, SVG_GLYPH_REF_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_FORMAT_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_X_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_Y_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_DX_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// t.put(null, SVG_DY_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// xmlTraitInformation = t;
+// }
+
/**
* The attribute initializer.
*/
@@ -54,6 +79,12 @@
}
/**
+ * The 'xlink:href' attribute value. Note that this attribute not
+ * actually animatable, according to SVG 1.1.
+ */
+ protected SVGOMAnimatedString href;
+
+ /**
* Creates a new SVGOMGlyphRefElement object.
*/
protected SVGOMGlyphRefElement() {
@@ -66,6 +97,23 @@
*/
public SVGOMGlyphRefElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ href =
+ createLiveAnimatedString(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE);
}
/**
@@ -79,7 +127,7 @@
* <b>DOM</b>: Implements {@link org.w3c.dom.svg.SVGURIReference#getHref()}.
*/
public SVGAnimatedString getHref() {
- return SVGURIReferenceSupport.getHref(this);
+ return href;
}
/**
@@ -181,15 +229,10 @@
return new SVGOMGlyphRefElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- // XXX Fill in these attributes.
- }
- return super.getAttributeType(ns, ln);
- }
+// /**
+// * Returns the table of TraitInformation objects for this element.
+// */
+// protected DoublyIndexedTable getTraitInformationTable() {
+// return xmlTraitInformation;
+// }
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGradientElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGradientElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGradientElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMGradientElement.java Wed Dec 20 16:05:36 2006
@@ -20,6 +20,7 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.dom.util.XMLSupport;
import org.apache.batik.util.SVGTypes;
@@ -42,6 +43,26 @@
implements SVGGradientElement {
/**
+ * Table mapping XML attribute names to TraitInformation objects.
+ */
+ protected static DoublyIndexedTable xmlTraitInformation;
+ static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation);
+ t.put(null, SVG_GRADIENT_UNITS_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_IDENT));
+ t.put(null, SVG_SPREAD_METHOD_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_IDENT));
+ t.put(null, SVG_GRADIENT_TRANSFORM_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_TRANSFORM_LIST));
+ t.put(null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_BOOLEAN));
+ t.put(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_URI));
+ xmlTraitInformation = t;
+ }
+
+ /**
* The attribute initializer.
*/
protected static final AttributeInitializer attributeInitializer;
@@ -78,6 +99,26 @@
};
/**
+ * The 'gradientUnits' attribute value.
+ */
+ protected SVGOMAnimatedEnumeration gradientUnits;
+
+ /**
+ * The 'spreadMethod' attribute value.
+ */
+ protected SVGOMAnimatedEnumeration spreadMethod;
+
+ /**
+ * The 'xlink:href' attribute value.
+ */
+ protected SVGOMAnimatedString href;
+
+ /**
+ * The 'externalResourcesRequired' attribute value.
+ */
+ protected SVGOMAnimatedBoolean externalResourcesRequired;
+
+ /**
* Creates a new SVGOMGradientElement object.
*/
protected SVGOMGradientElement() {
@@ -90,6 +131,33 @@
*/
protected SVGOMGradientElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ gradientUnits =
+ createLiveAnimatedEnumeration
+ (null, SVG_GRADIENT_UNITS_ATTRIBUTE, UNITS_VALUES, (short) 2);
+ spreadMethod =
+ createLiveAnimatedEnumeration
+ (null, SVG_SPREAD_METHOD_ATTRIBUTE, SPREAD_METHOD_VALUES,
+ (short) 1);
+ href =
+ createLiveAnimatedString(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE);
+ externalResourcesRequired =
+ createLiveAnimatedBoolean
+ (null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE, false);
}
/**
@@ -106,9 +174,7 @@
* org.w3c.dom.svg.SVGGradientElement#getGradientUnits()}.
*/
public SVGAnimatedEnumeration getGradientUnits() {
- return getAnimatedEnumerationAttribute
- (null, SVG_GRADIENT_UNITS_ATTRIBUTE, UNITS_VALUES,
- (short)2);
+ return gradientUnits;
}
/**
@@ -116,9 +182,7 @@
* org.w3c.dom.svg.SVGGradientElement#getSpreadMethod()}.
*/
public SVGAnimatedEnumeration getSpreadMethod() {
- return getAnimatedEnumerationAttribute
- (null, SVG_SPREAD_METHOD_ATTRIBUTE, SPREAD_METHOD_VALUES,
- (short)1);
+ return spreadMethod;
}
/**
@@ -126,7 +190,7 @@
* org.w3c.dom.svg.SVGURIReference#getHref()}.
*/
public SVGAnimatedString getHref() {
- return SVGURIReferenceSupport.getHref(this);
+ return href;
}
// SVGExternalResourcesRequired support /////////////////////////////
@@ -136,8 +200,7 @@
* org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
*/
public SVGAnimatedBoolean getExternalResourcesRequired() {
- return SVGExternalResourcesRequiredSupport.
- getExternalResourcesRequired(this);
+ return externalResourcesRequired;
}
/**
@@ -155,36 +218,11 @@
return new SVGOMAElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
/**
- * Returns whether the given XML attribute is animatable.
+ * Returns the table of TraitInformation objects for this element.
*/
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE)) {
- return true;
- }
- // XXX gradientUnits, gradientTransform should be here too
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_GRADIENT_UNITS_ATTRIBUTE)
- || ln.equals(SVG_SPREAD_METHOD_ATTRIBUTE)) {
- return SVGTypes.TYPE_IDENT;
- } else if (ln.equals(SVG_GRADIENT_TRANSFORM_ATTRIBUTE)) {
- return SVGTypes.TYPE_TRANSFORM_LIST;
- } else if (ln.equals(SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE)) {
- return SVGTypes.TYPE_BOOLEAN;
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMHKernElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMHKernElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMHKernElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMHKernElement.java Wed Dec 20 16:05:36 2006
@@ -19,6 +19,7 @@
package org.apache.batik.dom.svg;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
@@ -34,6 +35,26 @@
extends SVGOMElement
implements SVGHKernElement {
+// /**
+// * Table mapping XML attribute names to TraitInformation objects.
+// */
+// protected static DoublyIndexedTable xmlTraitInformation;
+// static {
+// DoublyIndexedTable t =
+// new DoublyIndexedTable(SVGOMElement.xmlTraitInformation);
+// t.put(null, SVG_U1_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_G1_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_U2_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_G2_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_CDATA));
+// t.put(null, SVG_K_ATTRIBUTE,
+// new TraitInformation(false, SVGTypes.TYPE_NUMBER));
+// xmlTraitInformation = t;
+// }
+
/**
* Creates a new SVGOMHKernElement object.
*/
@@ -63,22 +84,10 @@
return new SVGOMHKernElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_U1_ATTRIBUTE)
- || ln.equals(SVG_G1_ATTRIBUTE)
- || ln.equals(SVG_U2_ATTRIBUTE)
- || ln.equals(SVG_G2_ATTRIBUTE)) {
- return SVGTypes.TYPE_CDATA;
- } else if (ln.equals(SVG_K_ATTRIBUTE)) {
- return SVGTypes.TYPE_NUMBER;
- }
- }
- return super.getAttributeType(ns, ln);
- }
+// /**
+// * Returns the table of TraitInformation objects for this element.
+// */
+// protected DoublyIndexedTable getTraitInformationTable() {
+// return xmlTraitInformation;
+// }
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMImageElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMImageElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMImageElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMImageElement.java Wed Dec 20 16:05:36 2006
@@ -20,6 +20,7 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.dom.util.XMLSupport;
import org.apache.batik.util.SVGTypes;
@@ -40,6 +41,24 @@
implements SVGImageElement {
/**
+ * Table mapping XML attribute names to TraitInformation objects.
+ */
+ protected static DoublyIndexedTable xmlTraitInformation;
+ static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGURIReferenceGraphicsElement.xmlTraitInformation);
+ t.put(null, SVG_X_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_Y_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_WIDTH_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_HEIGHT_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ xmlTraitInformation = t;
+ }
+
+ /**
* The attribute initializer.
*/
protected static final AttributeInitializer attributeInitializer;
@@ -60,6 +79,32 @@
}
/**
+ * The 'x' attribute value.
+ */
+ protected SVGOMAnimatedLength x;
+
+ /**
+ * The 'y' attribute value.
+ */
+ protected SVGOMAnimatedLength y;
+
+ /**
+ * The 'width' attribute value.
+ */
+ protected SVGOMAnimatedLength width;
+
+ /**
+ * The 'height' attribute value.
+ */
+ protected SVGOMAnimatedLength height;
+
+ /**
+ * The 'preserveAspectRatio' attribute value.
+ */
+ protected SVGOMAnimatedPreserveAspectRatio preserveAspectRatio =
+ createLiveAnimatedPreserveAspectRatio();
+
+ /**
* Creates a new SVGOMImageElement object.
*/
protected SVGOMImageElement() {
@@ -72,6 +117,36 @@
*/
public SVGOMImageElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ x = createLiveAnimatedLength
+ (null, SVG_X_ATTRIBUTE, SVG_IMAGE_X_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y = createLiveAnimatedLength
+ (null, SVG_Y_ATTRIBUTE, SVG_IMAGE_Y_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ width =
+ createLiveAnimatedLength
+ (null, SVG_WIDTH_ATTRIBUTE, null,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ height =
+ createLiveAnimatedLength
+ (null, SVG_HEIGHT_ATTRIBUTE, null,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ preserveAspectRatio = createLiveAnimatedPreserveAspectRatio();
}
/**
@@ -85,43 +160,35 @@
* <b>DOM</b>: Implements {@link SVGImageElement#getX()}.
*/
public SVGAnimatedLength getX() {
- return getAnimatedLengthAttribute
- (null, SVG_X_ATTRIBUTE, SVG_IMAGE_X_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x;
}
/**
* <b>DOM</b>: Implements {@link SVGImageElement#getY()}.
*/
public SVGAnimatedLength getY() {
- return getAnimatedLengthAttribute
- (null, SVG_Y_ATTRIBUTE, SVG_IMAGE_Y_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y;
}
/**
* <b>DOM</b>: Implements {@link SVGImageElement#getWidth()}.
*/
public SVGAnimatedLength getWidth() {
- return getAnimatedLengthAttribute
- (null, SVG_WIDTH_ATTRIBUTE, null,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
+ return width;
}
/**
* <b>DOM</b>: Implements {@link SVGImageElement#getHeight()}.
*/
public SVGAnimatedLength getHeight() {
- return getAnimatedLengthAttribute
- (null, SVG_HEIGHT_ATTRIBUTE, null,
- SVGOMAnimatedLength.VERTICAL_LENGTH, true);
+ return height;
}
/**
* <b>DOM</b>: Implements {@link SVGImageElement#getPreserveAspectRatio()}.
*/
public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
- return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
+ return preserveAspectRatio;
}
/**
@@ -139,57 +206,14 @@
return new SVGOMImageElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
/**
- * Returns whether the given XML attribute is animatable.
+ * Returns the table of TraitInformation objects for this element.
*/
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_HEIGHT_ATTRIBUTE)
- || ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) {
- return true;
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE)
- || ln.equals(SVG_Y_ATTRIBUTE)
- || ln.equals(SVG_WIDTH_ATTRIBUTE)
- || ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
- return SVGTypes.TYPE_LENGTH;
- } else if (ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) {
- return SVGTypes.TYPE_PRESERVE_ASPECT_RATIO_VALUE;
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
-
- /**
- * Gets how percentage values are interpreted by the given attribute.
- */
- protected short getAttributePercentageInterpretation(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_WIDTH;
- }
- if (ln.equals(SVG_Y_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_HEIGHT;
- }
- }
- return super.getAttributePercentageInterpretation(ns, ln);
- }
/**
* Updates an attribute value in this target.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLineElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLineElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLineElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLineElement.java Wed Dec 20 16:05:36 2006
@@ -20,15 +20,13 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
import org.w3c.dom.svg.SVGAnimatedLength;
import org.w3c.dom.svg.SVGLineElement;
-import java.util.Map;
-import java.util.HashMap;
-
/**
* This class implements {@link SVGLineElement}.
*
@@ -39,28 +37,43 @@
extends SVGGraphicsElement
implements SVGLineElement {
-
/**
- * this map supports a fast lookup from svg-attribute-name string to
- * svgType-integer. It is faster than doing string-equals in a
- * lengthy if-else-statement.
- * This map is used only by {@link #getAttributeType }
+ * Table mapping XML attribute names to TraitInformation objects.
*/
- private static final Map typeMap = new HashMap();
-
-
+ protected static DoublyIndexedTable xmlTraitInformation;
static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGGraphicsElement.xmlTraitInformation);
+ t.put(null, SVG_X_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_Y_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_WIDTH_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_HEIGHT_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ xmlTraitInformation = t;
+ }
- Map map = typeMap;
+ /**
+ * The 'x1' attribute value.
+ */
+ protected SVGOMAnimatedLength x1;
- SVGOMAttributeInfo svgType = new SVGOMAttributeInfo( SVGTypes.TYPE_LENGTH, true );
+ /**
+ * The 'y1' attribute value.
+ */
+ protected SVGOMAnimatedLength y1;
- map.put( SVG_X1_ATTRIBUTE, svgType );
- map.put( SVG_Y1_ATTRIBUTE, svgType );
- map.put( SVG_X2_ATTRIBUTE, svgType );
- map.put( SVG_Y2_ATTRIBUTE, svgType );
+ /**
+ * The 'x2' attribute value.
+ */
+ protected SVGOMAnimatedLength x2;
- }
+ /**
+ * The 'y2' attribute value.
+ */
+ protected SVGOMAnimatedLength y2;
/**
* Creates a new SVGOMLineElement object.
@@ -75,6 +88,33 @@
*/
public SVGOMLineElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ x1 = createLiveAnimatedLength
+ (null, SVG_X1_ATTRIBUTE, SVG_LINE_X1_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y1 = createLiveAnimatedLength
+ (null, SVG_Y1_ATTRIBUTE, SVG_LINE_Y1_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ x2 = createLiveAnimatedLength
+ (null, SVG_X2_ATTRIBUTE, SVG_LINE_X2_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y2 = createLiveAnimatedLength
+ (null, SVG_Y2_ATTRIBUTE, SVG_LINE_Y2_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
}
/**
@@ -88,36 +128,28 @@
* <b>DOM</b>: Implements {@link SVGLineElement#getX1()}.
*/
public SVGAnimatedLength getX1() {
- return getAnimatedLengthAttribute
- (null, SVG_X1_ATTRIBUTE, SVG_LINE_X1_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x1;
}
/**
* <b>DOM</b>: Implements {@link SVGLineElement#getY1()}.
*/
public SVGAnimatedLength getY1() {
- return getAnimatedLengthAttribute
- (null, SVG_Y1_ATTRIBUTE, SVG_LINE_Y1_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y1;
}
/**
* <b>DOM</b>: Implements {@link SVGLineElement#getX2()}.
*/
public SVGAnimatedLength getX2() {
- return getAnimatedLengthAttribute
- (null, SVG_X2_ATTRIBUTE, SVG_LINE_X2_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x2;
}
/**
* <b>DOM</b>: Implements {@link SVGLineElement#getY2()}.
*/
public SVGAnimatedLength getY2() {
- return getAnimatedLengthAttribute
- (null, SVG_Y2_ATTRIBUTE, SVG_LINE_Y2_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y2;
}
/**
@@ -127,69 +159,14 @@
return new SVGOMLineElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
- /**
- * Returns whether the given XML attribute is animatable.
- */
- public boolean OLDisAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X1_ATTRIBUTE)
- || ln.equals(SVG_Y1_ATTRIBUTE)
- || ln.equals(SVG_X2_ATTRIBUTE)
- || ln.equals(SVG_Y2_ATTRIBUTE)) {
- return true;
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
/**
- * Returns whether the given XML attribute is animatable.
+ * Returns the table of TraitInformation objects for this element.
*/
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- SVGOMAttributeInfo typeCode = (SVGOMAttributeInfo)typeMap.get( ln );
- if ( typeCode != null ){
- // it is one of 'my' mappings..
- return typeCode.getIsAnimatable();
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
-
- if (ns == null) {
- SVGOMAttributeInfo typeCode = (SVGOMAttributeInfo)typeMap.get( ln );
- if ( typeCode != null ){
- // it is one of 'my' mappings..
- return typeCode.getSVGType();
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
-
- /**
- * Gets how percentage values are interpreted by the given attribute.
- */
- protected short getAttributePercentageInterpretation(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X1_ATTRIBUTE) || ln.equals(SVG_X2_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_WIDTH;
- }
- if (ln.equals(SVG_Y1_ATTRIBUTE) || ln.equals(SVG_Y2_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_HEIGHT;
- }
- }
- return super.getAttributePercentageInterpretation(ns, ln);
- }
/**
* Updates an attribute value in this target.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java?view=diff&rev=489226&r1=489225&r2=489226
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java Wed Dec 20 16:05:36 2006
@@ -20,6 +20,7 @@
import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DoublyIndexedTable;
import org.apache.batik.util.SVGTypes;
import org.w3c.dom.Node;
@@ -37,6 +38,44 @@
implements SVGLinearGradientElement {
/**
+ * Table mapping XML attribute names to TraitInformation objects.
+ */
+ protected static DoublyIndexedTable xmlTraitInformation;
+ static {
+ DoublyIndexedTable t =
+ new DoublyIndexedTable(SVGOMGradientElement.xmlTraitInformation);
+ t.put(null, SVG_X_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_Y_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ t.put(null, SVG_WIDTH_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
+ t.put(null, SVG_HEIGHT_ATTRIBUTE,
+ new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
+ xmlTraitInformation = t;
+ }
+
+ /**
+ * The 'x1' attribute value.
+ */
+ protected SVGOMAnimatedLength x1;
+
+ /**
+ * The 'y1' attribute value.
+ */
+ protected SVGOMAnimatedLength y1;
+
+ /**
+ * The 'x2' attribute value.
+ */
+ protected SVGOMAnimatedLength x2;
+
+ /**
+ * The 'y2' attribute value.
+ */
+ protected SVGOMAnimatedLength y2;
+
+ /**
* Creates a new SVGOMLinearGradientElement object.
*/
protected SVGOMLinearGradientElement() {
@@ -49,6 +88,33 @@
*/
public SVGOMLinearGradientElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes all live attributes for this element.
+ */
+ protected void initializeAllLiveAttributes() {
+ super.initializeAllLiveAttributes();
+ initializeLiveAttributes();
+ }
+
+ /**
+ * Initializes the live attribute values of this element.
+ */
+ private void initializeLiveAttributes() {
+ x1 = createLiveAnimatedLength
+ (null, SVG_X1_ATTRIBUTE, SVG_LINEAR_GRADIENT_X1_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y1 = createLiveAnimatedLength
+ (null, SVG_Y1_ATTRIBUTE, SVG_LINEAR_GRADIENT_Y1_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ x2 = createLiveAnimatedLength
+ (null, SVG_X2_ATTRIBUTE, SVG_LINEAR_GRADIENT_X2_DEFAULT_VALUE,
+ SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ y2 = createLiveAnimatedLength
+ (null, SVG_Y2_ATTRIBUTE, SVG_LINEAR_GRADIENT_Y2_DEFAULT_VALUE,
+ SVGOMAnimatedLength.VERTICAL_LENGTH, false);
}
/**
@@ -62,36 +128,28 @@
* <b>DOM</b>: Implements {@link SVGLinearGradientElement#getX1()}.
*/
public SVGAnimatedLength getX1() {
- return getAnimatedLengthAttribute
- (null, SVG_X1_ATTRIBUTE, SVG_LINEAR_GRADIENT_X1_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x1;
}
/**
* <b>DOM</b>: Implements {@link SVGLinearGradientElement#getY1()}.
*/
public SVGAnimatedLength getY1() {
- return getAnimatedLengthAttribute
- (null, SVG_Y1_ATTRIBUTE, SVG_LINEAR_GRADIENT_Y1_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y1;
}
/**
* <b>DOM</b>: Implements {@link SVGLinearGradientElement#getX2()}.
*/
public SVGAnimatedLength getX2() {
- return getAnimatedLengthAttribute
- (null, SVG_X2_ATTRIBUTE, SVG_LINEAR_GRADIENT_X2_DEFAULT_VALUE,
- SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
+ return x2;
}
/**
* <b>DOM</b>: Implements {@link SVGLinearGradientElement#getY2()}.
*/
public SVGAnimatedLength getY2() {
- return getAnimatedLengthAttribute
- (null, SVG_Y2_ATTRIBUTE, SVG_LINEAR_GRADIENT_Y2_DEFAULT_VALUE,
- SVGOMAnimatedLength.VERTICAL_LENGTH, false);
+ return y2;
}
/**
@@ -101,54 +159,14 @@
return new SVGOMLinearGradientElement();
}
- // ExtendedTraitAccess ///////////////////////////////////////////////////
-
/**
- * Returns whether the given XML attribute is animatable.
+ * Returns the table of TraitInformation objects for this element.
*/
- public boolean isAttributeAnimatable(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X1_ATTRIBUTE)
- || ln.equals(SVG_Y1_ATTRIBUTE)
- || ln.equals(SVG_X2_ATTRIBUTE)
- || ln.equals(SVG_Y2_ATTRIBUTE)) {
- return true;
- }
- }
- return super.isAttributeAnimatable(ns, ln);
- }
-
- /**
- * Returns the type of the given attribute.
- */
- public int getAttributeType(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X1_ATTRIBUTE)
- || ln.equals(SVG_Y1_ATTRIBUTE)
- || ln.equals(SVG_X2_ATTRIBUTE)
- || ln.equals(SVG_Y2_ATTRIBUTE)) {
- return SVGTypes.TYPE_LENGTH;
- }
- }
- return super.getAttributeType(ns, ln);
+ protected DoublyIndexedTable getTraitInformationTable() {
+ return xmlTraitInformation;
}
// AnimationTarget ///////////////////////////////////////////////////////
-
- /**
- * Gets how percentage values are interpreted by the given attribute.
- */
- protected short getAttributePercentageInterpretation(String ns, String ln) {
- if (ns == null) {
- if (ln.equals(SVG_X1_ATTRIBUTE) || ln.equals(SVG_X2_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_WIDTH;
- }
- if (ln.equals(SVG_Y1_ATTRIBUTE) || ln.equals(SVG_Y2_ATTRIBUTE)) {
- return PERCENTAGE_VIEWPORT_HEIGHT;
- }
- }
- return super.getAttributePercentageInterpretation(ns, ln);
- }
/**
* Updates an attribute value in this target.