xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pareshdahiwal <pareshdahi...@yahoo.com>
Subject Re: createSVGDocument() inside applet method not working in firefox
Date Wed, 05 Sep 2007 15:26:59 GMT

Hi thomas,

Thanks for your reply.

I found where I was wrong after searching a lot in google.

The cause of my problem was that I was using html DIV tag to show/hide the
In firefox, whenever I used to display the applet, the applet:init() and
applet:start() methods were getting called again (surprisingly after
javascript liveconnect call). So the live-connect call was working fine but
my application was getting re-initialized again after live-connect call.
[Don't know why init() and start() methods were getting called again].
This was not happening in Internet Explorer since it just initializes applet
once for displaying div tag.

So the solution was to just hide the applet by using "style=width:1px;
height:1px;" for applet tag instead of using "style=display:none" for div
tag. And for showing the applet again just change its width & height to
suitable value.

Now my applet is running beautifully on Internet Explorer as well as FireFox
and displaying the file as per demand.



thomas.deweese wrote:
> Hi Pareshdhiwal,
> pareshdahiwal <pareshdahiwal@yahoo.com> wrote on 08/31/2007 09:12:09 AM:
>>    I am trying to load an svg file in the canvas using as 
>>    public appletMethod(String fileName) {
>>    byte[] fileData = ..... // I fetch this data from database blob field
>>    InputStream inputStream = new ByteArrayInputStream(fileData);
>>    BufferedInputStream bis = new BufferedInputStream(inputStream);
>>    String parser = XMLResourceDescriptor.getXMLParserClassName();
>>    SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);
>>    SVGDocument document = SVGApplication.factory.createSVGDocument(null, 
> bis);
>>    // svgCanvas is an instace of org.apache.batik.swing.JSVGCanvas
>>    svgCanvas.setDocument(document);
>>    }
>>    I have written javascript code calling this appletMethod().
>>    when I call this method from javascript FIRST-TIME it loads the 
> respective
>> svg file....but does not load on sub-sequent calls. 
>    Where does it fail the subsequent calls?  do you get the fileData
> from the blob?  Can you build the streams?  etc.
>>    I have noticed one thing that method svgLoadEventDispatchStarted() is
>> getting called only at first time and not on sub-sequent calls.
>    This makes is sound like the setDocument call isn't being made for
> some reason...
>>    svgCanvas.addSVGLoadEventDispatcherListener(new
>> SVGLoadEventDispatcherAdapter() {
>>       public void 
>> svgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent e) { 
>>              System.out.println("Loaded...."); 
>>          }
>>    }
>>    on Java-console I can see "Loaded...." printed on first call but not 
> on
>> sub-sequent calls.
>>    I am using JRE version 1.6.0_02, FireFox version, IE version
>> 7.0.5730.11, batik version 1.6.
>>    I am really getting frustrated with this problem because my code 
> works in
>> IE but not in firefox.
>>    If anyone had come across such situation and/or have any suggestions,
>> please help and/or suggest.
>    I would suggest adding lots of print statements to see where the
> second call goes wrong.  There are also several events the canvas
> issues before the SVGLoad Event (document load, document build, etc).
> I would suggest registering listeners for those as well with prints
> and see what get's called...
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View this message in context: http://www.nabble.com/createSVGDocument%28%29-inside-applet-method-not-working-in-firefox-tf4360091.html#a12500001
Sent from the Batik - Users mailing list archive at Nabble.com.

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

View raw message