com.sun.lwuit.animations
Class CommonTransitions

java.lang.Object
  extended by com.sun.lwuit.animations.Transition
      extended by com.sun.lwuit.animations.CommonTransitions
All Implemented Interfaces:
Animation

public final class CommonTransitions
extends Transition

Contains common transition animations including the following:

  1. Slide - the exiting form slides out of the screen while the new form slides in.
  2. Fade - components fade into/out of the screen
  3. Timeline - uses an animation image as an alpha mask between the source/destination

Instances of this class are created using factory methods.


Field Summary
static int SLIDE_HORIZONTAL
          Slide the transition horizontally
static int SLIDE_VERTICAL
          Slide the transition vertically
 
Method Summary
 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
 Transition copy(boolean reverse)
          Create a copy of the transition, usually the transition used is a copy.
static CommonTransitions createDialogPulsate()
          Creates a dialog pulsate transition
static CommonTransitions createEmpty()
          Creates an empty transition that does nothing.
static CommonTransitions createFade(int duration)
          Creates a transition for fading a form in while fading out the original form
static CommonTransitions createFastSlide(int type, boolean forward, int duration)
          Creates a slide transition with the given duration and direction, this differs from the standard slide animation by focusing on speed rather than on minimizing heap usage.
static CommonTransitions createFastSlide(int type, boolean forward, int duration, boolean drawDialogMenu)
          Creates a slide transition with the given duration and direction, this differs from the standard slide animation by focusing on speed rather than on minimizing heap usage This method works by creating two images and sliding them which works much faster for all devices however takes up more ram.
protected  Motion createMotion(int startOffset, int dest, int speed)
          This method can be overriden by subclasses to create their own motion object on the fly
static CommonTransitions createSlide(int type, boolean forward, int duration)
          Creates a slide transition with the given duration and direction
static CommonTransitions createSlide(int type, boolean forward, int duration, boolean drawDialogMenu)
          Creates a slide transition with the given duration and direction
static CommonTransitions createSlideFadeTitle(boolean forward, int duration)
          Creates a slide transition for the body of the form that fades the title in while sliding
static CommonTransitions createTimeline(Image animation)
          Creates a transition using an animated image object (e.g. timeline object) as an alpha mask between the source/target
 Motion getMotion()
          Motion represents the physical movement within a transition, it can be replaced by the user to provide a more appropriate physical feel
 void initTransition()
          Callback thats invoked before a transition begins, the source form may be null for the first form in the application.
static boolean isDefaultLinearMotion()
          Indicates whether the motion associated with these transitions by default is linear or spline motion
 boolean isLinearMotion()
          Indicates whether the motion associated with this transition is linear or spline motion
 void paint(Graphics g)
          Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.
static void setDefaultLinearMotion(boolean aDefaultLinearMotion)
          Indicates whether the motion associated with these transitions by default is linear or spline motion
 void setLinearMotion(boolean linearMotion)
          Indicates whether the motion associated with this transition is linear or spline motion
 void setMotion(Motion motion)
          Motion represents the physical movement within a transition, it can be replaced by the user to provide a more appropriate physical feel
 
Methods inherited from class com.sun.lwuit.animations.Transition
cleanSource, getDestination, getSource, init
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLIDE_HORIZONTAL

public static final int SLIDE_HORIZONTAL
Slide the transition horizontally

See Also:
createSlide(int, boolean, int), Constant Field Values

SLIDE_VERTICAL

public static final int SLIDE_VERTICAL
Slide the transition vertically

See Also:
createSlide(int, boolean, int), Constant Field Values
Method Detail

createEmpty

public static CommonTransitions createEmpty()
Creates an empty transition that does nothing. This has the same effect as setting a transition to null.

Returns:
empty transition

createSlideFadeTitle

public static CommonTransitions createSlideFadeTitle(boolean forward,
                                                     int duration)
Creates a slide transition for the body of the form that fades the title in while sliding

Parameters:
forward - forward is a boolean value, represent the directions of switching forms, for example for a horizontally type, true means horizontally movement to right.
duration - represent the time the transition should take in millisecond

createDialogPulsate

public static CommonTransitions createDialogPulsate()
Creates a dialog pulsate transition


createFastSlide

public static CommonTransitions createFastSlide(int type,
                                                boolean forward,
                                                int duration)
Creates a slide transition with the given duration and direction, this differs from the standard slide animation by focusing on speed rather than on minimizing heap usage. This method works by creating two images and sliding them which works much faster for all devices however takes up more ram. Notice that this method of painting doesn't support various basic LWUIT abilities such as translucent menus/dialogs etc.

