| javax.microedition.lcdui.Canvas com.sun.perseus.midp.SVGCanvas
SVGCanvas | class SVGCanvas extends Canvas implements CanvasUpdateListener(Code) | | This class provides support for an LCDUI Canvas extension which can display
an SVG Document.
version: $Id: SVGCanvas.java,v 1.16 2006/04/21 06:40:56 st125089 Exp $ |
Constructor Summary | |
public | SVGCanvas(DocumentNode documentNode) Parameters: documentNode - the documentNode this component will render. |
Method Summary | |
protected void | buildOffscreen(int width, int height) The offscreen buffer has the size of the component. | protected void | checkOffscreen() Checks if the offscreen buffer needs to be built or rebuilt. | protected void | dispatchKeyEvent(String eventType, int keyCode) Dispatches a key event to the DOM tree. | protected void | dispatchPointerEvent(String eventType, float[] pt) Dispatches a mouse event to the DOM tree. | public float | getTimeIncrement() Get the current time increment for animation rendering. | protected void | hideNotify() Invoked when the component is hidden. | public void | initialLoadComplete(Exception e) Called by the SimpleCanvasManager when the initial load is
complete. | void | invokeAndWait(Runnable runnable) Invoke the Runnable in the Document update thread and
return only after this Runnable has finished. | void | invokeLater(Runnable runnable) Schedule execution of the input Runnable in the update thread at a later time. | protected void | keyPressed(int keyCode) Invoked when a key has been pressed. | protected void | keyReleased(int keyCode) Invoked when a key has been released. | protected void | paint(Graphics g) | public void | pause() Transition this SVGAnimator to the paused state.
The SVGAnimator stops advancing the document's current time
automatically (see the SVGDocument's setCurrentTime method). | public void | play() Transition this SVGAnimator to the playing
state. | protected void | pointerPressed(int x, int y) Invoked when a mouse button has been pressed on a component. | protected void | pointerReleased(int x, int y) Invoked when a mouse button has been released on a component. | public void | setSVGEventListener(SVGEventListener svgEventListener) Associate the specified SVGEventListener with this
SVGAnimator .
Parameters: svgEventListener - the SVGEventListener that will receiveevents forwarded by this SVGAnimator . | public void | setTimeIncrement(float timeIncrement) Set the time increment to be used for animation rendering.
Parameters: timeIncrement - the minimal period of time, in seconds, thatshould elapse between frame. | protected void | showNotify() Invoked when the component is shown. | protected void | sizeChanged(int w, int h) Invoked when the component's size changes. | String | stateToString() Helper method. | public void | stop() Transition this SVGAnimator to the stopped state. | public void | updateComplete(Object canvasManager) Invoked by the SimpleCanvasManager when it is done updating the
canvas. |
CLEAR_COLOR | final public static int CLEAR_COLOR(Code) | | Color used to clear the canvas' background.
|
SMIL_ANIMATION_FRAME_LENGTH | final public static int SMIL_ANIMATION_FRAME_LENGTH(Code) | | SMIL Animation's frame length, in milliseconds
|
STATE_PAUSED | final public static int STATE_PAUSED(Code) | | Paused state, i.e., repainting buffer but no longer advancing the
time.
|
STATE_PLAYING | final public static int STATE_PLAYING(Code) | | Playing state, i.e., playing animations and repainting buffer.
|
STATE_STOPPED | final public static int STATE_STOPPED(Code) | | Initial state.
|
canvasManager | protected SimpleCanvasManager canvasManager(Code) | | The SimpleCanvasManager manages the area where the SVG
content is rendered.
|
documentNode | protected DocumentNode documentNode(Code) | | This component displays a DocumentNode object, which
is built from the URI
|
lastMouseTarget | protected ModelNode lastMouseTarget(Code) | | The last mouse event target.
|
lastWasPressed | protected boolean lastWasPressed(Code) | | True if the last pointer event was a pointer pressed event.
|
lastX | protected int lastX(Code) | | Last x position on a pointer pressed event.
|
lastY | protected int lastY(Code) | | Last y position on a pointer pressed event.
|
offscreenHeight | protected int offscreenHeight(Code) | | Offscreen height
|
offscreenWidth | protected int offscreenWidth(Code) | | Offscreen width
|
smilSample | protected SMILSample smilSample(Code) | | The animation sampler, which runs animations in the update thread.
|
state | protected int state(Code) | | The current player state.
|
timeIncrement | protected float timeIncrement(Code) | | The time increment for the animation.
|
updateQueue | protected RunnableQueue updateQueue(Code) | | The RunnableQueue is the _only_ valid way to access the
model tree. No access to the model should be done other
than from the RunnableQueue thread.
|
SVGCanvas | public SVGCanvas(DocumentNode documentNode)(Code) | | Parameters: documentNode - the documentNode this component will render. The inputDocumentNode must be fully loaded before this method is called.Note: if the DocumentNode already has an associated RunnableQueue,it is simply replaced. It is the responsibility of the caller to stop that RunnableQueue if need be. throws: IllegalArgumentException - see SVGCanvas.setURI setURI. |
buildOffscreen | protected void buildOffscreen(int width, int height)(Code) | | The offscreen buffer has the size of the component. This method
is called in the MIDP painting thread.
Parameters: width - the requested minimum buffer width Parameters: height - the requested minimum buffer height |
checkOffscreen | protected void checkOffscreen()(Code) | | Checks if the offscreen buffer needs to be built or rebuilt.
|
dispatchKeyEvent | protected void dispatchKeyEvent(String eventType, int keyCode)(Code) | | Dispatches a key event to the DOM tree.
Parameters: eventType - the DOM event type. Parameters: keyCode - the key code. |
dispatchPointerEvent | protected void dispatchPointerEvent(String eventType, float[] pt)(Code) | | Dispatches a mouse event to the DOM tree.
Parameters: eventType - the DOM event type. Parameters: pt - the mouse event coordinates. |
getTimeIncrement | public float getTimeIncrement()(Code) | | Get the current time increment for animation rendering. The
SVGAnimator increments the SVG document's current time by this amount
upon each rendering. The default value is 0.1 (100 milliseconds).
the current time increment, in seconds, used for animationrendering. See Also: SVGCanvas.setTimeIncrement |
hideNotify | protected void hideNotify()(Code) | | Invoked when the component is hidden.
|
initialLoadComplete | public void initialLoadComplete(Exception e)(Code) | | Called by the SimpleCanvasManager when the initial load is
complete. This method is called in the RunnableQueue thread.
Parameters: e - if not null, it means that the initial load failed due tothis exception. |
invokeAndWait | void invokeAndWait(Runnable runnable) throws InterruptedException(Code) | | Invoke the Runnable in the Document update thread and
return only after this Runnable has finished.
Parameters: runnable - the new Runnable to invoke. throws: InterruptedException - if the current thread is waiting,sleeping, or otherwise paused for a long time and another threadinterrupts it. throws: NullPointerException - if runnable is null. throws: IllegalStateException - if the animator is in the stopped state. |
invokeLater | void invokeLater(Runnable runnable)(Code) | | Schedule execution of the input Runnable in the update thread at a later time.
Parameters: runnable - the new Runnable to execute in the Document's updatethread when time permits. throws: NullPointerException - if runnable is null. throws: IllegalStateException - if the animator is in the stopped state. |
keyPressed | protected void keyPressed(int keyCode)(Code) | | Invoked when a key has been pressed.
Parameters: keyCode - the code of the event key |
keyReleased | protected void keyReleased(int keyCode)(Code) | | Invoked when a key has been released.
Parameters: keyCode - the code of the event key |
pause | public void pause()(Code) | | Transition this SVGAnimator to the paused state.
The SVGAnimator stops advancing the document's current time
automatically (see the SVGDocument's setCurrentTime method). In consequence,
animation playback will be paused until another call to the play method
is made, at which points animations will resume from the document's current
time. SVGImage updates (through API calls) cause a rendering update
while the SVGAnimator is in the paused state.
throws: IllegalStateException - if the animator is not in the playingstate. |
play | public void play()(Code) | | Transition this SVGAnimator to the playing
state. In the playing state, both Animation and SVGImage
updates cause rendering updates. Note that in the playing state,
when the document's current time changes, the animator will seek
to the new time, and continue to play animations from this place.
throws: IllegalStateException - if the animator is not currently inthe stopped or paused state. |
pointerPressed | protected void pointerPressed(int x, int y)(Code) | | Invoked when a mouse button has been pressed on a component.
Parameters: x - the x-axis coordinate of the pointer event Parameters: y - the y-axis coordinate of the pointer event |
pointerReleased | protected void pointerReleased(int x, int y)(Code) | | Invoked when a mouse button has been released on a component.
Parameters: x - the x-axis coordinate of the pointer event Parameters: y - the y-axis coordinate of the pointer event |
setSVGEventListener | public void setSVGEventListener(SVGEventListener svgEventListener)(Code) | | Associate the specified SVGEventListener with this
SVGAnimator .
Parameters: svgEventListener - the SVGEventListener that will receiveevents forwarded by this SVGAnimator . If null,events will not be forwarded by the SVGAnimator . |
setTimeIncrement | public void setTimeIncrement(float timeIncrement)(Code) | | Set the time increment to be used for animation rendering.
Parameters: timeIncrement - the minimal period of time, in seconds, thatshould elapse between frame. Must be greater than zero. throws: IllegalArgumentException - if timeIncrement is less than or equal tozero. See Also: SVGCanvas.getTimeIncrement |
showNotify | protected void showNotify()(Code) | | Invoked when the component is shown.
|
sizeChanged | protected void sizeChanged(int w, int h)(Code) | | Invoked when the component's size changes.
Parameters: w - the new width Parameters: h - the new height |
stateToString | String stateToString()(Code) | | Helper method. Converts the current state to a String.
|
stop | public void stop()(Code) | | Transition this SVGAnimator to the stopped state.
In this state, no rendering updates are performed.
throws: IllegalStateException - if the animator is not in the playingor paused state. |
updateComplete | public void updateComplete(Object canvasManager)(Code) | | Invoked by the SimpleCanvasManager when it is done updating the
canvas. This is used during the progressive rendering loading phase and
when a Runnable has been invoked on the RunnableQueue associated with the
SVG image. This method is called in the RunnableQueue thread.
Parameters: canvasManager - the SimpleCanvasManager which is reportingthe update. |
|
|