com.getsnappy.snappyj
Class JavaScriptLoadingIndicator

java.lang.Object
  extended by com.getsnappy.snappyj.JavaScriptLoadingIndicator
Direct Known Subclasses:
BlockingAnimatedGifLoadingIndicator, ContextAnimatedGifLoadingIndicator, ContextBlockingAnimatedGifLoadingIndicator, DoNothingLoadingIndicator, LargeAnimatedGifLoadingIndicator, MediumAnimatedGifLoadingIndicator, SmallAnimatedGifLoadingIndicator

public abstract class JavaScriptLoadingIndicator
extends java.lang.Object

This is used to indicate to a user using JavaScript that it's containing context is being reloaded or forwarded. Under the hood we make an asynchronous call to replace the contents of the context but it seems like bad user interface to just let the client wait without displaying some sort of indication to them that we are performing an asynchronous action and that your servers are busy generating results. By default asynchronous requests do not display a busy pointer, so it appears to the client that they did not click anything and nothing is happening. This class can be easily extended to support your exact needs. We provide several useful implementations out of the box.

[Small|Medium|Large]AnimatedGifLoadingIndicator - Display an animated gif (or any image) centered in the space of this context. DoNothingLoadingIndicator -


Constructor Summary
JavaScriptLoadingIndicator()
           
 
Method Summary
 void jsFinish(java.io.Writer out)
          Called immediately before replacing the contents of the page.
abstract  void jsStart(java.io.Writer out)
          This function is called immediately before reloading or forwarding a context from JavaScript.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptLoadingIndicator

public JavaScriptLoadingIndicator()
Method Detail

jsStart

public abstract void jsStart(java.io.Writer out)
                      throws java.io.IOException
This function is called immediately before reloading or forwarding a context from JavaScript. This is abstract because it should always do something, except for the DoNothingLoadingIndicator, which true to it's name does nothing. It must output the JavaScript definition of a function (everything BETWEEN the braces).

Parameters:
out -
Throws:
java.io.IOException
See Also:
DoNothingLoadingIndicator

jsFinish

public void jsFinish(java.io.Writer out)
              throws java.io.IOException
Called immediately before replacing the contents of the page. One use is for for displaying 100% on a progress. Another concept is too allow browsers to load all images and/or other external resources before showing the contents. It must output the JavaScript definition of a function (everything BETWEEN the braces).

Parameters:
out -
Throws:
java.io.IOException