xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m.@mherrn.de
Subject RE: How to assert that a document is done loading
Date Tue, 05 Jun 2012 13:48:59 GMT
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



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


Mime
View raw message