KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > databinding > observable > ObservableEvent


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.core.databinding.observable;
13
14 import java.util.EventObject JavaDoc;
15
16 /**
17  * Abstract event object for events fired by {@link IObservable} objects. All
18  * events fired by observables must be derived from this class so that the way
19  * of dispatching events can be improved in later versions of the framework.
20  *
21  * @since 1.0
22  *
23  */

24 public abstract class ObservableEvent extends EventObject JavaDoc {
25
26     /**
27      * Creates a new observable event.
28      *
29      * @param source
30      */

31     public ObservableEvent(IObservable source) {
32         super(source);
33     }
34
35     /**
36      *
37      */

38     private static final long serialVersionUID = 7693906965267871813L;
39
40     /**
41      * Returns the observable that generated this event.
42      *
43      * @return the observable that generated this event
44      */

45     public IObservable getObservable() {
46         return (IObservable) getSource();
47     }
48
49     /**
50      * Dispatch this event to the given listener. Subclasses must implement this
51      * method by calling the appropriate type-safe event handling method on the
52      * given listener according to the type of this event.
53      *
54      * @param listener
55      * the listener that should handle the event
56      */

57     protected abstract void dispatch(IObservablesListener listener);
58
59     /**
60      * Returns a unique object used for distinguishing this event type from
61      * others.
62      *
63      * @return a unique object representing the concrete type of this event.
64      */

65     protected abstract Object JavaDoc getListenerType();
66
67 }
68
Popular Tags