/*
 * @(#)TreeMessageEvent.java
 *
 * Last Modified: 9/15/01
 */

import java.awt.AWTEvent;
import java.awt.Event;

/**
 * A semantic event which indicates that a TreeMessage-defined action occured.
 * This high-level event is generated by an Tree Object when
 * an action occurs (such as a change in size).
 * The event is passed to every <code>TreeMessageListener</code> object
 * that registered to receive such events using the Animation's
 * <code>addTreeMessageListener</code> method.
 * <P>
 * The object that implements the <code>TreeMessageListener</code> interface
 * gets this <code>TreeMessageEvent</code> when the event occurs. The listener
 * is therefore spared the details of processing individual selection, and can
 * instead process a "meaningful" (semantic) event.
 *
 *
 * @author Corey Sanders
 * @version 1.3 9/15/01
 */
public class TreeMessageEvent extends AWTEvent {

	/**
     * ID for the Tree event.
     */
	public static final int TREE = 5001;

	/**
     * ID for the Panel event.
     */
	public static final int PANEL = 5002;

	/**
     * ID for the Animation event.
     */
	public static final int ANIMATION = 5003;

	/**
	 * command passed for change of key type.
	 */
	public static final String KEY_TYPE_CHANGE = "Key Type Change";

	/**
	 * command passed for an error message.
	 */
	public static final String ERROR_MESSAGE = "Error Message";

	/**
	 * command passed for color panel request.
	 */
	public static final String COLOR_PANEL = "Color Panel";

	/**
	 * command passed for animation change.
	 */
	public static final String ANIMATION_CHANGE = "Animation Change";

	/**
	 * command passed for animation step change.
	 */
	public static final String ANIMATION_STEP_CHANGE = "Animation Step Change";

	/**
	 * command passed for status message.
	 */
	public static final String STATUS_MESSAGE = "Status Message";

	/**
	 * command passed for set input options request.
	 */
	public static final String SET_INPUT_OPTIONS = "Set Input Options";

	/**
	 * command passed for set color settings request.
	 */
	public static final String SET_PRESET_COLOR_OPTIONS = "Set Preset Color Options";

	/**
	 * command passed for a change in color choice.
	 */
	public static final String COLOR_CHANGE = "Color Changed";



   /**
     * The string that gives the message
     * of the TreeMessageEvent.
     */
    private String message;

	/**
     * An Object which goes along with the message for any purpose or need.
     */
    private Object messageObject;

	/**
     * Constructs a <code>TreeMessageEvent</code> object.
     *
     * @param source  the object that originated the event
     * @param id      an integer that identifies the event
     * @param msg String message.
     */
    public TreeMessageEvent(Object source, int id, String msg) {
        this(source, id, msg, null);
    }

	/**
     * Constructs a <code>TreeMessageEvent</code> object with a message object.
     *
     * @param source  the object that originated the event
     * @param id      an integer that identifies the event
     * @param msg String message.
     * @param msgObject object that refers to the String message.
     */
    public TreeMessageEvent(Object source, int id, String msg, Object msgObject) {
         super(source, id);
         this.message = msg;
         this.messageObject = msgObject;
    }

    /**
     * Returns the description String associated with this AnimationEvent.
     *
     *@return the string identifying the description for this event
     */
    public String getMessage() {
        return message;
    }

    /**
     * Returns the status String associated with this AnimationEvent.
     *
     *@return the string identifying the status for this event
     */
    public Object getMessageObject() {
        return messageObject;
    }

}

