You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Denis Bohm <de...@fireflydesign.com> on 2003/08/21 07:31:34 UTC

tspan.setAttributeNS(null, "class", "normal") null pointer exception

Setting color to the Shadow?When I try to append a tspan to a text element
and then set the tspan class:

        Element tspan = document.createElementNS(
            SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
        );
        tspan.appendChild(document.createCDATASection(text));
        text.appendChild(tspan);
        tspan.setAttributeNS(null, "class", "normal");

I get a null pointer exception:

In Event
java.lang.NullPointerException
        at
org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
91)
        at
org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
SEngine.java:2280)
        at
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
a:268)
        at
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
)
        at
org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
        at
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
t.java:544)
        at
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
lement.java:725)
        at
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
tElement.java:672)
        at
org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
)
        at com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
        at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
        at com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
        at
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
a:268)
        at
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
)
        at
org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
        at
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
eEventSupport.java:372)
        at
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
pport.java:286)
        at
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
atcher.java:538)
        at
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
patcher.java:502)
        at
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
er.java:391)
        at
org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
java:244)
        at
org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
nt.java:1989)
        at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
        at java.lang.Thread.run(Thread.java:534)


Am I doing something wrong?

Thanks,
  Denis


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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Thomas DeWeese <Th...@Kodak.com>.
Denis Bohm wrote:
> Hi Thomas,
> 
> Most of it looks good.  But, there seems to be an infinite loop in
> GlyphLayout when selecting a string of an element that was created from Java
> dynamically.  Static text that was loaded with the document seems to work
> fine.  I've attached the test case I used.  Mousing over the bottom text
> works fine, but mousing over the top exhibits the problem.

     The infinate loop is fixed. BTW I'm going to be updating the
code so the way that character index's are done is compliant with
an SVG errata.  Currently it skips characters who's glyphs are not
rendered (text on a path is the most common problem), it will now
include those characters but if you ask for geometry info it will
throw an 'INDEX_SIZE_ERR' to indicate that the location/bounds aren't
available for that character.

> BTW: Thanks for all the quick feedback and help.  It's a fantastic
> contribution!

     Thanks, for the helpful bug reports.

> 
> Denis
> 
> ----- Original Message ----- 
> From: "Thomas DeWeese" <Th...@Kodak.com>
> To: "Batik Users" <ba...@xml.apache.org>
> Sent: Friday, August 22, 2003 4:19 AM
> Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> exception
> 
> 
> 
>>Denis Bohm wrote:
>>
>>>One other side effect of replacing the subtree is that listeners get
> 
> called,
> 
>>>such as mouseout.
>>>
>>>I think I'll try creating a rect subtree behind the text that highlights
> 
> the
> 
>>>text areas next.
>>
>>    I just committed fixes for the clientX/Y parameters, and text
> 
> selection.
> 
>>Let me know if they work for you.
>>
>>
>>>----- Original Message ----- 
>>>From: "Thomas DeWeese" <Th...@Kodak.com>
>>>To: "Batik Users" <ba...@xml.apache.org>
>>>Sent: Thursday, August 21, 2003 12:54 PM
>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
>>>exception
>>>
>>>
>>>
>>>
>>>>Denis Bohm wrote:
>>>>
>>>>
>>>>>Thanks for the tips.  I'll try replacing the DOM subtree to avoid the
>>>>>performance issue.  The only immediate downside to that seems to be
> 
> that
> 
>>>>>text selections can get lost...
>>>>
>>>>   Well if you are willing to talk directly to the JSVGCanvas you can
>>>>get the text selection from that and use it to restore it after you
>>>>add the node back in (once I fix text selection DOM APIs - BTW don't
>>>
>>>bother putting
>>>
>>>
>>>>togeather an example for that I'm going to rework some internal examples
>>>
>>>to use this
>>>
>>>
>>>>API).
>>>>
>>>>
>>>>
>>>>>----- Original Message ----- 
>>>>>From: "Thomas DeWeese" <Th...@Kodak.com>
>>>>>To: "Batik Users" <ba...@xml.apache.org>
>>>>>Sent: Thursday, August 21, 2003 12:24 PM
>>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
>>>>>exception
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Denis Bohm wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>I changed my sources so that if the old property value is null then
> 
> it
> 
>>>>>>>considers it as a change (rather than throwing a null pointer
>>>>>
>>>>>exception).
>>>>>
>>>>>
>>>>>
>>>>>>>Now changing the attribute seems to work.
>>>>>>
>>>>>> This is essentially the patch I was going to make.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>However, it seems very very very
>>>>>>>slow to refresh when changing class attributes that result in simple
>>>>>
>>>>>style
>>>>>
>>>>>
>>>>>
>>>>>>>changes.
>>>>>>
>>>>>>  In SVG there is no such thing as a 'simple style change'.  So for
>>>>>
>>>>>example
>>>>>
>>>>>
>>>>>
>>>>>>if the text uses an SVG font then the font now needs to inherit the
>>>>>
>>>>>modified
>>>>>
>>>>>
>>>>>
>>>>>>fill color.  Also consider that your one element can in certain cases
>>>>>>be mapped into several disjoint pieces by BIDI reordering.  This is
>>>
>>>really
>>>
>>>
>>>>>>amazingly complex stuff.  The text code in Batik is by a fair bit the
>>>>>>most complex piece, the code has been almost completely rewritten
> 
> three
> 
>>>>>times
>>>>>
>>>>>
>>>>>
>>>>>>already and serveral weeks of effort have gone into trying to optimize
>>>
>>>it
>>>
>>>
>>>>>>and still it sucks! :)
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>In my case, the class change only results in changing the fill
>>>>>>>color - which shouldn't effect the bounds of the elements.  Changing
>>>
>>>the
>>>
>>>
>>>>>>>class for about 25 tspan elements (making up one short line of text)
>>>>>
>>>>>takes
>>>>>
>>>>>
>>>>>
>>>>>>>about 1.5 seconds.  I ran OptimizeIt on the code and it appears that
>>>>>
>>>>>each
>>>>>
>>>>>
>>>>>
>>>>>>>time the class property is changed on one tspan element the glyphs go
>>>>>>>through relayout down in the gvt layer.
>>>>>>
>>>>>> I've just taken a look through the code and I may try and optimize
>>>
>>>this
>>>
>>>
>>>>>>case a bit (although SVG Fonts are very problematic).
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>This results in the creation of
>>>>>>>around 27,000 points during the process.
>>>>>>
>>>>>> Hmm, thanks for pointing this out, not that I think this is the
>>>
>>>bottle
>>>
>>>
>>>>>neck
>>>>>
>>>>>
>>>>>
>>>>>>but it was easy to fix most of these :).
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Any tips for speeding up changing the color of text runs?  For
> 
> example,
> 
>>>>>is
>>>>>
>>>>>
>>>>>
>>>>>>>there some way to batch changes to the DOM?
>>>>>>
>>>>>>  The best you can do (and it is probably pretty good) is remove the
>>>>>
>>>>>elements from
>>>>>
>>>>>
>>>>>
>>>>>>the rendering tree: text.parentNode.removeChild(text)  Then make all
>>>
>>>your
>>>
>>>
>>>>>changes
>>>>>
>>>>>
>>>>>
>>>>>>and add it back in - this will keep Batik from trying to keep the
>>>>>
>>>>>rendering tree
>>>>>
>>>>>
>>>>>
>>>>>>in sync with the modified elements.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Thanks,
>>>>>>>Denis
>>>>>>>
>>>>>>>----- Original Message ----- 
>>>>>>>From: "Denis Bohm" <de...@fireflydesign.com>
>>>>>>>To: "Batik Users" <ba...@xml.apache.org>
>>>>>>>Sent: Thursday, August 21, 2003 8:26 AM
>>>>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null
> 
> pointer
> 
>>>>>>>exception
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>I've attached a standalone version that shows the problem.
>>>>>>>>
>>>>>>>>----- Original Message ----- 
>>>>>>>>From: "Thomas DeWeese" <Th...@Kodak.com>
>>>>>>>>To: "Batik Users" <ba...@xml.apache.org>
>>>>>>>>Sent: Thursday, August 21, 2003 5:19 AM
>>>>>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null
>>>
>>>pointer
>>>
>>>
>>>>>>>>exception
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Denis Bohm wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>Setting color to the Shadow?When I try to append a tspan to a text
>>>>>>>>
>>>>>>>>element
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>and then set the tspan class:
>>>>>>>>>>
>>>>>>>>>>     Element tspan = document.createElementNS(
>>>>>>>>>>         SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
>>>>>>>>>>     );
>>>>>>>>>>     tspan.appendChild(document.createCDATASection(text));
>>>>>>>>>>     text.appendChild(tspan);
>>>>>>>>>>     tspan.setAttributeNS(null, "class", "normal");
>>>>>>>>>>
>>>>>>>>>>I get a null pointer exception:
>>>>>>>>>
>>>>>>>>>  Can you provide a standalone version of this problem?
>>>>>>>>>Looking at the line indicated below it isn't real clear why you
>>>>>>>>>would get an NPE.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>In Event
>>>>>>>>>>java.lang.NullPointerException
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> 
>>>>>>>>>>91)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> 
>>>>>>>>>>SEngine.java:2280)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>>>>>>>a:268)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>>>>>>>)
>>>>>>>>>>     at
>>>>
>>>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455
> 
> )
> 
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> 
>>>>>>>>>>t.java:544)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> 
>>>>>>>>>>lement.java:725)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> 
>>>>>>>>>>tElement.java:672)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> 
>>>>>>>>>>)
>>>>>>>>>>     at
>>>>>>>
>>>>>>>com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>>     at
> 
> com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
> 
>>>>>>>>>>     at
>>>>>>>>
>>>>>>>>com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>>>>>>>a:268)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>>>>>>>)
>>>>>>>>>>     at
>>>>
>>>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455
> 
> )
> 
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> 
>>>>>>>>>>eEventSupport.java:372)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> 
>>>>>>>>>>pport.java:286)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> 
>>>>>>>>>>atcher.java:538)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> 
>>>>>>>>>>patcher.java:502)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> 
>>>>>>>>>>er.java:391)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> 
>>>>>>>>>>java:244)
>>>>>>>>>>     at
>>>>>>>>>>
>>>>>>>>
> org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> 
>>>>>>>>>>nt.java:1989)
>>>>>>>>>>     at
>>>>>>>>
>>>>>>>>org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>     at java.lang.Thread.run(Thread.java:534)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Am I doing something wrong?
>>>>>>>>>>
>>>>>>>>>>Thanks,
>>>>>>>>>>Denis
>>>>>>>>>>
>>>>>>>>>>
>>>>
>>>>>>>>---------------------------------------------------------------------
>>>>>>>>
>>>>>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>---------------------------------------------------------------------
>>>>>>>>
>>>>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>-------------------------------------------------------------------------
> 
> -
> 
>>>>>--
>>>>>
>>>>>
>>>>>
>>>>>>>----
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>
>>>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-users-help@xml.apache.org




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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Denis Bohm <de...@fireflydesign.com>.
Hi Thomas,

