Mercurial > projects > dwt2
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ObservableEvent.d Tue Apr 14 11:35:29 2009 +0200 @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2006, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +module org.eclipse.core.databinding.observable.ObservableEvent; + +import java.lang.all; + +import java.util.EventObject; + +/** + * Abstract event object for events fired by {@link IObservable} objects. All + * events fired by observables must be derived from this class so that the way + * of dispatching events can be improved in later versions of the framework. + * + * @since 1.0 + * + */ +public abstract class ObservableEvent : EventObject { + + /** + * Creates a new observable event. + * + * @param source + */ + public this(IObservable source) { + super(source); + } + + /** + * + */ + private static final long serialVersionUID = 7693906965267871813L; + + /** + * Returns the observable that generated this event. + * + * @return the observable that generated this event + */ + public IObservable getObservable() { + return cast(IObservable) getSource(); + } + + /** + * Dispatch this event to the given listener. Subclasses must implement this + * method by calling the appropriate type-safe event handling method on the + * given listener according to the type of this event. + * + * @param listener + * the listener that should handle the event + */ + protected abstract void dispatch(IObservablesListener listener); + + /** + * Returns a unique object used for distinguishing this event type from + * others. + * + * @return a unique object representing the concrete type of this event. + */ + protected abstract Object getListenerType(); + +}