Spec-Zone .ru
спецификации, руководства, описания, API

Customizing the Rich Internet Application Loading Experience

The RIA Loading Experience

Java Rich Internet applications (RIAs) are downloaded over the internet and displayed to the end user. The speed of the download may vary depending on various criteria such as the size of the RIA JAR file, any external dependencies, and the speed of the internet connection.

When the RIA is being downloaded, by default, the RIA software (Java Plug-in and Java Web Start software) will display the standard progress indicators, such as the spinning Java logo and progress bars. End users may get impatient when confronted with large downloads. With improvements in RIA software technology in the Java SE 6 update 18 and Java SE 6 update 21 releases, you can keep the end user engaged by providing a creative, captivating, and meaningful RIA loading experience. You can customize the RIA loading experience in several ways as described next.

You can also use a combination of the above options to accomodate older versions of the Java Runtime Environment (JRE) software on the client machine.

Note: Certain customization options are specific to applets or to Java Web Start applications. Such cases will be identified in this topic.

The RIA Loading Process

This section describes the process by which RIAs are loaded.

RIA software initiates a series of steps to download, validate, and execute a RIA. The RIA loading process can be broadly broken down into the following stages. RIA software provides varying levels of progress-related feedback during these stages.

Customization Options

Adding a Splash Screen

The simplest way to customize a RIA's loading experience is to provide a splash screen. Specify the image that should be displayed in the splash screen. No changes are required in the RIA itself. RIA software displays the splash screen when the RIA is being loaded and hides it when the RIA's resources have been downloaded and validated. See the following topics for more information:

Implementing a Customized Loading Progress Indicator

You can replace the default loading progress indicator with a custom implementation that provides regular feedback about how the RIA is loading. Don't feel constrained by rectangular boxes or the use of the Swing JProgressBar component. You can develop a customized loading progress indicator that is meaningful to your RIA or web site. The loading progress indicator can use visual or non-visual means to keep the end user interested and engaged while the RIA is loading in the background.

See Customizing the Loading Experience topic in the Java Tutorials for step-by-step instructions and detailed examples. A few screenshots of loading progress indicators are shown next.

Default loading progress indicator for Java Web Start application

Default Progress Indicator for Java Web Start applications

Customized loading progress indicator for Java Web Start application

Customized Progress Indicator for Java Web Start applications

Customized loading progress indicator for the Reversi JavaFX applet (black balls turn white as loading progresses)

Customized Progress Indicator for Reversi application

The following features enable varied customizations of the loading progress indicator for a RIA that is deployed by using JNLP technology:

The next few paragraphs describe technical details about implementing a loading progress indicator.

The javax.jnlp.DownloadServiceListener Interface

A loading progress indicator class should implement the javax.jnlp.DownloadServiceListener interface.

Constructors of the Loading Progress Indicator Class

Specify the following constructors in the loading progress indicator class. The RIA software will invoke the appropriate constructor depending on the capabilities of the JRE software on the client machine. In some cases, RIA software may not instantiate the loading progress indicator class if all resources are up-to-date.

Methods of the javax.jnlp.DownloadServiceListener Interface

The loading progress indicator class should implement the following methods of the interface to receive and convey the latest progress information.

Update progress information in the loading progress indicator based on the overallPercent values received in these methods.

Specifying the Custom Progress Indicator in the JNLP File

Include the following information in the RIA's Java Network Launch Protocol (JNLP) file to specify a loading progress indicator:

A sample JNLP file for an applet is shown next.

<jnlp spec="1.0+" codebase="" href="">
...
  <resources>
    ...
    <jar href="MyApplet.jar" main="true" />    
    <jar href="CustomProgressIndicator.jar" download="progress" />
  </resources>

  <applet-desc
     name="MyFavoriteApplet"
     main-class="myAppletPackage.MyFavoriteApplet"
     progress-class="myCustomProgressPackage.MyCustomProgressIndicator"
     width="600"
     height="200">
  </applet-desc>
...
</jnlp>

How the RIA Software Communicates Progress

RIA software communicates progress information as follows:

Best Practices and Tips

Resources



Java Technology

Copyright © 1993, 2010, Oracle and/or its affiliates. All rights reserved.

Contact Us