Most of it looks good.  But, there seems to be an infinite loop in
GlyphLayout when selecting a string of an element that was created from Java
dynamically.  Static text that was loaded with the document seems to work
fine.  I've attached the test case I used.  Mousing over the bottom text
works fine, but mousing over the top exhibits the problem.

BTW: Thanks for all the quick feedback and help.  It's a fantastic
contribution!

Denis

----- Original Message ----- 
From: "Thomas DeWeese" <Th...@Kodak.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Friday, August 22, 2003 4:19 AM
Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
exception


> Denis Bohm wrote:
> > One other side effect of replacing the subtree is that listeners get
called,
> > such as mouseout.
> >
> > I think I'll try creating a rect subtree behind the text that highlights
the
> > text areas next.
>
>     I just committed fixes for the clientX/Y parameters, and text
selection.
> Let me know if they work for you.
>
> >
> > ----- Original Message ----- 
> > From: "Thomas DeWeese" <Th...@Kodak.com>
> > To: "Batik Users" <ba...@xml.apache.org>
> > Sent: Thursday, August 21, 2003 12:54 PM
> > Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> > exception
> >
> >
> >
> >>Denis Bohm wrote:
> >>
> >>>Thanks for the tips.  I'll try replacing the DOM subtree to avoid the
> >>>performance issue.  The only immediate downside to that seems to be
that
> >>>text selections can get lost...
> >>
> >>    Well if you are willing to talk directly to the JSVGCanvas you can
> >>get the text selection from that and use it to restore it after you
> >>add the node back in (once I fix text selection DOM APIs - BTW don't
> >
> > bother putting
> >
> >>togeather an example for that I'm going to rework some internal examples
> >
> > to use this
> >
> >>API).
> >>
> >>
> >>>----- Original Message ----- 
> >>>From: "Thomas DeWeese" <Th...@Kodak.com>
> >>>To: "Batik Users" <ba...@xml.apache.org>
> >>>Sent: Thursday, August 21, 2003 12:24 PM
> >>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> >>>exception
> >>>
> >>>
> >>>
> >>>
> >>>>Denis Bohm wrote:
> >>>>
> >>>>
> >>>>>I changed my sources so that if the old property value is null then
it
> >>>>>considers it as a change (rather than throwing a null pointer
> >>>
> >>>exception).
> >>>
> >>>
> >>>>>Now changing the attribute seems to work.
> >>>>
> >>>>  This is essentially the patch I was going to make.
> >>>>
> >>>>
> >>>>
> >>>>>However, it seems very very very
> >>>>>slow to refresh when changing class attributes that result in simple
> >>>
> >>>style
> >>>
> >>>
> >>>>>changes.
> >>>>
> >>>>   In SVG there is no such thing as a 'simple style change'.  So for
> >>>
> >>>example
> >>>
> >>>
> >>>>if the text uses an SVG font then the font now needs to inherit the
> >>>
> >>>modified
> >>>
> >>>
> >>>>fill color.  Also consider that your one element can in certain cases
> >>>>be mapped into several disjoint pieces by BIDI reordering.  This is
> >
> > really
> >
> >>>>amazingly complex stuff.  The text code in Batik is by a fair bit the
> >>>>most complex piece, the code has been almost completely rewritten
three
> >>>
> >>>times
> >>>
> >>>
> >>>>already and serveral weeks of effort have gone into trying to optimize
> >
> > it
> >
> >>>>and still it sucks! :)
> >>>>
> >>>>
> >>>>
> >>>>>In my case, the class change only results in changing the fill
> >>>>>color - which shouldn't effect the bounds of the elements.  Changing
> >
> > the
> >
> >>>>>class for about 25 tspan elements (making up one short line of text)
> >>>
> >>>takes
> >>>
> >>>
> >>>>>about 1.5 seconds.  I ran OptimizeIt on the code and it appears that
> >>>
> >>>each
> >>>
> >>>
> >>>>>time the class property is changed on one tspan element the glyphs go
> >>>>>through relayout down in the gvt layer.
> >>>>
> >>>>  I've just taken a look through the code and I may try and optimize
> >
> > this
> >
> >>>>case a bit (although SVG Fonts are very problematic).
> >>>>
> >>>>
> >>>>
> >>>>>This results in the creation of
> >>>>>around 27,000 points during the process.
> >>>>
> >>>>  Hmm, thanks for pointing this out, not that I think this is the
> >
> > bottle
> >
> >>>neck
> >>>
> >>>
> >>>>but it was easy to fix most of these :).
> >>>>
> >>>>
> >>>>
> >>>>>Any tips for speeding up changing the color of text runs?  For
example,
> >>>
> >>>is
> >>>
> >>>
> >>>>>there some way to batch changes to the DOM?
> >>>>
> >>>>   The best you can do (and it is probably pretty good) is remove the
> >>>
> >>>elements from
> >>>
> >>>
> >>>>the rendering tree: text.parentNode.removeChild(text)  Then make all
> >
> > your
> >
> >>>changes
> >>>
> >>>
> >>>>and add it back in - this will keep Batik from trying to keep the
> >>>
> >>>rendering tree
> >>>
> >>>
> >>>>in sync with the modified elements.
> >>>>
> >>>>
> >>>>
> >>>>>Thanks,
> >>>>> Denis
> >>>>>
> >>>>>----- Original Message ----- 
> >>>>>From: "Denis Bohm" <de...@fireflydesign.com>
> >>>>>To: "Batik Users" <ba...@xml.apache.org>
> >>>>>Sent: Thursday, August 21, 2003 8:26 AM
> >>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null
pointer
> >>>>>exception
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>I've attached a standalone version that shows the problem.
> >>>>>>
> >>>>>>----- Original Message ----- 
> >>>>>>From: "Thomas DeWeese" <Th...@Kodak.com>
> >>>>>>To: "Batik Users" <ba...@xml.apache.org>
> >>>>>>Sent: Thursday, August 21, 2003 5:19 AM
> >>>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null
> >
> > pointer
> >
> >>>>>>exception
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Denis Bohm wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>Setting color to the Shadow?When I try to append a tspan to a text
> >>>>>>
> >>>>>>element
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>and then set the tspan class:
> >>>>>>>>
> >>>>>>>>      Element tspan = document.createElementNS(
> >>>>>>>>          SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
> >>>>>>>>      );
> >>>>>>>>      tspan.appendChild(document.createCDATASection(text));
> >>>>>>>>      text.appendChild(tspan);
> >>>>>>>>      tspan.setAttributeNS(null, "class", "normal");
> >>>>>>>>
> >>>>>>>>I get a null pointer exception:
> >>>>>>>
> >>>>>>>   Can you provide a standalone version of this problem?
> >>>>>>>Looking at the line indicated below it isn't real clear why you
> >>>>>>>would get an NPE.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>In Event
> >>>>>>>>java.lang.NullPointerException
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> >
> >>>>>>>>91)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> >
> >>>>>>>>SEngine.java:2280)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> >
> >>>>>>>>a:268)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> >
> >>>>>>>>)
> >>>>>>>>      at
> >>
>
>>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455
)
> >>>>>>>
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> >
> >>>>>>>>t.java:544)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> >
> >>>>>>>>lement.java:725)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> >
> >>>>>>>>tElement.java:672)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> >
> >>>>>>>>)
> >>>>>>>>      at
> >>>>>
> >>>>>com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>      at
com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
> >>>>>>>>      at
> >>>>>>
> >>>>>>com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> >
> >>>>>>>>a:268)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> >
> >>>>>>>>)
> >>>>>>>>      at
> >>
>
>>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455
)
> >>>>>>>
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> >
> >>>>>>>>eEventSupport.java:372)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> >
> >>>>>>>>pport.java:286)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> >
> >>>>>>>>atcher.java:538)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> >
> >>>>>>>>patcher.java:502)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> >
> >>>>>>>>er.java:391)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> >
> >>>>>>>>java:244)
> >>>>>>>>      at
> >>>>>>>>
> >>>>>>
> >
org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> >
> >>>>>>>>nt.java:1989)
> >>>>>>>>      at
> >>>>>>
> >>>>>>org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>      at java.lang.Thread.run(Thread.java:534)
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>Am I doing something wrong?
> >>>>>>>>
> >>>>>>>>Thanks,
> >>>>>>>>Denis
> >>>>>>>>
> >>>>>>>>
> >>
>
>>>>>>>---------------------------------------------------------------------
> >>>>>>>
> >>>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
>
>>>>>>>---------------------------------------------------------------------
> >>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>>
>
>>>-------------------------------------------------------------------------
-
> >>>
> >>>--
> >>>
> >>>
> >>>>>----
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
>
>>>>>>---------------------------------------------------------------------
> >>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>>
> >>>>>
> >>>>>
> >>>>>---------------------------------------------------------------------
> >>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>
> >>>
> >>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>

Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Thomas DeWeese <Th...@Kodak.com>.
Denis Bohm wrote:
> One other side effect of replacing the subtree is that listeners get called,
> such as mouseout.
> 
> I think I'll try creating a rect subtree behind the text that highlights the
> text areas next.

    I just committed fixes for the clientX/Y parameters, and text selection.