Parameters:
type - type can be either vertically or horizontally, which means the movement direction of the transition
forward - forward is a boolean value, represent the directions of switching forms, for example for a horizontally type, true means horizontally movement to right.
duration - represent the time the transition should take in millisecond
Returns:
a transition object

createSlide

public static CommonTransitions createSlide(int type,
                                            boolean forward,
                                            int duration)
Creates a slide transition with the given duration and direction

Parameters:
type - type can be either vertically or horizontally, which means the movement direction of the transition
forward - forward is a boolean value, represent the directions of switching forms, for example for a horizontally type, true means horizontally movement to right.
duration - represent the time the transition should take in millisecond
Returns:
a transition object

createSlide

public static CommonTransitions createSlide(int type,
                                            boolean forward,
                                            int duration,
                                            boolean drawDialogMenu)
Creates a slide transition with the given duration and direction

Parameters:
type - type can be either vertically or horizontally, which means the movement direction of the transition
forward - forward is a boolean value, represent the directions of switching forms, for example for a horizontally type, true means horizontally movement to right.
duration - represent the time the transition should take in millisecond
drawDialogMenu - indicates that the menu (softkey area) of the dialog should be kept during a slide transition. This is only relevant for dialog in/out transitions.
Returns:
a transition object

createFastSlide

public static CommonTransitions createFastSlide(int type,
                                                boolean forward,
                                                int duration,
                                                boolean drawDialogMenu)
Creates a slide transition with the given duration and direction, this differs from the standard slide animation by focusing on speed rather than on minimizing heap usage This method works by creating two images and sliding them which works much faster for all devices however takes up more ram. Notice that this method of painting doesn't support various basic LWUIT abilities such as translucent menus/dialogs etc.

Parameters:
type - type can be either vertically or horizontally, which means the movement direction of the transition
forward - forward is a boolean value, represent the directions of switching forms, for example for a horizontally type, true means horizontally movement to right.
duration - represent the time the transition should take in millisecond
drawDialogMenu - indicates that the menu (softkey area) of the dialog should be kept during a slide transition. This is only relevant for dialog in/out transitions.
Returns:
a transition object

createFade

public static CommonTransitions createFade(int duration)
Creates a transition for fading a form in while fading out the original form

Parameters:
duration - represent the time the transition should take in millisecond
Returns:
a transition object

createTimeline

public static CommonTransitions createTimeline(Image animation)
Creates a transition using an animated image object (e.g. timeline object) as an alpha mask between the source/target

Parameters:
animation - the image object to execute
Returns:
a transition object

initTransition

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

Overrides:
initTransition in class Transition

createMotion

protected Motion createMotion(int startOffset,
                              int dest,
                              int speed)
This method can be overriden by subclasses to create their own motion object on the fly

Parameters:
startOffset - the start offset for the menu
dest - the destination of the motion
speed - the speed of the motion
Returns:
a motion instance

animate

public 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. Frames are defined by the Display class.

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

paint

public 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
Specified by:
paint in class Transition
Parameters:
g - graphics context

cleanup

public void cleanup()
Description copied from class: Transition
Optional operation to cleanup the garbage left over by a running transition

Overrides:
cleanup in class Transition

getMotion

public Motion getMotion()
Motion represents the physical movement within a transition, it can be replaced by the user to provide a more appropriate physical feel

Returns:
the instanceo of the motion class used by this transition

setMotion

public void setMotion(Motion motion)
Motion represents the physical movement within a transition, it can be replaced by the user to provide a more appropriate physical feel

Parameters:
motion - new instance of the motion class that will be used by the transition

copy

public Transition copy(boolean reverse)
Description copied from class: Transition
Create a copy of the transition, usually the transition used is a copy.

Overrides:
copy in class Transition
Parameters:
reverse - creates a new transition instance with "reverse" behavior useful for signifying "back" operations
Returns:
new transition instance

isLinearMotion

public boolean isLinearMotion()
Indicates whether the motion associated with this transition is linear or spline motion

Returns:
the linearMotion

setLinearMotion

public void setLinearMotion(boolean linearMotion)
Indicates whether the motion associated with this transition is linear or spline motion

Parameters:
linearMotion - the linearMotion to set

isDefaultLinearMotion

public static boolean isDefaultLinearMotion()
Indicates whether the motion associated with these transitions by default is linear or spline motion

Returns:
the defaultLinearMotion

setDefaultLinearMotion

public static void setDefaultLinearMotion(boolean aDefaultLinearMotion)
Indicates whether the motion associated with these transitions by default is linear or spline motion

Parameters:
aDefaultLinearMotion - the defaultLinearMotion to set