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 2005/10/14 08:11:21 UTC

svn commit: r321030 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ dom/ dom/events/ gvt/

Author: cam
Date: Thu Oct 13 23:11:08 2005
New Revision: 321030

URL: http://svn.apache.org/viewcvs?rev=321030&view=rev
Log:
1. New style of CustomEvents in addition to the horribly complex one.
2. 'text' elements in 1.2 documents now look at the flattened
   tree for content.
3. Changes to the contents of flowDiv elements now effects changes
   in the GVT nodes appropriately.  Changes to flowRegions still
   do not, though.
4. Elements in flowRegions are now rendered.
5. Fixed small bug with the xblChildNodes NodeList not being updated
   properly.

Added:
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMCustomEvent.java   (with props)
Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/BindableElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeUpdateHandler.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12TextElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DocumentEventSupport.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/UpdateTracker.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java Thu Oct 13 23:11:08 2005
@@ -43,6 +43,7 @@
 import org.apache.batik.css.engine.SVGCSSEngine;
 import org.apache.batik.css.engine.SystemColorSupport;
 import org.apache.batik.css.engine.value.Value;
+import org.apache.batik.dom.AbstractNode;
 import org.apache.batik.dom.events.NodeEventTarget;
 import org.apache.batik.dom.svg.SVGContext;
 import org.apache.batik.dom.svg.SVGDOMImplementation;
@@ -1536,12 +1537,12 @@
         }
 
         /**
-         * Handles 'DOMNodeRemoved' event type.
+         * Handles 'DOMCharacterDataModified' event type.
          */
         public void handleEvent(Event evt) {
             Node node = (Node)evt.getTarget();
             while (node != null && !(node instanceof SVGOMElement)) {
-                node = node.getParentNode();
+                node = (Node) ((AbstractNode) node).getParentNodeEventTarget();
             }
             BridgeUpdateHandler h = getBridgeUpdateHandler(node);
             if (h != null) {
@@ -1578,7 +1579,7 @@
                     ((Element)elem.getParentNode());
                 if ((pgn == null) || !(pgn instanceof CompositeGraphicsNode)) {
                     // Something changed in this element but we really don't
-                    // care since it's parent isn't displayed either.
+                    // care since its parent isn't displayed either.
                     return;
                 }
                 CompositeGraphicsNode parent = (CompositeGraphicsNode)pgn;

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java Thu Oct 13 23:11:08 2005
@@ -103,7 +103,7 @@
     // in this text element.
     protected WeakHashMap elemTPI = new WeakHashMap();
 
-    // This s true if any of the spans of this text element
+    // This is true if any of the spans of this text element
     // use a 'complex' SVG font (meaning the font uses more
     // and just the 'd' attribute on the glyph element.
     // In this case we need to recreate the font when ever
@@ -258,13 +258,38 @@
         return false;
     }
 
+    // Tree navigation ------------------------------------------------------
+
+    /**
+     * Returns the first child node of the given node that should be
+     * processed by the text bridge.
+     */
+    protected Node getFirstChild(Node n) {
+        return n.getFirstChild();
+    }
+
+    /**
+     * Returns the next sibling node of the given node that should be
+     * processed by the text bridge.
+     */
+    protected Node getNextSibling(Node n) {
+        return n.getNextSibling();
+    }
+
+    /**
+     * Returns the parent node of the given node that should be
+     * processed by the text bridge.
+     */
+    protected Node getParentNode(Node n) {
+        return n.getParentNode();
+    }
+
     // Listener implementation ----------------------------------------------
 
     /**
      * The DOM EventListener to receive 'DOMNodeRemoved' event.
      */
-    protected DOMChildNodeRemovedEventListener childNodeRemovedEventListener = 
-        new DOMChildNodeRemovedEventListener();
+    protected DOMChildNodeRemovedEventListener childNodeRemovedEventListener;
 
     /**
      * The DOM EventListener invoked when a node is removed.
@@ -282,8 +307,7 @@
     /**
      * The DOM EventListener to receive 'DOMSubtreeModified' event.
      */
-    protected DOMSubtreeModifiedEventListener subtreeModifiedEventListener = 
-        new DOMSubtreeModifiedEventListener();
+    protected DOMSubtreeModifiedEventListener subtreeModifiedEventListener;
 
     /**
      * The DOM EventListener invoked when the subtree is modified.
@@ -301,54 +325,80 @@
     // BridgeUpdateHandler implementation -----------------------------------
 
     /**
-     * This method insures that any modification to a text
+     * This method ensures that any modification to a text
      * element and its children is going to be reflected 
      * into the GVT tree.
      */
     protected void initializeDynamicSupport(BridgeContext ctx,
                                             Element e,
                                             GraphicsNode node) {
-        super.initializeDynamicSupport(ctx,e,node);
+        super.initializeDynamicSupport(ctx, e, node);
 
         if (!ctx.isDynamic())
             return;             // Only add the listeners if we are dynamic
 
+        addTextEventListeners(ctx, (NodeEventTarget) e);
 
-        NodeEventTarget evtTarget = (NodeEventTarget)e;
+        // traverse the children to add context on 
+        // <tspan>, <tref> and <textPath>
+        Node child = getFirstChild(e);
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                addContextToChild(ctx,(Element)child);
+            }
+            child = getNextSibling(child);
+        }
+    }
+
+    /**
+     * Adds the DOM listeners for this text bridge.
+     */
+    protected void addTextEventListeners(BridgeContext ctx, NodeEventTarget e) {
+        if (childNodeRemovedEventListener == null) {
+            childNodeRemovedEventListener =
+                new DOMChildNodeRemovedEventListener();
+        }
+        if (subtreeModifiedEventListener == null) {
+            subtreeModifiedEventListener =
+                new DOMSubtreeModifiedEventListener();
+        }
 
         //to be notified when a child is removed from the 
         //<text> element.
-        evtTarget.addEventListenerNS
+        e.addEventListenerNS
             (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
              childNodeRemovedEventListener, true, null);
         ctx.storeEventListenerNS
-            (evtTarget, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
+            (e, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
              childNodeRemovedEventListener, true);
         
         //to be notified when the modification of the subtree
         //of the <text> element is done
-        evtTarget.addEventListenerNS
+        e.addEventListenerNS
             (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
              subtreeModifiedEventListener, false, null);
         ctx.storeEventListenerNS
-            (evtTarget, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
+            (e, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
              subtreeModifiedEventListener, false);
+    }
 
-        // traverse the children to add context on 
-        // <tspan>, <tref> and <textPath>
-        Node child  = e.getFirstChild();
-        while (child != null) {
-            if (child.getNodeType() == Node.ELEMENT_NODE) {
-                addContextToChild(ctx,(Element)child);
-            }
-            child = child.getNextSibling();
-        }
+    /**
+     * Removes the DOM listeners for this text bridge.
+     */
+    protected void removeTextEventListeners(BridgeContext ctx,
+                                            NodeEventTarget e) {
+        e.removeEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
+             childNodeRemovedEventListener, true);
+        e.removeEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
+             subtreeModifiedEventListener, false);
     }
 
     /**
      * Add to the element children of the node, a
-     * <code>SVGContext</code> to support dynamic updated . This is
-     * recurssive, the children of the nodes are also traversed to add
+     * <code>SVGContext</code> to support dynamic update. This is
+     * recursive, the children of the nodes are also traversed to add
      * to the support elements their context
      *
      * @param ctx a <code>BridgeContext</code> value
@@ -371,12 +421,12 @@
             }
         }
 
-        Node child  = e.getFirstChild();
+        Node child = getFirstChild(e);
         while (child != null) {
             if (child.getNodeType() == Node.ELEMENT_NODE) {
                 addContextToChild(ctx, (Element)child);
             }        
-            child = child.getNextSibling();
+            child = getNextSibling(child);
         }
     }
 
@@ -410,16 +460,10 @@
     }
 
     /**
-     * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
+     * Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.
      */
     public void handleDOMNodeRemovedEvent(MutationEvent evt) {
-        NodeEventTarget evtTarget = (NodeEventTarget) evt.getTarget();
-        evtTarget.removeEventListenerNS
-            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
-             childNodeRemovedEventListener, true);
-        evtTarget.removeEventListenerNS
-            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
-             subtreeModifiedEventListener, false);
+        removeTextEventListeners(ctx, (NodeEventTarget) evt.getTarget());
         super.handleDOMNodeRemovedEvent(evt);
     }
 