Let me know if they work for you.

> 
> ----- Original Message ----- 
> From: "Thomas DeWeese" <Th...@Kodak.com>
> To: "Batik Users" <ba...@xml.apache.org>
> Sent: Thursday, August 21, 2003 12:54 PM
> Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> exception
> 
> 
> 
>>Denis Bohm wrote:
>>
>>>Thanks for the tips.  I'll try replacing the DOM subtree to avoid the
>>>performance issue.  The only immediate downside to that seems to be that
>>>text selections can get lost...
>>
>>    Well if you are willing to talk directly to the JSVGCanvas you can
>>get the text selection from that and use it to restore it after you
>>add the node back in (once I fix text selection DOM APIs - BTW don't
> 
> bother putting
> 
>>togeather an example for that I'm going to rework some internal examples
> 
> to use this
> 
>>API).
>>
>>
>>>----- Original Message ----- 
>>>From: "Thomas DeWeese" <Th...@Kodak.com>
>>>To: "Batik Users" <ba...@xml.apache.org>
>>>Sent: Thursday, August 21, 2003 12:24 PM
>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
>>>exception
>>>
>>>
>>>
>>>
>>>>Denis Bohm wrote:
>>>>
>>>>
>>>>>I changed my sources so that if the old property value is null then it
>>>>>considers it as a change (rather than throwing a null pointer
>>>
>>>exception).
>>>
>>>
>>>>>Now changing the attribute seems to work.
>>>>
>>>>  This is essentially the patch I was going to make.
>>>>
>>>>
>>>>
>>>>>However, it seems very very very
>>>>>slow to refresh when changing class attributes that result in simple
>>>
>>>style
>>>
>>>
>>>>>changes.
>>>>
>>>>   In SVG there is no such thing as a 'simple style change'.  So for
>>>
>>>example
>>>
>>>
>>>>if the text uses an SVG font then the font now needs to inherit the
>>>
>>>modified
>>>
>>>
>>>>fill color.  Also consider that your one element can in certain cases
>>>>be mapped into several disjoint pieces by BIDI reordering.  This is
> 
> really
> 
>>>>amazingly complex stuff.  The text code in Batik is by a fair bit the
>>>>most complex piece, the code has been almost completely rewritten three
>>>
>>>times
>>>
>>>
>>>>already and serveral weeks of effort have gone into trying to optimize
> 
> it
> 
>>>>and still it sucks! :)
>>>>
>>>>
>>>>
>>>>>In my case, the class change only results in changing the fill
>>>>>color - which shouldn't effect the bounds of the elements.  Changing
> 
> the
> 
>>>>>class for about 25 tspan elements (making up one short line of text)
>>>
>>>takes
>>>
>>>
>>>>>about 1.5 seconds.  I ran OptimizeIt on the code and it appears that
>>>
>>>each
>>>
>>>
>>>>>time the class property is changed on one tspan element the glyphs go
>>>>>through relayout down in the gvt layer.
>>>>
>>>>  I've just taken a look through the code and I may try and optimize
> 
> this
> 
>>>>case a bit (although SVG Fonts are very problematic).
>>>>
>>>>
>>>>
>>>>>This results in the creation of
>>>>>around 27,000 points during the process.
>>>>
>>>>  Hmm, thanks for pointing this out, not that I think this is the
> 
> bottle
> 
>>>neck
>>>
>>>
>>>>but it was easy to fix most of these :).
>>>>
>>>>
>>>>
>>>>>Any tips for speeding up changing the color of text runs?  For example,
>>>
>>>is
>>>
>>>
>>>>>there some way to batch changes to the DOM?
>>>>
>>>>   The best you can do (and it is probably pretty good) is remove the
>>>
>>>elements from
>>>
>>>
>>>>the rendering tree: text.parentNode.removeChild(text)  Then make all
> 
> your
> 
>>>changes
>>>
>>>
>>>>and add it back in - this will keep Batik from trying to keep the
>>>
>>>rendering tree
>>>
>>>
>>>>in sync with the modified elements.
>>>>
>>>>
>>>>
>>>>>Thanks,
>>>>> Denis
>>>>>
>>>>>----- Original Message ----- 
>>>>>From: "Denis Bohm" <de...@fireflydesign.com>
>>>>>To: "Batik Users" <ba...@xml.apache.org>
>>>>>Sent: Thursday, August 21, 2003 8:26 AM
>>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
>>>>>exception
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>I've attached a standalone version that shows the problem.
>>>>>>
>>>>>>----- Original Message ----- 
>>>>>>From: "Thomas DeWeese" <Th...@Kodak.com>
>>>>>>To: "Batik Users" <ba...@xml.apache.org>
>>>>>>Sent: Thursday, August 21, 2003 5:19 AM
>>>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null
> 
> pointer
> 
>>>>>>exception
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Denis Bohm wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Setting color to the Shadow?When I try to append a tspan to a text
>>>>>>
>>>>>>element
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>and then set the tspan class:
>>>>>>>>
>>>>>>>>      Element tspan = document.createElementNS(
>>>>>>>>          SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
>>>>>>>>      );
>>>>>>>>      tspan.appendChild(document.createCDATASection(text));
>>>>>>>>      text.appendChild(tspan);
>>>>>>>>      tspan.setAttributeNS(null, "class", "normal");
>>>>>>>>
>>>>>>>>I get a null pointer exception:
>>>>>>>
>>>>>>>   Can you provide a standalone version of this problem?
>>>>>>>Looking at the line indicated below it isn't real clear why you
>>>>>>>would get an NPE.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>In Event
>>>>>>>>java.lang.NullPointerException
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> 
>>>>>>>>91)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> 
>>>>>>>>SEngine.java:2280)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>>>>>a:268)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>>>>>)
>>>>>>>>      at
>>
>>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>>>>>>>
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> 
>>>>>>>>t.java:544)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> 
>>>>>>>>lement.java:725)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> 
>>>>>>>>tElement.java:672)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> 
>>>>>>>>)
>>>>>>>>      at
>>>>>
>>>>>com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
>>>>>
>>>>>
>>>>>
>>>>>>>>      at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
>>>>>>>>      at
>>>>>>
>>>>>>com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>>>>>a:268)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>>>>>)
>>>>>>>>      at
>>
>>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>>>>>>>
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> 
>>>>>>>>eEventSupport.java:372)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> 
>>>>>>>>pport.java:286)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> 
>>>>>>>>atcher.java:538)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> 
>>>>>>>>patcher.java:502)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> 
>>>>>>>>er.java:391)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> 
>>>>>>>>java:244)
>>>>>>>>      at
>>>>>>>>
>>>>>>
> org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> 
>>>>>>>>nt.java:1989)
>>>>>>>>      at
>>>>>>
>>>>>>org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>      at java.lang.Thread.run(Thread.java:534)
>>>>>>>>
>>>>>>>>
>>>>>>>>Am I doing something wrong?
>>>>>>>>
>>>>>>>>Thanks,
>>>>>>>>Denis
>>>>>>>>
>>>>>>>>
>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>
>>>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>--------------------------------------------------------------------------
>>>
>>>--
>>>
>>>
>>>>>----
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 




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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Denis Bohm <de...@fireflydesign.com>.
One other side effect of replacing the subtree is that listeners get called,
such as mouseout.

