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.StaleEvent;
|
81
|
13 import org.eclipse.core.databinding.observable.IStaleListener;
|
|
14 import org.eclipse.core.databinding.observable.ObservableEvent;
|
|
15 import org.eclipse.core.databinding.observable.IObservable;
|
|
16 import org.eclipse.core.databinding.observable.IObservablesListener;
|
78
|
17
|
|
18 import java.lang.all;
|
|
19
|
|
20 /**
|
|
21 * Generic event denoting that the state of an {@link IObservable} object is
|
|
22 * about to change. Note that this event is only fired when an observable
|
|
23 * becomes stale, not when it becomes unstale; an observable that becomes
|
|
24 * unstale should always fire a change event. Staleness can be used (for
|
|
25 * example) to notify listeners when an observable has started a background
|
|
26 * thread for updating its state. Clients can safely ignore staleness.
|
|
27 *
|
|
28 * @see IObservable#isStale()
|
|
29 *
|
|
30 * @since 1.0
|
|
31 *
|
|
32 */
|
|
33 public class StaleEvent : ObservableEvent {
|
|
34
|
|
35 /**
|
|
36 * Creates a new stale event.
|
|
37 *
|
|
38 * @param source
|
|
39 * the source observable
|
|
40 */
|
|
41 public this(IObservable source) {
|
|
42 super(source);
|
|
43 }
|
|
44
|
|
45 /**
|
|
46 *
|
|
47 */
|
|
48 private static final long serialVersionUID = 3491012225431471077L;
|
|
49
|
|
50 static final Object TYPE = new Object();
|
|
51
|
|
52 protected void dispatch(IObservablesListener listener) {
|
|
53 (cast(IStaleListener) listener).handleStale(this);
|
|
54 }
|
|
55
|
|
56 protected Object getListenerType() {
|
|
57 return TYPE;
|
|
58 }
|
|
59
|
|
60 }
|