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 2007/04/11 06:32:10 UTC
svn commit: r527382 - in /xmlgraphics/batik/trunk/sources/org/apache/batik:
bridge/ dom/svg/ script/rhino/
Author: cam
Date: Tue Apr 10 21:31:58 2007
New Revision: 527382
URL: http://svn.apache.org/viewvc?view=rev&rev=527382
Log:
Changes to the way LiveAttributeValues are handled, to avoid
bugs with syncing to/from the corresponding XML attribute.
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGCircleElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGLineElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPathElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGRectElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGUseElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGLength.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMPathElement.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGPointShapeElement.java
xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/Messages.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java Tue Apr 10 21:31:58 2007
@@ -179,6 +179,7 @@
SVGOMAnimatedTransformList atl =
(SVGOMAnimatedTransformList) te.getTransform();
if (atl.isSpecified()) {
+ atl.check();
AbstractSVGTransformList tl =
(AbstractSVGTransformList) te.getTransform().getAnimVal();
at.concatenate(tl.getAffineTransform());
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGCircleElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGCircleElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGCircleElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGCircleElementBridge.java Tue Apr 10 21:31:58 2007
@@ -21,6 +21,7 @@
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
+import org.apache.batik.dom.svg.AbstractSVGAnimatedLength;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGOMCircleElement;
@@ -70,13 +71,19 @@
SVGOMCircleElement ce = (SVGOMCircleElement) e;
// 'cx' attribute - default is 0
- float cx = ce.getCx().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _cx =
+ (AbstractSVGAnimatedLength) ce.getCx();
+ float cx = _cx.getCheckedValue();
// 'cy' attribute - default is 0
- float cy = ce.getCy().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _cy =
+ (AbstractSVGAnimatedLength) ce.getCy();
+ float cy = _cy.getCheckedValue();
// 'r' attribute - required
- float r = ce.getR().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _r =
+ (AbstractSVGAnimatedLength) ce.getR();
+ float r = _r.getCheckedValue();
float x = cx - r;
float y = cy - r;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGEllipseElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGEllipseElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGEllipseElementBridge.java Tue Apr 10 21:31:58 2007
@@ -21,6 +21,7 @@
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
+import org.apache.batik.dom.svg.AbstractSVGAnimatedLength;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGOMEllipseElement;
@@ -70,16 +71,24 @@
SVGOMEllipseElement ee = (SVGOMEllipseElement) e;
// 'cx' attribute - default is 0
- float cx = ee.getCx().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _cx =
+ (AbstractSVGAnimatedLength) ee.getCx();
+ float cx = _cx.getCheckedValue();
// 'cy' attribute - default is 0
- float cy = ee.getCy().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _cy =
+ (AbstractSVGAnimatedLength) ee.getCy();
+ float cy = _cy.getCheckedValue();
// 'rx' attribute - required
- float rx = ee.getRx().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _rx =
+ (AbstractSVGAnimatedLength) ee.getRx();
+ float rx = _rx.getCheckedValue();
// 'ry' attribute - required
- float ry = ee.getRy().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _ry =
+ (AbstractSVGAnimatedLength) ee.getRy();
+ float ry = _ry.getCheckedValue();
shapeNode.setShape(new Ellipse2D.Float(cx - rx, cy - ry,
rx * 2, ry * 2));
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java Tue Apr 10 21:31:58 2007
@@ -36,8 +36,10 @@
import org.apache.batik.dom.AbstractNode;
import org.apache.batik.dom.events.DOMMouseEvent;
import org.apache.batik.dom.events.NodeEventTarget;
+import org.apache.batik.dom.svg.AbstractSVGAnimatedLength;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
+import org.apache.batik.dom.svg.SVGOMAnimatedPreserveAspectRatio;
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.dom.svg.SVGOMElement;
import org.apache.batik.ext.awt.color.ICCColorSpaceExt;
@@ -62,7 +64,6 @@
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
-import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio;
import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.svg.SVGImageElement;
import org.w3c.dom.svg.SVGSVGElement;
@@ -437,12 +438,13 @@
|| ln.equals(SVG_HEIGHT_ATTRIBUTE)) {
SVGImageElement ie = (SVGImageElement) e;
ImageNode imageNode = (ImageNode) node;
- float val;
+ AbstractSVGAnimatedLength _attr;
if (ln.charAt(0) == 'w') {
- val = ie.getWidth().getAnimVal().getValue();
+ _attr = (AbstractSVGAnimatedLength) ie.getWidth();
} else {
- val = ie.getHeight().getAnimVal().getValue();
+ _attr = (AbstractSVGAnimatedLength) ie.getHeight();
}
+ float val = _attr.getCheckedValue();
if (val == 0 || imageNode.getImage() instanceof ShapeNode) {
rebuildImageNode();
} else {
@@ -871,10 +873,12 @@
try {
SVGImageElement ie = (SVGImageElement) e;
- SVGAnimatedPreserveAspectRatio aPAR = ie.getPreserveAspectRatio();
+ SVGOMAnimatedPreserveAspectRatio _par =
+ (SVGOMAnimatedPreserveAspectRatio) ie.getPreserveAspectRatio();
+ _par.check();
AffineTransform at = ViewBox.getPreserveAspectRatioTransform
- (e, vb, w, h, aPAR, ctx);
+ (e, vb, w, h, _par, ctx);
at.preConcatenate(AffineTransform.getTranslateInstance(x, y));
node.setTransform(at);
@@ -958,16 +962,24 @@
SVGImageElement ie = (SVGImageElement) element;
// 'x' attribute - default is 0
- float x = ie.getX().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x =
+ (AbstractSVGAnimatedLength) ie.getX();
+ float x = _x.getCheckedValue();
// 'y' attribute - default is 0
- float y = ie.getY().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y =
+ (AbstractSVGAnimatedLength) ie.getY();
+ float y = _y.getCheckedValue();
// 'width' attribute - required
- float w = ie.getWidth().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _width =
+ (AbstractSVGAnimatedLength) ie.getWidth();
+ float w = _width.getCheckedValue();
// 'height' attribute - required
- float h = ie.getHeight().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _height =
+ (AbstractSVGAnimatedLength) ie.getHeight();
+ float h = _height.getCheckedValue();
return new Rectangle2D.Float(x, y, w, h);
} catch (LiveAttributeException ex) {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGLineElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGLineElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGLineElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGLineElementBridge.java Tue Apr 10 21:31:58 2007
@@ -20,6 +20,7 @@
import java.awt.geom.Line2D;
+import org.apache.batik.dom.svg.AbstractSVGAnimatedLength;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGOMLineElement;
@@ -95,16 +96,24 @@
SVGOMLineElement le = (SVGOMLineElement) e;
// 'x1' attribute - default is 0
- float x1 = le.getX1().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x1 =
+ (AbstractSVGAnimatedLength) le.getX1();
+ float x1 = _x1.getCheckedValue();
// 'y1' attribute - default is 0
- float y1 = le.getY1().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y1 =
+ (AbstractSVGAnimatedLength) le.getY1();
+ float y1 = _y1.getCheckedValue();
// 'x2' attribute - default is 0
- float x2 = le.getX2().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x2 =
+ (AbstractSVGAnimatedLength) le.getX2();
+ float x2 = _x2.getCheckedValue();
// 'y2' attribute - default is 0
- float y2 = le.getY2().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y2 =
+ (AbstractSVGAnimatedLength) le.getY2();
+ float y2 = _y2.getCheckedValue();
shapeNode.setShape(new Line2D.Float(x1, y1, x2, y2));
} catch (LiveAttributeException ex) {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPathElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPathElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPathElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPathElementBridge.java Tue Apr 10 21:31:58 2007
@@ -26,6 +26,7 @@
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGAnimatedPathDataSupport;
+import org.apache.batik.dom.svg.SVGOMAnimatedPathData;
import org.apache.batik.dom.svg.SVGOMPathElement;
import org.apache.batik.dom.svg.SVGPathContext;
import org.apache.batik.ext.awt.geom.PathLength;
@@ -84,7 +85,10 @@
AWTPathProducer app = new AWTPathProducer();
try {
// 'd' attribute - required
- SVGPathSegList p = pe.getAnimatedPathSegList();
+ SVGOMAnimatedPathData _d =
+ (SVGOMAnimatedPathData) pe.getAnimatedPathData();
+ _d.check();
+ SVGPathSegList p = _d.getAnimatedPathSegList();
app.setWindingRule(CSSUtilities.convertFillRule(e));
SVGAnimatedPathDataSupport.handlePathSegList(p, app);
} catch (LiveAttributeException ex) {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolygonElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolygonElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolygonElementBridge.java Tue Apr 10 21:31:58 2007
@@ -24,6 +24,7 @@
import org.apache.batik.css.engine.SVGCSSEngine;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
+import org.apache.batik.dom.svg.SVGOMAnimatedPoints;
import org.apache.batik.dom.svg.SVGOMPolygonElement;
import org.apache.batik.gvt.ShapeNode;
import org.apache.batik.parser.AWTPolygonProducer;
@@ -76,9 +77,12 @@
Element e,
ShapeNode shapeNode) {
+ SVGOMPolygonElement pe = (SVGOMPolygonElement) e;
try {
- SVGOMPolygonElement pe = (SVGOMPolygonElement) e;
- SVGPointList pl = pe.getAnimatedPoints();
+ SVGOMAnimatedPoints _points =
+ (SVGOMAnimatedPoints) pe.getSVGOMAnimatedPoints();
+ _points.check();
+ SVGPointList pl = _points.getAnimatedPoints();
int size = pl.getNumberOfItems();
if (size == 0) {
shapeNode.setShape(DEFAULT_SHAPE);
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolylineElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolylineElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGPolylineElementBridge.java Tue Apr 10 21:31:58 2007
@@ -24,6 +24,7 @@
import org.apache.batik.css.engine.SVGCSSEngine;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
+import org.apache.batik.dom.svg.SVGOMAnimatedPoints;
import org.apache.batik.dom.svg.SVGOMPolylineElement;
import org.apache.batik.gvt.ShapeNode;
import org.apache.batik.parser.AWTPolylineProducer;
@@ -76,9 +77,12 @@
Element e,
ShapeNode shapeNode) {
+ SVGOMPolylineElement pe = (SVGOMPolylineElement) e;
try {
- SVGOMPolylineElement pe = (SVGOMPolylineElement) e;
- SVGPointList pl = pe.getAnimatedPoints();
+ SVGOMAnimatedPoints _points =
+ (SVGOMAnimatedPoints) pe.getSVGOMAnimatedPoints();
+ _points.check();
+ SVGPointList pl = _points.getAnimatedPoints();
int size = pl.getNumberOfItems();
if (size == 0) {
shapeNode.setShape(DEFAULT_SHAPE);
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGRectElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGRectElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGRectElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGRectElementBridge.java Tue Apr 10 21:31:58 2007
@@ -22,6 +22,7 @@
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
+import org.apache.batik.dom.svg.AbstractSVGAnimatedLength;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGOMRectElement;
@@ -72,25 +73,37 @@
SVGOMRectElement re = (SVGOMRectElement) e;
// 'x' attribute - default is 0
- float x = re.getX().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x =
+ (AbstractSVGAnimatedLength) re.getX();
+ float x = _x.getCheckedValue();
// 'y' attribute - default is 0
- float y = re.getY().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y =
+ (AbstractSVGAnimatedLength) re.getY();
+ float y = _y.getCheckedValue();
// 'width' attribute - required
- float w = re.getWidth().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _width =
+ (AbstractSVGAnimatedLength) re.getWidth();
+ float w = _width.getCheckedValue();
// 'height' attribute - required
- float h = re.getHeight().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _height =
+ (AbstractSVGAnimatedLength) re.getHeight();
+ float h = _height.getCheckedValue();
// 'rx' attribute - default is 0
- float rx = re.getRx().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _rx =
+ (AbstractSVGAnimatedLength) re.getRx();
+ float rx = _rx.getCheckedValue();
if (rx > w / 2) {
rx = w / 2;
}
// 'ry' attribute - default is rx
- float ry = re.getRy().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _ry =
+ (AbstractSVGAnimatedLength) re.getRy();
+ float ry = _ry.getCheckedValue();
if (ry > h / 2) {
ry = h / 2;
}
@@ -99,7 +112,7 @@
if (rx == 0 || ry == 0) {
shape = new Rectangle2D.Float(x, y, w, h);
} else {
- shape = new RoundRectangle2D.Float(x, y, w, h, rx*2, ry*2);
+ shape = new RoundRectangle2D.Float(x, y, w, h, rx * 2, ry * 2);
}
shapeNode.setShape(shape);
} catch (LiveAttributeException ex) {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java Tue Apr 10 21:31:58 2007
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Set;
+import org.apache.batik.dom.svg.AbstractSVGAnimatedLength;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGContext;
@@ -116,17 +117,25 @@
// x and y have no meaning on the outermost 'svg' element
if (!isOutermost) {
// 'x' attribute - default is 0
- x = se.getX().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x =
+ (AbstractSVGAnimatedLength) se.getX();
+ x = _x.getCheckedValue();
// 'y' attribute - default is 0
- y = se.getY().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y =
+ (AbstractSVGAnimatedLength) se.getY();
+ y = _y.getCheckedValue();
}
// 'width' attribute - default is 100%
- float w = se.getWidth().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _width =
+ (AbstractSVGAnimatedLength) se.getWidth();
+ float w = _width.getCheckedValue();
// 'height' attribute - default is 100%
- float h = se.getHeight().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _height =
+ (AbstractSVGAnimatedLength) se.getHeight();
+ float h = _height.getCheckedValue();
// 'visibility'
cgn.setVisible(CSSUtilities.convertVisibility(e));
@@ -263,10 +272,14 @@
boolean isOutermost = doc.getRootElement() == e;
if (!isOutermost) {
// 'x' attribute - default is 0
- float x = se.getX().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x =
+ (AbstractSVGAnimatedLength) se.getX();
+ float x = _x.getCheckedValue();
// 'y' attribute - default is 0
- float y = se.getY().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y =
+ (AbstractSVGAnimatedLength) se.getY();
+ float y = _y.getCheckedValue();
AffineTransform positionTransform =
AffineTransform.getTranslateInstance(x, y);
@@ -313,17 +326,25 @@
float y = 0;
if (!isOutermost) {
// 'x' attribute - default is 0
- x = se.getX().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x =
+ (AbstractSVGAnimatedLength) se.getX();
+ x = _x.getCheckedValue();
// 'y' attribute - default is 0
- y = se.getY().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y =
+ (AbstractSVGAnimatedLength) se.getY();
+ y = _y.getCheckedValue();
}
// 'width' attribute - default is 100%
- float w = se.getWidth().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _width =
+ (AbstractSVGAnimatedLength) se.getWidth();
+ float w = _width.getCheckedValue();
// 'height' attribute - default is 100%
- float h = se.getHeight().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _height =
+ (AbstractSVGAnimatedLength) se.getHeight();
+ float h = _height.getCheckedValue();
CanvasGraphicsNode cgn;
cgn = (CanvasGraphicsNode)node;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java Tue Apr 10 21:31:58 2007
@@ -51,6 +51,9 @@
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGContext;
+import org.apache.batik.dom.svg.SVGOMAnimatedEnumeration;
+import org.apache.batik.dom.svg.SVGOMAnimatedLengthList;
+import org.apache.batik.dom.svg.SVGOMAnimatedNumberList;
import org.apache.batik.dom.svg.SVGOMElement;
import org.apache.batik.dom.svg.SVGOMTextPositioningElement;
import org.apache.batik.dom.svg.SVGTextContent;
@@ -228,14 +231,18 @@
SVGOMTextPositioningElement te = (SVGOMTextPositioningElement) e;
// 'x' attribute - default is 0
- SVGLengthList xs = te.getX().getAnimVal();
+ SVGOMAnimatedLengthList _x = (SVGOMAnimatedLengthList) te.getX();
+ _x.check();
+ SVGLengthList xs = _x.getAnimVal();
float x = 0;
if (xs.getNumberOfItems() > 0) {
x = xs.getItem(0).getValue();
}
// 'y' attribute - default is 0
- SVGLengthList ys = te.getY().getAnimVal();
+ SVGOMAnimatedLengthList _y = (SVGOMAnimatedLengthList) te.getY();
+ _y.check();
+ SVGLengthList ys = _y.getAnimVal();
float y = 0;
if (ys.getNumberOfItems() > 0) {
y = ys.getItem(0).getValue();
@@ -1254,11 +1261,27 @@
SVGTextPositioningElement te = (SVGTextPositioningElement) element;
try {
- SVGLengthList xs = te.getX().getAnimVal();
- SVGLengthList ys = te.getY().getAnimVal();
- SVGLengthList dxs = te.getDx().getAnimVal();
- SVGLengthList dys = te.getDy().getAnimVal();
- SVGNumberList rs = te.getRotate().getAnimVal();
+ SVGOMAnimatedLengthList _x =
+ (SVGOMAnimatedLengthList) te.getX();
+ _x.check();
+ SVGOMAnimatedLengthList _y =
+ (SVGOMAnimatedLengthList) te.getY();
+ _y.check();
+ SVGOMAnimatedLengthList _dx =
+ (SVGOMAnimatedLengthList) te.getDx();
+ _dx.check();
+ SVGOMAnimatedLengthList _dy =
+ (SVGOMAnimatedLengthList) te.getDy();
+ _dy.check();
+ SVGOMAnimatedNumberList _rotate =
+ (SVGOMAnimatedNumberList) te.getRotate();
+ _rotate.check();
+
+ SVGLengthList xs = _x.getAnimVal();
+ SVGLengthList ys = _y.getAnimVal();
+ SVGLengthList dxs = _dx.getAnimVal();
+ SVGLengthList dys = _dy.getAnimVal();
+ SVGNumberList rs = _rotate.getAnimVal();
int len;
@@ -1708,10 +1731,12 @@
if (textLength.isSpecified()) {
result.put(GVTAttributedCharacterIterator.TextAttribute.
BBOX_WIDTH,
- new Float(textLength.getAnimVal().getValue()));
+ new Float(textLength.getCheckedValue()));
// lengthAdjust
- if (tce.getLengthAdjust().getAnimVal() ==
+ SVGOMAnimatedEnumeration _lengthAdjust =
+ (SVGOMAnimatedEnumeration) tce.getLengthAdjust();
+ if (_lengthAdjust.getCheckedVal() ==
SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS) {
result.put(GVTAttributedCharacterIterator.
TextAttribute.LENGTH_ADJUST,
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGUseElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGUseElementBridge.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGUseElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGUseElementBridge.java Tue Apr 10 21:31:58 2007
@@ -24,6 +24,7 @@
import java.awt.geom.Rectangle2D;
import org.apache.batik.dom.events.NodeEventTarget;
+import org.apache.batik.dom.svg.AbstractSVGAnimatedLength;
import org.apache.batik.dom.svg.AnimatedLiveAttributeValue;
import org.apache.batik.dom.svg.LiveAttributeException;
import org.apache.batik.dom.svg.SVGOMAnimatedLength;
@@ -335,10 +336,14 @@
SVGUseElement ue = (SVGUseElement) e;
try {
// 'x' attribute - default is 0
- float x = ue.getX().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _x =
+ (AbstractSVGAnimatedLength) ue.getX();
+ float x = _x.getCheckedValue();
// 'y' attribute - default is 0
- float y = ue.getY().getAnimVal().getValue();
+ AbstractSVGAnimatedLength _y =
+ (AbstractSVGAnimatedLength) ue.getY();
+ float y = _y.getCheckedValue();
AffineTransform xy = AffineTransform.getTranslateInstance(x, y);
xy.preConcatenate(at);
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java Tue Apr 10 21:31:58 2007
@@ -128,6 +128,49 @@
}
/**
+ * Gets the current animated length value. If the attribute is missing
+ * or malformed, an exception is thrown.
+ */
+ public float getCheckedValue() {
+ if (hasAnimVal) {
+ if (animVal == null) {
+ animVal = new AnimSVGLength(direction);
+ }
+ if (nonNegative && animVal.value < 0) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE,
+ animVal.getValueAsString());
+ }
+ return animVal.getValue();
+ } else {
+ if (baseVal == null) {
+ baseVal = new BaseSVGLength(direction);
+ }
+ baseVal.revalidate();
+ if (baseVal.unitType == SVGLength.SVG_LENGTHTYPE_UNKNOWN) {
+ if (baseVal.missing) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ } else {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ baseVal.getValueAsString());
+ }
+ }
+ if (nonNegative && baseVal.value < 0) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE,
+ baseVal.getValueAsString());
+ }
+ return baseVal.getValue();
+ }
+ }
+
+ /**
* Updates the animated value with the given {@link AnimatableValue}.
*/
protected void updateAnimatedValue(AnimatableValue val) {
@@ -201,6 +244,11 @@
protected boolean valid;
/**
+ * Whether the attribute is missing.
+ */
+ protected boolean missing;
+
+ /**
* Creates a new BaseSVGLength.
* @param direction is one of HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTH
*/
@@ -221,6 +269,7 @@
protected void reset() {
try {
changing = true;
+ valid = true;
String value = getValueAsString();
element.setAttributeNS(namespaceURI, localName, value);
} finally {
@@ -236,31 +285,22 @@
return;
}
- unitType = SVG_LENGTHTYPE_UNKNOWN;
- value = 0;
+ missing = false;
+ valid = true;
Attr attr = element.getAttributeNodeNS(namespaceURI, localName);
String s;
if (attr == null) {
s = getDefaultValue();
if (s == null) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ missing = true;
+ return;
}
} else {
s = attr.getValue();
}
parse(s);
-
- if (nonNegative && value < 0) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE, s);
- }
-
- valid = true;
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGLength.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGLength.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGLength.java Tue Apr 10 21:31:58 2007
@@ -135,7 +135,6 @@
* <b>DOM</b>: Implements {@link SVGLength#setValue(float)}.
*/
public void setValue(float value) throws DOMException {
- revalidate();
this.value = UnitProcessor.userSpaceToSVG(value, unitType,
direction, context);
reset();
@@ -164,7 +163,10 @@
*/
public String getValueAsString() {
revalidate();
- return Float.toString(value)+UNITS[unitType];
+ if (unitType == SVGLength.SVG_LENGTHTYPE_UNKNOWN) {
+ return "";
+ }
+ return Float.toString(value) + UNITS[unitType];
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java Tue Apr 10 21:31:58 2007
@@ -161,6 +161,26 @@
}
/**
+ * Gets the current animated value, throwing an exception if the attribute
+ * is malformed.
+ */
+ public short getCheckedVal() {
+ if (hasAnimVal) {
+ return animVal;
+ }
+ if (!valid) {
+ update();
+ }
+ if (baseVal == 0) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ getBaseValAsString());
+ }
+ return baseVal;
+ }
+
+ /**
* Returns the base value of the attribute as an {@link AnimatableValue}.
*/
public AnimatableValue getUnderlyingValue(AnimationTarget target) {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java Tue Apr 10 21:31:58 2007
@@ -118,6 +118,29 @@
}
/**
+ * Throws an exception if the length list value is malformed.
+ */
+ public void check() {
+ if (!hasAnimVal) {
+ if (baseVal == null) {
+ baseVal = new BaseSVGLengthList();
+ }
+ baseVal.revalidate();
+ if (baseVal.missing) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ }
+ if (baseVal.malformed) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ baseVal.getValueAsString());
+ }
+ }
+ }
+
+ /**
* Returns the base value of the attribute as an {@link AnimatableValue}.
*/
public AnimatableValue getUnderlyingValue(AnimationTarget target) {
@@ -200,6 +223,16 @@
public class BaseSVGLengthList extends AbstractSVGLengthList {
/**
+ * Whether the value is missing.
+ */
+ protected boolean missing;
+
+ /**
+ * Whether the value is malformed.
+ */
+ protected boolean malformed;
+
+ /**
* Creates a new BaseSVGLengthList.
*/
public BaseSVGLengthList() {
@@ -255,6 +288,26 @@
}
/**
+ * Resets the value of the associated attribute.
+ */
+ protected void resetAttribute() {
+ super.resetAttribute();
+ missing = false;
+ malformed = false;
+ }
+
+ /**
+ * Appends the string representation of the given {@link SVGItem} to
+ * the DOM attribute. This is called in response to an append to
+ * the list.
+ */
+ protected void resetAttribute(SVGItem item) {
+ super.resetAttribute(item);
+ missing = false;
+ malformed = false;
+ }
+
+ /**
* Initializes the list, if needed.
*/
protected void revalidate() {
@@ -262,12 +315,15 @@
return;
}
+ valid = true;
+ missing = false;
+ malformed = false;
+
String s = getValueAsString();
boolean isEmpty = s != null && s.length() == 0;
if (s == null || isEmpty && !emptyAllowed) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MISSING, s);
+ missing = true;
+ return;
}
if (isEmpty) {
itemList = new ArrayList(1);
@@ -284,12 +340,9 @@
} catch (ParseException e) {
itemList = new ArrayList(1);
valid = true;
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s);
+ malformed = true;
}
}
- valid = true;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java Tue Apr 10 21:31:58 2007
@@ -210,6 +210,7 @@
protected void reset() {
try {
changing = true;
+ valid = true;
String value;
if (baseEnumerationVal ==
SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE) {
@@ -429,4 +430,4 @@
return baseEnumerationVal;
}
}
-}
\ No newline at end of file
+}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java Tue Apr 10 21:31:58 2007
@@ -110,6 +110,29 @@
}
/**
+ * Throws an exception if the number list value is malformed.
+ */
+ public void check() {
+ if (!hasAnimVal) {
+ if (baseVal == null) {
+ baseVal = new BaseSVGNumberList();
+ }
+ baseVal.revalidate();
+ if (baseVal.missing) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ }
+ if (baseVal.malformed) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ baseVal.getValueAsString());
+ }
+ }
+ }
+
+ /**
* Returns the base value of the attribute as an {@link AnimatableValue}.
*/
public AnimatableValue getUnderlyingValue(AnimationTarget target) {
@@ -185,6 +208,16 @@
public class BaseSVGNumberList extends AbstractSVGNumberList {
/**
+ * Whether the value is missing.
+ */
+ protected boolean missing;
+
+ /**
+ * Whether the value is malformed.
+ */
+ protected boolean malformed;
+
+ /**
* Create a DOMException.
*/
protected DOMException createDOMException(short type, String key,
@@ -233,6 +266,26 @@
}
/**
+ * Resets the value of the associated attribute.
+ */
+ protected void resetAttribute() {
+ super.resetAttribute();
+ missing = false;
+ malformed = false;
+ }
+
+ /**
+ * Appends the string representation of the given {@link SVGItem} to
+ * the DOM attribute. This is called in response to an append to
+ * the list.
+ */
+ protected void resetAttribute(SVGItem item) {
+ super.resetAttribute(item);
+ missing = false;
+ malformed = false;
+ }
+
+ /**
* Initializes the list, if needed.
*/
protected void revalidate() {
@@ -240,12 +293,15 @@
return;
}
+ valid = true;
+ missing = false;
+ malformed = false;
+
String s = getValueAsString();
boolean isEmpty = s != null && s.length() == 0;
if (s == null || isEmpty && !emptyAllowed) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ missing = true;
+ return;
}
if (isEmpty) {
itemList = new ArrayList(1);
@@ -262,12 +318,9 @@
} catch (ParseException e) {
itemList = new ArrayList(1);
valid = true;
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s);
+ malformed = true;
}
}
- valid = true;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java Tue Apr 10 21:31:58 2007
@@ -156,6 +156,29 @@
}
/**
+ * Throws an exception if the path data is malformed.
+ */
+ public void check() {
+ if (!hasAnimVal) {
+ if (pathSegs == null) {
+ pathSegs = new BaseSVGPathSegList();
+ }
+ pathSegs.revalidate();
+ if (pathSegs.missing) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ }
+ if (pathSegs.malformed) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ pathSegs.getValueAsString());
+ }
+ }
+ }
+
+ /**
* Returns the base value of the attribute as an {@link AnimatableValue}.
*/
public AnimatableValue getUnderlyingValue(AnimationTarget target) {
@@ -244,6 +267,16 @@
public class BaseSVGPathSegList extends AbstractSVGPathSegList {
/**
+ * Whether the attribute is missing.
+ */
+ protected boolean missing;
+
+ /**
+ * Whether the attribute is malformed.
+ */
+ protected boolean malformed;
+
+ /**
* Create a DOMException.
*/
protected DOMException createDOMException(short type, String key,
@@ -283,6 +316,26 @@
}
/**
+ * Resets the value of the associated attribute.
+ */
+ protected void resetAttribute() {
+ super.resetAttribute();
+ missing = false;
+ malformed = false;
+ }
+
+ /**
+ * Appends the string representation of the given {@link SVGItem} to
+ * the DOM attribute. This is called in response to an append to
+ * the list.
+ */
+ protected void resetAttribute(SVGItem item) {
+ super.resetAttribute(item);
+ missing = false;
+ malformed = false;
+ }
+
+ /**
* Initializes the list, if needed.
*/
protected void revalidate() {
@@ -290,11 +343,14 @@
return;
}
+ valid = true;
+ missing = false;
+ malformed = false;
+
String s = getValueAsString();
if (s == null) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ missing = true;
+ return;
}
try {
ListBuilder builder = new ListBuilder();
@@ -307,11 +363,7 @@
itemList = builder.getList();
} catch (ParseException e) {
itemList = new ArrayList(1);
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s);
- } finally {
- valid = true;
+ malformed = true;
}
}
}
@@ -324,6 +376,16 @@
extends AbstractSVGNormPathSegList {
/**
+ * Whether the attribute is missing.
+ */
+ protected boolean missing;
+
+ /**
+ * Whether the attribute is malformed.
+ */
+ protected boolean malformed;
+
+ /**
* Create a DOMException.
*/
protected DOMException createDOMException(short type, String key,
@@ -370,11 +432,14 @@
return;
}
+ valid = true;
+ missing = false;
+ malformed = false;
+
String s = getValueAsString();
if (s == null) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ missing = true;
+ return;
}
try {
ListBuilder builder = new ListBuilder();
@@ -387,11 +452,7 @@
itemList = builder.getList();
} catch (ParseException e) {
itemList = new ArrayList(1);
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s);
- } finally {
- valid = true;
+ malformed = true;
}
}
}
@@ -605,7 +666,6 @@
(command, PATHSEG_LETTERS[command],
parameters[j[0]++]);
}
- System.err.println("command == " + command);
return null;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java Tue Apr 10 21:31:58 2007
@@ -100,6 +100,29 @@
}
/**
+ * Throws an exception if the points list value is malformed.
+ */
+ public void check() {
+ if (!hasAnimVal) {
+ if (baseVal == null) {
+ baseVal = new BaseSVGPointList();
+ }
+ baseVal.revalidate();
+ if (baseVal.missing) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ }
+ if (baseVal.malformed) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ baseVal.getValueAsString());
+ }
+ }
+ }
+
+ /**
* Returns the base value of the attribute as an {@link AnimatableValue}.
*/
public AnimatableValue getUnderlyingValue(AnimationTarget target) {
@@ -177,6 +200,16 @@
protected class BaseSVGPointList extends AbstractSVGPointList {
/**
+ * Whether the attribute is missing.
+ */
+ protected boolean missing;
+
+ /**
+ * Whether the attribute is malformed.
+ */
+ protected boolean malformed;
+
+ /**
* Create a DOMException.
*/
protected DOMException createDOMException(short type, String key,
@@ -217,6 +250,26 @@
}
/**
+ * Resets the value of the associated attribute.
+ */
+ protected void resetAttribute() {
+ super.resetAttribute();
+ missing = false;
+ malformed = false;
+ }
+
+ /**
+ * Appends the string representation of the given {@link SVGItem} to
+ * the DOM attribute. This is called in response to an append to
+ * the list.
+ */
+ protected void resetAttribute(SVGItem item) {
+ super.resetAttribute(item);
+ missing = false;
+ malformed = false;
+ }
+
+ /**
* Initializes the list, if needed.
*/
protected void revalidate() {
@@ -224,11 +277,14 @@
return;
}
+ valid = true;
+ missing = false;
+ malformed = false;
+
String s = getValueAsString();
if (s == null) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ missing = true;
+ return;
}
try {
ListBuilder builder = new ListBuilder();
@@ -241,12 +297,8 @@
itemList = builder.getList();
} catch (ParseException e) {
itemList = new ArrayList(1);
- valid = true;
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s);
+ malformed = true;
}
- valid = true;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java Tue Apr 10 21:31:58 2007
@@ -82,6 +82,24 @@
return animVal;
}
+
+ /**
+ * Throws an exception if the points list value is malformed.
+ */
+ public void check() {
+ if (!hasAnimVal) {
+ if (baseVal == null) {
+ baseVal = new BaseSVGPARValue();
+ }
+ if (baseVal.malformed) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ baseVal.getValueAsString());
+ }
+ }
+ }
+
/**
* Returns the base value of the attribute as an {@link AnimatableValue}.
*/
@@ -156,6 +174,11 @@
public class BaseSVGPARValue extends AbstractSVGPreserveAspectRatio {
/**
+ * Whether the attribute is malformed.
+ */
+ protected boolean malformed;
+
+ /**
* Creates a new BaseSVGPARValue.
*/
public BaseSVGPARValue() {
@@ -179,6 +202,7 @@
element.setAttributeNS
(null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE,
value);
+ malformed = false;
} finally {
changing = false;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java Tue Apr 10 21:31:58 2007
@@ -101,6 +101,29 @@
}
/**
+ * Throws an exception if the points list value is malformed.
+ */
+ public void check() {
+ if (!hasAnimVal) {
+ if (baseVal == null) {
+ baseVal = new BaseSVGTransformList();
+ }
+ baseVal.revalidate();
+ if (baseVal.missing) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ }
+ if (baseVal.malformed) {
+ throw new LiveAttributeException
+ (element, localName,
+ LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
+ baseVal.getValueAsString());
+ }
+ }
+ }
+
+ /**
* Returns the base value of the attribute as an {@link AnimatableValue}.
*/
public AnimatableValue getUnderlyingValue(AnimationTarget target) {
@@ -176,6 +199,16 @@
public class BaseSVGTransformList extends AbstractSVGTransformList {
/**
+ * Whether the attribute is missing.
+ */
+ protected boolean missing;
+
+ /**
+ * Whether the attribute is malformed.
+ */
+ protected boolean malformed;
+
+ /**
* Create a DOMException.
*/
protected DOMException createDOMException(short type, String key,
@@ -216,6 +249,26 @@
}
/**
+ * Resets the value of the associated attribute.
+ */
+ protected void resetAttribute() {
+ super.resetAttribute();
+ missing = false;
+ malformed = false;
+ }
+
+ /**
+ * Appends the string representation of the given {@link SVGItem} to
+ * the DOM attribute. This is called in response to an append to
+ * the list.
+ */
+ protected void resetAttribute(SVGItem item) {
+ super.resetAttribute(item);
+ missing = false;
+ malformed = false;
+ }
+
+ /**
* Initializes the list, if needed.
*/
protected void revalidate() {
@@ -223,11 +276,14 @@
return;
}
+ valid = true;
+ missing = false;
+ malformed = false;
+
String s = getValueAsString();
if (s == null) {
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MISSING, null);
+ missing = true;
+ return;
}
try {
ListBuilder builder = new ListBuilder();
@@ -240,12 +296,8 @@
itemList = builder.getList();
} catch (ParseException e) {
itemList = new ArrayList(1);
- valid = true;
- throw new LiveAttributeException
- (element, localName,
- LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s);
+ malformed = true;
}
- valid = true;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMPathElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMPathElement.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMPathElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMPathElement.java Tue Apr 10 21:31:58 2007
@@ -146,6 +146,14 @@
}
/**
+ * Returns the {@link SVGOMAnimatedPathData} object that manages the
+ * path data for this element.
+ */
+ public SVGOMAnimatedPathData getAnimatedPathData() {
+ return d;
+ }
+
+ /**
* <b>DOM</b>: Implements {@link SVGPathElement#getPathSegList()}.
*/
public SVGPathSegList getPathSegList() {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGPointShapeElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGPointShapeElement.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGPointShapeElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGPointShapeElement.java Tue Apr 10 21:31:58 2007
@@ -85,6 +85,14 @@
}
/**
+ * Gets the {@link SVGOMAnimatedPoints} object that manages the
+ * point list for this element.
+ */
+ public SVGOMAnimatedPoints getSVGOMAnimatedPoints() {
+ return points;
+ }
+
+ /**
* <b>DOM</b>: Implements {@link
* org.w3c.dom.svg.SVGAnimatedPoints#getPoints()}.
*/
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/Messages.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/Messages.java?view=diff&rev=527382&r1=527381&r2=527382
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/Messages.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/Messages.java Tue Apr 10 21:31:58 2007
@@ -22,7 +22,6 @@
import java.util.MissingResourceException;
import org.apache.batik.i18n.LocalizableSupport;
-import org.apache.batik.util.gui.resource.ResourceManager;
/**
* This class manages the message for the Rhino interpreter