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