KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > databinding > observable > tree > IObservableTree


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 package org.eclipse.core.internal.databinding.observable.tree;
13
14 import org.eclipse.core.databinding.observable.IObservable;
15
16 /**
17  *
18  * A tree whose changes can be tracked by tree change listeners. If the tree is
19  * ordered ({@link #isOrdered()}), the order of children for a given tree path
20  * matters, and tree change notifications will always specify indices. If the
21  * tree is unordered, the children of a tree path are an unordered set and
22  * indices in change notifications are not specified.
23  *
24  * <p>
25  * This interface is not intended to be implemented by clients. Clients should
26  * instead subclass one of the framework classes that implement this interface.
27  * Note that direct implementers of this interface outside of the framework will
28  * be broken in future releases when methods are added to this interface.
29  * </p>
30  *
31  * @since 1.1
32  */

33 public interface IObservableTree extends IObservable {
34     
35     /**
36      * Element that can be returned from synchronous getters if this observable
37      * tree is lazy.
38      */

39     public final static Object JavaDoc UNKNOWN_ELEMENT = new Object JavaDoc();
40     
41     /**
42      * @param listener
43      */

44     public void addTreeChangeListener(ITreeChangeListener listener);
45
46     /**
47      * @param listener
48      */

49     public void removeTreeChangeListener(ITreeChangeListener listener);
50
51     /**
52      * Returns whether the order of children for a given parent is important. If
53      * this tree is ordered, tree change notifications will always specify
54      * indices.
55      *
56      * @return true if the order of children for a given parent is important
57      */

58     public boolean isOrdered();
59     
60     /**
61      * Returns whether this tree is optimized to fetch subsets of children
62      * lazily and possibly asynchronously. Implies {@link #isOrdered()}.
63      *
64      * @return true if this tree
65      */

66     public boolean isLazy();
67
68     /**
69      * @param parentPath
70      * @return the children at the given parent path
71      */

72     public Object JavaDoc[] getChildren(TreePath parentPath);
73     
74     /**
75      * @param parentPath
76      * @param children
77      */

78     public void setChildren(TreePath parentPath, Object JavaDoc[] children);
79     
80     /**
81      * @param parentPath
82      * @param childElement
83      */

84     public void addChild(TreePath parentPath, Object JavaDoc childElement);
85     
86     /**
87      * @param parentPath
88      * @param childElement
89      */

90     public void removeChild(TreePath parentPath, Object JavaDoc childElement);
91     
92     /**
93      * @param parentPath
94      * @param index
95      * @param childElement
96      */

97     public void insertChild(TreePath parentPath, int index, Object JavaDoc childElement);
98     
99     /**
100      * @param parentPath
101      * @param index
102      */

103     public void removeChild(TreePath parentPath, int index);
104     
105     /**
106      * @param parentPath
107      * @return <code>true</code> if the element at the given path has children
108      */

109     public boolean hasChildren(TreePath parentPath);
110     
111     /**
112      * @param parentPath
113      * @return the number of children of the element at the given path
114      */

115     public int getChildCount(TreePath parentPath);
116     
117     /**
118      * @param parentPath
119      * @param count
120      */

121     public void setChildCount(TreePath parentPath, int count);
122     
123     /**
124      * Updates the number of children for the given parent elements in the
125      * specified request.
126      *
127      * @param update specifies counts to update and stores result
128      */

129     public void updateChildrenCount(IChildrenCountUpdate update);
130     
131     /**
132      * Updates children as requested by the update.
133      *
134      * @param update specifies children to update and stores result
135      */

136     public void updateChildren(IChildrenUpdate update);
137     
138     /**
139      * Updates whether elements have children.
140      *
141      * @param update specifies elements to update and stores result
142      */

143     public void updateHasChildren(IHasChildrenUpdate update);
144
145 }
146
Popular Tags