I think I'll try creating a rect subtree behind the text that highlights the
text areas next.

----- Original Message ----- 
From: "Thomas DeWeese" <Th...@Kodak.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Thursday, August 21, 2003 12:54 PM
Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
exception


> Denis Bohm wrote:
> > Thanks for the tips.  I'll try replacing the DOM subtree to avoid the
> > performance issue.  The only immediate downside to that seems to be that
> > text selections can get lost...
>
>     Well if you are willing to talk directly to the JSVGCanvas you can
> get the text selection from that and use it to restore it after you
> add the node back in (once I fix text selection DOM APIs - BTW don't
bother putting
> togeather an example for that I'm going to rework some internal examples
to use this
> API).
>
> >
> > ----- Original Message ----- 
> > From: "Thomas DeWeese" <Th...@Kodak.com>
> > To: "Batik Users" <ba...@xml.apache.org>
> > Sent: Thursday, August 21, 2003 12:24 PM
> > Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> > exception
> >
> >
> >
> >>Denis Bohm wrote:
> >>
> >>>I changed my sources so that if the old property value is null then it
> >>>considers it as a change (rather than throwing a null pointer
> >
> > exception).
> >
> >>>Now changing the attribute seems to work.
> >>
> >>   This is essentially the patch I was going to make.
> >>
> >>
> >>>However, it seems very very very
> >>>slow to refresh when changing class attributes that result in simple
> >
> > style
> >
> >>>changes.
> >>
> >>    In SVG there is no such thing as a 'simple style change'.  So for
> >
> > example
> >
> >>if the text uses an SVG font then the font now needs to inherit the
> >
> > modified
> >
> >>fill color.  Also consider that your one element can in certain cases
> >>be mapped into several disjoint pieces by BIDI reordering.  This is
really
> >>amazingly complex stuff.  The text code in Batik is by a fair bit the
> >>most complex piece, the code has been almost completely rewritten three
> >
> > times
> >
> >>already and serveral weeks of effort have gone into trying to optimize
it
> >>and still it sucks! :)
> >>
> >>
> >>>In my case, the class change only results in changing the fill
> >>>color - which shouldn't effect the bounds of the elements.  Changing
the
> >>>class for about 25 tspan elements (making up one short line of text)
> >
> > takes
> >
> >>>about 1.5 seconds.  I ran OptimizeIt on the code and it appears that
> >
> > each
> >
> >>>time the class property is changed on one tspan element the glyphs go
> >>>through relayout down in the gvt layer.
> >>
> >>   I've just taken a look through the code and I may try and optimize
this
> >>case a bit (although SVG Fonts are very problematic).
> >>
> >>
> >>>This results in the creation of
> >>>around 27,000 points during the process.
> >>
> >>   Hmm, thanks for pointing this out, not that I think this is the
bottle
> >
> > neck
> >
> >>but it was easy to fix most of these :).
> >>
> >>
> >>>Any tips for speeding up changing the color of text runs?  For example,
> >
> > is
> >
> >>>there some way to batch changes to the DOM?
> >>
> >>    The best you can do (and it is probably pretty good) is remove the
> >
> > elements from
> >
> >>the rendering tree: text.parentNode.removeChild(text)  Then make all
your
> >
> > changes
> >
> >>and add it back in - this will keep Batik from trying to keep the
> >
> > rendering tree
> >
> >>in sync with the modified elements.
> >>
> >>
> >>>Thanks,
> >>>  Denis
> >>>
> >>>----- Original Message ----- 
> >>>From: "Denis Bohm" <de...@fireflydesign.com>
> >>>To: "Batik Users" <ba...@xml.apache.org>
> >>>Sent: Thursday, August 21, 2003 8:26 AM
> >>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> >>>exception
> >>>
> >>>
> >>>
> >>>
> >>>>I've attached a standalone version that shows the problem.
> >>>>
> >>>>----- Original Message ----- 
> >>>>From: "Thomas DeWeese" <Th...@Kodak.com>
> >>>>To: "Batik Users" <ba...@xml.apache.org>
> >>>>Sent: Thursday, August 21, 2003 5:19 AM
> >>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null
pointer
> >>>>exception
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Denis Bohm wrote:
> >>>>>
> >>>>>
> >>>>>>Setting color to the Shadow?When I try to append a tspan to a text
> >>>>
> >>>>element
> >>>>
> >>>>
> >>>>>>and then set the tspan class:
> >>>>>>
> >>>>>>       Element tspan = document.createElementNS(
> >>>>>>           SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
> >>>>>>       );
> >>>>>>       tspan.appendChild(document.createCDATASection(text));
> >>>>>>       text.appendChild(tspan);
> >>>>>>       tspan.setAttributeNS(null, "class", "normal");
> >>>>>>
> >>>>>>I get a null pointer exception:
> >>>>>
> >>>>>    Can you provide a standalone version of this problem?
> >>>>>Looking at the line indicated below it isn't real clear why you
> >>>>>would get an NPE.
> >>>>>
> >>>>>
> >>>>>
> >>>>>>In Event
> >>>>>>java.lang.NullPointerException
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> >
> >>>>>>91)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> >
> >>>>>>SEngine.java:2280)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> >
> >>>>>>a:268)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> >
> >>>>>>)
> >>>>>>       at
>
>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> >
> >>>>>>t.java:544)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> >
> >>>>>>lement.java:725)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> >
> >>>>>>tElement.java:672)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> >
> >>>>>>)
> >>>>>>       at
> >>>
> >>>com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
> >>>
> >>>
> >>>>>>       at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
> >>>>>>       at
> >>>>
> >>>>com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
> >>>>
> >>>>
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> >
> >>>>>>a:268)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> >
> >>>>>>)
> >>>>>>       at
>
>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> >
> >>>>>>eEventSupport.java:372)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> >
> >>>>>>pport.java:286)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> >
> >>>>>>atcher.java:538)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> >
> >>>>>>patcher.java:502)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> >
> >>>>>>er.java:391)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> >
> >>>>>>java:244)
> >>>>>>       at
> >>>>>>
> >>>>
> >
org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> >
> >>>>>>nt.java:1989)
> >>>>>>       at
> >>>>
> >>>>org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
> >>>>
> >>>>
> >>>>>>       at java.lang.Thread.run(Thread.java:534)
> >>>>>>
> >>>>>>
> >>>>>>Am I doing something wrong?
> >>>>>>
> >>>>>>Thanks,
> >>>>>> Denis
> >>>>>>
> >>>>>>
>
>>>>>>---------------------------------------------------------------------
> >>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>---------------------------------------------------------------------
> >>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>
>
>>--------------------------------------------------------------------------
> >
> > --
> >
> >>>----
> >>>
> >>>
> >>>
> >>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>
> >>>
> >>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>


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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Thomas DeWeese <Th...@Kodak.com>.
Denis Bohm wrote:
> Thanks for the tips.  I'll try replacing the DOM subtree to avoid the
> performance issue.  The only immediate downside to that seems to be that
> text selections can get lost...

    Well if you are willing to talk directly to the JSVGCanvas you can
