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 emzic <em...@embege.com> on 2008/11/19 16:50:35 UTC

visualizing updates of the domtree on a JSVGCanvas

hello, i use a JSVGCanvas and set a svgdocument to it via

	svgcanvas.setSVGDocument(document);

now i update the svgdocument via the dom-tree, but the changes dont seem to
be visible on the jsvgcanvas.

how can i visualize the new svg on the jsvgcanvas? do i need to set some
kind of listeners?

thanks!
-- 
View this message in context: http://www.nabble.com/visualizing-updates-of-the-domtree-on-a-JSVGCanvas-tp20582708p20582708.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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


RE: visualizing updates of the domtree on a JSVGCanvas

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

emzic <em...@embege.com> wrote on 11/20/2008 04:39:06 AM:

> >>>now i update the svgdocument via the dom-tree
> > 
> > How exactly?  Do you make your changes thread-safe, using the update
> > manager, such as
> > 
> >   RunnableQueue rq =
> > svgCanvas.getUpdateManager().getUpdateRunnableQueue();
> >   rq.invokeLater(new Runnable(){
> >     public void run(){
> >       //your doc updates here
> >     }
> >   });
> > 
> 
> hmmmm, will i need to do this for every document update? 

   Probably.

> because i have code like:
> ((Element) node).setAttributeNS(null, "style", "fill:none");
> all over the place.

   The only time you don't need to submit the change to the
Update Manager's RunnableQueue is if the change is made in
a DOM listener on the document you are modifying.  If the
change is made in any other context (say a swing callback
or some other thread listening to a network connection, etc)
then you must synchronize it by submitting it to the runnable
queue.  See the Batik FAQ to understand why...

RE: visualizing updates of the domtree on a JSVGCanvas

Posted by emzic <em...@embege.com>.
thanks for your reply!


Dan Slater wrote:
> 
> Do you call
> 
>   svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
> 
> before setSVGDocument?
> 
now, but i have added it now. thanks!



>>>now i update the svgdocument via the dom-tree
> 
> How exactly?  Do you make your changes thread-safe, using the update
> manager, such as
> 
>   RunnableQueue rq =
> svgCanvas.getUpdateManager().getUpdateRunnableQueue();
>   rq.invokeLater(new Runnable(){
>     public void run(){
>       //your doc updates here
>     }
>   });
> 

hmmmm, will i need to do this for every document update? because i have code
like:
((Element) node).setAttributeNS(null, "style", "fill:none");
all over the place.

-- 
View this message in context: http://www.nabble.com/visualizing-updates-of-the-domtree-on-a-JSVGCanvas-tp20582708p20597816.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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