I have an unusual setup. Basically I have batik applet that receives ecma scripts through a socket. When I receive the scripts I put them in a list and invokeLater with the AWT event queue to execute them. The problem is that I have a hard time determining when the document is definitely fully loaded and ready to go. Unfortunately, if I try to get the interpreter from the bridge context before the document I get a nasty RuntimeException with a "Unknown document" message which is fair. I do add listeners to try to ensure the document is ready to go:

// Set the JSVGCanvas listeners.
m_svgCanvas.addSVGDocumentLoaderListener(new SVGDocumentLoaderAdapter() {
public void documentLoadingStarted(SVGDocumentLoaderEvent e) {
m_label.setText("Document Loading...");


documentLoaded = false;
}
public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
m_label.setText("Document Loaded.");
m_consumer.log("Document Loaded.");
documentLoaded = true;
}
});


m_svgCanvas.addGVTTreeBuilderListener(new GVTTreeBuilderAdapter() {
public void gvtBuildStarted(GVTTreeBuilderEvent e) {
m_label.setText("Build Started...");
m_consumer.log("Build Started...");
buildCompleted = false;
}
public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
m_label.setText("Build Done.");
m_consumer.log("Build Done.");
buildCompleted = true;
}
});


m_svgCanvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
public void gvtRenderingPrepare(GVTTreeRendererEvent e) {
m_label.setText("Rendering Started...");
m_consumer.log("Rendering Started...");
renderCompleted = false;
}
public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
String uri = m_svgCanvas.getSVGDocument().getURL();
m_label.setText(uri);
m_consumer.log("Rendering Completed...");
renderCompleted = true;
}



Notice I set boolean values for each of the listeners. The reason I did this was because the events seem to fire out of order so I make sure all the booleans are true before I try to execute the scripts that have queued up. In other words, instead of always seeing "Document Loading->Document Loaded->Build Started->Build Finished->Rendering Started->Rendering Completed, they are sometimes out of order. Rendering Started seems to jump in whenever it feels like it. If I run a script and the Render starts over again it resets the interpreter and kills the scripts that were running. Is there something I'm missing?


Thanks,
Stephen


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to