KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > databinding > observable > map > MapChangeEvent


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.map;
13
14 import org.eclipse.core.databinding.observable.IObservablesListener;
15 import org.eclipse.core.databinding.observable.ObservableEvent;
16
17 /**
18  * Map change event describing an incremental change of an
19  * {@link IObservableMap} object.
20  *
21  * @since 1.0
22  *
23  */

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

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

36     public MapDiff diff;
37
38     /**
39      * Creates a new map change event
40      *
41      * @param source
42      * the source observable map
43      * @param diff
44      * the map change
45      */

46     public MapChangeEvent(IObservableMap source, MapDiff diff) {
47         super(source);
48         this.diff = diff;
49     }
50
51     /**
52      * Returns the observable map from which this event originated.
53      *
54      * @return the observable map from which this event originated
55      */

56     public IObservableMap getObservableMap() {
57         return (IObservableMap) getSource();
58     }
59
60     protected void dispatch(IObservablesListener listener) {
61         ((IMapChangeListener) listener).handleMapChange(this);
62     }
63
64     protected Object JavaDoc getListenerType() {
65         return TYPE;
66     }
67
68 }
69
Popular Tags