public abstract class Transition

  1. Object
  2. Transition

ImplementsAnimation

Known subtypesBubbleTransition, CommonTransitions, FlipTransition, MorphTransition

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

Constructors

public Transition()

Methods

public final void init(Component source, Component destination)Invoked by com.codename1.ui.Display to set the source and destination forms.
protected void hideInterformContainers()Sets visibility on all shared InterFormContainers between the source and destination to be hidden.
protected void showInterformContainers()Sets visibility on all shared InterFormContainers between the source and destination to be visible.
protected void paintInterformContainers(Graphics g)Paints all shared InterFormContainers between the source and destination.
public void initTransition()Callback thats invoked before a transition begins, the source form may be null for the first form in the application.
public final Component getDestination()Returns the destination form that should be set once animation is completed
public final Component getSource()Returns the source form which is the form from which the animation is starting.
public void cleanup()Optional operation to cleanup the garbage left over by a running transition
public Transition copy(boolean reverse)Create a copy of the transition, usually the transition used is a copy.
protected final void cleanSource()Allows setting the source form to null to save memory if the transition doesn’t need it in memory.
public abstract boolean animate()Allows the animation to reduce “repaint” calls when it returns false.
public 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.

Inherited methods

Constructor details

Transition

public Transition()

Method details

init

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

Parameters

source Component
the source form from which the transition originates
destination Component
the destination form to which the transition will lead

hideInterformContainers

protected void hideInterformContainers()
Sets visibility on all shared InterFormContainers between the source and destination to be hidden. This is useful since these containers are not transitioned like the rest of components, so the transition may need to be able to paint the source or destination without these containers, and paint them separately.

showInterformContainers

protected void showInterformContainers()
Sets visibility on all shared InterFormContainers between the source and destination to be visible. This is useful since these containers are not transitioned like the rest of components, so the transition may need to be able to paint the source or destination without these containers, and paint them separately.

paintInterformContainers

protected void paintInterformContainers(Graphics g)
Paints all shared InterFormContainers between the source and destination.

Parameters

g Graphics
Graphics context to paint to.

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 component

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 component

cleanup

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

copy

public Transition copy(boolean reverse)
Create a copy of the transition, usually the transition used is a copy.

Parameters

reverse boolean
creates a new transition instance with “reverse” behavior useful for signifying “back” operations

Returns

new transition instance

cleanSource

protected final void cleanSource()
Allows setting the source form to null to save memory if the transition doesn’t need it in memory.

animate

public abstract boolean animate()
Allows the animation to reduce “repaint” calls when it returns false. It is called once for every frame. Frames are defined by the com.codename1.ui.Display class.

Returns

true if a repaint is desired or false if no repaint is necessary

paint

public 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.

Parameters

g Graphics
graphics context