Class RMAnimator

java.lang.Object
com.reportmill.base.RMObject
com.reportmill.graphics.RMAnimator
All Implemented Interfaces:
RMArchiver.Archiving, Cloneable

public class RMAnimator extends RMObject
This class represents a timer for animation, holding things like a current time and max time.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    An interface for classes that want to receive notification of certain animator events.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new animator.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Tells animator owner's children's agents to activate.
    void
    Adds a freeze frame for the animator's current time to the freeze-frame list.
    void
    addListener(Object aListner)
    Adds an Listener to animator's listener list.
    void
    Declare newBorn shapes so that if they are added at non-zero time, we won't get bogus initial values (after an explicit time change, they will start to accept changes).
    boolean
    Returns whether the current time is not currently a key-frame.
    Standard clone implementation.
    void
    copy(Object anObj)
    Copies the attributes of the given object.
    boolean
    equals(Object anObj)
    Standard equals implementation.
    void
    This method tells the animator to move one frame backward (based on the frame rate).
    void
    This method tells the animator to move one frame forward (based on the frame rate).
    fromXML(RXArchiver anArchiver, RXElement anElement)
    XML unarchival.
    boolean
    Returns whether agents are enabled (useful to disable when editing).
    float
    Returns the length of time for a single frame (1/frame-rate).
    float
    Returns the frame rate for this animator.
    Returns the list of key-frames present in animator owner's children.
    getKeyFrames(List shapeList, boolean includeImplied)
    Returns the list of key-frames present in the given list of shapes (assumed to be animator owner's descendants).
    boolean
    Returns whether this animator loops when time hits max time.
    float
    Returns the max time for this animator.
    Returns the owner of the animator.
    boolean
    Returns whether the time is reset to start value when animator stops.
    Returns the key-frame time that new anim records should be made relative to.
    float
    Returns the number of seconds the animator has been playing for.
    float
     
    Returns the frames that should be used when generating a non animated document (say in PDF).
    float
    Returns the current time of the animator.
    boolean
    Returns whether animator owner's children are devoid of any animation records.
    boolean
    Returns whether the animator owner's children should accept changes.
    boolean
    Returns whether the given objects was created while at the current time.
    boolean
    Returns whether the animator is currently in the act of playing.
    void
    Initiates a Swing timer to start automatically incrementing the animator's time (by frame rate increments).
    void
    removeFramesAtTime(float aTime)
    Removes records of the animator owner's children at a given time.
    void
    removeFramesBetweenTimes(float startTime, float endTime, boolean inclusive)
    Removes records of the animator owner's children in the given time range.
    void
    Remove an Listener from animator's listener list.
    void
    scaleFrames(float start, float length, float newLength)
    Scales records of the animator owner's children in the range from start to start + length to a given new length.
    void
    setAgentsEnabled(boolean aValue)
    Sets whether agents are enabled (useful to disable when editing).
    void
    setEnabled(boolean aFlag)
    Sets whether the animator owner's children should accept changes.
    void
    setFrameRate(float aValue)
    Sets the frame rate for this animator.
    void
    setLoops(boolean aValue)
    Sets whether this animator loops when time hits max time.
    void
    setMaxTime(float maxTime)
    Sets the max time for this animator.
    void
    setOwner(RMShape anObject)
    Sets the owner of the animator.
    void
    setResetTimeOnStop(boolean aFlag)
    Sets whether the time is reset to start value when animator stops.
    void
    Sets the key-frame time that new anim records should be made from.
    void
     
    void
    setTime(float aTime)
    Sets the current time of the animator (clamped to maxTime), tells owner to setTime as well.
    void
    shiftFrames(float fromTime, float byTime)
    Shifts records of animator owner's children from the given from-time on, by the given by-time.
    void
    Disables the Swing timer to stop automatically incrementing the animator's time.
    Returns a string description of the animator.
    toXML(RXArchiver anArchiver)
    XML archival.
    void
    Called as a notification that the animator is about to change state (registers for undo).

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RMAnimator

      public RMAnimator()
      Creates a new animator.
  • Method Details

    • getOwner

      public RMShape getOwner()
      Returns the owner of the animator.
    • setOwner

      public void setOwner(RMShape anObject)
      Sets the owner of the animator.
    • getTime

      public float getTime()
      Returns the current time of the animator.
    • setTime

      public void setTime(float aTime)
      Sets the current time of the animator (clamped to maxTime), tells owner to setTime as well.
    • getMaxTime

      public float getMaxTime()
      Returns the max time for this animator.
    • setMaxTime

      public void setMaxTime(float maxTime)
      Sets the max time for this animator. May also call setTime() if animator's current time is beyond new max.
    • getFrameRate

      public float getFrameRate()
      Returns the frame rate for this animator.
    • setFrameRate

      public void setFrameRate(float aValue)
      Sets the frame rate for this animator.
    • getFrameInterval

      public float getFrameInterval()
      Returns the length of time for a single frame (1/frame-rate).
    • getLoops

      public boolean getLoops()
      Returns whether this animator loops when time hits max time.
    • setLoops

      public void setLoops(boolean aValue)
      Sets whether this animator loops when time hits max time.
    • getResetTimeOnStop

      public boolean getResetTimeOnStop()
      Returns whether the time is reset to start value when animator stops.
    • setResetTimeOnStop

      public void setResetTimeOnStop(boolean aFlag)
      Sets whether the time is reset to start value when animator stops.
    • getKeyFrames

      public List getKeyFrames()
      Returns the list of key-frames present in animator owner's children.
    • getKeyFrames

      public List getKeyFrames(List shapeList, boolean includeImplied)
      Returns the list of key-frames present in the given list of shapes (assumed to be animator owner's descendants).
    • canFreezeFrame

      public boolean canFreezeFrame()
      Returns whether the current time is not currently a key-frame.
    • addFreezeFrame

      public void addFreezeFrame()
      Adds a freeze frame for the animator's current time to the freeze-frame list.
    • getScopedKeyFrame

      public Number getScopedKeyFrame()
      Returns the key-frame time that new anim records should be made relative to.
    • setScopedKeyFrame

      public void setScopedKeyFrame(Number aValue)
      Sets the key-frame time that new anim records should be made from.
    • getStillFramesString

      public String getStillFramesString()
      Returns the frames that should be used when generating a non animated document (say in PDF).
    • setStillFramesString

      public void setStillFramesString(String aString)
    • getStillFrame

      public float getStillFrame()
    • getAgentsEnabled

      public boolean getAgentsEnabled()
      Returns whether agents are enabled (useful to disable when editing).
    • setAgentsEnabled

      public void setAgentsEnabled(boolean aValue)
      Sets whether agents are enabled (useful to disable when editing).
    • activateAgents

      public void activateAgents()
      Tells animator owner's children's agents to activate.
    • play

      public void play()
      Initiates a Swing timer to start automatically incrementing the animator's time (by frame rate increments).
    • stop

      public void stop()
      Disables the Swing timer to stop automatically incrementing the animator's time.
    • frameForward

      public void frameForward()
      This method tells the animator to move one frame forward (based on the frame rate).
    • frameBackward

      public void frameBackward()
      This method tells the animator to move one frame backward (based on the frame rate).
    • isRunning

      public boolean isRunning()
      Returns whether the animator is currently in the act of playing.
    • getSecondsElapsed

      public float getSecondsElapsed()
      Returns the number of seconds the animator has been playing for.
    • shiftFrames

      public void shiftFrames(float fromTime, float byTime)
      Shifts records of animator owner's children from the given from-time on, by the given by-time.
    • scaleFrames

      public void scaleFrames(float start, float length, float newLength)
      Scales records of the animator owner's children in the range from start to start + length to a given new length.
    • isEmpty

      public boolean isEmpty()
      Returns whether animator owner's children are devoid of any animation records.
    • removeFramesAtTime

      public void removeFramesAtTime(float aTime)
      Removes records of the animator owner's children at a given time.
    • removeFramesBetweenTimes

      public void removeFramesBetweenTimes(float startTime, float endTime, boolean inclusive)
      Removes records of the animator owner's children in the given time range.
    • isEnabled

      public boolean isEnabled()
      Returns whether the animator owner's children should accept changes.
    • setEnabled

      public void setEnabled(boolean aFlag)
      Sets whether the animator owner's children should accept changes. This can be used strategically to disable the Animator so that it does not receive certain events (like each of the discrete moves in a mouse drag loop). Should be followed by enable (they can be nested).
    • addListener

      public void addListener(Object aListner)
      Adds an Listener to animator's listener list.
    • removeListener

      public void removeListener(Object aListner)
      Remove an Listener from animator's listener list.
    • isNewborn

      public boolean isNewborn(Object anObj)
      Returns whether the given objects was created while at the current time.
    • addNewborn

      public void addNewborn(Object anObj)
      Declare newBorn shapes so that if they are added at non-zero time, we won't get bogus initial values (after an explicit time change, they will start to accept changes).
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • clone

      public Object clone()
      Standard clone implementation.
      Overrides:
      clone in class RMObject
    • copy

      public void copy(Object anObj)
      Copies the attributes of the given object.
      Overrides:
      copy in class RMObject
    • toXML

      public RXElement toXML(RXArchiver anArchiver)
      XML archival.
    • fromXML

      public Object fromXML(RXArchiver anArchiver, RXElement anElement)
      XML unarchival.
    • willChange

      public void willChange()
      Called as a notification that the animator is about to change state (registers for undo).
    • toString

      public String toString()
      Returns a string description of the animator.
      Overrides:
      toString in class Object