Monday Feb 08, 2010

Java Download Service Listener


One of the previous post [Applet Startup Time] provided a way to measure start-up time of JavaFX Applets. Many responded with requested information (Thanks a lot!). One of the main concern raised was high start-up time for "Without JavaFX Runtime". This is high because it includes time taken to download and install JavaFX Runtime.

Unfortunately there was no way to notify the user about exact progress of this. Hence user will not be able to differentiate between download and install of "JavaFX Runtime" and "JavaFX Application".

Recent JavaFX Update 1.2.3 reduced the download size and start-up time. You can notice this change by trying out the start-up time measurement applet again.. But still it doesn't provide a way to exactly notify the start-up progress. We can only specify a custom splash-screen as specified here.

And then we have Java Update 1.6.0_18 - [Download Now] - Not sure how many of you noticed this feature - Download Service Listener It allows you to provide a Custom Progress UI using AWT/Swing/Java2D APIs. It has callback methods which will provide information related to download and validation of resources. Please refer to Download Service Listener Example for more information. Refer to ProgressListener.java and ProgressView.java for implementation used in this sample.

<script src="http://dl.javafx.com/1.2/dtfx.js"></script> <script src="http://javafxdemos.googlecode.com/hg/resource/ProgressListener/ProgressListenerFX.js"></script>


To launch click on above image or

Now we can implement custom progress listener with actual values. We can use the same approach for JavaFX applications as well. There is minor issue in using this feature with JavaFX Applet deployed using dtfx.js. This script is not updated to utilize this feature. So for now we need to explicitly hide the default splash screen by invoking JavaScript method hideOverlay as shown in ProgressListenerFX.html

Reference:

Hmm.. thatz a long post with lots of information.. But I think its very useful.. As usual, please try it out and let me know feedback..


<script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="http://javafxdemos.googlecode.com/hg/resource/ProgressListener/zoneit.js"></script>

Monday Aug 31, 2009

JavaFX - Applet Startup Time


We keep getting various numbers related to JavaFX applet startup time. Yes this is very important and we need a consistent way to measure this and compare. Here is an attempt..

Update:

When the page is loaded, the system time is noted using JavaScript. Time is again noted once Applet is loaded. Difference between time obtained in Applet and JavaScript is computed to be startup time. I think this will be fair and consistent way to measure startup time. This requires JavaSE 6 Update 10 and above. It will be good to try out a few times and get the average number..

<script src="http://dl.javafx.com/1.2/dtfx.js"></script> <script src="/rakeshmenonp/resource/Startup/Startup.js"></script>

User Without JavaFX
Runtime
Load
Applet
Re-load
Applet
Rakesh Menon453.000.70
Pär Dahlberg-7.270.66
Julien Buret-1.710.32
cozmint-7.831.55
Philippe Lhoste-3.420.98
Ernie Kent-4.730.66
Carl Dea - FF-5.740.63
Carl Dea - IE-3.340.74
Simon Brocklehurst-3.120.79
Tom Eugelink-2.680.64
Guido-2.560.62
GC - WinXP-64bit FF-64bitError
Carl Antaki-4.060.67
Nick Apperley-3.270.83
Andy Xie478.321.05
Wojciech Halicki-Piszko-4.450.8
Endre Stølsvik723.80-
Chui Tey - Chrome 2.0.172.43-6.952.86
Chui Tey - MSIE 8.0.6001.18702IS-3.220.70
Chui Tey - FF 3.0.10-4.130.70
JosK (Intel Core 2CPU 4300@1.8GHZ (1,93GB) 512RAM) - Chrome 2.0.172.43-4.264.08
JosK (Intel Core 2CPU 4300@1.8GHZ (1,93GB) 512RAM) - Chrome 3.0.195.21-3.981.05
JosK (Intel Core 2CPU 4300@1.8GHZ (1,93GB) 512RAM) - IE 8.0.6001.18702-8.331.06
Jonathan (Quad Core Q9300 @ 2.5GHZ, 4GB ram JRE 1.6u15)15.50-0.52
Thierry (2 year olds windows dual core basic PC)17.503.10-
Robrecht (Windows xp SP2 Intel Core 2 cpu T5600 @ 1,83GHz, 2GB Ram jre: 1.6.0_15)4.832.800.62
Venkateswara Rao Desu (Fedora 9 JDK 1.6_10)Applet not initialized
André Costa-1.910.42
Joeri Sykora (jdk 1.6.0_16 in Firefox 3.5.3)-1.020.65
Thustle (1.6.0_16 on Chrome v3 on Vista 32bit Intel Core2 Quad Q6600 2.4GHz 4GB)-9.300.74
Vance (Intel Core 2 Duo P8700 2.53GHz/1066Mhz RAM:4GB, DDR3, 1067 MHz, Ubuntu 9.10, FireFox 3.5.5, JRE: 1.6.0_15, Connection: comcast high-speed cable)7.62.30.3
Venkateswara Rao Desu (Fedora 11 Firefox 3.5.5 Sun Java Plugin)17.00-0.70
Venkateswara Rao Desu (Windows XP Java 1.6.0_18)9.3-0.38
Jor (WinXP, FF 3.5.7, Java 1.6.0_17)36-0.21

