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