comparison org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/viewers/TreeNode.d @ 85:6be48cf9f95c

Work on databinding
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Apr 2009 13:54:50 +0200
parents 0a55d2d5a946
children
comparison
equal deleted inserted replaced
84:fcf926c91ca4 85:6be48cf9f95c
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * Stefan Xenos, IBM - initial API and implementation 10 * Stefan Xenos, IBM - initial API and implementation
11 *******************************************************************************/ 11 *******************************************************************************/
12 module org.eclipse.jface.internal.databinding.provisional.viewers.TreeNode; 12 module org.eclipse.jface.internal.databinding.provisional.viewers.TreeNode;
13 import org.eclipse.jface.internal.databinding.provisional.viewers.UnorderedTreeContentProvider;
13 14
14 import java.lang.all; 15 import java.lang.all;
15 16
16 import java.util.Collections; 17 import java.util.Collections;
17 import java.util.HashSet; 18 import java.util.HashSet;
50 * Set of child elements. 51 * Set of child elements.
51 */ 52 */
52 private IObservableSet children; 53 private IObservableSet children;
53 54
54 private bool hasPendingNode = false; 55 private bool hasPendingNode = false;
55 private bool isStale; 56 private bool isStale_;
56 private bool listeningToChildren = false; 57 private bool listeningToChildren = false;
57 private bool prefetchEnqueued = false; 58 private bool prefetchEnqueued = false;
58 59
59 /** 60 /**
60 * @param element 61 * @param element
76 */ 77 */
77 public void addParent(Object parent) { 78 public void addParent(Object parent) {
78 if (this.parent is null) { 79 if (this.parent is null) {
79 this.parent = parent; 80 this.parent = parent;
80 } else { 81 } else {
81 if (parent.equals(this.parent)) { 82 if (parent.opEquals(this.parent)) {
82 return; 83 return;
83 } 84 }
84 if (parents is null) { 85 if (parents is null) {
85 parents = new HashSet(); 86 parents = new HashSet();
86 parents.add(this.parent); 87 parents.add(this.parent);
140 return children; 141 return children;
141 } 142 }
142 143
143 private void updateStale() { 144 private void updateStale() {
144 bool willBeStale = children.isStale(); 145 bool willBeStale = children.isStale();
145 if (willBeStale !is isStale) { 146 if (willBeStale !is isStale_) {
146 isStale = willBeStale; 147 isStale_ = willBeStale;
147 148
148 contentProvider.changeStale(isStale? 1 : -1); 149 contentProvider.changeStale(isStale_? 1 : -1);
149 } 150 }
150 } 151 }
151 152
152 /** 153 /**
153 * @return TODO 154 * @return TODO
154 */ 155 */
155 public bool isStale() { 156 public bool isStale() {
156 return isStale; 157 return isStale_;
157 } 158 }
158 159
159 /** 160 /**
160 * Returns true if the viewer should show a plus sign for expanding this 161 * Returns true if the viewer should show a plus sign for expanding this
161 * node. 162 * node.
188 children.removeStaleListener(this); 189 children.removeStaleListener(this);
189 } 190 }
190 children.dispose(); 191 children.dispose();
191 children = null; 192 children = null;
192 193
193 if (listeningToChildren && isStale) { 194 if (listeningToChildren && isStale_) {
194 contentProvider.changeStale(-1); 195 contentProvider.changeStale(-1);
195 } 196 }
196 } 197 }
197 } 198 }
198 199