Hi!
I am stuck on a problem for a couple of days. I get the following exception:
java.lang.NullPointerException
at org.apache.batik.bridge.SVGSVGElementBridge.handleDOMAttrModifiedEvent(SVGSVGElementBridge.java:230)
at org.apache.batik.bridge.BridgeContext$DOMAttrModifiedEventListener.handleEvent(BridgeContext.java:1041)
at org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:227)
at org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:184)
at org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:413)
at org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElement.java:502)
at org.apache.batik.dom.AbstractAttr.setNodeValue(AbstractAttr.java:133)
at org.apache.batik.dom.AbstractAttr.setValue(AbstractAttr.java:176)
at org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:231)
at com.redcrea.ina.svg.codegen.helper.LengthXMLAttribute.setLength(LengthXMLAttribute.java:58)


(last line is from my code).

Snippet of the method where the exception occurs:
229 CompositeGraphicsNode gn = node.getParent();
230 gn.remove(node);
231 disposeTree(e);

So it appears that the graphic node has no parent. However, starting an exploration of the svg document in debug mode, one can reach the corresponding element and its associated GraphicsNode. So the element has a parent but the GraphicsNode has not.

In my program this behaviour is 100% reproducible.
Now there is something very puzzling. My application is a graphic editor using direct manipulation, ie I can create shapes and can drag&drop them around, resize them, etc. Some of the graphic elements that appear are actually borrowed from external svg documents, which is somewhat similar to an <image> referencing another svg document, except that I cannot use this mechanism because the target svg documents are not accessible through an URL. So I have to copy the target document's content into the main document. I have two ways of embedding documents:
-In the first one, which I call "reference mode", the target document is copied into the main document after it gets loaded loaded, and is removed just before saving, so that when I next load the main document I will get the later version of the target document.
-In the second one, the target document is copied once and for all into the main document.


When I use the latter mode, I don't have any problem. However with the "reference mode", I can move the object once, but at the second movement I immediately get the exception. When I "move the object", I mean perform a whole dnd operation, which means that the position/size attributes are modified many times (once for each mouse drag event). The only additional thing that is performed between the two moves is that the GVT tree is rendered.

I tried setting the attribute with setAttributeNS and with getAnimatedLength ().getBaseVal ().setValue (), result is the same.

Do you have any idea on what could cause a graphics node of an element that has a parent to not itself have a parent?

Guillaume


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to