get the text selection from that and use it to restore it after you
add the node back in (once I fix text selection DOM APIs - BTW don't bother putting
togeather an example for that I'm going to rework some internal examples to use this
API).

> 
> ----- Original Message ----- 
> From: "Thomas DeWeese" <Th...@Kodak.com>
> To: "Batik Users" <ba...@xml.apache.org>
> Sent: Thursday, August 21, 2003 12:24 PM
> Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> exception
> 
> 
> 
>>Denis Bohm wrote:
>>
>>>I changed my sources so that if the old property value is null then it
>>>considers it as a change (rather than throwing a null pointer
> 
> exception).
> 
>>>Now changing the attribute seems to work.
>>
>>   This is essentially the patch I was going to make.
>>
>>
>>>However, it seems very very very
>>>slow to refresh when changing class attributes that result in simple
> 
> style
> 
>>>changes.
>>
>>    In SVG there is no such thing as a 'simple style change'.  So for
> 
> example
> 
>>if the text uses an SVG font then the font now needs to inherit the
> 
> modified
> 
>>fill color.  Also consider that your one element can in certain cases
>>be mapped into several disjoint pieces by BIDI reordering.  This is really
>>amazingly complex stuff.  The text code in Batik is by a fair bit the
>>most complex piece, the code has been almost completely rewritten three
> 
> times
> 
>>already and serveral weeks of effort have gone into trying to optimize it
>>and still it sucks! :)
>>
>>
>>>In my case, the class change only results in changing the fill
>>>color - which shouldn't effect the bounds of the elements.  Changing the
>>>class for about 25 tspan elements (making up one short line of text)
> 
> takes
> 
>>>about 1.5 seconds.  I ran OptimizeIt on the code and it appears that
> 
> each
> 
>>>time the class property is changed on one tspan element the glyphs go
>>>through relayout down in the gvt layer.
>>
>>   I've just taken a look through the code and I may try and optimize this
>>case a bit (although SVG Fonts are very problematic).
>>
>>
>>>This results in the creation of
>>>around 27,000 points during the process.
>>
>>   Hmm, thanks for pointing this out, not that I think this is the bottle
> 
> neck
> 
>>but it was easy to fix most of these :).
>>
>>
>>>Any tips for speeding up changing the color of text runs?  For example,
> 
> is
> 
>>>there some way to batch changes to the DOM?
>>
>>    The best you can do (and it is probably pretty good) is remove the
> 
> elements from
> 
>>the rendering tree: text.parentNode.removeChild(text)  Then make all your
> 
> changes
> 
>>and add it back in - this will keep Batik from trying to keep the
> 
> rendering tree
> 
>>in sync with the modified elements.
>>
>>
>>>Thanks,
>>>  Denis
>>>
>>>----- Original Message ----- 
>>>From: "Denis Bohm" <de...@fireflydesign.com>
>>>To: "Batik Users" <ba...@xml.apache.org>
>>>Sent: Thursday, August 21, 2003 8:26 AM
>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
>>>exception
>>>
>>>
>>>
>>>
>>>>I've attached a standalone version that shows the problem.
>>>>
>>>>----- Original Message ----- 
>>>>From: "Thomas DeWeese" <Th...@Kodak.com>
>>>>To: "Batik Users" <ba...@xml.apache.org>
>>>>Sent: Thursday, August 21, 2003 5:19 AM
>>>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
>>>>exception
>>>>
>>>>
>>>>
>>>>
>>>>>Denis Bohm wrote:
>>>>>
>>>>>
>>>>>>Setting color to the Shadow?When I try to append a tspan to a text
>>>>
>>>>element
>>>>
>>>>
>>>>>>and then set the tspan class:
>>>>>>
>>>>>>       Element tspan = document.createElementNS(
>>>>>>           SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
>>>>>>       );
>>>>>>       tspan.appendChild(document.createCDATASection(text));
>>>>>>       text.appendChild(tspan);
>>>>>>       tspan.setAttributeNS(null, "class", "normal");
>>>>>>
>>>>>>I get a null pointer exception:
>>>>>
>>>>>    Can you provide a standalone version of this problem?
>>>>>Looking at the line indicated below it isn't real clear why you
>>>>>would get an NPE.
>>>>>
>>>>>
>>>>>
>>>>>>In Event
>>>>>>java.lang.NullPointerException
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> 
>>>>>>91)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> 
>>>>>>SEngine.java:2280)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>>>a:268)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>>>)
>>>>>>       at
>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> 
>>>>>>t.java:544)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> 
>>>>>>lement.java:725)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> 
>>>>>>tElement.java:672)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> 
>>>>>>)
>>>>>>       at
>>>
>>>com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
>>>
>>>
>>>>>>       at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
>>>>>>       at
>>>>
>>>>com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
>>>>
>>>>
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>>>a:268)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>>>)
>>>>>>       at
>>>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> 
>>>>>>eEventSupport.java:372)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> 
>>>>>>pport.java:286)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> 
>>>>>>atcher.java:538)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> 
>>>>>>patcher.java:502)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> 
>>>>>>er.java:391)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> 
>>>>>>java:244)
>>>>>>       at
>>>>>>
>>>>
> org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> 
>>>>>>nt.java:1989)
>>>>>>       at
>>>>
>>>>org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
>>>>
>>>>
>>>>>>       at java.lang.Thread.run(Thread.java:534)
>>>>>>
>>>>>>
>>>>>>Am I doing something wrong?
>>>>>>
>>>>>>Thanks,
>>>>>> Denis
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>>
>>>>>
>>>>
>>>
>>--------------------------------------------------------------------------
> 
> --
> 
>>>----
>>>
>>>
>>>
>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 




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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Denis Bohm <de...@fireflydesign.com>.
Thanks for the tips.  I'll try replacing the DOM subtree to avoid the
performance issue.  The only immediate downside to that seems to be that
text selections can get lost...

