view org.eclipse.core.databinding.observable/src/org/eclipse/core/databinding/observable/ObservableEvent.d @ 96:b74ac5dfcc06

package to module and java.lang.all import
author Frank Benoit <benoit@tionex.de>
date Tue, 21 Apr 2009 11:03:33 +0200
parents 6208d4f6a277
children c86eb8b3098e
line wrap: on
line source

/*******************************************************************************
 * 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();

}