xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dao <dao.ho...@gmail.com>
Subject appending a child element in a document
Date Mon, 11 Jan 2010 22:45:08 GMT
hello,

I don't understand a behaviour of my batik canvas:

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(newRunnable()
{

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?

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


 StringWriter stringWriter = new StringWriter();

org.apache.batik.dom.util.DOMUtilities.writeDocument(canvas.getSVGDocument(),
stringWriter);

stringWriter.flush();

stringWriter.close();

return stringWriter.toString();



-- 
Dao Hodac

Mime
View raw message