Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 33f2fd2afd322828acfcf0e5b216e15d465845e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*******************************************************************************
 * Copyright (c) 2007, 2008 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
 * 
 * Contributors:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.utility.model;

import org.eclipse.jpt.utility.model.listener.CollectionChangeListener;
import org.eclipse.jpt.utility.model.listener.ListChangeListener;
import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.model.listener.StateChangeListener;
import org.eclipse.jpt.utility.model.listener.TreeChangeListener;

/**
 * Interface to be implemented by models that notify listeners of
 * changes to bound properties, collections, lists, and/or trees.
 * 
 * Provisional API: This interface is part of an interim API that is still
 * under development and expected to change significantly before reaching
 * stability. It is available at this early stage to solicit feedback from
 * pioneering adopters on the understanding that any code that uses this API
 * will almost certainly be broken (repeatedly) as the API evolves.
 */
public interface Model {

	// ********** state change **********

	/**
	 * Add a listener that listens to all state change events.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addStateChangeListener(StateChangeListener listener);

	/**
	 * Remove the specified state change listener. If the listener
	 * was added more than once, it will be notified one less time
	 * after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removeStateChangeListener(StateChangeListener listener);


	// ********** property change **********

	/**
	 * Add a listener that listens to all property change events,
	 * regardless of the property name associated with that event.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addPropertyChangeListener(PropertyChangeListener listener);

	/**
	 * Add a listener that listens to all property change events with
	 * the specified property name.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);

	/**
	 * Remove a listener that listens to all property change events,
	 * regardless of the property name associated with that event.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removePropertyChangeListener(PropertyChangeListener listener);

	/**
	 * Remove a listener that listens to all property change events,
	 * with the specified property name.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);


	// ********** collection change **********

	/**
	 * Add a listener that listens to all collection change events,
	 * regardless of the collection name associated with that event.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addCollectionChangeListener(CollectionChangeListener listener);

	/**
	 * Add a listener that listens to all collection change events with
	 * the specified collection name.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addCollectionChangeListener(String collectionName, CollectionChangeListener listener);

	/**
	 * Remove a listener that listens to all collection change events,
	 * regardless of the collection name associated with that event.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removeCollectionChangeListener(CollectionChangeListener listener);

	/**
	 * Remove a listener that listens to all collection change events,
	 * with the specified collection name.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removeCollectionChangeListener(String collectionName, CollectionChangeListener listener);


	// ********** list change **********

	/**
	 * Add a listener that listens to all list change events,
	 * regardless of the list name associated with that event.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addListChangeListener(ListChangeListener listener);

	/**
	 * Add a listener that listens to all list change events with
	 * the specified list name.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addListChangeListener(String listName, ListChangeListener listener);

	/**
	 * Remove a listener that listens to all list change events,
	 * regardless of the list name associated with that event.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removeListChangeListener(ListChangeListener listener);

	/**
	 * Remove a listener that listens to all list change events,
	 * with the specified list name.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removeListChangeListener(String listName, ListChangeListener listener);


	// ********** tree change **********

	/**
	 * Add a listener that listens to all tree change events,
	 * regardless of the tree name associated with that event.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addTreeChangeListener(TreeChangeListener listener);

	/**
	 * Add a listener that listens to all tree change events with
	 * the specified tree name.
	 * The same listener may be added more than once and will be called
	 * as many times as it is added. The listener cannot be null.
	 */
	void addTreeChangeListener(String treeName, TreeChangeListener listener);

	/**
	 * Remove a listener that listens to all tree change events,
	 * regardless of the tree name associated with that event.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removeTreeChangeListener(TreeChangeListener listener);

	/**
	 * Remove a listener that listens to all tree change events,
	 * with the specified tree name.
	 * If the listener was added more than once, it will be notified one less
	 * time after being removed. An exception will be thrown if the
	 * listener is null or if the listener was never added.
	 */
	void removeTreeChangeListener(String treeName, TreeChangeListener listener);

}

Back to the top