comparison org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ObservableEvent.d @ 78:0a55d2d5a946

Added file for databinding
author Frank Benoit <benoit@tionex.de>
date Tue, 14 Apr 2009 11:35:29 +0200
parents
children 383ce7bd736b
comparison
equal deleted inserted replaced
76:f05e6e8b2f2d 78:0a55d2d5a946
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 module org.eclipse.core.databinding.observable.ObservableEvent;
13
14 import java.lang.all;
15
16 import java.util.EventObject;
17
18 /**
19 * Abstract event object for events fired by {@link IObservable} objects. All
20 * events fired by observables must be derived from this class so that the way
21 * of dispatching events can be improved in later versions of the framework.
22 *
23 * @since 1.0
24 *
25 */
26 public abstract class ObservableEvent : EventObject {
27
28 /**
29 * Creates a new observable event.
30 *
31 * @param source
32 */
33 public this(IObservable source) {
34 super(source);
35 }
36
37 /**
38 *
39 */
40 private static final long serialVersionUID = 7693906965267871813L;
41
42 /**
43 * Returns the observable that generated this event.
44 *
45 * @return the observable that generated this event
46 */
47 public IObservable getObservable() {
48 return cast(IObservable) getSource();
49 }
50
51 /**
52 * Dispatch this event to the given listener. Subclasses must implement this
53 * method by calling the appropriate type-safe event handling method on the
54 * given listener according to the type of this event.
55 *
56 * @param listener
57 * the listener that should handle the event
58 */
59 protected abstract void dispatch(IObservablesListener listener);
60
61 /**
62 * Returns a unique object used for distinguishing this event type from
63 * others.
64 *
65 * @return a unique object representing the concrete type of this event.
66 */
67 protected abstract Object getListenerType();
68
69 }