tkormann 02/02/13 07:01:15 Modified: samples/tests/spec/scripting rect.svg sources/org/apache/batik/bridge AbstractGraphicsNodeBridge.java SVGImageElementBridge.java SVGSVGElementBridge.java SVGTextElementBridge.java SVGUseElementBridge.java Log: clean dynamic setup in the bridge Revision Changes Path 1.2 +7 -3 xml-batik/samples/tests/spec/scripting/rect.svg Index: rect.svg =================================================================== RCS file: /home/cvs/xml-batik/samples/tests/spec/scripting/rect.svg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- rect.svg 12 Feb 2002 16:34:06 -0000 1.1 +++ rect.svg 13 Feb 2002 15:01:14 -0000 1.2 @@ -14,7 +14,7 @@ <!-- Modification of a rect's attributes --> <!-- --> <!-- @author [EMAIL PROTECTED] --> -<!-- @version $Id: rect.svg,v 1.1 2002/02/12 16:34:06 tkormann Exp $ --> +<!-- @version $Id: rect.svg,v 1.2 2002/02/13 15:01:14 tkormann Exp $ --> <!-- ====================================================================== --> <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> @@ -32,8 +32,12 @@ elt.setAttribute("y", y) elt.setAttribute("width", w) elt.setAttribute("height", h) - elt.setAttribute("rx", rx) - elt.setAttribute("ry", ry) + if (rx != null) { + elt.setAttribute("rx", rx) + } + if (ry != null) { + elt.setAttribute("ry", ry) + } } </script> 1.12 +17 -7 xml-batik/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java Index: AbstractGraphicsNodeBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- AbstractGraphicsNodeBridge.java 13 Feb 2002 13:00:31 -0000 1.11 +++ AbstractGraphicsNodeBridge.java 13 Feb 2002 15:01:14 -0000 1.12 @@ -39,7 +39,7 @@ * </ul> * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: AbstractGraphicsNodeBridge.java,v 1.11 2002/02/13 13:00:31 tkormann Exp $ + * @version $Id: AbstractGraphicsNodeBridge.java,v 1.12 2002/02/13 15:01:14 tkormann Exp $ */ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge implements GraphicsNodeBridge, ErrorConstants { @@ -117,22 +117,32 @@ // 'pointer-events' node.setPointerEventType(CSSUtilities.convertPointerEvents(e)); - // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { - ((EventTarget)e).addEventListener("DOMAttrModified", - new DOMAttrModifiedEventListener(), - false); this.e = e; this.node = node; this.ctx = ctx; - ctx.bind(e, node); - BridgeEventSupport.addDOMListener(ctx, e); + initializeDynamicSupport(); } + // Handle children elements such as <title> SVGUtilities.bridgeChildren(ctx, e); } // dynamic support + + /** + * This method is invoked during the build phase if the document + * is dynamic. The responsability of this method is to ensure that + * any dynamic modifications of the element this bridge is + * dedicated to, happen on its associated GVT product. + */ + protected void initializeDynamicSupport() { + ((EventTarget)e).addEventListener("DOMAttrModified", + new DOMAttrModifiedEventListener(), + false); + ctx.bind(e, node); + BridgeEventSupport.addDOMListener(ctx, e); + } /** * Handles DOMAttrModified events. 1.36 +25 -13 xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java Index: SVGImageElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- SVGImageElementBridge.java 13 Feb 2002 09:51:01 -0000 1.35 +++ SVGImageElementBridge.java 13 Feb 2002 15:01:14 -0000 1.36 @@ -52,7 +52,7 @@ * Bridge class for the <image> element. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: SVGImageElementBridge.java,v 1.35 2002/02/13 09:51:01 tkormann Exp $ + * @version $Id: SVGImageElementBridge.java,v 1.36 2002/02/13 15:01:14 tkormann Exp $ */ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge { @@ -176,22 +176,13 @@ // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { - ((EventTarget)e).addEventListener("DOMAttrModified", - new DOMAttrModifiedEventListener(), - false); this.e = e; this.node = node; this.ctx = ctx; - // HACK due to the way images are represented in GVT - ImageNode imgNode = (ImageNode)node; - if (imgNode.getImage() instanceof RasterImageNode) { - // register the RasterImageNode instead - ctx.bind(e, imgNode.getImage()); - } else { - ctx.bind(e, node); - } - BridgeEventSupport.addDOMListener(ctx, e); + initializeDynamicSupport(); } + + // Handle children elements such as <title> SVGUtilities.bridgeChildren(ctx, e); } @@ -210,6 +201,27 @@ } // dynamic support + + /** + * This method is invoked during the build phase if the document + * is dynamic. The responsability of this method is to ensure that + * any dynamic modifications of the element this bridge is + * dedicated to, happen on its associated GVT product. + */ + protected void initializeDynamicSupport() { + ((EventTarget)e).addEventListener("DOMAttrModified", + new DOMAttrModifiedEventListener(), + false); + // HACK due to the way images are represented in GVT + ImageNode imgNode = (ImageNode)node; + if (imgNode.getImage() instanceof RasterImageNode) { + // register the RasterImageNode instead + ctx.bind(e, imgNode.getImage()); + } else { + ctx.bind(e, node); + } + BridgeEventSupport.addDOMListener(ctx, e); + } /** * Handles DOMAttrModified events. 1.22 +16 -6 xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java Index: SVGSVGElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- SVGSVGElementBridge.java 13 Feb 2002 13:00:31 -0000 1.21 +++ SVGSVGElementBridge.java 13 Feb 2002 15:01:14 -0000 1.22 @@ -33,7 +33,7 @@ * Bridge class for the <svg> element. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: SVGSVGElementBridge.java,v 1.21 2002/02/13 13:00:31 tkormann Exp $ + * @version $Id: SVGSVGElementBridge.java,v 1.22 2002/02/13 15:01:14 tkormann Exp $ */ public class SVGSVGElementBridge extends AbstractSVGBridge implements GraphicsNodeBridge, ErrorConstants { @@ -209,15 +209,11 @@ // we have built all children, we can close the viewport ctx.closeViewport(e); - // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { - ((EventTarget)e).addEventListener("DOMAttrModified", - new DOMAttrModifiedEventListener(), - false); this.e = e; this.node = node; this.ctx = ctx; - ctx.bind(e, node); + initializeDynamicSupport(); } } @@ -229,6 +225,20 @@ } // dynamic support + + /** + * This method is invoked during the build phase if the document + * is dynamic. The responsability of this method is to ensure that + * any dynamic modifications of the element this bridge is + * dedicated to, happen on its associated GVT product. + */ + protected void initializeDynamicSupport() { + ((EventTarget)e).addEventListener("DOMAttrModified", + new DOMAttrModifiedEventListener(), + false); + ctx.bind(e, node); + BridgeEventSupport.addDOMListener(ctx, e); + } /** * Handles DOMAttrModified events. 1.48 +16 -7 xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java Index: SVGTextElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- SVGTextElementBridge.java 13 Feb 2002 13:00:31 -0000 1.47 +++ SVGTextElementBridge.java 13 Feb 2002 15:01:14 -0000 1.48 @@ -60,7 +60,7 @@ * Bridge class for the <text> element. * * @author <a href="[EMAIL PROTECTED]>Bill Haneman</a> - * @version $Id: SVGTextElementBridge.java,v 1.47 2002/02/13 13:00:31 tkormann Exp $ + * @version $Id: SVGTextElementBridge.java,v 1.48 2002/02/13 15:01:14 tkormann Exp $ */ public class SVGTextElementBridge extends AbstractSVGBridge implements GraphicsNodeBridge, ErrorConstants { @@ -215,16 +215,11 @@ // 'pointer-events' node.setPointerEventType(CSSUtilities.convertPointerEvents(e)); - // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { - ((EventTarget)e).addEventListener("DOMAttrModified", - new DOMAttrModifiedEventListener(), - false); this.e = e; this.node = node; this.ctx = ctx; - ctx.bind(e, node); - BridgeEventSupport.addDOMListener(ctx, e); + initializeDynamicSupport(); } // Handle children elements such as <title> @@ -239,6 +234,20 @@ } // dynamic support + + /** + * This method is invoked during the build phase if the document + * is dynamic. The responsability of this method is to ensure that + * any dynamic modifications of the element this bridge is + * dedicated to, happen on its associated GVT product. + */ + protected void initializeDynamicSupport() { + ((EventTarget)e).addEventListener("DOMAttrModified", + new DOMAttrModifiedEventListener(), + false); + ctx.bind(e, node); + BridgeEventSupport.addDOMListener(ctx, e); + } /** * Handles DOMAttrModified events. 1.19 +19 -6 xml-batik/sources/org/apache/batik/bridge/SVGUseElementBridge.java Index: SVGUseElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGUseElementBridge.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- SVGUseElementBridge.java 13 Feb 2002 13:00:31 -0000 1.18 +++ SVGUseElementBridge.java 13 Feb 2002 15:01:15 -0000 1.19 @@ -37,7 +37,7 @@ * Bridge class for the <use> element. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: SVGUseElementBridge.java,v 1.18 2002/02/13 13:00:31 tkormann Exp $ + * @version $Id: SVGUseElementBridge.java,v 1.19 2002/02/13 15:01:15 tkormann Exp $ */ public class SVGUseElementBridge extends AbstractSVGBridge implements GraphicsNodeBridge, ErrorConstants { @@ -233,15 +233,14 @@ // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { - ((EventTarget)e).addEventListener("DOMAttrModified", - new DOMAttrModifiedEventListener(), - false); this.e = e; this.node = node; this.ctx = ctx; - - ctx.bind(e, node); + initializeDynamicSupport(); } + + // Handle children elements such as <title> + SVGUtilities.bridgeChildren(ctx, e); } /** @@ -252,6 +251,20 @@ } // dynamic support + + /** + * This method is invoked during the build phase if the document + * is dynamic. The responsability of this method is to ensure that + * any dynamic modifications of the element this bridge is + * dedicated to, happen on its associated GVT product. + */ + protected void initializeDynamicSupport() { + ((EventTarget)e).addEventListener("DOMAttrModified", + new DOMAttrModifiedEventListener(), + false); + ctx.bind(e, node); + BridgeEventSupport.addDOMListener(ctx, e); + } /** * Handles DOMAttrModified events.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]