RE: How to assert that a document is done loading

[email protected]
Newsgroups gmane.text.xml.batik.user
Message-ID <[email protected]>
I give another example in the hope of making my problem clear. :-)

This is the naive solution:

if (this.svgCanvas.getSVGDocument() != null){
   //do something with the SVGDocument
}else{
  this.svgCanvas.addSVGLoadEventDispatcherListener(new
SVGLoadEventDispatcherAdapter() {
    @Override
    public void
svgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent e) {
        //do something with the SVGDocument
    }
  });
}


I checks whether the SVGDocument can be retrieved (that means: loading has
finished) and modifies it directly. Otherwise it sets up the
LoadEventDispatcherListener to get triggered when loading has finished and
then does the modifications.

The problem is: It is possible that the SVGDocument is null, but directly
after calling getSVGDocument() the loading finishes. Therefore the
svgLoadEventDispatcherEvent gets triggered _before_ I am able to set it
up.

And that is what I am trying to avoid. I need a way to _reliably_ get a
reference to the SVGDocument


Regards
Marco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.