Class Transition

java.lang.Object
com.codename1.ui.animations.Transition
All Implemented Interfaces:
Animation
Direct Known Subclasses:
BubbleTransition, CommonTransitions, FlipTransition, MorphTransition

public abstract class Transition extends Object implements Animation
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.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    Allows the animation to reduce "repaint" calls when it returns false.
    protected final void
    Allows setting the source form to null to save memory if the transition doesn't need it in memory.
    void
    Optional operation to cleanup the garbage left over by a running transition
    copy(boolean reverse)
    Create a copy of the transition, usually the transition used is a copy.
    final Component
    Returns the destination form that should be set once animation is completed
    final Component
    Returns the source form which is the form from which the animation is starting.
    protected void
    Sets visibility on all shared InterFormContainers between the source and destination to be hidden.
    final void
    init(Component source, Component destination)
    Invoked by com.codename1.ui.Display to set the source and destination forms.
    void
    Callback thats invoked before a transition begins, the source form may be null for the first form in the application.
    abstract void
    Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.
    protected void
    Paints all shared InterFormContainers between the source and destination.
    protected void
    Sets visibility on all shared InterFormContainers between the source and destination to be visible.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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: the source form from which the transition originates

      • destination: 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.

      Since

      7.0

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

      Since

      7.0

    • paintInterformContainers

      protected void paintInterformContainers(Graphics g)

      Paints all shared InterFormContainers between the source and destination.

      Parameters
      • g: Graphics context to paint to.
      Since

      7.0

    • 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: @param reverse 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

      Specified by:
      animate in interface Animation
    • 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 context
      Specified by:
      paint in interface Animation