xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: AW: NullPointerException with setToolTip in CanvasUserAgent
Date Sat, 10 Sep 2005 11:43:07 GMT
Hi Dominik,

Steiner, Dominik wrote:

> thank you again for getting back to me...
> 
> Well, basically my application is doing two tooltip changes.
> 
> 	1) there are like 100 circles which all have a tooltip 
>          and get changed pretty often (about every 2 seconds) ... 
>          but this didn't throw any exceptions
> 	2) then there are a few polygons with tooltips, which 
>          are displaying the actually contained circle elements.. 
>          so when I do a mouse over on the polygon the tooltip pops 
>          up, and sometimes it throws this exception, but only sometimes...

    When you change the tool-tips do you modify the contents of the
existing title/desc element or do you replace the title/desc with a
new title desc element?

> My tooltip changes are all done in the Updatemanager thread...
> What do you recommend me? Changing the handleElement method myself?

    Hmm, I just noticed that the handleElement method does run in
the UpdateManager thread.  So this method doesn't look like it has
a problem to me anymore.   Which still leaves me to wonder why
'parent' ends up null.

    We have an existing test:
	samples/tests/spec/scripting/addDescOnClick.svg

    This doesn't throw an error, perhaps you could compare and
see what the differences are?  Perhaps modify it so it does
throw an error.

    You could also try adding the simple 'if (parent==null) return'
right after it set's parent.

> Thanks again for your great help, you are our hero... :-)
> 
> Dominik Steiner
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
> Gesendet: Freitag, 9. September 2005 12:24
> An: batik-users@xmlgraphics.apache.org
> Betreff: Re: NullPointerException with setToolTip in CanvasUserAgent
> 
> Hi Steiner,
> 
> Steiner, Dominik wrote:
> 
> 
>>The line in the JSVGCanvas which throws the exception is following
>>
>>                  SVGDocument doc = (SVGDocument)elt.getOwnerDocument();
> 
> 
>     Actually this means that 'elt' is null.  In this context 'elt'
> is the parent of a 'title' or 'desc' element.  So are you dynamically
> modifying the title/desc on mouseover or something?  It's easy enough to
> check if the 'parent' is null in 'handleElement', but I'm trying to
> figure out how it get's here in the first place.
> 
>     I should note that in this context I think this code is a bit
> fishy, we are poking around the DOM tree outside of the UpdateManager
> thread which really isn't a good thing.  Probably the call to
> handleElement shouldn't be forwarded to the AWT Event thread.  Most of
> the work should be done in the UpdateManager thread and only the
> final tool-tip manipulation should be done in the AWT thread...
> 
> 
>>So that means that my element has no ownerdocument... as it is launched 
>>from the EventDispatchThread I'm not sure how to avoid this exception by 
>>checking that my element is not null??
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Mime
View raw message