|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--AbstractAnimation
The Abstract Animation object defines numerous methods of an Animation that are independent of the specific type of Animation, resulting in much repeated code. Therefore, that code has been inserted in this abstract class that many Animations extend to take use of these methods.
drawAnimation must be defined to extend this class appropriately.
| Field Summary | |
static int |
DEFAULT_CONVERSION
The Default step conversion used in animation (400). |
static int |
DEFAULT_STEP
The Default step size used in the animation (16). |
protected java.util.LinkedList |
listeners
The list of listeners to this Animation Object. |
| Fields inherited from interface Animation |
ANIMATION_MESSAGE, BEGIN, FINISH, PAUSE, PLAY, REDRAW, REWIND, STEP, STOP |
| Constructor Summary | |
AbstractAnimation()
The constructor which initiates the abstract animation. |
|
| Method Summary | |
void |
addAnimationListener(AnimationListener l)
Adds an animationListener that recieves meaningful events from the animation, according to the Animation interface and the AnimationEvent. |
void |
addDescription(java.lang.String d)
Adds a description that may be used to describe to the listener the type of event occuring. |
protected void |
animationAction()
Calls all of the listeners of the current Animation and passed information regarding the progress and status of the current Animation. |
protected void |
animationAction(int id,
java.lang.String cmd,
java.lang.String description,
double progress)
Calls all of the listeners of the current Animation and passes information regarding the progress and status of the current Animation. |
protected void |
animationAction(java.lang.String cmd,
java.lang.String description)
Calls all of the listeners of the current Animation and passed information regarding the progress and status of the current Animation. |
void |
drawAnimation(java.awt.Graphics2D g2)
Draws the animation of the next step, using the status of the animation (Animation.PLAY, Animation.PAUSE and so forth). |
void |
drawAnimation(java.awt.Graphics2D g2,
java.lang.String startingStatus)
Draws the animation of the next step, using the status of the animation (Animation.PLAY, Animation.PAUSE and so forth). |
java.lang.String |
getDescription()
Gets the description added with addDescription and should be accessed through the listener. |
AnimationListener[] |
getListeners()
Returns an array of all the listeners that were added to this Animation with addAnimationListener. |
protected java.lang.String |
getStartingCommand()
Gets the starting command for the current animation. |
java.lang.String |
getStatus()
Gets the status of the Animation using a command within Animation interface. |
boolean |
getStep()
Gets whether the current animation is in stepping mode or not. |
protected int |
getStepConversion()
Gets the conversion factor for step size and step time. |
protected double |
getStepSize()
Gets the step size for the animation. |
int |
getStepTime()
Gets the step time for the animation. |
protected void |
messageAction(java.lang.String msg)
Calls animationAction with an ANIMATION_MESSAGE, sending the message to all of its listeners. |
void |
removeAnimationListener(AnimationListener l)
Removes an animationListener from the animation, according to the Animation interface and the AnimationEvent. |
protected void |
setStartingCommand(java.lang.String command)
Sets the starting command for the current animation. |
void |
setStatus(java.lang.String cmd)
Sets the status of the Animation using a command within Animation interface. |
void |
setStep(boolean b)
Sets whether the current animation is in stepping mode or not. |
protected void |
setStepConversion(int conversion)
Sets the conversion factor for step size and step time. |
protected void |
setStepSize(double t)
Sets the step size for the animation. |
void |
setStepTime(int t)
Sets the step time for the animation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.LinkedList listeners
addAnimationListener
is used.
public static final int DEFAULT_STEP
public static final int DEFAULT_CONVERSION
| Constructor Detail |
public AbstractAnimation()
| Method Detail |
protected java.lang.String getStartingCommand()
protected int getStepConversion()
protected double getStepSize()
public int getStepTime()
getStepTime in interface Animationpublic java.lang.String getDescription()
addDescription and should be accessed through the listener.
getDescription in interface Animationpublic boolean getStep()
getStep in interface Animationpublic java.lang.String getStatus()
Animation interface.
getStatus in interface Animationpublic AnimationListener[] getListeners()
addAnimationListener.
If no such listener list exists, then an empty array is returned.
AnimationListeners.protected void setStartingCommand(java.lang.String command)
command - String starting command.protected void setStepConversion(int conversion)
conversion - factor of conversion for step time to step size.protected void setStepSize(double t)
t - the step sizepublic void setStepTime(int t)
setStepTime in interface Animationt - the step timepublic void addDescription(java.lang.String d)
getDescription.
addDescription in interface Animationd - the string defining the description.public void setStep(boolean b)
setStep in interface Animationb - boolean defining whether it is skipping.public void setStatus(java.lang.String cmd)
Animation interface.
setStatus in interface Animationcmd - cmd that the Animation's status is set to.public void addAnimationListener(AnimationListener l)
AnimationEvent.
addAnimationListener in interface Animationl - the listener for the AnimationEvents occuring within this Animation.public void removeAnimationListener(AnimationListener l)
AnimationEvent.
removeAnimationListener in interface Animationl - the listener removed from recieving the AnimationEvents occuring within this Animation.
protected void animationAction(int id,
java.lang.String cmd,
java.lang.String description,
double progress)
animationEventPerformed method is called.
id - int id for the animationcmd - String Animation command passed instead of the current Status.description - String description for messages.progress - double progress of the animation
protected void animationAction(java.lang.String cmd,
java.lang.String description)
ABSTRACT_ANIMATION is passed.
Within, the animationEventPerformed method is called.
cmd - String Animation command passed instead of the current Status.description - String description for messages.protected void animationAction()
ABSTRACT_ANIMATION is passed.
The current status and current decription are passed.
Within, the animationEventPerformed method is called.
protected void messageAction(java.lang.String msg)
Animation.ANIMATION_MESSAGE.
msg - the message sent to all of the listeners as an Animation.ANIMATION_MESSAGE.public void drawAnimation(java.awt.Graphics2D g2)
The starting status used for the animation is the one previously defined.
drawAnimation in interface Animation
public void drawAnimation(java.awt.Graphics2D g2,
java.lang.String startingStatus)
drawAnimation in interface Animationg2 - the graphics to which the animation step should be drawn.startingStatus - the status used as the starting command of animation, if needed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||