----- Original Message ----- 
From: "Thomas DeWeese" <Th...@Kodak.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Thursday, August 21, 2003 12:24 PM
Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
exception


> Denis Bohm wrote:
> > I changed my sources so that if the old property value is null then it
> > considers it as a change (rather than throwing a null pointer
exception).
> > Now changing the attribute seems to work.
>
>    This is essentially the patch I was going to make.
>
> > However, it seems very very very
> > slow to refresh when changing class attributes that result in simple
style
> > changes.
>     In SVG there is no such thing as a 'simple style change'.  So for
example
> if the text uses an SVG font then the font now needs to inherit the
modified
> fill color.  Also consider that your one element can in certain cases
> be mapped into several disjoint pieces by BIDI reordering.  This is really
> amazingly complex stuff.  The text code in Batik is by a fair bit the
> most complex piece, the code has been almost completely rewritten three
times
> already and serveral weeks of effort have gone into trying to optimize it
> and still it sucks! :)
>
> > In my case, the class change only results in changing the fill
> > color - which shouldn't effect the bounds of the elements.  Changing the
> > class for about 25 tspan elements (making up one short line of text)
takes
> > about 1.5 seconds.  I ran OptimizeIt on the code and it appears that
each
> > time the class property is changed on one tspan element the glyphs go
> > through relayout down in the gvt layer.
>
>    I've just taken a look through the code and I may try and optimize this
> case a bit (although SVG Fonts are very problematic).
>
> > This results in the creation of
> > around 27,000 points during the process.
>
>    Hmm, thanks for pointing this out, not that I think this is the bottle
neck
> but it was easy to fix most of these :).
>
> > Any tips for speeding up changing the color of text runs?  For example,
is
> > there some way to batch changes to the DOM?
>
>     The best you can do (and it is probably pretty good) is remove the
elements from
> the rendering tree: text.parentNode.removeChild(text)  Then make all your
changes
> and add it back in - this will keep Batik from trying to keep the
rendering tree
> in sync with the modified elements.
>
> > Thanks,
> >   Denis
> >
> > ----- Original Message ----- 
> > From: "Denis Bohm" <de...@fireflydesign.com>
> > To: "Batik Users" <ba...@xml.apache.org>
> > Sent: Thursday, August 21, 2003 8:26 AM
> > Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> > exception
> >
> >
> >
> >>I've attached a standalone version that shows the problem.
> >>
> >>----- Original Message ----- 
> >>From: "Thomas DeWeese" <Th...@Kodak.com>
> >>To: "Batik Users" <ba...@xml.apache.org>
> >>Sent: Thursday, August 21, 2003 5:19 AM
> >>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> >>exception
> >>
> >>
> >>
> >>>Denis Bohm wrote:
> >>>
> >>>>Setting color to the Shadow?When I try to append a tspan to a text
> >>
> >>element
> >>
> >>>>and then set the tspan class:
> >>>>
> >>>>        Element tspan = document.createElementNS(
> >>>>            SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
> >>>>        );
> >>>>        tspan.appendChild(document.createCDATASection(text));
> >>>>        text.appendChild(tspan);
> >>>>        tspan.setAttributeNS(null, "class", "normal");
> >>>>
> >>>>I get a null pointer exception:
> >>>
> >>>     Can you provide a standalone version of this problem?
> >>>Looking at the line indicated below it isn't real clear why you
> >>>would get an NPE.
> >>>
> >>>
> >>>>In Event
> >>>>java.lang.NullPointerException
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> >
> >>>>91)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> >
> >>>>SEngine.java:2280)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> >
> >>>>a:268)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> >
> >>>>)
> >>>>        at
> >>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> >
> >>>>t.java:544)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> >
> >>>>lement.java:725)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> >
> >>>>tElement.java:672)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> >
> >>>>)
> >>>>        at
> >
> > com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
> >
> >>>>        at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
> >>>>        at
> >>
> >>com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
> >>
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> >
> >>>>a:268)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> >
> >>>>)
> >>>>        at
> >>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> >
> >>>>eEventSupport.java:372)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> >
> >>>>pport.java:286)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> >
> >>>>atcher.java:538)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> >
> >>>>patcher.java:502)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> >
> >>>>er.java:391)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> >
> >>>>java:244)
> >>>>        at
> >>>>
> >>
> >
org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> >
> >>>>nt.java:1989)
> >>>>        at
> >>
> >>org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
> >>
> >>>>        at java.lang.Thread.run(Thread.java:534)
> >>>>
> >>>>
> >>>>Am I doing something wrong?
> >>>>
> >>>>Thanks,
> >>>>  Denis
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>>For additional commands, e-mail: batik-users-help@xml.apache.org
> >>>
> >>>
> >>
> >
> >
>
> --------------------------------------------------------------------------
--
> > ----
> >
> >
> >
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >>For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>


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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Thomas DeWeese <Th...@Kodak.com>.
Denis Bohm wrote:
> I changed my sources so that if the old property value is null then it
> considers it as a change (rather than throwing a null pointer exception).
> Now changing the attribute seems to work.  

   This is essentially the patch I was going to make.

