org.netbeans.microedition.svg
Class SVGWaitScreen

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by org.netbeans.microedition.svg.SVGPlayer
              extended by org.netbeans.microedition.svg.SVGAnimatorWrapper
                  extended by org.netbeans.microedition.svg.SVGWaitScreen
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener

public class SVGWaitScreen
extends SVGAnimatorWrapper

This component suits as a wait screen, which let the user to execute a blocking background task (e.g. a network communication) and waits for it until finished. During the execution of the task, an SVG image/animation is being shown on the screen.

The background task is being started immediately prior the component is being shown on the screen.

When the background task is finished, this component calls commandAction method on assigned CommandListener object. In the case of success, the commandAction method is called with SUCCESS_COMMAND as parameter, in the case of failure, the commandAction method is called with FAILURE_COMMAND as parameter.


Field Summary
static javax.microedition.lcdui.Command FAILURE_COMMAND
          Command fired when the background task failed (threw exception)
static javax.microedition.lcdui.Command SUCCESS_COMMAND
          Command fired when the background task was finished succesfully
 
Fields inherited from class org.netbeans.microedition.svg.SVGPlayer
BOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER, LEFT, PAUSED, PLAYING, RIGHT, STOPPED, TOP, TOP_LEFT, TOP_RIGHT
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, UP
 
Constructor Summary
SVGWaitScreen(javax.microedition.m2g.SVGImage svgImage, javax.microedition.lcdui.Display display)
          Creates a new instance of SVGWaitScreen.
 
Method Summary
 org.netbeans.microedition.util.CancellableTask getTask()
          Gets the background task.
 void setTask(org.netbeans.microedition.util.CancellableTask task)
          Sets the task to be run on the background.
 
Methods inherited from class org.netbeans.microedition.svg.SVGPlayer
addCommand, commandAction, computeAnchorTranslate, getAnimator, getAnimatorState, getCommandListener, getDisplay, getDocument, getSafeSVGEventListener, getScreenBBox, getSVGAnimationElementById, getSvgCanvas, getSVGElementById, getSVGEventListener, getSVGImage, getSVGLocatableElementById, getTicker, getTimeIncrement, getTitle, invokeAndWait, invokeAndWaitSafely, invokeLater, invokeLaterSafely, isResetAnimationWhenStopped, paint, pause, play, removeCommand, reset, rotate, rotate, rotateAbout, rotateAbout, rotateAboutSafely, rotateSafely, scale, scale, scaleAbout, scaleAbout, scaleAboutSafely, scaleSafely, screenTranslate, screenTranslate, screenTranslateSafely, setCommandListener, setFloatTrait, setFloatTraitSafely, setFullScreenMode, setResetAnimationWhenStopped, setRGBTrait, setRGBTrait, setRGBTraitSafely, setRGBTraitSafely, setSafeSVGEventListener, setStartAnimationImmediately, setSVGEventListener, setTicker, setTimeIncrement, setTitle, setTrait, setTraitSafely, startAnimation, startAnimation, startAnimationSafely, stop, stopAnimation, stopAnimation, stopAnimationSafely, translate, translate, translateSafely
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, showNotify, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Displayable
getHeight, getWidth, isShown
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS_COMMAND

public static final javax.microedition.lcdui.Command SUCCESS_COMMAND
Command fired when the background task was finished succesfully


FAILURE_COMMAND

public static final javax.microedition.lcdui.Command FAILURE_COMMAND
Command fired when the background task failed (threw exception)

Constructor Detail

SVGWaitScreen

public SVGWaitScreen(javax.microedition.m2g.SVGImage svgImage,
                     javax.microedition.lcdui.Display display)
              throws java.lang.IllegalArgumentException
Creates a new instance of SVGWaitScreen. It requires instance of SVGImage, which will be used for animation and display.

Please note, supplied SVGImage shouldn't be reused in other SVGAnimator.

Throws:
java.lang.IllegalArgumentException
Method Detail

setTask

public void setTask(org.netbeans.microedition.util.CancellableTask task)
Sets the task to be run on the background.

Parameters:
task - task to be executed

getTask

public org.netbeans.microedition.util.CancellableTask getTask()
Gets the background task.

Returns:
task being executed in background while this component is being shown on the screen