78
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2006, 2008 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 * Brad Reynolds - bug 167204
|
|
11 * Matthew Hall - bug 208858
|
|
12 *******************************************************************************/
|
|
13
|
|
14 module org.eclipse.core.databinding.observable.list.IObservableList;
|
81
|
15 import org.eclipse.core.databinding.observable.list.IListChangeListener;
|
78
|
16
|
|
17 import java.lang.all;
|
|
18
|
|
19 import java.util.Collection;
|
|
20 import java.util.Iterator;
|
|
21 import java.util.List;
|
|
22 import java.util.ListIterator;
|
|
23
|
|
24 import org.eclipse.core.databinding.observable.IObservableCollection;
|
|
25
|
|
26 /**
|
|
27 * A list whose changes can be tracked by list change listeners.
|
|
28 *
|
|
29 * @noextend This interface is not intended to be extended by clients.
|
|
30 * @noimplement This interface is not intended to be implemented by clients.
|
|
31 * Clients should instead subclass one of the framework classes
|
|
32 * that implement this interface. Note that direct implementers of
|
|
33 * this interface outside of the framework will be broken in future
|
|
34 * releases when methods are added to this interface.
|
|
35 *
|
|
36 * @see AbstractObservableList
|
|
37 * @see ObservableList
|
|
38 *
|
|
39 * @since 1.0
|
|
40 */
|
|
41 public interface IObservableList : List, IObservableCollection {
|
|
42
|
|
43 /**
|
|
44 * Adds the given list change listener to the list of list change listeners.
|
|
45 * @param listener
|
|
46 */
|
|
47 public void addListChangeListener(IListChangeListener listener);
|
|
48
|
|
49 /**
|
|
50 * Removes the given list change listener from the list of list change listeners.
|
|
51 * Has no effect if the given listener is not registered as a list change listener.
|
|
52 *
|
|
53 * @param listener
|
|
54 */
|
|
55 public void removeListChangeListener(IListChangeListener listener);
|
|
56
|
|
57 /**
|
|
58 * @TrackedGetter
|
|
59 */
|
|
60 public int size();
|
|
61
|
|
62 /**
|
|
63 * @TrackedGetter
|
|
64 */
|
|
65 public bool isEmpty();
|
|
66
|
|
67 /**
|
|
68 * @TrackedGetter
|
|
69 */
|
|
70 public bool contains(Object o);
|
|
71
|
|
72 /**
|
|
73 * @TrackedGetter
|
|
74 */
|
|
75 public Iterator iterator();
|
|
76
|
|
77 /**
|
|
78 * @TrackedGetter
|
|
79 */
|
|
80 public Object[] toArray();
|
|
81
|
|
82 /**
|
|
83 * @TrackedGetter
|
|
84 */
|
|
85 public Object[] toArray(Object a[]);
|
|
86
|
|
87 /**
|
|
88 *
|
|
89 */
|
|
90 public bool add(Object o);
|
|
91
|
|
92 /**
|
|
93 *
|
|
94 */
|
|
95 public bool remove(Object o);
|
|
96
|
|
97 /**
|
|
98 * @TrackedGetter
|
|
99 */
|
|
100 public bool containsAll(Collection c);
|
|
101
|
|
102 /**
|
|
103 *
|
|
104 */
|
|
105 public bool addAll(Collection c);
|
|
106
|
|
107 /**
|
|
108 *
|
|
109 */
|
|
110 public bool addAll(int index, Collection c);
|
|
111
|
|
112 /**
|
|
113 *
|
|
114 */
|
|
115 public bool removeAll(Collection c);
|
|
116
|
|
117 /**
|
|
118 *
|
|
119 */
|
|
120 public bool retainAll(Collection c);
|
|
121
|
|
122 /**
|
|
123 * @TrackedGetter
|
|
124 */
|
|
125 public bool opEquals(Object o);
|
|
126
|
|
127 /**
|
|
128 * @TrackedGetter
|
|
129 */
|
|
130 public int hashCode();
|
|
131
|
|
132 /**
|
|
133 * @TrackedGetter
|
|
134 */
|
|
135 public Object get(int index);
|
|
136
|
|
137 /**
|
|
138 *
|
|
139 */
|
|
140 public Object set(int index, Object element);
|
|
141
|
|
142 /**
|
|
143 * Moves the element located at <code>oldIndex</code> to
|
|
144 * <code>newIndex</code>. This method is equivalent to calling
|
|
145 * <code>add(newIndex, remove(oldIndex))</code>.
|
|
146 * <p>
|
|
147 * Implementors should deliver list change notification for the remove and
|
|
148 * add operations in the same ListChangeEvent, as this allows
|
|
149 * {@link ListDiff#acceptcast(ListDiffVisitor)} to recognize the operation as a
|
|
150 * move.
|
|
151 *
|
|
152 * @param oldIndex
|
|
153 * the element's position before the move. Must be within the
|
|
154 * range <code>0 <= oldIndex < size()</code>.
|
|
155 * @param newIndex
|
|
156 * the element's position after the move. Must be within the
|
|
157 * range <code>0 <= newIndex < size()</code>.
|
|
158 * @return the element that was moved.
|
|
159 * @throws IndexOutOfBoundsException
|
|
160 * if either argument is out of range (<code>0 <= index < size()</code>).
|
|
161 * @see ListDiffVisitor#handleMove(int, int, Object)
|
|
162 * @see ListDiff#acceptcast(ListDiffVisitor)
|
|
163 * @since 1.1
|
|
164 */
|
|
165 public Object move(int oldIndex, int newIndex);
|
|
166
|
|
167 /**
|
|
168 *
|
|
169 */
|
|
170 public Object remove(int index);
|
|
171
|
|
172 /**
|
|
173 * @TrackedGetter
|
|
174 */
|
|
175 public int indexOf(Object o);
|
|
176
|
|
177 /**
|
|
178 * @TrackedGetter
|
|
179 */
|
|
180 public int lastIndexOf(Object o);
|
|
181
|
|
182 /**
|
|
183 * @TrackedGetter
|
|
184 */
|
|
185 public ListIterator listIterator();
|
|
186
|
|
187 /**
|
|
188 * @TrackedGetter
|
|
189 */
|
|
190 public ListIterator listIterator(int index);
|
|
191
|
|
192 /**
|
|
193 * @TrackedGetter
|
|
194 */
|
|
195 public List subList(int fromIndex, int toIndex);
|
|
196
|
|
197 /**
|
|
198 * @return the type of the elements or <code>null</code> if untyped
|
|
199 */
|
|
200 Object getElementType();
|
|
201 }
|