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.internal.databinding.observable.tree.IObservableTree;
|
81
|
13 import org.eclipse.core.internal.databinding.observable.tree.ITreeChangeListener;
|
|
14 import org.eclipse.core.internal.databinding.observable.tree.TreePath;
|
|
15 import org.eclipse.core.internal.databinding.observable.tree.IChildrenCountUpdate;
|
|
16 import org.eclipse.core.internal.databinding.observable.tree.IHasChildrenUpdate;
|
|
17 import org.eclipse.core.internal.databinding.observable.tree.IChildrenUpdate;
|
78
|
18
|
|
19 import java.lang.all;
|
|
20
|
|
21 import org.eclipse.core.databinding.observable.IObservable;
|
|
22
|
|
23 /**
|
|
24 *
|
|
25 * A tree whose changes can be tracked by tree change listeners. If the tree is
|
|
26 * ordered ({@link #isOrdered()}), the order of children for a given tree path
|
|
27 * matters, and tree change notifications will always specify indices. If the
|
|
28 * tree is unordered, the children of a tree path are an unordered set and
|
|
29 * indices in change notifications are not specified.
|
|
30 *
|
|
31 * <p>
|
|
32 * This interface is not intended to be implemented by clients. Clients should
|
|
33 * instead subclass one of the framework classes that implement this interface.
|
|
34 * Note that direct implementers of this interface outside of the framework will
|
|
35 * be broken in future releases when methods are added to this interface.
|
|
36 * </p>
|
|
37 *
|
|
38 * @since 1.1
|
|
39 */
|
85
|
40 static this(){
|
|
41 IObservableTree.UNKNOWN_ELEMENT = new Object();
|
|
42 }
|
78
|
43 public interface IObservableTree : IObservable {
|
|
44
|
|
45 /**
|
|
46 * Element that can be returned from synchronous getters if this observable
|
|
47 * tree is lazy.
|
|
48 */
|
85
|
49 public static Object UNKNOWN_ELEMENT;
|
78
|
50
|
|
51 /**
|
|
52 * @param listener
|
|
53 */
|
|
54 public void addTreeChangeListener(ITreeChangeListener listener);
|
|
55
|
|
56 /**
|
|
57 * @param listener
|
|
58 */
|
|
59 public void removeTreeChangeListener(ITreeChangeListener listener);
|
|
60
|
|
61 /**
|
|
62 * Returns whether the order of children for a given parent is important. If
|
|
63 * this tree is ordered, tree change notifications will always specify
|
|
64 * indices.
|
|
65 *
|
|
66 * @return true if the order of children for a given parent is important
|
|
67 */
|
|
68 public bool isOrdered();
|
|
69
|
|
70 /**
|
|
71 * Returns whether this tree is optimized to fetch subsets of children
|
|
72 * lazily and possibly asynchronously. Implies {@link #isOrdered()}.
|
|
73 *
|
|
74 * @return true if this tree
|
|
75 */
|
|
76 public bool isLazy();
|
|
77
|
|
78 /**
|
|
79 * @param parentPath
|
|
80 * @return the children at the given parent path
|
|
81 */
|
|
82 public Object[] getChildren(TreePath parentPath);
|
|
83
|
|
84 /**
|
|
85 * @param parentPath
|
|
86 * @param children
|
|
87 */
|
|
88 public void setChildren(TreePath parentPath, Object[] children);
|
|
89
|
|
90 /**
|
|
91 * @param parentPath
|
|
92 * @param childElement
|
|
93 */
|
|
94 public void addChild(TreePath parentPath, Object childElement);
|
|
95
|
|
96 /**
|
|
97 * @param parentPath
|
|
98 * @param childElement
|
|
99 */
|
|
100 public void removeChild(TreePath parentPath, Object childElement);
|
|
101
|
|
102 /**
|
|
103 * @param parentPath
|
|
104 * @param index
|
|
105 * @param childElement
|
|
106 */
|
|
107 public void insertChild(TreePath parentPath, int index, Object childElement);
|
|
108
|
|
109 /**
|
|
110 * @param parentPath
|
|
111 * @param index
|
|
112 */
|
|
113 public void removeChild(TreePath parentPath, int index);
|
|
114
|
|
115 /**
|
|
116 * @param parentPath
|
|
117 * @return <code>true</code> if the element at the given path has children
|
|
118 */
|
|
119 public bool hasChildren(TreePath parentPath);
|
|
120
|
|
121 /**
|
|
122 * @param parentPath
|
|
123 * @return the number of children of the element at the given path
|
|
124 */
|
|
125 public int getChildCount(TreePath parentPath);
|
|
126
|
|
127 /**
|
|
128 * @param parentPath
|
|
129 * @param count
|
|
130 */
|
|
131 public void setChildCount(TreePath parentPath, int count);
|
|
132
|
|
133 /**
|
|
134 * Updates the number of children for the given parent elements in the
|
|
135 * specified request.
|
|
136 *
|
|
137 * @param update specifies counts to update and stores result
|
|
138 */
|
|
139 public void updateChildrenCount(IChildrenCountUpdate update);
|
|
140
|
|
141 /**
|
|
142 * Updates children as requested by the update.
|
|
143 *
|
|
144 * @param update specifies children to update and stores result
|
|
145 */
|
|
146 public void updateChildren(IChildrenUpdate update);
|
|
147
|
|
148 /**
|
|
149 * Updates whether elements have children.
|
|
150 *
|
|
151 * @param update specifies elements to update and stores result
|
|
152 */
|
|
153 public void updateHasChildren(IHasChildrenUpdate update);
|
|
154
|
|
155 }
|