Legend:

  • Without JavaFX Runtime - After clearing Java Web Start cache - [ javaws -uninstall ] May have to wait for sometime as clearing process may be running in background. This is the time taken to download JavaFX runtime and load the applet.
  • Load Applet - Launch browser and load applet (JavaFX runtime already installed)
  • Re-Load Applet - Re-load the page after loading applet
  • Duration - specified in seconds


Please launch the applet and let me know the start-up time with system configuration and connection speed.. Thanks in advance..

Wednesday Apr 15, 2009

JavaFX - Where is Applet tag?!


For deploying JavaFX in browser, we use JavaScript code as shown below

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "JavaFX_Flickr_Image_Viewer.jar",
              draggable: true,
              width: 800,
              height: 650,
              code: "carousel.Main",
              name: "JavaFX_Flickr_Image_Viewer"
        }
    );
</script>

JavaFX uses dtfx.js which in turn uses deployJava.js to detect presence of java, the version of java on the system etc. Refer to Java Deployment Toolkit documentation for more information.

So how does JavaFX deploys as Applet without using Applet tag?

It indeed uses Applet tag, dtfx.js script generates the required Applet tag. It generates two <div> sections. The first section shows the spinning java logo and second sections embeds the Applet. First the spinning logo is shown, when applet is loaded, its visibility status is changed to false.

The generated html tags will be as shown below, which has embedded Applet tag

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<div id="deployJavaApplet1Overlay" 
    style="width:800;height:650;position:absolute;background:white">
    <table width=800 height=650 border=padding=margin=0>
    <tr><td align="center" valign="middle">
        <img src="http://dl.javafx.com/javafx-loading-100x100.gif" width=100 imgHeight=100>
    </td></tr>
    </table>
</div>
<div id="deployJavaApplet1" style="position:relative;left:-10000px">
    <APPLET MAYSCRIPT
        code="org.jdesktop.applet.util.JNLPAppletLauncher"
        archive="JavaFX_Flickr_Image_Viewer.jar,
        http://dl.javafx.com/applet-launcher__V1.1.1.jar,
        http://dl.javafx.com/javafx-rt__V1.1.1.jar,
        http://dl.javafx.com/fxdloader__V1.1.1.jar,
        http://dl.javafx.com/jmc__V1.1.1.jar,
        http://dl.javafx.com/Decora-SSE__V1.1.1.jar,
        http://dl.javafx.com/emptyJarFile-1239792034654__V1.1.1.jar"
        width=800
        height=650>
        <param name="codebase_lookup" value="false">
        <param name="subapplet.classname" value="com.sun.javafx.runtime.adapter.Applet">
        <param name="progressbar" value="false">
        <param name="classloader_cache" value="false">
        <param name="draggable" value="true">
        <param name="MainJavaFXScript" value="carousel.Main">
        <param name="subapplet.displayname" value="JavaFX_Flickr_Image_Viewer">
        <param name="jnlpNumExtensions" value="2">
        <param name="jnlpExtension1" value="http://dl.javafx.com/jmc__V1.1.1.jnlp">
        <param name="jnlpExtension2" value="http://dl.javafx.com/Decora__V1.1.1.jnlp">
        <param name="jnlp_href" value="JavaFX_Flickr_Image_Viewer_browser.jnlp">
        <param name="deployJavaAppletID" value="deployJavaApplet1">
    </APPLET>
</div>

How will we get this generated Applet tag?

Just add displayhtml: true as shown below. This will display the html instead of loading the applet!

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "JavaFX_Flickr_Image_Viewer.jar",
              draggable: true,
              width: 800,
              height: 650,
              code: "carousel.Main",
              name: "JavaFX_Flickr_Image_Viewer",
              displayhtml: true
        }
    );
</script>

<script type="text/javascript">var dzone_url = "http://blogs.sun.com/rakeshmenonp/entry/javafx_sudoku_css_support";</script> <script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script>
<script type="text/javascript"> digg_skin = 'compact'; digg_window = 'new'; </script> <script language="javascript" src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
<script src="http://slashdot.org/slashdot-it.js" type="text/javascript"></script>

About


The views expressed on this blog are my own and do not necessarily reflect that of my organization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today