com.sun.perseus.demo
Class PlaySVGImageDemo

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by com.sun.perseus.demo.PlaySVGImageDemo
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener, javax.microedition.m2g.SVGEventListener
Direct Known Subclasses:
BouncingBalls, GreetingCard, LocationBasedService

public class PlaySVGImageDemo
extends javax.microedition.midlet.MIDlet
implements javax.microedition.lcdui.CommandListener, javax.microedition.m2g.SVGEventListener

Simple demo which plays an SVG animation, using the JSR 226 SVGAnimator class.


Field Summary
protected  org.w3c.dom.Document doc
          The Document associated with the SVGAnimator
static java.lang.String ERROR_COULD_NOT_LOAD_SVG
          Error message thrown when the SVG resource could not be loaded.
static int KEY_HELP
           
static int KEY_PAUSE
           
static int KEY_PLAY
           
static int KEY_ROTATE
           
static int KEY_START_DEMO
           
static int KEY_STOP
          Key codes used to control the animator's state.
static long SPLASH_MIN_LENGTH
          The minimal amount of time to wait when a splash screen is displayed.
protected  javax.microedition.lcdui.Canvas splashCanvas
          The splash Canvas.
 java.lang.String splashImageName
          The optional splash image to show while the resources for the MIDlet are loading.
protected  int state
          One of STATE_STOPPED, STATE_PAUSED, STATE_PLAYING or STATE_INTERRUPTED
static int STATE_INTERRUPTED
           
static int STATE_PAUSED
           
static int STATE_PLAYING
           
static int STATE_STOPPED
          State constants.
protected  org.w3c.dom.svg.SVGSVGElement svg
          The root svg element.
static java.lang.String SVG_NAMESPACE_URI
          The SVG Namespace URI.
protected  javax.microedition.m2g.SVGAnimator svgAnimator
          The SVGAnimator built from the SVG resource.
protected  javax.microedition.lcdui.Canvas svgCanvas
          The Canvas, managed by the SVGAnimator, where the SVG animation is displayed.
protected  javax.microedition.m2g.SVGImage svgImage
          The SVGImage associated with the SVGAnimator
 java.lang.String svgImageName
          The SVG image played by this MIDlet is stored along the MIDlet's code.
 
Constructor Summary
PlaySVGImageDemo(java.lang.String svgImage, java.lang.String splashImage, boolean autoStart)
           
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
           
 void destroyApp(boolean unconditional)
           
 void hideNotify()
           
 void keyPressed(int keyCode)
           
 void keyReleased(int keyCode)
           
 void pauseApp()
           
 void pointerPressed(int x, int y)
           
 void pointerReleased(int x, int y)
           
 void showNotify()
           
 void sizeChanged(int width, int height)
           
 void startApp()
           
 
Methods inherited from class javax.microedition.midlet.MIDlet
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SVG_NAMESPACE_URI

public static final java.lang.String SVG_NAMESPACE_URI
The SVG Namespace URI.

See Also:
Constant Field Values

SPLASH_MIN_LENGTH

public static final long SPLASH_MIN_LENGTH
The minimal amount of time to wait when a splash screen is displayed.

See Also:
Constant Field Values

STATE_STOPPED

public static final int STATE_STOPPED
State constants. These are used to track the animator's state.

See Also:
Constant Field Values

STATE_PAUSED

public static final int STATE_PAUSED
See Also:
Constant Field Values

STATE_PLAYING

public static final int STATE_PLAYING
See Also:
Constant Field Values

STATE_INTERRUPTED

public static final int STATE_INTERRUPTED
See Also:
Constant Field Values

KEY_STOP

public static final int KEY_STOP
Key codes used to control the animator's state.

See Also:
Constant Field Values

KEY_PLAY

public static final int KEY_PLAY
See Also:
Constant Field Values

KEY_PAUSE

public static final int KEY_PAUSE
See Also:
Constant Field Values

KEY_START_DEMO

public static final int KEY_START_DEMO
See Also:
Constant Field Values

KEY_ROTATE

public static final int KEY_ROTATE
See Also:
Constant Field Values

KEY_HELP

public static final int KEY_HELP
See Also:
Constant Field Values

ERROR_COULD_NOT_LOAD_SVG

public static final java.lang.String ERROR_COULD_NOT_LOAD_SVG
Error message thrown when the SVG resource could not be loaded.

See Also:
Constant Field Values

svgImageName

public final java.lang.String svgImageName
The SVG image played by this MIDlet is stored along the MIDlet's code.


splashImageName

public final java.lang.String splashImageName
The optional splash image to show while the resources for the MIDlet are loading.


svgCanvas

protected javax.microedition.lcdui.Canvas svgCanvas
The Canvas, managed by the SVGAnimator, where the SVG animation is displayed.

See Also:
SVGAnimator.getTargetComponent()

splashCanvas

protected javax.microedition.lcdui.Canvas splashCanvas
The splash Canvas. May be null.


svgAnimator

protected javax.microedition.m2g.SVGAnimator svgAnimator
The SVGAnimator built from the SVG resource.


svgImage

protected javax.microedition.m2g.SVGImage svgImage
The SVGImage associated with the SVGAnimator


doc

protected org.w3c.dom.Document doc
The Document associated with the SVGAnimator


svg

protected org.w3c.dom.svg.SVGSVGElement svg
The root svg element.


state

protected int state
One of STATE_STOPPED, STATE_PAUSED, STATE_PLAYING or STATE_INTERRUPTED

Constructor Detail

PlaySVGImageDemo

public PlaySVGImageDemo(java.lang.String svgImage,
                        java.lang.String splashImage,
                        boolean autoStart)
Method Detail

startApp

public void startApp()
Specified by:
startApp in class javax.microedition.midlet.MIDlet

keyPressed

public void keyPressed(int keyCode)
Specified by:
keyPressed in interface javax.microedition.m2g.SVGEventListener

keyReleased

public void keyReleased(int keyCode)
Specified by:
keyReleased in interface javax.microedition.m2g.SVGEventListener

pointerPressed

public void pointerPressed(int x,
                           int y)
Specified by:
pointerPressed in interface javax.microedition.m2g.SVGEventListener

pointerReleased

public void pointerReleased(int x,
                            int y)
Specified by:
pointerReleased in interface javax.microedition.m2g.SVGEventListener

hideNotify

public void hideNotify()
Specified by:
hideNotify in interface javax.microedition.m2g.SVGEventListener

showNotify

public void showNotify()
Specified by:
showNotify in interface javax.microedition.m2g.SVGEventListener

sizeChanged

public void sizeChanged(int width,
                        int height)
Specified by:
sizeChanged in interface javax.microedition.m2g.SVGEventListener

pauseApp

public void pauseApp()
Specified by:
pauseApp in class javax.microedition.midlet.MIDlet

destroyApp

public void destroyApp(boolean unconditional)
Specified by:
destroyApp in class javax.microedition.midlet.MIDlet

commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable d)
Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener