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 Simon AM Cox <sa...@ecs.soton.ac.uk> on 2003/07/03 15:21:00 UTC

removeChild and replaceChild hanging the JVM

Hi,

I have a browser, losely based on the Squiggle example.  I also have a 
tree which shows only 'g' elements in the SVG document and allows them 
to be removed from the tree, using either removeChild or replaceChild. 
On most documents this works fine, however on the 'mapSpain.svg' sample 
document the JVM seems to hang during either of these calls.  I'm using 
batik 1.5beta, I've just upgraded and it seemed to work before with 1.1.1.

What I'm trying to get to eventually is allowing hte users to switch 
layers on/off, I guess if there's a more preffered way of doing this 
then I'd rather do that.  Although, I'd rather do it from Java than use 
the scripting feature of SVG.

Thanks,

Simon Cox


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


Re: removeChild and replaceChild hanging the JVM

Posted by Simon AM Cox <sa...@ecs.soton.ac.uk>.
Thomas DeWeese wrote:
> Simon AM Cox wrote:
> 
>> Hi,
>>
>> I have a browser, losely based on the Squiggle example.  I also have a 
>> tree which shows only 'g' elements in the SVG document and allows them 
>> to be removed from the tree, using either removeChild or replaceChild. 
>> On most documents this works fine, however on the 'mapSpain.svg' 
>> sample document the JVM seems to hang during either of these calls.  
>> I'm using batik 1.5beta, I've just upgraded and it seemed to work 
>> before with 1.1.1.
> 
> 
>    Since you don't mention it I assume you aren't calling 
> removeChild/replaceChild from
> the UpdateManager's runnable queue?
> 
>    If not you are probably running into a threading issue.  Search the 
> archives for examples of how
> to use the UpdateManager's runnable queue to make DOM modifications with 
> Batik 1.5.  As a
> bonus the canvas will automatically update for you.

That was the first mistake I made, which stopped it working all of the 
time.  However, I already fixed that and it works for most svg 
documents, just not mapSpain.svg.  I did a little digging with a 
debugger and the thread seems to be sitting on an Object.wait() amongst 
some calls like getLanguage().

> 
>> What I'm trying to get to eventually is allowing hte users to switch 
>> layers on/off, I guess if there's a more preffered way of doing this 
>> then I'd rather do that.  Although, I'd rather do it from Java than 
>> use the scripting feature of SVG.

I've worked round the problem now by toggling the 'VISIBILITY' attribute 
between 'visible' and 'hidden', which seems to fit the job much better 
(and takes up much less code!).

Thanks


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


Re: removeChild and replaceChild hanging the JVM

Posted by Thomas DeWeese <Th...@Kodak.com>.
Simon AM Cox wrote:

> Hi,
>
> I have a browser, losely based on the Squiggle example.  I also have a 
> tree which shows only 'g' elements in the SVG document and allows them 
> to be removed from the tree, using either removeChild or replaceChild. 
> On most documents this works fine, however on the 'mapSpain.svg' 
> sample document the JVM seems to hang during either of these calls.  
> I'm using batik 1.5beta, I've just upgraded and it seemed to work 
> before with 1.1.1.

    Since you don't mention it I assume you aren't calling 
removeChild/replaceChild from
the UpdateManager's runnable queue?

    If not you are probably running into a threading issue.  Search the 
archives for examples of how
to use the UpdateManager's runnable queue to make DOM modifications with 
Batik 1.5.  As a
bonus the canvas will automatically update for you.

> What I'm trying to get to eventually is allowing hte users to switch 
> layers on/off, I guess if there's a more preffered way of doing this 
> then I'd rather do that.  Although, I'd rather do it from Java than 
> use the scripting feature of SVG.





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