/*
 * @(#)ControllerEvent.java	1.5 02/08/21
 *
 * Copyright (c) 1996-2002 Sun Microsystems, Inc.  All rights reserved.
 */

package javax.media;

/**
 * <code>ControllerEvent</code> is the base class for events generated by
 * a <CODE>Controller</CODE>.
 *
 * These events are used by <CODE>ControllerListener</CODE>.
 *
 * @see Controller
 * @see ControllerListener
 * @see MediaEvent
 * @version 1.5, 02/08/21
 */

public class ControllerEvent extends javax.media.MediaEvent {

    Controller eventSrc;

    public ControllerEvent(Controller from) {
	super(from);
	eventSrc = from;
    }

    /**
     * Get the <CODE>Controller</CODE> that posted this event.  
     * The returned <CODE>Controller</CODE> has at least one active
     * listener. (The 
     * <CODE>addListener</CODE> method has been called on
     * the <CODE>Controller</CODE>).
     * 
     * @return The <CODE>Controller</CODE> that posted this event.
     */
    public Controller getSourceController() {
	return eventSrc;
    }

    public Object getSource() {
	return eventSrc;
    }

    /**
     * Returns the String representation of this event's values.
     */
    public String toString() {
	return getClass().getName() + "[source=" + eventSrc + "]";
    }
}
