comparison org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueChangeEvent.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.value.ValueChangeEvent;
13
14 import java.lang.all;
15
16 import org.eclipse.core.databinding.observable.IObservablesListener;
17 import org.eclipse.core.databinding.observable.ObservableEvent;
18
19 /**
20 * Value change event describing a change of an {@link IObservableValue}
21 * object's current value.
22 *
23 * @since 1.0
24 *
25 */
26 public class ValueChangeEvent : ObservableEvent {
27
28 /**
29 *
30 */
31 private static final long serialVersionUID = 2305345286999701156L;
32
33 static final Object TYPE = new Object();
34
35 /**
36 * Description of the change to the source observable value. Listeners must
37 * not change this field.
38 */
39 public ValueDiff diff;
40
41 /**
42 * Creates a new value change event.
43 *
44 * @param source
45 * the source observable value
46 * @param diff
47 * the value change
48 */
49 public this(IObservableValue source, ValueDiff diff) {
50 super(source);
51 this.diff = diff;
52 }
53
54 /**
55 * Returns the observable value from which this event originated.
56 *
57 * @return returns the observable value from which this event originated
58 */
59 public IObservableValue getObservableValue() {
60 return cast(IObservableValue) source;
61 }
62
63 protected void dispatch(IObservablesListener listener) {
64 (cast(IValueChangeListener) listener).handleValueChange(this);
65 }
66
67 protected Object getListenerType() {
68 return TYPE;
69 }
70
71 }