Class AbstractEffect

java.lang.Object
org.eclipse.nebula.animation.effects.AbstractEffect
All Implemented Interfaces:
IEffect
Direct Known Subclasses:
AlphaEffect, CrossFadeEffect, GalleryGroupResizeEffect, GrowEffect, MoveControlEffect, MoveScrollBarEffect, ResizeEffect, SetBoundsEffect, SetColorEffect, ShakeEffect

public abstract class AbstractEffect
extends java.lang.Object
implements IEffect
Abstract implementation for an effect.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected boolean done  
    protected IMovement easingFunction  
    protected long length  
    protected java.lang.Runnable runnableOnCancel  
    protected java.lang.Runnable runnableOnStop  
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractEffect​(long lengthMilli, IMovement movement)
    Create a new effect.
    AbstractEffect​(long lengthMilli, IMovement movement, java.lang.Runnable onStop, java.lang.Runnable onCancel)
    Create a new effect, with listeners for stop and cancel events.
  • Method Summary

    Modifier and Type Method Description
    abstract void applyEffect​(long currentTime)
    Apply this effect.
    void cancel()
    Set the effect as done and run the cancel runnable.
    protected void doCancel()
    Run the onCancel runnable if any.
    void doEffect()  
    void doEffect​(long time)
    Apply effect to the target according to the given time.
    protected void doStop()
    Run the onStop runnable if any.
    long getLength()
    Get effect length
    boolean isDone()  
    void processEnd​(long time)
    Check if the effect has ended.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AbstractEffect

      public AbstractEffect​(long lengthMilli, IMovement movement)
      Create a new effect.
      Parameters:
      lengthMilli -
      movement -
    • AbstractEffect

      public AbstractEffect​(long lengthMilli, IMovement movement, java.lang.Runnable onStop, java.lang.Runnable onCancel)
      Create a new effect, with listeners for stop and cancel events.
      Parameters:
      lengthMilli -
      movement -
      onStop -
      onCancel -
  • Method Details

    • applyEffect

      public abstract void applyEffect​(long currentTime)
      Apply this effect.
      Parameters:
      currentTime -
    • cancel

      public void cancel()
      Description copied from interface: IEffect
      Set the effect as done and run the cancel runnable.
      Specified by:
      cancel in interface IEffect
      See Also:
      IEffect.cancel()
    • doCancel

      protected void doCancel()
      Run the onCancel runnable if any.
    • doEffect

      public void doEffect()
      See Also:
      org.eclipse.nebula.animation.effects.IEffect#doEffect()
    • doEffect

      public void doEffect​(long time)
      Description copied from interface: IEffect
      Apply effect to the target according to the given time.
      Specified by:
      doEffect in interface IEffect
      Parameters:
      time - - Current time in ms. This value may be larger than the effect length.
      See Also:
      IEffect.doEffect(long)
    • doStop

      protected void doStop()
      Run the onStop runnable if any.
    • getLength

      public long getLength()
      Description copied from interface: IEffect
      Get effect length
      Specified by:
      getLength in interface IEffect
      Returns:
      length (ms)
      See Also:
      IEffect.getLength()
    • isDone

      public boolean isDone()
      Specified by:
      isDone in interface IEffect
      Returns:
      true if the effect as already reached its end.
      See Also:
      IEffect.isDone()
    • processEnd

      public void processEnd​(long time)
      Check if the effect has ended. In that case, start the onStop runnable.