@@ -454,7 +498,7 @@
     /**
      * Invoked when an MutationEvent of type 'DOMSubtree' is fired.
      */
-    public void handleDOMSubtreeModifiedEvent(MutationEvent evt){
+    public void handleDOMSubtreeModifiedEvent(MutationEvent evt) {
         //an operation occured onto the children of the
         //text element, check if the layout was discarded
         if (laidoutText == null) {
@@ -485,7 +529,7 @@
      *   &lt;altGlyph&gt;
      */
     protected boolean isParentDisplayed(Node childNode) {
-        Node parentNode = childNode.getParentNode();
+        Node parentNode = getParentNode(childNode);
         return isTextElement((Element)parentNode);
     }
 
@@ -493,7 +537,7 @@
      * Recompute the layout of the &lt;text&gt; node.
      *
      * Assign onto the TextNode pending to the element
-     * the new recomputed AtrributedString. Also
+     * the new recomputed AttributedString. Also
      * update <code>laidoutText</code> with the new
      * value.
      */
@@ -571,9 +615,9 @@
                                                Element element,
                                                BridgeContext ctx) {
         // Add Paint attributres for children of text element
-        for (Node child = element.getFirstChild();
+        for (Node child = getFirstChild(element);
              child != null;
-             child = child.getNextSibling()) {
+             child = getNextSibling(child)) {
             if (child.getNodeType() != Node.ELEMENT_NODE) 
                 continue;
 
@@ -828,9 +872,9 @@
 	if (o != null)
 	    subBidiLevel = ((Integer)o);
 
-        for (Node n = element.getFirstChild();
+        for (Node n = getFirstChild(element);
              n != null;
-             n = n.getNextSibling()) {
+             n = getNextSibling(n)) {
 
             if (preserve) {
                 prevEndsWithSpace = false;
@@ -1154,9 +1198,9 @@
         if (node2 == null || node1 == null) {
             return false;
         }
-        Node parent = node2.getParentNode();
+        Node parent = getParentNode(node2);
         while (parent != null && parent != node1) {
-            parent = parent.getParentNode();
+            parent = getParentNode(parent);
         }
         return (parent == node1);
     }
@@ -1291,9 +1335,9 @@
                                                    Element element,
                                                    BridgeContext ctx) {
         // do the same for each child element
-        for (Node child = element.getFirstChild();
+        for (Node child = getFirstChild(element);
              child != null;
-             child = child.getNextSibling()) {
+             child = getNextSibling(child)) {
             if (child.getNodeType() != Node.ELEMENT_NODE) continue;
 
             Element childElement = (Element)child;
@@ -1328,9 +1372,9 @@
                                            TextPaintInfo parentPI,
                                            BridgeContext ctx) {
         // Add Paint attributres for children of text element
-        for (Node child = element.getFirstChild();
+        for (Node child = getFirstChild(element);
              child != null;
-             child = child.getNextSibling()) {
+             child = getNextSibling(child)) {
             if (child.getNodeType() != Node.ELEMENT_NODE) {
                 continue;
             }
@@ -2845,7 +2889,7 @@
 
             Element p = runElem;
             while ((p != null) && (p != txtElem) && (p != elem)) {
-                p = (Element)p.getParentNode();
+                p = (Element) txtBridge.getParentNode(p);
             }
             if (p != elem) continue;
 
@@ -2907,7 +2951,7 @@
 
             Element p = runElem;
             while ((p != null) && (p != txtElem) && (p != elem)) {
-                p = (Element)p.getParentNode();
+                p = (Element) txtBridge.getParentNode(p);
             }
             if (p != elem) continue;
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/BindableElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/BindableElementBridge.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/BindableElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/BindableElementBridge.java Thu Oct 13 23:11:08 2005
@@ -214,6 +214,14 @@
     }
 
     /**
+     * Invoked when the xblChildNodes property has changed because a
+     * descendant xbl:content element has updated its selected nodes.
+     */
+    public void handleContentSelectionChangedEvent
+            (ContentSelectionChangedEvent csce) {
+    }
+
+    /**
      * Rebuild the graphics tree.
      */
     protected void handleElementAdded(CompositeGraphicsNode gn, 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java Thu Oct 13 23:11:08 2005
@@ -797,10 +797,6 @@
      * Get the list of child nodes of a node in the fully flattened tree.
      */
     public NodeList getXblChildNodes(Node n) {
-        NodeList nl = getXblDefinitions(n);
-        if (nl.getLength() == 0) {
-            return n.getChildNodes();
-        }
         XBLRecord rec = getRecord(n);
         if (rec.childNodes == null) {
             rec.childNodes = new XblChildNodes(rec);

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java Thu Oct 13 23:11:08 2005
@@ -32,6 +32,8 @@
 import org.apache.batik.dom.events.NodeEventTarget;
 import org.apache.batik.dom.svg.SVGOMDocument;
 import org.apache.batik.dom.svg12.XBLEventSupport;
+import org.apache.batik.dom.svg12.XBLOMShadowTreeElement;
+import org.apache.batik.dom.xbl.NodeXBL;
 import org.apache.batik.dom.xbl.XBLManager;
 import org.apache.batik.script.Interpreter;
 import org.apache.batik.script.InterpreterPool;
@@ -57,7 +59,12 @@
     /**
      * The BindingListener for XBL binding events.
      */
-    protected BindingListener bindingListener;
+    protected XBLBindingListener bindingListener;
+
+    /**
+     * The ContentSelectionChangedListener for xbl:content element events.
+     */
+    protected XBLContentListener contentListener;
 
     /**
      * The EventTarget that has the mouse capture.
@@ -178,6 +185,8 @@
         if (xm != null) {
             bindingListener = new XBLBindingListener();
             xm.addBindingListener(bindingListener);
+            contentListener = new XBLContentListener();
+            xm.addContentSelectionChangedListener(contentListener);
         }
     }
 
@@ -190,6 +199,7 @@
         if (xm instanceof DefaultXBLManager) {
             DefaultXBLManager dxm = (DefaultXBLManager) xm;
             dxm.removeBindingListener(bindingListener);
+            dxm.removeContentSelectionChangedListener(contentListener);
         }
     }
 
@@ -491,6 +501,34 @@
                     h12.handleBindingEvent(bindableElement, shadowTree);
                 } catch (Exception e) {
                     userAgent.displayError(e);
+                }
+            }
+        }
+    }
+
+    /**
+     * The ContentSelectionChangedListener.
+     */
+    protected class XBLContentListener
+            implements ContentSelectionChangedListener {
+        
+        /**
+         * Invoked after an xbl:content element has updated its selected
+         * nodes list.
+         * @param csce the ContentSelectionChangedEvent object
+         */
+        public void contentSelectionChanged(ContentSelectionChangedEvent csce) {
+            Element e = (Element) csce.getContentElement().getParentNode();
+            if (e instanceof XBLOMShadowTreeElement) {
+                e = ((NodeXBL) e).getXblBoundElement();
+            }
+            BridgeUpdateHandler h = getBridgeUpdateHandler(e);
+            if (h instanceof SVG12BridgeUpdateHandler) {
+                SVG12BridgeUpdateHandler h12 = (SVG12BridgeUpdateHandler) h;
+                try {
+                    h12.handleContentSelectionChangedEvent(csce);
+                } catch (Exception ex) {
+                    userAgent.displayError(ex);
                 }
             }
         }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeUpdateHandler.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeUpdateHandler.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeUpdateHandler.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeUpdateHandler.java Thu Oct 13 23:11:08 2005
@@ -35,4 +35,10 @@
      * Invoked when a bindable element's binding has changed.
      */
     void handleBindingEvent(Element bindableElement, Element shadowTree);
+
+    /**
+     * Invoked when the xblChildNodes property has changed because a
+     * descendant xbl:content element has updated its selected nodes.
+     */
+    void handleContentSelectionChangedEvent(ContentSelectionChangedEvent csce);
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12TextElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12TextElementBridge.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12TextElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12TextElementBridge.java Thu Oct 13 23:11:08 2005
@@ -17,10 +17,21 @@
  */
 package org.apache.batik.bridge.svg12;
 
+import org.apache.batik.bridge.Bridge;
+import org.apache.batik.bridge.BridgeContext;
 import org.apache.batik.bridge.SVGTextElementBridge;
+import org.apache.batik.dom.AbstractNode;
+import org.apache.batik.dom.svg12.XBLEventSupport;
+import org.apache.batik.dom.events.EventSupport;
+import org.apache.batik.dom.events.NodeEventTarget;
+import org.apache.batik.dom.xbl.NodeXBL;
 import org.apache.batik.dom.xbl.ShadowTreeEvent;
+import org.apache.batik.util.XMLConstants;
 
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.events.Event;
+import org.w3c.dom.events.MutationEvent;
 
 /**
  * Bridge class for SVG 'text' elements with support for text content
@@ -33,12 +44,148 @@
         extends SVGTextElementBridge
         implements SVG12BridgeUpdateHandler {
 
+    /**
+     * Returns a new instance of this bridge.
+     */
+    public Bridge getInstance() {
+        return new SVG12TextElementBridge();
+    }
+
+    /**
+     * Adds the DOM listeners for this text bridge.
+     */
+    protected void addTextEventListeners(BridgeContext ctx, NodeEventTarget e) {
+        if (childNodeRemovedEventListener == null) {
+            childNodeRemovedEventListener =
+                new DOMChildNodeRemovedEventListener();
+        }
+        if (subtreeModifiedEventListener == null) {
+            subtreeModifiedEventListener =
+                new DOMSubtreeModifiedEventListener();
+        }
+
+        SVG12BridgeContext ctx12 = (SVG12BridgeContext) ctx;
+        AbstractNode n = (AbstractNode) e;
+        XBLEventSupport evtSupport =
+            (XBLEventSupport) n.initializeEventSupport();
+
+        //to be notified when a child is removed from the 
+        //<text> element.
+        evtSupport.addImplementationEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
+             childNodeRemovedEventListener, true);
+        ctx12.storeImplementationEventListenerNS
+            (e, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
+             childNodeRemovedEventListener, true);
+        
+        //to be notified when the modification of the subtree
+        //of the <text> element is done
+        evtSupport.addImplementationEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
+             subtreeModifiedEventListener, false);
+        ctx12.storeImplementationEventListenerNS
+            (e, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
+             subtreeModifiedEventListener, false);
+    }
+
+    /**
+     * Removes the DOM listeners for this text bridge.
+     */
+    protected void removeTextEventListeners(BridgeContext ctx,
+                                            NodeEventTarget e) {
+        AbstractNode n = (AbstractNode) e;
+        XBLEventSupport evtSupport =
+            (XBLEventSupport) n.initializeEventSupport();
+
+        evtSupport.removeImplementationEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
+             childNodeRemovedEventListener, true);
+        evtSupport.removeImplementationEventListenerNS
+            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified",
+             subtreeModifiedEventListener, false);
+    }
+
+    /**
+     * The DOM EventListener invoked when a node is removed.
+     */
+    protected class DOMChildNodeRemovedEventListener
+            extends SVGTextElementBridge.DOMChildNodeRemovedEventListener {
+        public void handleEvent(Event evt) {
+            super.handleEvent(EventSupport.getUltimateOriginalEvent(evt));
+        }
+    }
+
+    /**
+     * The DOM EventListener invoked when the subtree is modified.
+     */
+    protected class DOMSubtreeModifiedEventListener
+            extends SVGTextElementBridge.DOMSubtreeModifiedEventListener {
+        public void handleEvent(Event evt) {
+            System.err.println("***");
+            super.handleEvent(EventSupport.getUltimateOriginalEvent(evt));
+        }
+    }
+
+    // Tree navigation ------------------------------------------------------
+
+    /**
+     * Returns the first child node of the given node that should be
+     * processed by the text bridge.
+     */
+    protected Node getFirstChild(Node n) {
+        return ((NodeXBL) n).getXblFirstChild();
+    }
+
+    /**
+     * Returns the next sibling node of the given node that should be
+     * processed by the text bridge.
+     */
+    protected Node getNextSibling(Node n) {
+        return ((NodeXBL) n).getXblNextSibling();
+    }
+
+    /**
+     * Returns the parent node of the given node that should be
+     * processed by the text bridge.
+     */
+    protected Node getParentNode(Node n) {
+        return ((NodeXBL) n).getXblParentNode();
+    }
+
     // SVG12BridgeUpdateHandler //////////////////////////////////////////////
 
     /**
+     * Invoked when an MutationEvent of type 'DOMCharacterDataModified' 
+     * is fired.
+     */
+    public void handleDOMCharacterDataModified(MutationEvent evt) {
+        Node childNode = (Node)evt.getTarget();
+        //if the parent is displayed, then discard the layout.
+        if (isParentDisplayed(childNode)) {
+            if (getParentNode(childNode) != childNode.getParentNode()) {
+                // This text node was selected with an xbl:content element,
+                // so a DOMSubtreeModified event is not going to be captured.
+                // Better recompute the text layout now.
+                computeLaidoutText(ctx, e, node);
+            } else {
+                laidoutText = null;
+            }
+        }
+    }
+
+    /**
      * Invoked when a bindable element's binding has changed.
      */
     public void handleBindingEvent(Element bindableElement,
                                    Element shadowTree) {
+    }
+
+    /**
+     * Invoked when the xblChildNodes property has changed because a
+     * descendant xbl:content element has updated its selected nodes.
+     */
+    public void handleContentSelectionChangedEvent
+            (ContentSelectionChangedEvent csce) {
+        computeLaidoutText(ctx, e, node);
     }
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java Thu Oct 13 23:11:08 2005
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 1999-2003  The Apache Software Foundation 
+   Copyright 1999-2003,2005  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 
 package org.apache.batik.bridge.svg12;
 
+import java.awt.RenderingHints;
 import java.awt.Shape;
 import java.awt.font.TextAttribute;
 import java.awt.geom.AffineTransform;
@@ -52,9 +53,12 @@
 import org.apache.batik.css.engine.value.ValueConstants;
 
 import org.apache.batik.dom.events.NodeEventTarget;
+import org.apache.batik.dom.svg.SVGOMElement;
+import org.apache.batik.dom.svg12.SVGOMFlowRegionElement;
 import org.apache.batik.dom.util.XMLSupport;
 import org.apache.batik.dom.util.XLinkSupport;
 
+import org.apache.batik.gvt.CompositeGraphicsNode;
 import org.apache.batik.gvt.GraphicsNode;
 import org.apache.batik.gvt.flow.BlockInfo;
 import org.apache.batik.gvt.flow.FlowTextNode;
@@ -74,7 +78,7 @@
  * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
  * @version $Id$
  */
-public class SVGFlowRootElementBridge extends SVGTextElementBridge {
+public class SVGFlowRootElementBridge extends SVG12TextElementBridge {
 
     public static final AttributedCharacterIterator.Attribute FLOW_PARAGRAPH
         = GVTAttributedCharacterIterator.TextAttribute.FLOW_PARAGRAPH;
@@ -125,8 +129,61 @@
         return false;
     }
 
+    /**
+     * Creates a <tt>GraphicsNode</tt> according to the specified parameters.
+     *
+     * @param ctx the bridge context to use
+     * @param e the element that describes the graphics node to build
+     * @return a graphics node that represents the specified element
+     */
+    public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
+        // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage'
+        if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) {
+            return null;
+        }
+
+        CompositeGraphicsNode cgn = new CompositeGraphicsNode();
+
+        // 'transform'
+        String s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
+        if (s.length() != 0) {
+            cgn.setTransform
+                (SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
+        }
+        // 'visibility'
+        cgn.setVisible(CSSUtilities.convertVisibility(e));
+
+        // 'text-rendering' and 'color-rendering'
+        RenderingHints hints = null;
+        hints = CSSUtilities.convertColorRendering(e, hints);
+        hints = CSSUtilities.convertTextRendering (e, hints);
+        if (hints != null) {
+            cgn.setRenderingHints(hints);
+        }
+
+        // first child holds the flow region nodes
+        CompositeGraphicsNode cgn2 = new CompositeGraphicsNode();
+        cgn.add(cgn2);
+
+        // second child is the text node
+        FlowTextNode tn = new FlowTextNode();
+        tn.setLocation(getLocation(ctx, e));
+
+        // specify the text painter to use
+        if (ctx.getTextPainter() != null) {
+            tn.setTextPainter(ctx.getTextPainter());
+        }
+
+        cgn.add(tn);
+
+        return cgn;
+    }
+
+    /**
+     * Creates the graphics node for this element.
+     */
     protected GraphicsNode instantiateGraphicsNode() {
-        return new FlowTextNode();
+        return null; // createGraphicsNode is fully overridden
     }
 
     /**
@@ -163,6 +220,43 @@
                 nodeName.equals(SVG12Constants.SVG_FLOW_SPAN_TAG));
     }
     
+    /**
+     * Builds using the specified BridgeContext and element, the
+     * specified graphics node.
+     *
+     * @param ctx the bridge context to use
+     * @param e the element that describes the graphics node to build
+     * @param node the graphics node to build
+     */
+    public void buildGraphicsNode(BridgeContext ctx,
+                                  Element e,
+                                  GraphicsNode node) {
+        CompositeGraphicsNode cgn = (CompositeGraphicsNode) node;
+
+        // build flowRegion shapes
+        CompositeGraphicsNode cgn2 = (CompositeGraphicsNode) cgn.get(0);
+        GVTBuilder builder = ctx.getGVTBuilder();
+        for (Node n = getFirstChild(e); n != null; n = getNextSibling(n)) {
+            if (n instanceof SVGOMFlowRegionElement) {
+                for (Node m = getFirstChild(n);
+                        m != null;
+                        m = getNextSibling(m)) {
+                    if (m.getNodeType() != Node.ELEMENT_NODE) {
+                        continue;
+                    }
+                    GraphicsNode gn = builder.build(ctx, (Element) m);
+                    if (gn != null) {
+                        cgn2.add(gn);
+                    }
+                }
+            }
+        }
+
+        // build text node
+        GraphicsNode tn = (GraphicsNode) cgn.get(1);
+        super.buildGraphicsNode(ctx, e, tn);
+    }
+
     protected void computeLaidoutText(BridgeContext ctx, 
                                        Element e,
                                        GraphicsNode node) {
@@ -170,6 +264,33 @@
     }
 
     /**
+     * Add to the element children of the node, a
+     * <code>SVGContext</code> to support dynamic update. This is
+     * recursive, the children of the nodes are also traversed to add
+     * to the support elements their context
+     *
+     * @param ctx a <code>BridgeContext</code> value
+     * @param e an <code>Element</code> value
+     *
+     * @see org.apache.batik.dom.svg.SVGContext
+     * @see org.apache.batik.bridge.BridgeUpdateHandler
+     */
+    protected void addContextToChild(BridgeContext ctx, Element e) {
+        if (SVG_NAMESPACE_URI.equals(e.getNamespaceURI())) {
+            String ln = e.getLocalName();
+            if (ln.equals(SVG12Constants.SVG_FLOW_DIV_TAG)
+                    || ln.equals(SVG12Constants.SVG_FLOW_LINE_TAG)
+                    || ln.equals(SVG12Constants.SVG_FLOW_PARA_TAG)
+                    || ln.equals(SVG12Constants.SVG_FLOW_SPAN_TAG)) {
+                ((SVGOMElement) e).setSVGContext
+                    (new FlowContentBridge(ctx, this, e));
+            }
+        }
+
+        super.addContextToChild(ctx, e);
+    }
+
+    /**
      * Creates the attributed string which represents the given text
      * element children.
      *
@@ -216,8 +337,8 @@
 
         if (!nodeName.equals(SVG12Constants.SVG_FLOW_ROOT_TAG)) return null;
         
-        for (Node n = elem.getFirstChild();
-             n != null; n = n.getNextSibling()) {
+        for (Node n = getFirstChild(elem);
+             n != null; n = getNextSibling(n)) {
             if (n.getNodeType()     != Node.ELEMENT_NODE) continue;
 
             String nNS = n.getNamespaceURI();
@@ -244,8 +365,8 @@
         List paraEnds  = new ArrayList();
         List paraElems = new ArrayList();
         List lnLocs    = new ArrayList();
-        for (Node n = div.getFirstChild();
-             n != null; n = n.getNextSibling()) {
+        for (Node n = getFirstChild(div);
+             n != null; n = getNextSibling(n)) {
             if (n.getNodeType()     != Node.ELEMENT_NODE) continue;
             if (!getNamespaceURI().equals(n.getNamespaceURI())) continue;
             Element e = (Element)n;
@@ -311,8 +432,8 @@
         // Element comes in as flowDiv element we want flowRoot.
         element = (Element)element.getParentNode();
         List ret = new LinkedList();
-        for (Node n = element.getFirstChild();
-             n != null; n = n.getNextSibling()) {
+        for (Node n = getFirstChild(element);
+             n != null; n = getNextSibling(n)) {
             
             if (n.getNodeType()     != Node.ELEMENT_NODE) continue;
             if (!SVG12Constants.SVG_NAMESPACE_URI.equals(n.getNamespaceURI())) 
@@ -334,22 +455,22 @@
     protected void gatherRegionInfo(BridgeContext ctx, Element rgn,
                                     float verticalAlign, List regions) {
 
-        GVTBuilder builder = ctx.getGVTBuilder();
-        for (Node n = rgn.getFirstChild(); 
-             n != null; n = n.getNextSibling()) {
-
-            if (n.getNodeType()     != Node.ELEMENT_NODE) continue;
-            if (!getNamespaceURI().equals(n.getNamespaceURI())) continue;
-            Element e = (Element)n;
+        for (Node n = getFirstChild(rgn); n != null; n = getNextSibling(n)) {
 
-            GraphicsNode gn = builder.build(ctx, e) ;
-            if (gn == null) continue;
+            if (n.getNodeType() != Node.ELEMENT_NODE) {
+                continue;
+            }
 
+            GraphicsNode gn = ctx.getGraphicsNode((Element) n);
             Shape s = gn.getOutline();
-            if (s == null) continue;
+            if (s == null) {
+                continue;
+            }
+
             AffineTransform at = gn.getTransform();
-            if (at != null) 
+            if (at != null) {
                 s = at.createTransformedShape(s);
+            }
             regions.add(new RegionInfo(s, verticalAlign));
         }
     }
@@ -393,9 +514,9 @@
         if (lnLocs.size() != 0)
             lineBreak = ((Integer)lnLocs.get(lnLocs.size()-1)).intValue();
 
-        for (Node n = element.getFirstChild();
+        for (Node n = getFirstChild(element);
              n != null;
-             n = n.getNextSibling()) {
+             n = getNextSibling(n)) {
             
             if (preserve) {
                 prevEndsWithSpace = false;
@@ -656,5 +777,20 @@
             ((LineHeightValue)v).getFontSizeRelative())
             lineHeight *= fontSize;
         return lineHeight;
+    }
+
+    /**
+     * Bridge class for flow text children that contain text.
+     */
+    protected class FlowContentBridge extends AbstractTextChildTextContent {
+
+        /**
+         * Creates a new FlowContentBridge.
+         */
+        public FlowContentBridge(BridgeContext ctx,
+                                 SVGTextElementBridge parent,
+                                 Element e) {
+            super(ctx, parent, e);
+        }
     }
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java Thu Oct 13 23:11:08 2005
@@ -705,7 +705,8 @@
                 || eventType.equals("MouseEvent")
                 || eventType.equals("KeyEvent")
                 || eventType.equals("KeyboardEvent")
-                || eventType.equals("TextEvent");
+                || eventType.equals("TextEvent")
+                || eventType.equals("CustomEvent");
         }
         return false;
     }

Added: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMCustomEvent.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMCustomEvent.java?rev=321030&view=auto
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMCustomEvent.java (added)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMCustomEvent.java Thu Oct 13 23:11:08 2005
@@ -0,0 +1,51 @@
+/*
+
+   Copyright 2005  The Apache Software Foundation 
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.batik.dom.events;
+
+/**
+ * A custom event object.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id$
+ */
+public class DOMCustomEvent extends DOMEvent {
+
+    /**
+     * The custom details associated with this event.
+     */
+    protected Object details;
+
+    /**
+     * Returns the custom details of this event.
+     */
+    public Object getDetails() {
+        return details;
+    }
+
+    /**
+     * Initializes this custom event.
+     */
+    public void initCustomEventNS(String namespaceURIArg,
+                                  String typeArg,
+                                  boolean canBubbleArg,
+                                  boolean cancelableArg,
+                                  Object detailsArg) {
+        initEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg);
+        details = detailsArg;
+    }
+}

Propchange: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMCustomEvent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DocumentEventSupport.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DocumentEventSupport.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DocumentEventSupport.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DocumentEventSupport.java Thu Oct 13 23:11:08 2005
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2001-2003  The Apache Software Foundation 
+   Copyright 2001-2005  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -65,6 +65,11 @@
     public static final String TEXT_EVENT_TYPE = "TextEvent";
     
     /**
+     * The CustomEvent type.
+     */
+    public static final String CUSTOM_EVENT_TYPE = "CustomEvent";
+
+    /**
      * The Event type.
      */
     public static final String EVENT_DOM2_TYPE = "Events";
@@ -109,6 +114,8 @@
                            new UIEventFactory());
         eventFactories.put(TEXT_EVENT_TYPE.toLowerCase(),
                            new TextEventFactory());
+        eventFactories.put(CUSTOM_EVENT_TYPE.toLowerCase(),
+                           new CustomEventFactory());
         // DOM 2 event names:
         eventFactories.put(EVENT_DOM2_TYPE.toLowerCase(),
                            new SimpleEventFactory());
@@ -273,6 +280,18 @@
          */
         public Event createEvent() {
             return new DOMTextEvent();
+        }
+    }
+
+    /**
+     * To create a Custom event.
+     */
+    protected static class CustomEventFactory implements EventFactory {
+        /**
+         * Creates a new Event object.
+         */
+        public Event createEvent() {
+            return new DOMCustomEvent();
         }
     }
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/UpdateTracker.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/UpdateTracker.java?rev=321030&r1=321029&r2=321030&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/UpdateTracker.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/UpdateTracker.java Thu Oct 13 23:11:08 2005
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 1999-2003  The Apache Software Foundation 
+   Copyright 1999-2003,2005  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@
 import org.apache.batik.gvt.event.GraphicsNodeChangeAdapter;
 import org.apache.batik.gvt.event.GraphicsNodeChangeEvent;
 import org.apache.batik.ext.awt.image.renderable.Filter;
+
 /**
  * This class tracks the changes on a GVT tree
  *
@@ -166,7 +167,7 @@
 
     /**
      * This returns the dirty region for gn in the coordinate system
-     * given by <code>at</at>.
+     * given by <code>at</code>.
      * @param gn Node tree to return dirty region for.
      * @param at Affine transform to coordinate space to accumulate
      *           dirty regions in.
@@ -211,7 +212,7 @@
     }
 
     /**
-     * Recieves notification of a change to a GraphicsNode.
+     * Receives notification of a change to a GraphicsNode.
      * @param gnce The event object describing the GraphicsNode change.
      */
     public void changeStarted(GraphicsNodeChangeEvent gnce) {



Re: svn commit: r321030 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ dom/ dom/events/ gvt/

Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
thomas.deweese@kodak.com:
> > 4. Elements in flowRegions are now rendered.
> 
>    Your solution to this doesn't work for static documents.
> GraphicsNodes are only bound in the BridgeContext in dynamic
> documents.  I think if you run regard all of the flow tests will
> fail.

Oh, right.

> > 2. 'text' elements in 1.2 documents now look at the flattened
> >    tree for content.
> > 5. Fixed small bug with the xblChildNodes NodeList not being updated
> >    properly.
> 
>    I was working on your NPE error and I think my fixes exposed
> a bug in this stuff.  It appears that after the new text is 
> inserted the xblFirstChild doesn't pick it up.

When you commit the fix I'll look at this.

> > -            GraphicsNode gn = builder.build(ctx, e) ;
> > +            GraphicsNode gn = ctx.getGraphicsNode((Element) n);
> 
>    This won't work in a static document (it will return null).
> The two options I can think of are to switch how you get the
> GN based on if the ctx is dynamic, or to manage a local cache/map
> when you create the flowRegion stuff.

Understood.

>    To be honest I wouldn't worry to much about this since
> the SVG WG seems to be heading in a different direction.
> My guess is that we will be tossing this code when the
> SVG WG gets around to letting implementers know what they
> are planning for flow text in SVG 1.2 (full). Thank you
> very much!

Yeah, I know, but I need to get updates to flow text working for my own
purposes and I figured I may as well commit it if I've made the
changes.

Cameron

-- 
  e-mail : cam (at) mcc.id.au    	icq : 26955922
     web : http://mcc.id.au/	        msn : cam-msn (at) aka.mcc.id.au
  office : +61399055779		     jabber : heycam (at) jabber.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: svn commit: r321030 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ dom/ dom/events/ gvt/

Posted by th...@kodak.com.
Hi Cam,

cam@apache.org wrote on 10/14/2005 02:11:21 AM:

> 4. Elements in flowRegions are now rendered.

   Your solution to this doesn't work for static documents.
GraphicsNodes are only bound in the BridgeContext in dynamic
documents.  I think if you run regard all of the flow tests will
fail.

> 2. 'text' elements in 1.2 documents now look at the flattened
>    tree for content.
> 5. Fixed small bug with the xblChildNodes NodeList not being updated
>    properly.

   I was working on your NPE error and I think my fixes exposed
a bug in this stuff.  It appears that after the new text is 
inserted the xblFirstChild doesn't pick it up.

> -            GraphicsNode gn = builder.build(ctx, e) ;
> +            GraphicsNode gn = ctx.getGraphicsNode((Element) n);

   This won't work in a static document (it will return null).
The two options I can think of are to switch how you get the
GN based on if the ctx is dynamic, or to manage a local cache/map
when you create the flowRegion stuff.

   To be honest I wouldn't worry to much about this since
the SVG WG seems to be heading in a different direction.
My guess is that we will be tossing this code when the
SVG WG gets around to letting implementers know what they
are planning for flow text in SVG 1.2 (full). Thank you
very much!

Re: svn commit: r321030 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ dom/ dom/events/ gvt/

Posted by th...@kodak.com.
Hi Cam,

cam@apache.org wrote on 10/14/2005 02:11:21 AM:

> 4. Elements in flowRegions are now rendered.

   Your solution to this doesn't work for static documents.
GraphicsNodes are only bound in the BridgeContext in dynamic
documents.  I think if you run regard all of the flow tests will
fail.

> 2. 'text' elements in 1.2 documents now look at the flattened
>    tree for content.
> 5. Fixed small bug with the xblChildNodes NodeList not being updated
>    properly.

   I was working on your NPE error and I think my fixes exposed
a bug in this stuff.  It appears that after the new text is 
inserted the xblFirstChild doesn't pick it up.

> -            GraphicsNode gn = builder.build(ctx, e) ;
> +            GraphicsNode gn = ctx.getGraphicsNode((Element) n);

   This won't work in a static document (it will return null).
The two options I can think of are to switch how you get the
GN based on if the ctx is dynamic, or to manage a local cache/map
when you create the flowRegion stuff.

   To be honest I wouldn't worry to much about this since
the SVG WG seems to be heading in a different direction.
My guess is that we will be tossing this code when the
SVG WG gets around to letting implementers know what they
are planning for flow text in SVG 1.2 (full). Thank you
very much!

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org