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/06/27 11:08:48 UTC
svn commit: r417379 [3/3] - in /xmlgraphics/batik/branches/anim:
resources/org/apache/batik/dom/svg/resources/
sources/org/apache/batik/anim/ sources/org/apache/batik/anim/values/
sources/org/apache/batik/bridge/ sources/org/apache/batik/dom/svg/ sourc...
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java Tue Jun 27 02:08:44 2006
@@ -17,37 +17,37 @@
*/
package org.apache.batik.dom.svg;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.batik.parser.ParseException;
+
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.svg.SVGAnimatedPoints;
import org.w3c.dom.svg.SVGException;
+import org.w3c.dom.svg.SVGPoint;
import org.w3c.dom.svg.SVGPointList;
/**
- * This class is the implementation of
- * the SVGAnimatedPoints interface.
+ * This class is the implementation of the SVGAnimatedPoints interface.
*
* @author <a href="mailto:nicolas.socheleau@bitflash.com">Nicolas Socheleau</a>
* @version $Id$
*/
public class SVGOMAnimatedPoints
- implements SVGAnimatedPoints,
- LiveAttributeValue {
-
- /**
- * The associated element.
- */
- protected AbstractElement element;
+ extends AbstractSVGAnimatedValue
+ implements SVGAnimatedPoints {
/**
- * The attribute's namespace URI.
+ * The base value.
*/
- protected String namespaceURI;
+ protected BaseSVGPointList baseVal;
/**
- * The attribute's local name.
+ * The animated value.
*/
- protected String localName;
+ protected AnimSVGPointList animVal;
/**
* Whether the list is changing.
@@ -55,54 +55,75 @@
protected boolean changing;
/**
- * SVGPointList mapping the static 'points' attribute.
- */
- protected AbstractSVGPointList points;
-
- /**
- * Default value for the 'points' attribute.
+ * Default value for the point list.
*/
protected String defaultValue;
/**
+ * Creates a new SVGOMAnimatedPoints.
+ * @param elt The associated element.
+ * @param ns The attribute's namespace URI.
+ * @param ln The attribute's local name.
+ * @param defaultValue The default value if the attribute is not specified.
*/
public SVGOMAnimatedPoints(AbstractElement elt,
String ns,
String ln,
- String defaultValue){
-
- element = elt;
- namespaceURI = ns;
- localName = ln;
+ String defaultValue) {
+ super(elt, ns, ln);
this.defaultValue = defaultValue;
}
/**
- * return the SVGPointList mapping
- * the static 'points' attribute
- * of the element
- *
- * @return a point list.
+ * <b>DOM</b>: Implements {@link SVGAnimatedPointList#getPoints()}.
+ */
+ public SVGPointList getPoints() {
+ if (baseVal == null) {
+ baseVal = new BaseSVGPointList();
+ }
+ return baseVal;
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGAnimatedPointList#getAnimatedPoints()}.
+ */
+ public SVGPointList getAnimatedPoints() {
+ if (animVal == null) {
+ animVal = new AnimSVGPointList();
+ }
+ return animVal;
+ }
+
+ /**
+ * Sets the animated value.
*/
- public SVGPointList getPoints(){
- if ( points == null ){
- points = new SVGOMPointList();
+ public void setAnimatedValue(float[] pts) {
+ if (animVal == null) {
+ animVal = new AnimSVGPointList();
}
- return points;
+ hasAnimVal = true;
+ animVal.setAnimatedValue(pts);
+ fireAnimatedAttributeListeners();
}
/**
+ * Resets the animated value.
*/
- public SVGPointList getAnimatedPoints(){
- throw new RuntimeException("TODO : getAnimatedPoints() !!");
+ public void resetAnimatedValue() {
+ hasAnimVal = false;
+ fireAnimatedAttributeListeners();
}
/**
* Called when an Attr node has been added.
*/
public void attrAdded(Attr node, String newv) {
- if (!changing && points != null) {
- points.invalidate();
+ if (!changing && baseVal != null) {
+ baseVal.invalidate();
+ }
+ // XXX Notify baseVal listeners (if we need them).
+ if (!hasAnimVal) {
+ fireAnimatedAttributeListeners();
}
}
@@ -110,8 +131,12 @@
* Called when an Attr node has been modified.
*/
public void attrModified(Attr node, String oldv, String newv) {
- if (!changing && points != null) {
- points.invalidate();
+ if (!changing && baseVal != null) {
+ baseVal.invalidate();
+ }
+ // XXX Notify baseVal listeners (if we need them).
+ if (!hasAnimVal) {
+ fireAnimatedAttributeListeners();
}
}
@@ -119,40 +144,41 @@
* Called when an Attr node has been removed.
*/
public void attrRemoved(Attr node, String oldv) {
- if (!changing && points != null) {
- points.invalidate();
+ if (!changing && baseVal != null) {
+ baseVal.invalidate();
+ }
+ // XXX Notify baseVal listeners (if we need them).
+ if (!hasAnimVal) {
+ fireAnimatedAttributeListeners();
}
}
-
+
/**
- * SVGPointList implementation for the
- * static 'points' attribute of the element.
+ * {@link SVGPointList} implementation for the base point list value.
*/
- public class SVGOMPointList extends AbstractSVGPointList {
+ protected class BaseSVGPointList extends AbstractSVGPointList {
/**
* Create a DOMException.
*/
- protected DOMException createDOMException(short type,
- String key,
- Object[] args){
- return element.createDOMException(type,key,args);
+ protected DOMException createDOMException(short type, String key,
+ Object[] args) {
+ return element.createDOMException(type, key, args);
}
/**
* Create a SVGException.
*/
- protected SVGException createSVGException(short type,
- String key,
- Object[] args){
+ protected SVGException createSVGException(short type, String key,
+ Object[] args) {
- return ((SVGOMElement)element).createSVGException(type,key,args);
+ return ((SVGOMElement)element).createSVGException(type, key, args);
}
/**
- * Retrieve the value of the attribute 'points'.
+ * Returns the value of the DOM attribute containing the point list.
*/
- protected String getValueAsString(){
+ protected String getValueAsString() {
Attr attr = element.getAttributeNodeNS(namespaceURI, localName);
if (attr == null) {
return defaultValue;
@@ -161,16 +187,220 @@
}
/**
- * Set the value of the attribute 'points'
+ * Sets the DOM attribute value containing the point list.
*/
- protected void setAttributeValue(String value){
- try{
+ protected void setAttributeValue(String value) {
+ try {
changing = true;
element.setAttributeNS(namespaceURI, localName, value);
- }
- finally{
+ } finally {
changing = false;
}
+ }
+
+ /**
+ * Initializes the list, if needed.
+ */
+ protected void revalidate() {
+ if (valid) {
+ return;
+ }
+
+ String s = getValueAsString();
+ if (s == null) {
+ throw new LiveAttributeException(element, localName, true,
+ null);
+ }
+ try {
+ ListBuilder builder = new ListBuilder();
+
+ doParse(s, builder);
+
+ if (builder.getList() != null) {
+ clear(itemList);
+ }
+ itemList = builder.getList();
+ } catch (ParseException e) {
+ itemList = new ArrayList(1);
+ }
+ valid = true;
+ }
+ }
+
+ /**
+ * {@link SVGPointList} implementation for the base point list value.
+ */
+ protected class AnimSVGPointList extends AbstractSVGPointList {
+
+ /**
+ * Creates a new AnimSVGPointList.
+ */
+ public AnimSVGPointList() {
+ itemList = new ArrayList(1);
+ }
+
+ /**
+ * Create a DOMException.
+ */
+ protected DOMException createDOMException(short type, String key,
+ Object[] args) {
+ return element.createDOMException(type, key, args);
+ }
+
+ /**
+ * Create a SVGException.
+ */
+ protected SVGException createSVGException(short type, String key,
+ Object[] args) {
+
+ return ((SVGOMElement)element).createSVGException(type, key, args);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPointList#getNumberOfItems()}.
+ */
+ public int getNumberOfItems() {
+ if (hasAnimVal) {
+ return super.getNumberOfItems();
+ }
+ return getPoints().getNumberOfItems();
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPointList#getItem(int)}.
+ */
+ public SVGPoint getItem(int index) throws DOMException {
+ if (hasAnimVal) {
+ return super.getItem(index);
+ }
+ return getPoints().getItem(index);
+ }
+
+ /**
+ * Returns the value of the DOM attribute containing the point list.
+ */
+ protected String getValueAsString() {
+ if (itemList.size() == 0) {
+ return "";
+ }
+ StringBuffer sb = new StringBuffer();
+ Iterator i = itemList.iterator();
+ if (i.hasNext()) {
+ sb.append(((SVGItem) i.next()).getValueAsString());
+ }
+ while (i.hasNext()) {
+ sb.append(getItemSeparator());
+ sb.append(((SVGItem) i.next()).getValueAsString());
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Sets the DOM attribute value containing the point list.
+ */
+ protected void setAttributeValue(String value) {
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPointList#clear()}.
+ */
+ public void clear() throws DOMException {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.point.list", null);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPointList#initialize(SVGPoint)}.
+ */
+ public SVGPoint initialize(SVGPoint newItem)
+ throws DOMException, SVGException {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.point.list", null);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link
+ * SVGPointList#insertItemBefore(SVGPoint, int)}.
+ */
+ public SVGPoint insertItemBefore(SVGPoint newItem, int index)
+ throws DOMException, SVGException {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.point.list", null);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link
+ * SVGPointList#replaceItem(SVGPoint, int)}.
+ */
+ public SVGPoint replaceItem(SVGPoint newItem, int index)
+ throws DOMException, SVGException {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.point.list", null);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPointList#removeItem(int)}.
+ */
+ public SVGPoint removeItem(int index) throws DOMException {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.point.list", null);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPointList#appendItem(SVGPoint)}.
+ */
+ public SVGPoint appendItem(SVGPoint newItem) throws DOMException {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.point.list", null);
+ }
+
+ /**
+ * Sets the animated value.
+ */
+ protected void setAnimatedValue(float[] pts) {
+ int size = itemList.size();
+ int i = 0;
+ while (i < size && i < pts.length / 2) {
+ SVGPointItem p = (SVGPointItem) itemList.get(i);
+ p.x = pts[i * 2];
+ p.y = pts[i * 2 + 1];
+ i++;
+ }
+ while (i < pts.length / 2) {
+ appendItemImpl(new SVGPointItem(pts[i * 2], pts[i * 2 + 1]));
+ i++;
+ }
+ while (size > pts.length / 2) {
+ removeItemImpl(--size);
+ }
+ }
+
+ /**
+ * Resets the value of the associated attribute. Does nothing, since
+ * there is no attribute for an animated value.
+ */
+ protected void resetAttribute() {
+ }
+
+ /**
+ * Resets the value of the associated attribute. Does nothing, since
+ * there is no attribute for an animated value.
+ */
+ protected void resetAttribute(SVGItem item) {
+ }
+
+ /**
+ * Initializes the list, if needed. Does nothing, since there is no
+ * attribute to read the list from.
+ */
+ protected void revalidate() {
+ valid = true;
}
}
}
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java Tue Jun 27 02:08:44 2006
@@ -27,90 +27,218 @@
/**
* This class implements the {@link SVGAnimatedPreserveAspectRatio} interface.
*
- * @author Tonny Kohar
+ * @author <a href="mailto:tonny@kiyut.com">Tonny Kohar</a>
* @version $Id$
*/
-public class SVGOMAnimatedPreserveAspectRatio
- implements SVGAnimatedPreserveAspectRatio, LiveAttributeValue {
+public class SVGOMAnimatedPreserveAspectRatio
+ extends AbstractSVGAnimatedValue
+ implements SVGAnimatedPreserveAspectRatio {
+
/**
- * The associated element.
+ * The base value.
*/
- protected AbstractElement element;
-
+ protected BaseSVGPARValue baseVal;
+
+ /**
+ * The animated value.
+ */
+ protected AnimSVGPARValue animVal;
+
/**
* Whether the value is changing.
*/
- protected boolean changing = false;
-
+ protected boolean changing;
+
+ /**
+ * Creates a new SVGOMAnimatedPreserveAspectRatio.
+ * @param elt The associated element.
+ */
+ public SVGOMAnimatedPreserveAspectRatio(AbstractElement elt) {
+ super(elt, null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getBaseVal()}.
+ */
+ public SVGPreserveAspectRatio getBaseVal() {
+ if (baseVal == null) {
+ baseVal = new BaseSVGPARValue();
+ }
+ return baseVal;
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getAnimVal()}.
+ */
+ public SVGPreserveAspectRatio getAnimVal() {
+ if (animVal == null) {
+ animVal = new AnimSVGPARValue();
+ }
+ return animVal;
+ }
+
/**
- * SVGPreserveAspectRatio mapping the static 'preserveAspectRatio'
- * attribute.
+ * Sets the animated value.
*/
- protected AbstractSVGPreserveAspectRatio preserveAspectRatio;
-
-
- /** Creates a new instance of SVGOMAnimatePreserveAspectRatio */
- public SVGOMAnimatedPreserveAspectRatio(AbstractElement elt) {
- element = elt;
- preserveAspectRatio = new SVGOMPreserveAspectRatio();
- String attrValue = elt.getAttributeNS
- (null,SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
- if (attrValue != null) {
- preserveAspectRatio.setValueAsString(attrValue);
+ public void setAnimatedValue(short align, short meetOrSlice) {
+ if (animVal == null) {
+ animVal = new AnimSVGPARValue();
}
+ hasAnimVal = true;
+ animVal.setAnimatedValue(align, meetOrSlice);
+ fireAnimatedAttributeListeners();
+ }
+
+ /**
+ * Resets the animated value.
+ */
+ public void resetAnimatedValue() {
+ hasAnimVal = false;
+ fireAnimatedAttributeListeners();
}
-
+
+ /**
+ * Called when an Attr node has been added.
+ */
public void attrAdded(Attr node, String newv) {
- if (!changing) {
- preserveAspectRatio.setValueAsString(newv);
- // System.out.println("attr added: " + newv);
+ if (!changing && baseVal != null) {
+ baseVal.invalidate();
+ }
+ // XXX Notify baseVal listeners (if we need them).
+ if (!hasAnimVal) {
+ fireAnimatedAttributeListeners();
}
}
-
+
+ /**
+ * Called when an Attr node has been modified.
+ */
public void attrModified(Attr node, String oldv, String newv) {
- if (!changing) {
- preserveAspectRatio.setValueAsString(newv);
+ if (!changing && baseVal != null) {
+ baseVal.invalidate();
+ }
+ // XXX Notify baseVal listeners (if we need them).
+ if (!hasAnimVal) {
+ fireAnimatedAttributeListeners();
}
}
-
+
+ /**
+ * Called when an Attr node has been removed.
+ */
public void attrRemoved(Attr node, String oldv) {
- if (!changing) {
- preserveAspectRatio.reset();
+ if (!changing && baseVal != null) {
+ baseVal.invalidate();
+ }
+ // XXX Notify baseVal listeners (if we need them).
+ if (!hasAnimVal) {
+ fireAnimatedAttributeListeners();
}
}
-
- public SVGPreserveAspectRatio getAnimVal() {
- throw new RuntimeException("!!! TODO: getAnimVal()");
-
- }
-
- public SVGPreserveAspectRatio getBaseVal() {
- return preserveAspectRatio;
- }
-
- /** The implementation of SVGPreserveAspectRatio
+
+ /**
+ * This class represents the SVGPreserveAspectRatio returned by {@link
+ * #getBaseVal()}.
*/
- public class SVGOMPreserveAspectRatio
- extends AbstractSVGPreserveAspectRatio {
+ public class BaseSVGPARValue extends AbstractSVGPreserveAspectRatio {
/**
* Create a DOMException.
*/
- protected DOMException createDOMException(short type,
- String key,
- Object[] args){
- return element.createDOMException(type,key,args);
+ protected DOMException createDOMException(short type, String key,
+ Object[] args) {
+ return element.createDOMException(type, key, args);
}
-
+
+ /**
+ * Sets the associated DOM attribute.
+ */
protected void setAttributeValue(String value) throws DOMException {
try {
changing = true;
element.setAttributeNS
- (null,SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE,
+ (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE,
value);
} finally {
changing = false;
}
+ }
+
+ /**
+ * Re-reads the DOM attribute value.
+ */
+ protected void invalidate() {
+ String s = element.getAttributeNS
+ (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
+ setValueAsString(s);
+ }
+ }
+
+ /**
+ * This class represents the SVGPreserveAspectRatio returned by {@link
+ * #getAnimVal()}.
+ */
+ public class AnimSVGPARValue extends AbstractSVGPreserveAspectRatio {
+
+ /**
+ * Create a DOMException.
+ */
+ protected DOMException createDOMException(short type, String key,
+ Object[] args) {
+ return element.createDOMException(type, key, args);
+ }
+
+ /**
+ * Sets the associated DOM attribute. Does nothing, since animated
+ * values aren't reflected in the DOM.
+ */
+ protected void setAttributeValue(String value) throws DOMException {
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPreservAspectRatio#getAlign()}.
+ */
+ public short getAlign() {
+ if (hasAnimVal) {
+ return super.getAlign();
+ }
+ return getBaseVal().getAlign();
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPreservAspectRatio#getMeetOrSlice()}.
+ */
+ public short getMeetOrSlice() {
+ if (hasAnimVal) {
+ return super.getMeetOrSlice();
+ }
+ return getBaseVal().getMeetOrSlice();
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPreservAspectRatio#setAlign(short)}.
+ */
+ public void setAlign(short align) {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.preserve.aspect.ratio", null);
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPreservAspectRatio#setMeetOrSlice(short)}.
+ */
+ public void setMeetOrSlice(short meetOrSlice) {
+ throw element.createDOMException
+ (DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ "readonly.preserve.aspect.ratio", null);
+ }
+
+ /**
+ * Updates the animated value.
+ */
+ protected void setAnimatedValue(short align, short meetOrSlice) {
+ this.align = align;
+ this.meetOrSlice = meetOrSlice;
}
}
}
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCircleElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCircleElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCircleElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCircleElement.java Tue Jun 27 02:08:44 2006
@@ -138,7 +138,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_CX_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCursorElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCursorElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCursorElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMCursorElement.java Tue Jun 27 02:08:44 2006
@@ -194,7 +194,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMElement.java Tue Jun 27 02:08:44 2006
@@ -43,7 +43,6 @@
import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.SVGTypes;
-
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
@@ -55,6 +54,7 @@
import org.w3c.dom.svg.SVGAnimatedLengthList;
import org.w3c.dom.svg.SVGAnimatedNumber;
import org.w3c.dom.svg.SVGAnimatedNumberList;
+import org.w3c.dom.svg.SVGAnimatedPoints;
import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio;
import org.w3c.dom.svg.SVGAnimatedRect;
import org.w3c.dom.svg.SVGAnimatedString;
@@ -524,7 +524,7 @@
if (ln.equals(SVG_ID_ATTRIBUTE)) {
return SVGTypes.TYPE_CDATA;
}
- } else if (ns == XML_NAMESPACE_URI) {
+ } else if (ns.equals(XML_NAMESPACE_URI)) {
if (ln.equals(XML_BASE_ATTRIBUTE)) {
return SVGTypes.TYPE_URI;
} else if (ln.equals(XML_SPACE_ATTRIBUTE)
@@ -533,7 +533,7 @@
} else if (ln.equals(XML_LANG_ATTRIBUTE)) {
return SVGTypes.TYPE_LANG;
}
- } else if (ns == XLINK_NAMESPACE_URI) {
+ } else if (ns.equals(XLINK_NAMESPACE_URI)) {
if (ln.equals(XLINK_HREF_ATTRIBUTE)) {
return SVGTypes.TYPE_URI;
}
@@ -646,7 +646,7 @@
*/
protected void updateLengthAttributeValue(SVGAnimatedLength a,
AnimatableValue val) {
- SVGOMAnimatedLength al = (SVGOMAnimatedLength) a;
+ AbstractSVGAnimatedLength al = (AbstractSVGAnimatedLength) a;
if (val == null) {
al.resetAnimatedValue();
} else {
@@ -662,15 +662,15 @@
*/
protected void updateLengthListAttributeValue(SVGAnimatedLengthList a,
AnimatableValue val) {
- // XXX Rewrite SVGOMAnimatedLengthList.
-// SVGOMAnimatedLengthList all = (SVGOMAnimatedLengthList) a;
-// if (val == null) {
-// all.resetAnimatedValue();
-// } else {
-// AnimatableLengthListValue animLengthList =
-// (AnimatableLengthListValue) val;
-// all.setAnimatedValue(animLengthList.getLengthList());
-// }
+ SVGOMAnimatedLengthList all = (SVGOMAnimatedLengthList) a;
+ if (val == null) {
+ all.resetAnimatedValue();
+ } else {
+ AnimatableLengthListValue animLengthList =
+ (AnimatableLengthListValue) val;
+ all.setAnimatedValue(animLengthList.getLengthTypes(),
+ animLengthList.getLengthValues());
+ }
}
/**
@@ -696,17 +696,16 @@
*/
protected void updatePreserveAspectRatioAttributeValue
(SVGAnimatedPreserveAspectRatio a, AnimatableValue val) {
- // XXX Rewrite SVGOMAnimatedPreserveAspectRatio.
-// SVGOMAnimatedPreserveAspectRatio par =
-// (SVGOMAnimatedPreserveAspectRatio) a;
-// if (val == null) {
-// par.resetAnimatedValue();
-// } else {
-// AnimatablePreserveAspectRatioValue animPreserveAspectRatio =
-// (AnimatablePreserveAspectRatioValue) val;
-// par.setAnimatedValue(animPreserveAspectRatio.getAlign(),
-// animPreserveAspectRatio.getMeetOrSlice());
-// }
+ SVGOMAnimatedPreserveAspectRatio par =
+ (SVGOMAnimatedPreserveAspectRatio) a;
+ if (val == null) {
+ par.resetAnimatedValue();
+ } else {
+ AnimatablePreserveAspectRatioValue animPreserveAspectRatio =
+ (AnimatablePreserveAspectRatioValue) val;
+ par.setAnimatedValue(animPreserveAspectRatio.getAlign(),
+ animPreserveAspectRatio.getMeetOrSlice());
+ }
}
/**
@@ -715,15 +714,30 @@
*/
protected void updateNumberListAttributeValue(SVGAnimatedNumberList a,
AnimatableValue val) {
- // XXX Rewrite SVGOMAnimatedNumberList.
-// SVGOMAnimatedNumberList anl = (SVGOMAnimatedNumberList) a;
-// if (val == null) {
-// anl.resetAnimatedValue();
-// } else {
-// AnimatableNumberListValue animNumberList =
-// (AnimatableNumberListValue) val;
-// anl.setAnimatedValue(animNumberList.getNumberList());
-// }
+ SVGOMAnimatedNumberList anl = (SVGOMAnimatedNumberList) a;
+ if (val == null) {
+ anl.resetAnimatedValue();
+ } else {
+ AnimatableNumberListValue animNumberList =
+ (AnimatableNumberListValue) val;
+ anl.setAnimatedValue(animNumberList.getNumbers());
+ }
+ }
+
+ /**
+ * Updates an {@link SVGOMAnimatedPoints} with the given
+ * {@link AnimatableValue}.
+ */
+ protected void updatePointsAttributeValue(SVGAnimatedPoints a,
+ AnimatableValue val) {
+ SVGOMAnimatedPoints ap = (SVGOMAnimatedPoints) a;
+ if (val == null) {
+ ap.resetAnimatedValue();
+ } else {
+ AnimatablePointListValue animPointList =
+ (AnimatablePointListValue) val;
+ ap.setAnimatedValue(animPointList.getNumbers());
+ }
}
/**
@@ -746,8 +760,8 @@
* Gets how percentage values are interpreted by the given attribute
* or property.
*/
- public int getPercentageInterpretation(String ns, String an,
- boolean isCSS) {
+ public short getPercentageInterpretation(String ns, String an,
+ boolean isCSS) {
if (isCSS || ns == null) {
if (an.equals(CSSConstants.CSS_BASELINE_SHIFT_PROPERTY)
|| an.equals(CSSConstants.CSS_FONT_SIZE_PROPERTY)) {
@@ -764,7 +778,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
return AnimationTarget.PERCENTAGE_VIEWPORT_SIZE;
}
@@ -786,7 +800,7 @@
* {@link SVGContext}.PERCENTAGE_* constants)
* @return the SVG value in user units
*/
- public float svgToUserSpace(float v, int type, int pcInterp) {
+ public float svgToUserSpace(float v, short type, short pcInterp) {
return svgContext.svgToUserSpace(v, type, pcInterp);
}
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMEllipseElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMEllipseElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMEllipseElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMEllipseElement.java Tue Jun 27 02:08:44 2006
@@ -138,7 +138,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_CX_ATTRIBUTE) || ln.equals(SVG_RX_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFEOffsetElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFEOffsetElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFEOffsetElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFEOffsetElement.java Tue Jun 27 02:08:44 2006
@@ -95,7 +95,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_DX_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterElement.java Tue Jun 27 02:08:44 2006
@@ -277,7 +277,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMFilterPrimitiveStandardAttributes.java Tue Jun 27 02:08:44 2006
@@ -139,7 +139,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java Tue Jun 27 02:08:44 2006
@@ -141,7 +141,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMImageElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMImageElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMImageElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMImageElement.java Tue Jun 27 02:08:44 2006
@@ -179,7 +179,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLineElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLineElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLineElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLineElement.java Tue Jun 27 02:08:44 2006
@@ -138,7 +138,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X1_ATTRIBUTE) || ln.equals(SVG_X2_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMLinearGradientElement.java Tue Jun 27 02:08:44 2006
@@ -138,7 +138,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X1_ATTRIBUTE) || ln.equals(SVG_X2_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMarkerElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMarkerElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMarkerElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMarkerElement.java Tue Jun 27 02:08:44 2006
@@ -286,7 +286,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_REF_X_ATTRIBUTE)
|| ln.equals(SVG_MARKER_WIDTH_ATTRIBUTE)) {
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMaskElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMaskElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMaskElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMMaskElement.java Tue Jun 27 02:08:44 2006
@@ -172,7 +172,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE)
|| ln.equals(SVG_WIDTH_ATTRIBUTE)) {
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPatternElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPatternElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPatternElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPatternElement.java Tue Jun 27 02:08:44 2006
@@ -331,7 +331,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE)
|| ln.equals(SVG_WIDTH_ATTRIBUTE)) {
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPoint.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPoint.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPoint.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPoint.java Tue Jun 27 02:08:44 2006
@@ -22,28 +22,82 @@
import org.w3c.dom.svg.SVGPoint;
/**
- * This class provides an abstract implementation of the {@link SVGMatrix}
- * interface.
+ * An implementation of {@link SVGPoint} that is not associated with any
+ * attribute.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
* @version $Id$
*/
public class SVGOMPoint implements SVGPoint {
- float x, y;
- public SVGOMPoint() { x=0; y=0; }
+
+ /**
+ * The x coordinate.
+ */
+ protected float x;
+
+ /**
+ * The y coordinate.
+ */
+ protected float y;
+
+ /**
+ * Creates a new SVGOMPoint with coordinates set to <code>0</code>.
+ */
+ public SVGOMPoint() {
+ }
+
+ /**
+ * Creates a new SVGOMPoint with coordinates set to the specified values.
+ */
public SVGOMPoint(float x, float y) {
this.x = x;
this.y = y;
}
- public float getX( ) { return x; }
- public void setX( float x ) throws DOMException { this.x = x; }
- public float getY( ) { return y; }
- public void setY( float y ) throws DOMException { this.y = y; }
-
- public SVGPoint matrixTransform ( SVGMatrix matrix ) {
- float newX = matrix.getA()*getX() + matrix.getC()*getY() + matrix.getE();
- float newY = matrix.getB()*getX() + matrix.getD()*getY() + matrix.getF();
+ /**
+ * <b>DOM</b>: Implements {@link SVGPoint#getX()}.
+ */
+ public float getX() {
+ return x;
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPoint#setX(float)}.
+ */
+ public void setX(float x) throws DOMException {
+ this.x = x;
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPoint#getY()}.
+ */
+ public float getY() {
+ return y;
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPoint#setY(float)}.
+ */
+ public void setY(float y) throws DOMException {
+ this.y = y;
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link SVGPoint#matrixTransform(SVGMatrix)}.
+ */
+ public SVGPoint matrixTransform(SVGMatrix matrix) {
+ return matrixTransform(this, matrix);
+ }
+
+ /**
+ * Transforms an {@link SVGPoint} by an {@link SVGMatrix} and returns
+ * the new point.
+ */
+ public static SVGPoint matrixTransform(SVGPoint point, SVGMatrix matrix) {
+ float newX = matrix.getA() * point.getX() + matrix.getC() * point.getY()
+ + matrix.getE();
+ float newY = matrix.getB() * point.getX() + matrix.getD() * point.getY()
+ + matrix.getF();
return new SVGOMPoint(newX, newY);
}
}
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolygonElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolygonElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolygonElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolygonElement.java Tue Jun 27 02:08:44 2006
@@ -100,7 +100,7 @@
public int getAttributeType(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_POINTS_ATTRIBUTE)) {
- return SVGTypes.TYPE_NUMBER_LIST;
+ return SVGTypes.TYPE_POINTS_VALUE;
}
}
return super.getAttributeType(ns, ln);
@@ -115,7 +115,10 @@
AnimatableValue val) {
if (ns == null) {
if (ln.equals(SVG_POINTS_ATTRIBUTE)) {
- // XXX Handle points.
+ SVGOMAnimatedPoints p =
+ SVGAnimatedPointsSupport.getSVGOMAnimatedPoints(this);
+ updatePointsAttributeValue(p, val);
+ return;
}
}
super.updateAttributeValue(ns, ln, val);
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolylineElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolylineElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolylineElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMPolylineElement.java Tue Jun 27 02:08:44 2006
@@ -100,7 +100,7 @@
public int getAttributeType(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_POINTS_ATTRIBUTE)) {
- return SVGTypes.TYPE_NUMBER_LIST;
+ return SVGTypes.TYPE_POINTS_VALUE;
}
}
return super.getAttributeType(ns, ln);
@@ -115,7 +115,10 @@
AnimatableValue val) {
if (ns == null) {
if (ln.equals(SVG_POINTS_ATTRIBUTE)) {
- // XXX Handle points.
+ SVGOMAnimatedPoints p =
+ SVGAnimatedPointsSupport.getSVGOMAnimatedPoints(this);
+ updatePointsAttributeValue(p, val);
+ return;
}
}
super.updateAttributeValue(ns, ln, val);
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRadialGradientElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRadialGradientElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRadialGradientElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRadialGradientElement.java Tue Jun 27 02:08:44 2006
@@ -185,7 +185,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_CX_ATTRIBUTE) || ln.equals(SVG_FX_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRectElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRectElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRectElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMRectElement.java Tue Jun 27 02:08:44 2006
@@ -191,7 +191,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_RX_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java Tue Jun 27 02:08:44 2006
@@ -762,7 +762,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_WIDTH_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java Tue Jun 27 02:08:44 2006
@@ -70,10 +70,11 @@
* org.w3c.dom.svg.SVGTextContentElement#getTextLength()}.
*/
public SVGAnimatedLength getTextLength() {
- SVGAnimatedLength result =
- (SVGAnimatedLength)getLiveAttributeValue
+ AbstractSVGAnimatedLength result =
+ (AbstractSVGAnimatedLength)getLiveAttributeValue
(null, SVG_TEXT_LENGTH_ATTRIBUTE);
if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) ownerDocument;
result = new AbstractSVGAnimatedLength
(this, null, SVG_TEXT_LENGTH_ATTRIBUTE,
SVGOMAnimatedLength.HORIZONTAL_LENGTH, true) {
@@ -106,6 +107,8 @@
}
}
};
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
putLiveAttributeValue(null, SVG_TEXT_LENGTH_ATTRIBUTE,
(LiveAttributeValue)result);
}
@@ -128,7 +131,6 @@
*/
public int getNumberOfChars() {
return SVGTextContentSupport.getNumberOfChars(this);
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getNumberOfChars()");
}
/**
@@ -137,7 +139,6 @@
*/
public float getComputedTextLength() {
return SVGTextContentSupport.getComputedTextLength(this);
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getComputedTextLength()");
}
/**
@@ -146,8 +147,7 @@
*/
public float getSubStringLength(int charnum, int nchars)
throws DOMException {
- return SVGTextContentSupport.getSubStringLength(this,charnum,nchars);
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getSubStringLength()");
+ return SVGTextContentSupport.getSubStringLength(this, charnum, nchars);
}
/**
@@ -155,8 +155,7 @@
* org.w3c.dom.svg.SVGTextContentElement#getStartPositionOfChar(int)}.
*/
public SVGPoint getStartPositionOfChar(int charnum) throws DOMException {
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getStartPositionOfChar()");
- return SVGTextContentSupport.getStartPositionOfChar(this,charnum);
+ return SVGTextContentSupport.getStartPositionOfChar(this, charnum);
}
/**
@@ -164,8 +163,7 @@
* org.w3c.dom.svg.SVGTextContentElement#getEndPositionOfChar(int)}.
*/
public SVGPoint getEndPositionOfChar(int charnum) throws DOMException {
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getEndPositionOfChar()");
- return SVGTextContentSupport.getEndPositionOfChar(this,charnum);
+ return SVGTextContentSupport.getEndPositionOfChar(this, charnum);
}
/**
@@ -173,8 +171,7 @@
* org.w3c.dom.svg.SVGTextContentElement#getExtentOfChar(int)}.
*/
public SVGRect getExtentOfChar(int charnum) throws DOMException {
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getExtentOfChar()");
- return SVGTextContentSupport.getExtentOfChar(this,charnum);
+ return SVGTextContentSupport.getExtentOfChar(this, charnum);
}
/**
@@ -182,8 +179,7 @@
* org.w3c.dom.svg.SVGTextContentElement#getRotationOfChar(int)}.
*/
public float getRotationOfChar(int charnum) throws DOMException {
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getRotationOfChar()");
- return SVGTextContentSupport.getRotationOfChar(this,charnum);
+ return SVGTextContentSupport.getRotationOfChar(this, charnum);
}
/**
@@ -191,8 +187,8 @@
* org.w3c.dom.svg.SVGTextContentElement#getCharNumAtPosition(SVGPoint)}.
*/
public int getCharNumAtPosition(SVGPoint point) {
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getCharNumAtPosition()");
- return SVGTextContentSupport.getCharNumAtPosition(this,point.getX(),point.getY());
+ return SVGTextContentSupport.getCharNumAtPosition
+ (this, point.getX(), point.getY());
}
/**
@@ -201,8 +197,7 @@
*/
public void selectSubString(int charnum, int nchars)
throws DOMException {
- SVGTextContentSupport.selectSubString(this,charnum, nchars);
- //throw new RuntimeException(" !!! SVGOMTextContentElement.getSubStringLength()");
+ SVGTextContentSupport.selectSubString(this, charnum, nchars);
}
// SVGExternalResourcesRequired support /////////////////////////////
@@ -212,7 +207,7 @@
* org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
*/
public SVGAnimatedBoolean getExternalResourcesRequired() {
- return SVGExternalResourcesRequiredSupport.
+ return SVGExternalResourcesRequiredSupport.
getExternalResourcesRequired(this);
}
@@ -253,7 +248,7 @@
* org.w3c.dom.svg.SVGTests#getRequiredFeatures()}.
*/
public SVGStringList getRequiredFeatures() {
- return SVGTestsSupport.getRequiredFeatures(this);
+ return SVGTestsSupport.getRequiredFeatures(this);
}
/**
@@ -261,7 +256,7 @@
* org.w3c.dom.svg.SVGTests#getRequiredExtensions()}.
*/
public SVGStringList getRequiredExtensions() {
- return SVGTestsSupport.getRequiredExtensions(this);
+ return SVGTestsSupport.getRequiredExtensions(this);
}
/**
@@ -269,7 +264,7 @@
* org.w3c.dom.svg.SVGTests#getSystemLanguage()}.
*/
public SVGStringList getSystemLanguage() {
- return SVGTestsSupport.getSystemLanguage(this);
+ return SVGTestsSupport.getSystemLanguage(this);
}
/**
@@ -277,7 +272,7 @@
* org.w3c.dom.svg.SVGTests#hasExtension(String)}.
*/
public boolean hasExtension(String extension) {
- return SVGTestsSupport.hasExtension(this, extension);
+ return SVGTestsSupport.hasExtension(this, extension);
}
// ExtendedTraitAccess ///////////////////////////////////////////////////
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextElement.java Tue Jun 27 02:08:44 2006
@@ -140,10 +140,13 @@
SVGOMAnimatedLengthList result = (SVGOMAnimatedLengthList)
getLiveAttributeValue(null, SVGConstants.SVG_X_ATTRIBUTE);
if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) ownerDocument;
result = new SVGOMAnimatedLengthList(this, null,
SVGConstants.SVG_X_ATTRIBUTE,
X_DEFAULT_VALUE,
AbstractSVGLength.HORIZONTAL_LENGTH);
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
putLiveAttributeValue(null,
SVGConstants.SVG_X_ATTRIBUTE, result);
}
@@ -158,10 +161,13 @@
SVGOMAnimatedLengthList result = (SVGOMAnimatedLengthList)
getLiveAttributeValue(null, SVGConstants.SVG_Y_ATTRIBUTE);
if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) ownerDocument;
result = new SVGOMAnimatedLengthList(this, null,
SVGConstants.SVG_Y_ATTRIBUTE,
Y_DEFAULT_VALUE,
AbstractSVGLength.VERTICAL_LENGTH);
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
putLiveAttributeValue(null,
SVGConstants.SVG_Y_ATTRIBUTE, result);
}
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextPositioningElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextPositioningElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextPositioningElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMTextPositioningElement.java Tue Jun 27 02:08:44 2006
@@ -56,7 +56,6 @@
* <b>DOM</b>: Implements {@link SVGTextPositioningElement#getX()}.
*/
public SVGAnimatedLengthList getX() {
- //throw new RuntimeException(" !!! SVGOMTextPositioningElement.getX()");
return SVGTextPositioningElementSupport.getX(this);
}
@@ -64,7 +63,6 @@
* <b>DOM</b>: Implements {@link SVGTextPositioningElement#getY()}.
*/
public SVGAnimatedLengthList getY() {
- //throw new RuntimeException(" !!! SVGOMTextPositioningElement.getY()");
return SVGTextPositioningElementSupport.getY(this);
}
@@ -72,7 +70,6 @@
* <b>DOM</b>: Implements {@link SVGTextPositioningElement#getDx()}.
*/
public SVGAnimatedLengthList getDx() {
- //throw new RuntimeException(" !!! SVGOMTextPositioningElement.getDx()");
return SVGTextPositioningElementSupport.getDx(this);
}
@@ -80,7 +77,6 @@
* <b>DOM</b>: Implements {@link SVGTextPositioningElement#getDy()}.
*/
public SVGAnimatedLengthList getDy() {
- //throw new RuntimeException(" !!! SVGOMTextPositioningElement.getDy()");
return SVGTextPositioningElementSupport.getDy(this);
}
@@ -88,7 +84,7 @@
* <b>DOM</b>: Implements {@link SVGTextPositioningElement#getRotate()}.
*/
public SVGAnimatedNumberList getRotate() {
- throw new RuntimeException(" !!! SVGOMTextPositioningElement.getRotate()");
+ return SVGTextPositioningElementSupport.getRotate(this);
}
// ExtendedTraitAccess ///////////////////////////////////////////////////
@@ -131,7 +127,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_DX_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMUseElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMUseElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMUseElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGOMUseElement.java Tue Jun 27 02:08:44 2006
@@ -222,7 +222,7 @@
/**
* Gets how percentage values are interpreted by the given attribute.
*/
- protected int getAttributePercentageInterpretation(String ns, String ln) {
+ protected short getAttributePercentageInterpretation(String ns, String ln) {
if (ns == null) {
if (ln.equals(SVG_X_ATTRIBUTE)) {
return AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGPreserveAspectRatioSupport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGPreserveAspectRatioSupport.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGPreserveAspectRatioSupport.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGPreserveAspectRatioSupport.java Tue Jun 27 02:08:44 2006
@@ -23,9 +23,11 @@
/**
* Support for the 'preserveAspectRatio' interface on the SVG element.
- * @author Tonny Kohar
+ * @author <a href="mailto:tonny@kiyut.com">Tonny Kohar</a>
+ * @version $Id$
*/
public class SVGPreserveAspectRatioSupport {
+
/**
* To implement getPreserveAspectRatio.
* Returns the value of the 'preserveAspectRatio' attribute of the
@@ -38,7 +40,10 @@
(null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
if (ret == null) {
+ SVGOMDocument doc = (SVGOMDocument) elt.getOwnerDocument();
ret = new SVGOMAnimatedPreserveAspectRatio(elt);
+ ret.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
elt.putLiveAttributeValue
(null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, ret);
}
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGTextPositioningElementSupport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGTextPositioningElementSupport.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGTextPositioningElementSupport.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGTextPositioningElementSupport.java Tue Jun 27 02:08:44 2006
@@ -19,6 +19,7 @@
import org.apache.batik.util.SVGConstants;
import org.w3c.dom.svg.SVGAnimatedLengthList;
+import org.w3c.dom.svg.SVGAnimatedNumberList;
/**
* This class provide support for the SVGTextPositionningElement
@@ -37,6 +38,8 @@
= "";
public final static String DY_DEFAULT_VALUE
= "";
+ public final static String ROTATE_DEFAULT_VALUE
+ = "";
/**
* <b>DOM</b>: Implements {@link
@@ -47,10 +50,13 @@
SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
e.getLiveAttributeValue(null, SVGConstants.SVG_X_ATTRIBUTE);
if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) e.getOwnerDocument();
result = new SVGOMAnimatedLengthList(e, null,
SVGConstants.SVG_X_ATTRIBUTE,
X_DEFAULT_VALUE,
AbstractSVGLength.HORIZONTAL_LENGTH);
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
e.putLiveAttributeValue(null,
SVGConstants.SVG_X_ATTRIBUTE, result);
}
@@ -66,10 +72,13 @@
SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
e.getLiveAttributeValue(null, SVGConstants.SVG_Y_ATTRIBUTE);
if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) e.getOwnerDocument();
result = new SVGOMAnimatedLengthList(e, null,
SVGConstants.SVG_Y_ATTRIBUTE,
Y_DEFAULT_VALUE,
AbstractSVGLength.VERTICAL_LENGTH);
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
e.putLiveAttributeValue(null,
SVGConstants.SVG_Y_ATTRIBUTE, result);
}
@@ -85,10 +94,13 @@
SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
e.getLiveAttributeValue(null, SVGConstants.SVG_DX_ATTRIBUTE);
if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) e.getOwnerDocument();
result = new SVGOMAnimatedLengthList(e, null,
SVGConstants.SVG_DX_ATTRIBUTE,
DX_DEFAULT_VALUE,
AbstractSVGLength.HORIZONTAL_LENGTH);
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
e.putLiveAttributeValue(null,
SVGConstants.SVG_DX_ATTRIBUTE, result);
}
@@ -104,12 +116,36 @@
SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
e.getLiveAttributeValue(null, SVGConstants.SVG_DY_ATTRIBUTE);
if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) e.getOwnerDocument();
result = new SVGOMAnimatedLengthList(e, null,
SVGConstants.SVG_DY_ATTRIBUTE,
DY_DEFAULT_VALUE,
AbstractSVGLength.VERTICAL_LENGTH);
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
e.putLiveAttributeValue(null,
SVGConstants.SVG_DY_ATTRIBUTE, result);
+ }
+ return result;
+ }
+
+ /**
+ * <b>DOM</b>: Implements {@link
+ * org.w3c.dom.svg.SVGTextPositioningElement#getRotate()}.
+ */
+ public static SVGAnimatedNumberList getRotate(AbstractElement e){
+
+ SVGOMAnimatedNumberList result =(SVGOMAnimatedNumberList)
+ e.getLiveAttributeValue(null, SVGConstants.SVG_ROTATE_ATTRIBUTE);
+ if (result == null) {
+ SVGOMDocument doc = (SVGOMDocument) e.getOwnerDocument();
+ result = new SVGOMAnimatedNumberList(e, null,
+ SVGConstants.SVG_ROTATE_ATTRIBUTE,
+ ROTATE_DEFAULT_VALUE);
+ result.addAnimatedAttributeListener
+ (doc.getAnimatedAttributeListener());
+ e.putLiveAttributeValue(null,
+ SVGConstants.SVG_ROTATE_ATTRIBUTE, result);
}
return result;
}
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGURIReferenceGraphicsElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGURIReferenceGraphicsElement.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGURIReferenceGraphicsElement.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/svg/SVGURIReferenceGraphicsElement.java Tue Jun 27 02:08:44 2006
@@ -60,7 +60,7 @@
* Returns whether the given XML attribute is animatable.
*/
public boolean isAttributeAnimatable(String ns, String ln) {
- return ns == XLINK_NAMESPACE_URI && ln == XLINK_HREF_ATTRIBUTE
+ return XLINK_NAMESPACE_URI.equals(ns) && XLINK_HREF_ATTRIBUTE.equals(ln)
|| super.isAttributeAnimatable(ns, ln);
}
@@ -71,7 +71,7 @@
*/
public void updateAttributeValue(String ns, String ln,
AnimatableValue val) {
- if (ns == XLINK_NAMESPACE_URI
+ if (XLINK_NAMESPACE_URI.equals(ns)
&& ln.equals(XLINK_HREF_ATTRIBUTE)) {
SVGOMAnimatedString href = (SVGOMAnimatedString) getHref();
updateStringAttributeValue(href, val);
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/util/HashTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/util/HashTable.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/util/HashTable.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/dom/util/HashTable.java Tue Jun 27 02:08:44 2006
@@ -25,7 +25,6 @@
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
* @version $Id$
*/
-
public class HashTable implements Serializable {
/**
Added: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/FloatArrayProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/FloatArrayProducer.java?rev=417379&view=auto
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/FloatArrayProducer.java (added)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/FloatArrayProducer.java Tue Jun 27 02:08:44 2006
@@ -0,0 +1,112 @@
+package org.apache.batik.parser;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * A handler class that generates an array of floats from parsing a
+ * number list or a point list.
+ */
+public class FloatArrayProducer
+ extends DefaultNumberListHandler
+ implements PointsHandler {
+
+ /**
+ * List of <code>float[]</code> objects.
+ */
+ protected LinkedList as;
+
+ /**
+ * The current <code>float[]</code> object.
+ */
+ protected float[] a;
+
+ /**
+ * The index in which to store the next number.
+ */
+ protected int index;
+
+ /**
+ * The total number of floats accumulated.
+ */
+ protected int count;
+
+ /**
+ * Returns the array of floats accumulated.
+ */
+ public float[] getFloatArray() {
+ return a;
+ }
+
+ // NumberListHandler /////////////////////////////////////////////////////
+
+ /**
+ * Invoked when the number list attribute starts.
+ * @exception ParseException if an error occures while processing the
+ * number list.
+ */
+ public void startNumberList() throws ParseException {
+ as = new LinkedList();
+ a = new float[11];
+ count = 0;
+ index = 0;
+ }
+
+ /**
+ * Invoked when a float value has been parsed.
+ * @exception ParseException if an error occures while processing
+ * the number
+ */
+ public void numberValue(float v) throws ParseException {
+ if (index == a.length) {
+ as.add(a);
+ a = new float[a.length * 2 + 1];
+ index = 0;
+ }
+ a[index++] = v;
+ count++;
+ }
+
+ /**
+ * Invoked when the number list attribute ends.
+ * @exception ParseException if an error occures while processing the
+ * number list.
+ */
+ public void endNumberList() throws ParseException {
+ float[] all = new float[count];
+ int pos = 0;
+ Iterator it = as.iterator();
+ while (it.hasNext()) {
+ float[] b = (float[]) it.next();
+ System.arraycopy(b, 0, all, pos, b.length);
+ pos += b.length;
+ }
+ System.arraycopy(a, 0, all, pos, index);
+ as.clear();
+ a = all;
+ }
+
+ // PointsHandler /////////////////////////////////////////////////////////
+
+ /**
+ * Implements {@link PointsHandler#startPoints()}.
+ */
+ public void startPoints() throws ParseException {
+ startNumberList();
+ }
+
+ /**
+ * Implements {@link PointsHandler#point(float,float)}.
+ */
+ public void point(float x, float y) throws ParseException {
+ numberValue(x);
+ numberValue(y);
+ }
+
+ /**
+ * Implements {@link PointsHandler#endPoints()}.
+ */
+ public void endPoints() throws ParseException {
+ endNumberList();
+ }
+}
Propchange: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/FloatArrayProducer.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/LengthArrayProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/LengthArrayProducer.java?rev=417379&view=auto
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/LengthArrayProducer.java (added)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/LengthArrayProducer.java Tue Jun 27 02:08:44 2006
@@ -0,0 +1,209 @@
+package org.apache.batik.parser;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.w3c.dom.svg.SVGLength;
+
+/**
+ * A handler class that generates an array of shorts and an array floats from
+ * parsing a length list.
+ */
+public class LengthArrayProducer extends DefaultLengthListHandler {
+
+ /**
+ * List of <code>float[]</code> objects.
+ */
+ protected LinkedList vs;
+
+ /**
+ * The current <code>float[]</code> object.
+ */
+ protected float[] v;
+
+ /**
+ * List of <code>short[]</code> objects.
+ */
+ protected LinkedList us;
+
+ /**
+ * The current <code>short[]</code> object.
+ */
+ protected short[] u;
+
+ /**
+ * The index in which to store the next length.
+ */
+ protected int index;
+
+ /**
+ * The total number of lengths accumulated.
+ */
+ protected int count;
+
+ /**
+ * The unit for the current length.
+ */
+ protected short currentUnit;
+
+ /**
+ * Returns the array of length units accumulated.
+ */
+ public short[] getLengthTypeArray() {
+ return u;
+ }
+
+ /**
+ * Returns the array of length values accumulated.
+ */
+ public float[] getLengthValueArray() {
+ return v;
+ }
+
+ // LengthListHandler /////////////////////////////////////////////////////
+
+ /**
+ * Invoked when the length list attribute starts.
+ * @exception ParseException if an error occures while processing the
+ * number list.
+ */
+ public void startLengthList() throws ParseException {
+ us = new LinkedList();
+ u = new short[11];
+ vs = new LinkedList();
+ v = new float[11];
+ count = 0;
+ index = 0;
+ }
+
+ /**
+ * Invoked when a float value has been parsed.
+ * @exception ParseException if an error occures while processing
+ * the number
+ */
+ public void numberValue(float v) throws ParseException {
+ }
+
+ /**
+ * Implements {@link LengthHandler#lengthValue(float)}.
+ */
+ public void lengthValue(float val) throws ParseException {
+ if (index == v.length) {
+ vs.add(v);
+ v = new float[v.length * 2 + 1];
+ us.add(u);
+ u = new short[u.length * 2 + 1];
+ index = 0;
+ }
+ v[index] = val;
+ }
+
+ /**
+ * Implements {@link LengthHandler#startLength()}.
+ */
+ public void startLength() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_NUMBER;
+ }
+
+ /**
+ * Implements {@link LengthHandler#endLength()}.
+ */
+ public void endLength() throws ParseException {
+ u[index++] = currentUnit;
+ count++;
+ }
+
+ /**
+ * Implements {@link LengthHandler#em()}.
+ */
+ public void em() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_EMS;
+ }
+
+ /**
+ * Implements {@link LengthHandler#ex()}.
+ */
+ public void ex() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_EXS;
+ }
+
+ /**
+ * Implements {@link LengthHandler#in()}.
+ */
+ public void in() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_IN;
+ }
+
+ /**
+ * Implements {@link LengthHandler#cm()}.
+ */
+ public void cm() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_CM;
+ }
+
+ /**
+ * Implements {@link LengthHandler#mm()}.
+ */
+ public void mm() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_MM;
+ }
+
+ /**
+ * Implements {@link LengthHandler#pc()}.
+ */
+ public void pc() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_PC;
+ }
+
+ /**
+ * Implements {@link LengthHandler#pt()}.
+ */
+ public void pt() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_PT;
+ }
+
+ /**
+ * Implements {@link LengthHandler#px()}.
+ */
+ public void px() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_PX;
+ }
+
+ /**
+ * Implements {@link LengthHandler#percentage()}.
+ */
+ public void percentage() throws ParseException {
+ currentUnit = SVGLength.SVG_LENGTHTYPE_PERCENTAGE;
+ }
+
+ /**
+ * Invoked when the length list attribute ends.
+ * @exception ParseException if an error occures while processing the
+ * number list.
+ */
+ public void endLengthList() throws ParseException {
+ float[] allValues = new float[count];
+ int pos = 0;
+ Iterator it = vs.iterator();
+ while (it.hasNext()) {
+ float[] a = (float[]) it.next();
+ System.arraycopy(a, 0, allValues, pos, a.length);
+ pos += a.length;
+ }
+ System.arraycopy(v, 0, allValues, pos, index);
+ vs.clear();
+ v = allValues;
+
+ short[] allUnits = new short[count];
+ pos = 0;
+ it = us.iterator();
+ while (it.hasNext()) {
+ short[] a = (short[]) it.next();
+ System.arraycopy(a, 0, allUnits, pos, a.length);
+ pos += a.length;
+ }
+ System.arraycopy(u, 0, allUnits, pos, index);
+ us.clear();
+ u = allUnits;
+ }
+}
Propchange: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/LengthArrayProducer.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/PointsHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/PointsHandler.java?rev=417379&r1=417378&r2=417379&view=diff
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/PointsHandler.java (original)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/PointsHandler.java Tue Jun 27 02:08:44 2006
@@ -26,6 +26,7 @@
* @version $Id$
*/
public interface PointsHandler {
+
/**
* Invoked when the points attribute starts.
* @exception ParseException if an error occured while processing the