> However, it seems very very very
> slow to refresh when changing class attributes that result in simple style
> changes.  
    In SVG there is no such thing as a 'simple style change'.  So for example
if the text uses an SVG font then the font now needs to inherit the modified
fill color.  Also consider that your one element can in certain cases
be mapped into several disjoint pieces by BIDI reordering.  This is really
amazingly complex stuff.  The text code in Batik is by a fair bit the
most complex piece, the code has been almost completely rewritten three times
already and serveral weeks of effort have gone into trying to optimize it
and still it sucks! :)

> In my case, the class change only results in changing the fill
> color - which shouldn't effect the bounds of the elements.  Changing the
> class for about 25 tspan elements (making up one short line of text) takes
> about 1.5 seconds.  I ran OptimizeIt on the code and it appears that each
> time the class property is changed on one tspan element the glyphs go
> through relayout down in the gvt layer.  

   I've just taken a look through the code and I may try and optimize this
case a bit (although SVG Fonts are very problematic).

> This results in the creation of
> around 27,000 points during the process.

   Hmm, thanks for pointing this out, not that I think this is the bottle neck
but it was easy to fix most of these :).

> Any tips for speeding up changing the color of text runs?  For example, is
> there some way to batch changes to the DOM?

    The best you can do (and it is probably pretty good) is remove the elements from
the rendering tree: text.parentNode.removeChild(text)  Then make all your changes
and add it back in - this will keep Batik from trying to keep the rendering tree
in sync with the modified elements.

> Thanks,
>   Denis
> 
> ----- Original Message ----- 
> From: "Denis Bohm" <de...@fireflydesign.com>
> To: "Batik Users" <ba...@xml.apache.org>
> Sent: Thursday, August 21, 2003 8:26 AM
> Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> exception
> 
> 
> 
>>I've attached a standalone version that shows the problem.
>>
>>----- Original Message ----- 
>>From: "Thomas DeWeese" <Th...@Kodak.com>
>>To: "Batik Users" <ba...@xml.apache.org>
>>Sent: Thursday, August 21, 2003 5:19 AM
>>Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
>>exception
>>
>>
>>
>>>Denis Bohm wrote:
>>>
>>>>Setting color to the Shadow?When I try to append a tspan to a text
>>
>>element
>>
>>>>and then set the tspan class:
>>>>
>>>>        Element tspan = document.createElementNS(
>>>>            SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
>>>>        );
>>>>        tspan.appendChild(document.createCDATASection(text));
>>>>        text.appendChild(tspan);
>>>>        tspan.setAttributeNS(null, "class", "normal");
>>>>
>>>>I get a null pointer exception:
>>>
>>>     Can you provide a standalone version of this problem?
>>>Looking at the line indicated below it isn't real clear why you
>>>would get an NPE.
>>>
>>>
>>>>In Event
>>>>java.lang.NullPointerException
>>>>        at
>>>>
>>
> org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> 
>>>>91)
>>>>        at
>>>>
>>
> org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> 
>>>>SEngine.java:2280)
>>>>        at
>>>>
>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>a:268)
>>>>        at
>>>>
>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>)
>>>>        at
>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>>>>        at
>>>>
>>
> org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> 
>>>>t.java:544)
>>>>        at
>>>>
>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> 
>>>>lement.java:725)
>>>>        at
>>>>
>>
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> 
>>>>tElement.java:672)
>>>>        at
>>>>
>>
> org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> 
>>>>)
>>>>        at
> 
> com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
> 
>>>>        at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
>>>>        at
>>
>>com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
>>
>>>>        at
>>>>
>>
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> 
>>>>a:268)
>>>>        at
>>>>
>>
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> 
>>>>)
>>>>        at
>>>>org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>>>>        at
>>>>
>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> 
>>>>eEventSupport.java:372)
>>>>        at
>>>>
>>
> org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> 
>>>>pport.java:286)
>>>>        at
>>>>
>>
> org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> 
>>>>atcher.java:538)
>>>>        at
>>>>
>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> 
>>>>patcher.java:502)
>>>>        at
>>>>
>>
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> 
>>>>er.java:391)
>>>>        at
>>>>
>>
> org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> 
>>>>java:244)
>>>>        at
>>>>
>>
> org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> 
>>>>nt.java:1989)
>>>>        at
>>
>>org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
>>
>>>>        at java.lang.Thread.run(Thread.java:534)
>>>>
>>>>
>>>>Am I doing something wrong?
>>>>
>>>>Thanks,
>>>>  Denis
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>
> 
> 
> ----------------------------------------------------------------------------
> ----
> 
> 
> 
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 




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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Denis Bohm <de...@fireflydesign.com>.
I changed my sources so that if the old property value is null then it
considers it as a change (rather than throwing a null pointer exception).
Now changing the attribute seems to work.  However, it seems very very very
slow to refresh when changing class attributes that result in simple style
changes.  In my case, the class change only results in changing the fill
color - which shouldn't effect the bounds of the elements.  Changing the
class for about 25 tspan elements (making up one short line of text) takes
about 1.5 seconds.  I ran OptimizeIt on the code and it appears that each
time the class property is changed on one tspan element the glyphs go
through relayout down in the gvt layer.  This results in the creation of
around 27,000 points during the process.

