Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit.animations
Class Transition

java.lang.Object
  extended by com.sun.dtv.lwuit.animations.Transition
All Implemented Interfaces:
Animation, Animated
Direct Known Subclasses:
CommonTransitions

public abstract class Transition
extends Object
implements Animation, Animated

Represents a transition animation between two forms this class is used internally by DTVContainer to play an animation when moving from one form to the next. A transition can be installed on a Form object using the in/out transitions, for ease of use LookAndFeel has support for default transitions.


Field Summary
 
Fields inherited from interface com.sun.dtv.ui.Animated
ALTERNATING, LOOP, REPEATING
 
Constructor Summary
Transition()
           
 
Method Summary
abstract  boolean animate()
          Allows the animation to reduce "repaint" calls when it returns false.
 void cleanup()
          Optional operation to cleanup the garbage left over by a running transition.
abstract  Transition copy()
          Copies a transitions.
 int getAnimationMode()
          Obtains the animation mode for this animation.
 int getDelay()
          Obtains the delay after every image for this animation when running.
 Component getDestination()
          Returns the destination form that should be set once animation is completed.
 int getPosition()
          Obtains the current position the animation is at the point of time of th method call.
 int getRepetitionMode()
          Returns the repetition mode of this animation in form of a number.
 Component getSource()
          Returns the source form which is the form from which the animation is starting.
 void init(Component source, Component destination)
          Invoked to set the source and destination forms.
 void initTransition()
          Callback thats invoked before a transition begins, the source form may be null for the first form in the application.
 boolean isRunning()
          Obtains the running mode of an animation.
 void jumpTo(int position)
          Forces an animation to jump to the position indicated by the parameter.
abstract  void paint(Graphics g)
          Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.
 void setAnimationMode(int mode)
          Sets the animation mode for this animation.
 void setDelay(int n)
          Determines the delay after every image when running this animation.
 void setRepetitionMode(int n)
          Determines how often the animation is repeated once it has been started.
 void start()
          Starts an animation.
 void stop()
          Stops an animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transition

public Transition()
Method Detail

init

public final void init(Component source,
                       Component destination)
Invoked to set the source and destination forms. This method should not be invoked by developers.

Parameters:
source - the source form from which the transition originates
destination - the destination form to which the transition will lead

initTransition

public void initTransition()
Callback thats invoked before a transition begins, the source form may be null for the first form in the application.


getDestination

public final Component getDestination()
Returns the destination form that should be set once animation is completed.

Returns:
the destination

getSource

public final Component getSource()
Returns the source form which is the form from which the animation is starting. This may be null for the first form in the application.

Returns:
the source

cleanup

public void cleanup()
Optional operation to cleanup the garbage left over by a running transition.


copy

public abstract Transition copy()
Copies a transitions.

Returns:
the copied transition

animate

public abstract boolean animate()
Description copied from interface: Animation
Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame.

Specified by:
animate in interface Animation
Returns:
true if a repaint is desired or false if no repaint is necessary

paint

public abstract void paint(Graphics g)
Description copied from interface: Animation
Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.

Specified by:
paint in interface Animation

start

public void start()
Starts an animation. Please consider that an animation is in the stopped mode per default, so it has to be started explicitly once it has been created. In case the animation is already running, a call to start() causes a restart of the animation.

Specified by:
start in interface Animated

stop

public void stop()
Stops an animation. In case the animation is already stopped, the call to stop() has no effect.

Specified by:
stop in interface Animated

isRunning

public boolean isRunning()
Obtains the running mode of an animation. Returns true if the animation is running, false otherwise.

Specified by:
isRunning in interface Animated
Returns:
true if the animation is running, false otherwise

jumpTo

public void jumpTo(int position)
Forces an animation to jump to the position indicated by the parameter. An animation can be considered as a row of images, the parameter of this method provides the index within this row. If the animation is stopped, a call to this method causes the animation to show the image at the indicated position, but not to start. If the animation is running, a call to this method causes the animation to jump to the image at the indicated position and continue running immediately.

Specified by:
jumpTo in interface Animated
Parameters:
position - the index in the row of images building the animation to which the animation is forced to jump

getPosition

public int getPosition()
Obtains the current position the animation is at the point of time of th method call. An animation can be considered as a row of images, this method provides the index within this row.

Specified by:
getPosition in interface Animated
Returns:
the current position of the image within the row of images building this animation

setRepetitionMode

public void setRepetitionMode(int n)
Determines how often the animation is repeated once it has been started.

Specified by:
setRepetitionMode in interface Animated
Parameters:
n - number of repetitions to be determined. This can be any number larger than zero or LOOP alternatively. LOOP means that the animation runs in an endless loop until the stop() method has been called.
See Also:
getRepetitionMode()

getRepetitionMode

public int getRepetitionMode()
Returns the repetition mode of this animation in form of a number. The number reads how many repetitions have been determined for this animation.

Specified by:
getRepetitionMode in interface Animated
Returns:
number of repetitions determined for this animation or LOOP which means the animation runs in an endless loop until the stop() method has been called.
See Also:
setRepetitionMode(int)

setDelay

public void setDelay(int n)
Determines the delay after every image when running this animation.

Specified by:
setDelay in interface Animated
Parameters:
n - delay in milliseconds
See Also:
getDelay()

getDelay

public int getDelay()
Obtains the delay after every image for this animation when running.

Specified by:
getDelay in interface Animated
Returns:
the delay in milliseconds
See Also:
setDelay(int)

setAnimationMode

public void setAnimationMode(int mode)
Sets the animation mode for this animation. The animation mode determines how the animation is running: always forwards, or forwards and backwards alternating.

Specified by:
setAnimationMode in interface Animated
Parameters:
mode - the animation mode. Possible values are: REPEATING and ALTERNATING.
See Also:
getAnimationMode()

getAnimationMode

public int getAnimationMode()
Obtains the animation mode for this animation. The animation mode determines how the animation is running: always forwards, or forwards and backwards alternating.

Specified by:
getAnimationMode in interface Animated
Returns:
the animation mode. Possible values are: REPEATING and ALTERNATING.
See Also:
setAnimationMode(int)

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.