Hi Dao,

dao <[email protected]> wrote on 01/11/2010 05:45:08 PM:

> I put my batik canvas in a panel, that I put in a frame.
> I have 2 modes. the frame is visible or not (because it is a server 
> which can display locally or remotely. In this last case, I don't 
> want to draw the frame)
> 
> at the beginning of the process (ie after the treebuild complete) I 
> want to append a child to a node of the document.
> 
> If I have a local frame (setVisible(true)), I do this and it works 
> fine: the element
> getMaskLayer().appendChild(mask);
>        
 canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
> Runnable() { 
> public void run() {
> mask.setAttribute("style", "display:none");
> }
> });;
> 
> but when I put if I run the program with frame.setVisible(false), 
> and I dump the document, I do not have the style attribute set.
> 
> So, why the setVisible influences the behavior?

   Because the UpdateManager is only started after the first rendering
of the SVG document completes.  If the canvas isn't visible there isn't
a first rendering.

> FYI
> Then, I decided to do this:
>        
 canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
>  Runnable() {
> public void run() {
>                 getMaskLayer().appendChild(mask);
> mask.setAttribute("style", "display:none");
> }
> });;
> 
> In this case, the element is not appended. I dump the document doing
> this several seconds after the call is performed

    Right because the UpdateManager isn't started until after the
document is rendered for the first time.   The question is what 
should you do?  The answer is I don't know, I think it's exactly
right that a non-visible SVG Canvas doesn't do anything.

Reply via email to