annotate org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueChangingEvent.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 /*******************************************************************************
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2 * Copyright (c) 2006, 2007 IBM Corporation and others.
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 *
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8 * Contributors:
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
10 ******************************************************************************/
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
11
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12 module org.eclipse.core.databinding.observable.value.ValueChangingEvent;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14 import java.lang.all;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
15
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
16 import org.eclipse.core.databinding.observable.IObservablesListener;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
17 import org.eclipse.core.databinding.observable.ObservableEvent;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
18
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
19 /**
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20 * Value changing event describing a pending change of an
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 * {@link IObservableValue} object's current value. Listeners can veto the
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
22 * pending change by setting {@link #veto} to <code>true</code>.
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
23 *
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
24 * @since 1.0
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
25 *
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
26 */
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 public class ValueChangingEvent : ObservableEvent {
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29 /**
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
30 *
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
31 */
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32 private static final long serialVersionUID = 2305345286999701156L;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 static final Object TYPE = new Object();
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36 /**
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
37 * Description of the change to the source observable value. Listeners must
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38 * not change this field.
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39 */
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40 public ValueDiff diff;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42 /**
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 * Flag for vetoing this change. Default value is <code>false</code>, can
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 * be set to <code>true</code> by listeners to veto this change.
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45 */
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 public bool veto = false;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 /**
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 * Creates a new value changing event.
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50 *
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 * @param source
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 * the source observable value
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 * @param diff
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54 * the value change
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 */
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 public this(IObservableValue source, ValueDiff diff) {
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 super(source);
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 this.diff = diff;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 }
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 /**
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 * @return the observable value from which this event originated
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 */
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 public IObservableValue getObservableValue() {
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 return cast(IObservableValue) source;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 }
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 protected void dispatch(IObservablesListener listener) {
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 (cast(IValueChangingListener) listener).handleValueChanging(this);
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 }
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 protected Object getListenerType() {
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 return TYPE;
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 }
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75
0a55d2d5a946 Added file for databinding
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 }