KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > databinding > observable > value > ValueChangeEvent


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 package org.eclipse.core.databinding.observable.value;
13
14 import org.eclipse.core.databinding.observable.IObservablesListener;
15 import org.eclipse.core.databinding.observable.ObservableEvent;
16
17 /**
18  * Value change event describing a change of an {@link IObservableValue}
19  * object's current value.
20  *
21  * @since 1.0
22  *
23  */

24 public class ValueChangeEvent extends ObservableEvent {
25
26     /**
27      *
28      */

29     private static final long serialVersionUID = 2305345286999701156L;
30
31     static final Object JavaDoc TYPE = new Object JavaDoc();
32
33     /**
34      * Description of the change to the source observable value. Listeners must
35      * not change this field.
36      */

37     public ValueDiff diff;
38
39     /**
40      * Creates a new value change event.
41      *
42      * @param source
43      * the source observable value
44      * @param diff
45      * the value change
46      */

47     public ValueChangeEvent(IObservableValue source, ValueDiff diff) {
48         super(source);
49         this.diff = diff;
50     }
51
52     /**
53      * Returns the observable value from which this event originated.
54      *
55      * @return returns the observable value from which this event originated
56      */

57     public IObservableValue getObservableValue() {
58         return (IObservableValue) source;
59     }
60
61     protected void dispatch(IObservablesListener listener) {
62         ((IValueChangeListener) listener).handleValueChange(this);
63     }
64
65     protected Object JavaDoc getListenerType() {
66         return TYPE;
67     }
68
69 }
70
Popular Tags