Any tips for speeding up changing the color of text runs?  For example, is
there some way to batch changes to the DOM?

Thanks,
  Denis

----- Original Message ----- 
From: "Denis Bohm" <de...@fireflydesign.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Thursday, August 21, 2003 8:26 AM
Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
exception


> I've attached a standalone version that shows the problem.
>
> ----- Original Message ----- 
> From: "Thomas DeWeese" <Th...@Kodak.com>
> To: "Batik Users" <ba...@xml.apache.org>
> Sent: Thursday, August 21, 2003 5:19 AM
> Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
> exception
>
>
> > Denis Bohm wrote:
> > > Setting color to the Shadow?When I try to append a tspan to a text
> element
> > > and then set the tspan class:
> > >
> > >         Element tspan = document.createElementNS(
> > >             SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
> > >         );
> > >         tspan.appendChild(document.createCDATASection(text));
> > >         text.appendChild(tspan);
> > >         tspan.setAttributeNS(null, "class", "normal");
> > >
> > > I get a null pointer exception:
> >
> >      Can you provide a standalone version of this problem?
> > Looking at the line indicated below it isn't real clear why you
> > would get an NPE.
> >
> > > In Event
> > > java.lang.NullPointerException
> > >         at
> > >
>
org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> > > 91)
> > >         at
> > >
>
org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> > > SEngine.java:2280)
> > >         at
> > >
>
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> > > a:268)
> > >         at
> > >
>
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> > > )
> > >         at
> > > org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> > >         at
> > >
>
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> > > t.java:544)
> > >         at
> > >
>
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> > > lement.java:725)
> > >         at
> > >
>
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> > > tElement.java:672)
> > >         at
> > >
>
org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> > > )
> > >         at
com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
> > >         at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
> > >         at
> com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
> > >         at
> > >
>
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> > > a:268)
> > >         at
> > >
>
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> > > )
> > >         at
> > > org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> > >         at
> > >
>
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> > > eEventSupport.java:372)
> > >         at
> > >
>
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> > > pport.java:286)
> > >         at
> > >
>
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> > > atcher.java:538)
> > >         at
> > >
>
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> > > patcher.java:502)
> > >         at
> > >
>
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> > > er.java:391)
> > >         at
> > >
>
org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> > > java:244)
> > >         at
> > >
>
org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> > > nt.java:1989)
> > >         at
> org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
> > >         at java.lang.Thread.run(Thread.java:534)
> > >
> > >
> > > Am I doing something wrong?
> > >
> > > Thanks,
> > >   Denis
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: batik-users-help@xml.apache.org
> > >
> > >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org


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


Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Denis Bohm <de...@fireflydesign.com>.
I've attached a standalone version that shows the problem.

----- Original Message ----- 
From: "Thomas DeWeese" <Th...@Kodak.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Thursday, August 21, 2003 5:19 AM
Subject: Re: tspan.setAttributeNS(null, "class", "normal") null pointer
exception


> Denis Bohm wrote:
> > Setting color to the Shadow?When I try to append a tspan to a text
element
> > and then set the tspan class:
> >
> >         Element tspan = document.createElementNS(
> >             SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
> >         );
> >         tspan.appendChild(document.createCDATASection(text));
> >         text.appendChild(tspan);
> >         tspan.setAttributeNS(null, "class", "normal");
> >
> > I get a null pointer exception:
>
>      Can you provide a standalone version of this problem?
> Looking at the line indicated below it isn't real clear why you
> would get an NPE.
>
> > In Event
> > java.lang.NullPointerException
> >         at
> >
org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> > 91)
> >         at
> >
org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> > SEngine.java:2280)
> >         at
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> > a:268)
> >         at
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> > )
> >         at
> > org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> >         at
> >
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> > t.java:544)
> >         at
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> > lement.java:725)
> >         at
> >
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> > tElement.java:672)
> >         at
> >
org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> > )
> >         at com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
> >         at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
> >         at
com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
> >         at
> >
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> > a:268)
> >         at
> >
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> > )
> >         at
> > org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> >         at
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> > eEventSupport.java:372)
> >         at
> >
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> > pport.java:286)
> >         at
> >
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> > atcher.java:538)
> >         at
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> > patcher.java:502)
> >         at
> >
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> > er.java:391)
> >         at
> >
org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> > java:244)
> >         at
> >
org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> > nt.java:1989)
> >         at
org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
> >         at java.lang.Thread.run(Thread.java:534)
> >
> >
> > Am I doing something wrong?
> >
> > Thanks,
> >   Denis
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>

Re: tspan.setAttributeNS(null, "class", "normal") null pointer exception

Posted by Thomas DeWeese <Th...@Kodak.com>.
Denis Bohm wrote:
> Setting color to the Shadow?When I try to append a tspan to a text element
> and then set the tspan class:
> 
>         Element tspan = document.createElementNS(
>             SVGDOMImplementation.SVG_NAMESPACE_URI, "tspan"
>         );
>         tspan.appendChild(document.createCDATASection(text));
>         text.appendChild(tspan);
>         tspan.setAttributeNS(null, "class", "normal");
> 
> I get a null pointer exception:

     Can you provide a standalone version of this problem?
Looking at the line indicated below it isn't real clear why you
would get an NPE.

> In Event
> java.lang.NullPointerException
>         at
> org.apache.batik.css.engine.CSSEngine.invalidateProperties(CSSEngine.java:18
> 91)
>         at
> org.apache.batik.css.engine.CSSEngine$DOMAttrModifiedListener.handleEvent(CS
> SEngine.java:2280)
>         at
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> a:268)
>         at
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> )
>         at
> org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>         at
> org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElemen
> t.java:544)
>         at
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractE
> lement.java:725)
>         at
> org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(Abstrac
> tElement.java:672)
>         at
> org.apache.batik.dom.AbstractElement.setAttributeNS(AbstractElement.java:271
> )
>         at com.hp.hpl.epc.evaluator.DemoUI.appendTSpan(DemoUI.java:209)
>         at com.hp.hpl.epc.evaluator.DemoUI.mouseMove(DemoUI.java:409)
>         at com.hp.hpl.epc.evaluator.DemoUI$2.handleEvent(DemoUI.java:276)
>         at
> org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> a:268)
>         at
> org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:240
> )
>         at
> org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
>         at
> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Bridg
> eEventSupport.java:372)
>         at
> org.apache.batik.bridge.BridgeEventSupport$Listener.mouseMoved(BridgeEventSu
> pport.java:286)
>         at
> org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDisp
> atcher.java:538)
>         at
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDis
> patcher.java:502)
>         at
> org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatch
> er.java:391)
>         at
> org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.
> java:244)
>         at
> org.apache.batik.swing.svg.JSVGComponent$1MouseMovedRunnable.run(JSVGCompone
> nt.java:1989)
>         at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:204)
>         at java.lang.Thread.run(Thread.java:534)
> 
> 
> Am I doing something wrong?
> 
> Thanks,
>   Denis
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 




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