upstream version 1.2.2
[debian/freetts] / com / sun / speech / engine / SpeechEventWrapper.java
1 /**
2  * Copyright 1998-2001 Sun Microsystems, Inc.
3  * 
4  * See the file "license.terms" for information on usage and
5  * redistribution of this file, and for a DISCLAIMER OF ALL 
6  * WARRANTIES.
7  */
8 package com.sun.speech.engine;
9
10 import javax.speech.SpeechEvent;
11 import java.util.EventObject;
12
13 /**
14  * Wraps an arbitrary event object (from <code>EventObject</code>)
15  * in a <code>SpeechEvent</code> so that it can be dispatched through
16  * the speech event dispatch mechanism.
17  * One use of this is in the <code>BaseEngineProperties</code> class
18  * that needs to wrap and issue <code>PropertyChangeEvents</code>.
19  *
20  * @see SpeechEventUtilities
21  * @see EventObject
22  */
23 public class SpeechEventWrapper extends SpeechEvent {
24     /**
25      * Use an id that won't be confused with JSAPI event ids.
26      */
27     protected static int WRAPPER_ID = -25468;
28     
29     /**
30      * The wrapped event.
31      */
32     protected EventObject eventObject;
33
34     /**
35      * Class constructor.
36      *
37      * @param e the <code>EventObject</code> to wrap.
38      */
39     public SpeechEventWrapper(EventObject e) {
40         super(e.getSource(), WRAPPER_ID);
41         eventObject = e;
42     }
43
44     /**
45      * Gets the wrapped event.
46      *
47      * @return the event that was passed to the constructor
48      */
49     public EventObject getEventObject() {
50         return eventObject;
51     }
52 }