/*
* @(#)AnimationEvent.java
*
* Last Modified: 9/02/01
*/
import java.awt.*;
/**
* A semantic event which indicates that an Animation-defined action occured.
* This high-level event is generated by an Animation Object when
* an action occurs (such as a change in progress).
* The event is passed to every AnimationListener
object
* that registered to receive such events using the Animation's
* addAnimationListener
method.
*
* The object that implements the AnimationListener
interface
* gets this AnimationEvent
when the event occurs. The listener
* is therefore spared the details of processing individual selection, and can
* instead process a "meaningful" (semantic) event.
*
* @see AnimationListener
* @see Animation
*
* @author Corey Sanders
* @version 1.3 9/02/01
*/
public class AnimationEvent extends AWTEvent {
/**
* ID for the AbstractAnimation event.
*/
public static final int ABSTRACT_ANIMATION = 4000;
/**
* ID for the InsertBSTAnimation event.
*/
public static final int INSERT_BST_ANIMATION = 4001;
/**
* ID for the InsertRedBlackAnimation event.
*/
public static final int INSERT_RED_BLACK_ANIMATION = 5001;
/**
* ID for the DeleteBSTAnimation event.
*/
public static final int DELETE_BST_ANIMATION = 4002;
/**
* ID for the DeleteRedBlackAnimation event.
*/
public static final int DELETE_RED_BLACK_ANIMATION = 5002;
/**
* ID for the RotateBSTAnimation event.
*/
public static final int ROTATION_BST_ANIMATION = 4003;
/**
* ID for the RotateDoubleBSTAnimation event.
*/
public static final int ROTATION_DOUBLE_BST_ANIMATION = 4004;
/**
* ID for the MovingBSTAnimation event.
*/
public static final int MOVING_NODES_ANIMATION = 4005;
/**
* ID for the SearchBSTAnimation event.
*/
public static final int SEARCH_BST_ANIMATION = 4006;
/**
* ID for the SelectionBSTAnimation event.
*/
public static final int SELECTION_BST_ANIMATION = 4006;
/**
* ID for the PartitionBSTAnimation event.
*/
public static final int PARTITION_BST_ANIMATION = 4007;
/**
* ID for the BalanceBSTAnimation event.
*/
public static final int BALANCE_BST_ANIMATION = 4008;
/**
* ID for the TraverseBSTAnimation event.
*/
public static final int TRAVERSE_BST_ANIMATION = 4009;
/**
* ID for the DisplayChangeAnimation event.
*/
public static final int DISPLAY_CHANGE_ANIMATION = 7001;
/**
* The string that gives more details
* of the status of the AnimationEvent.
* @see #getStatus()
*/
private String status;
/**
* The string that gives more details
* of the description of the AnimationEvent.
* This information is very specific to the Animation
* that fired it.
* @see #getAnimationDescription()
*/
private String animationDescription;
/**
* The double (generally between 0 and 1) indicating the current progress of the animation.
* @see #getProgress()
*/
double progress;
/**
* Constructs an AnimationEvent
object.
*
* @param source the object that originated the event
* @param id an integer that identifies the event
*/
public AnimationEvent(Object source, int id) {
this(source, id, null, null, 0.0);
}
/**
* Constructs an AnimationEvent
object.
*
* @param source the object that originated the event
* @param id an integer that identifies the event
* @param progress double to indicate the progress that the animation starts on.
*/
public AnimationEvent(Object source, int id, double progress) {
this(source, id, null, null, progress);
}
/**
* Constructs an AnimationEvent
object.
*
* @param source the object that originated the event
* @param id an integer that identifies the event
* @param status a string describing the status of teh current AnimationEvent.
*/
public AnimationEvent(Object source, int id, String status) {
this(source, id, status, null, 0.0);
}
/**
* Constructs an AnimationEvent
object.
*
* @param source the object that originated the event
* @param id an integer that identifies the event
* @param status a string describing the status of teh current AnimationEvent.
* @param animationDescription a string that may specify a description (possibly one
* of several) associated with the event
*/
public AnimationEvent(Object source, int id, String status, String animationDescription) {
this(source, id, status, animationDescription, 0.0);
}
/**
* Constructs an AnimationEvent
object with the command and progress.
*
* @param source the object that originated the event
* @param id an integer that identifies the event
* @param status a string describing the status of teh current AnimationEvent.
* @param progress double to indicate the progress that the animation starts on.
*/
public AnimationEvent(Object source, int id, String status, double progress) {
this(source, id, status, null, progress);
}
/**
* Constructs an AnimationEvent
object with the command and progress.
*
* @param source the object that originated the event
* @param id an integer that identifies the event
* @param status a string describing the status of teh current AnimationEvent.
* @param animationDescription a string that may specify a description (possibly one
* of several) associated with the event
* @param progress double to indicate the progress that the animation starts on.
*/
public AnimationEvent(Object source, int id, String status, String animationDescription, double progress) {
super(source, id);
this.status = status;
this.animationDescription = animationDescription;
this.progress = progress;
}
/**
* Returns the description String associated with this AnimationEvent.
*
*@return the string identifying the description for this event
*/
public String getAnimationDescription() {
return animationDescription;
}
/**
* Returns the status String associated with this AnimationEvent.
*
*@return the string identifying the status for this event
*/
public String getStatus() {
return status;
}
/**
* Returns the double progress associated with this AnimationEvent.
*
*@return the double proegress for this event
*/
public double getProgress() {
return progress;
}
}