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 Joseph Foster <jl...@donnell.com> on 2003/07/31 18:47:16 UTC

Getting the UpdateManager from JSVGCanvas

So I need to modify the DOM of a document and according to the docs the
safe way to do this is to be sure to use the UpdateManager of the Canvas
and add things to the RunnableQueue that it maintains.

My problem is this:
Whenever I attempt to get the UpdateManager from the canvas-
canvas.getUpdateManager();
It is null.  Checking again in the documentation I see that the
UpdateManager in not provided until the first rendering is complete and
it says to use a GVTTreeRenderingListener to determine when the
rendering is finished.  Ok, I did that and had my getUpdateManager()
wait until the rendering complete event had happened.  Unfortunately it
is still null.

Is this a known issue?  Do I need to set the canvas to DYNAMIC update
type to get the UpdateManager?

Thanks,

Joe


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


Re: Getting the UpdateManager from JSVGCanvas

Posted by Thomas DeWeese <Th...@Kodak.com>.
Joseph Foster wrote:
> Thanks for your help, but I realized that I perhaps have been going
> about my entire issue wrong.  What I want to do is modify a document and
> then cause it to repaint.  I don't know if setting the canvas to dynamic
> mode is the best solution (as this seems to slow thigns down
> considerably).

   One option is to set the document as static and use
'setSVGDocument' to update the display.  This may save time
if you are changing most of the document.  For most
cases using ALWAYS_DYNAMIC should be faster.

> Is there an easy way to get the canvas to reflect changes in the model
> (which will be made at specific times)?  I attempted repaint() but that
> doesn't seem to do anything.  Only resizing the canvas a great amount
> actually triggered a re-rendering of the document.

   The display is always synced with the model for dynamic documents.
For static documents it should essentially never be synced. So
if you need to call repaint()/resize the document then I suspect
you are making your changes outside of the UpdateManager thread.

> Any ideas on the best strategy?
> 
> Thanks Again,
> 
> Joe
> 
> 
> ---------------------------------------------------------------------
> 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: Getting the UpdateManager from JSVGCanvas

Posted by Joseph Foster <jl...@donnell.com>.
Thanks for your help, but I realized that I perhaps have been going
about my entire issue wrong.  What I want to do is modify a document and
then cause it to repaint.  I don't know if setting the canvas to dynamic
mode is the best solution (as this seems to slow thigns down
considerably).

Is there an easy way to get the canvas to reflect changes in the model
(which will be made at specific times)?  I attempted repaint() but that
doesn't seem to do anything.  Only resizing the canvas a great amount
actually triggered a re-rendering of the document.

Any ideas on the best strategy?

Thanks Again,

Joe


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


Re: Getting the UpdateManager from JSVGCanvas

Posted by Thomas DeWeese <Th...@Kodak.com>.
Joseph Foster wrote:
> So I need to modify the DOM of a document and according to the docs the
> safe way to do this is to be sure to use the UpdateManager of the Canvas
> and add things to the RunnableQueue that it maintains.
> 
> My problem is this:
> Whenever I attempt to get the UpdateManager from the canvas-
> canvas.getUpdateManager();
> It is null.  Checking again in the documentation I see that the
> UpdateManager in not provided until the first rendering is complete and
> it says to use a GVTTreeRenderingListener to determine when the
> rendering is finished.  Ok, I did that and had my getUpdateManager()
> wait until the rendering complete event had happened.  Unfortunately it
> is still null.
> 
> Is this a known issue?  Do I need to set the canvas to DYNAMIC update
> type to get the UpdateManager?

   In short yes, I've added the following documentation to getUpdate Manager:

      * An UpdateManager is only created for Dynamic documents.  By
      * default the Canvas attempts to auto detect dynamic documents by
      * looking for script elements and/or event attributes in the
      * document, if it does not find these it assumes the document is
      * static.  Callers of this method will almost certainly want to
      * call setDocumentState(ALWAYS_DYNAMIC) before loading the document
      * so that an UpdateManager is always created (even for apparently
      * static documents).



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