|
1 /******************************************************************************* |
|
2 * Copyright (c) 2000, 2007 IBM Corporation and others. |
|
3 * Portion Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. This program and the accompanying materials |
|
5 * are made available under the terms of the Eclipse Public License v1.0 |
|
6 * which accompanies this distribution, and is available at |
|
7 * http://www.eclipse.org/legal/epl-v10.html |
|
8 * |
|
9 * Contributors: |
|
10 * IBM Corporation - initial API and implementation |
|
11 * Nokia Corporation - Qt implementation |
|
12 *******************************************************************************/ |
|
13 package org.eclipse.swt.widgets; |
|
14 |
|
15 import org.eclipse.swt.SWT; |
|
16 import org.eclipse.swt.SWTException; |
|
17 import org.eclipse.swt.graphics.Color; |
|
18 import org.eclipse.swt.graphics.Font; |
|
19 import org.eclipse.swt.graphics.Image; |
|
20 import org.eclipse.swt.graphics.Internal_GfxPackageSupport; |
|
21 import org.eclipse.swt.graphics.Rectangle; |
|
22 import org.eclipse.swt.internal.qt.OS; |
|
23 |
|
24 /** |
|
25 * Instances of this class represent a selectable user interface object that |
|
26 * represents a hierarchy of tree items in a tree widget. |
|
27 * |
|
28 * <dl> |
|
29 * <dt><b>Styles:</b></dt> |
|
30 * <dd>(none)</dd> |
|
31 * <dt><b>Events:</b></dt> |
|
32 * <dd>(none)</dd> |
|
33 * </dl> |
|
34 * <p> |
|
35 * IMPORTANT: This class is <em>not</em> intended to be subclassed. |
|
36 * </p> |
|
37 */ |
|
38 |
|
39 public class TreeItem extends Item { |
|
40 static Tree checkNull(Tree control) { |
|
41 if (control == null) |
|
42 SWT.error(SWT.ERROR_NULL_ARGUMENT); |
|
43 return control; |
|
44 } |
|
45 static TreeItem checkNull(TreeItem item) { |
|
46 if (item == null) |
|
47 SWT.error(SWT.ERROR_NULL_ARGUMENT); |
|
48 return item; |
|
49 } |
|
50 |
|
51 Tree tree; |
|
52 int itemHandle; |
|
53 TreeItem parentItem; |
|
54 TreeItem[] childrenItems; |
|
55 |
|
56 int childrenItemCount; |
|
57 int[] childrenItemsHandle; |
|
58 Font font; |
|
59 |
|
60 Color background; |
|
61 Color foreground; |
|
62 boolean grayed; |
|
63 // Tells if the item has all the data fetched (can be false only in |
|
64 // SWT.VIRTUAL style Tree) |
|
65 boolean cached; |
|
66 |
|
67 int checkedState; |
|
68 |
|
69 boolean selection; |
|
70 |
|
71 /** |
|
72 * Constructs a new instance of this class given its parent (which must be a |
|
73 * <code>Tree</code> or a <code>TreeItem</code>) and a style value |
|
74 * describing its behavior and appearance. The item is added to the end of |
|
75 * the items maintained by its parent. |
|
76 * <p> |
|
77 * The style value is either one of the style constants defined in class |
|
78 * <code>SWT</code> which is applicable to instances of this class, or must |
|
79 * be built by <em>bitwise OR</em>'ing together (that is, using the |
|
80 * <code>int</code> "|" operator) two or more of those <code>SWT</code> |
|
81 * style constants. The class description lists the style constants that are |
|
82 * applicable to the class. Style bits are also inherited from superclasses. |
|
83 * </p> |
|
84 * |
|
85 * @param parent |
|
86 * a tree control which will be the parent of the new instance |
|
87 * (cannot be null) |
|
88 * @param style |
|
89 * the style of control to construct |
|
90 * |
|
91 * @exception IllegalArgumentException |
|
92 * <ul> |
|
93 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> |
|
94 * </ul> |
|
95 * @exception SWTException |
|
96 * <ul> |
|
97 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
98 * thread that created the parent</li> |
|
99 * <li>ERROR_INVALID_SUBCLASS - if this class is not an |
|
100 * allowed subclass</li> |
|
101 * </ul> |
|
102 * |
|
103 * @see SWT |
|
104 * @see Widget#checkSubclass |
|
105 * @see Widget#getStyle |
|
106 */ |
|
107 public TreeItem(Tree parent, int style) { |
|
108 this(parent, style, checkNull(parent).getItemCount(), true); |
|
109 } |
|
110 |
|
111 /** |
|
112 * Constructs a new instance of this class given its parent (which must be a |
|
113 * <code>Tree</code> or a <code>TreeItem</code>), a style value describing |
|
114 * its behavior and appearance, and the index at which to place it in the |
|
115 * items maintained by its parent. |
|
116 * <p> |
|
117 * The style value is either one of the style constants defined in class |
|
118 * <code>SWT</code> which is applicable to instances of this class, or must |
|
119 * be built by <em>bitwise OR</em>'ing together (that is, using the |
|
120 * <code>int</code> "|" operator) two or more of those <code>SWT</code> |
|
121 * style constants. The class description lists the style constants that are |
|
122 * applicable to the class. Style bits are also inherited from superclasses. |
|
123 * </p> |
|
124 * |
|
125 * @param parent |
|
126 * a tree control which will be the parent of the new instance |
|
127 * (cannot be null) |
|
128 * @param style |
|
129 * the style of control to construct |
|
130 * @param index |
|
131 * the index to store the receiver in its parent |
|
132 * |
|
133 * @exception IllegalArgumentException |
|
134 * <ul> |
|
135 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> |
|
136 * </ul> |
|
137 * @exception SWTException |
|
138 * <ul> |
|
139 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
140 * thread that created the parent</li> |
|
141 * <li>ERROR_INVALID_SUBCLASS - if this class is not an |
|
142 * allowed subclass</li> |
|
143 * </ul> |
|
144 * |
|
145 * @see SWT |
|
146 * @see Widget#checkSubclass |
|
147 * @see Widget#getStyle |
|
148 */ |
|
149 public TreeItem(Tree parent, int style, int index) { |
|
150 this(parent, style, index, true); |
|
151 } |
|
152 |
|
153 TreeItem(Tree parent, int style, int index, boolean create) { |
|
154 super(parent, style); |
|
155 this.tree = parent; |
|
156 if( create ){ |
|
157 itemHandle = OS.QTreeWidgetItem_new(); |
|
158 OS.QTreeWidget_insertTopLevelItem(parent.topHandle, |
|
159 itemHandle, index); |
|
160 parent.addTopLevelItem(this, index, itemHandle); |
|
161 ensureValid( index ); |
|
162 } |
|
163 } |
|
164 |
|
165 /** |
|
166 * Constructs a new instance of this class given its parent (which must be a |
|
167 * <code>Tree</code> or a <code>TreeItem</code>) and a style value |
|
168 * describing its behavior and appearance. The item is added to the end of |
|
169 * the items maintained by its parent. |
|
170 * <p> |
|
171 * The style value is either one of the style constants defined in class |
|
172 * <code>SWT</code> which is applicable to instances of this class, or must |
|
173 * be built by <em>bitwise OR</em>'ing together (that is, using the |
|
174 * <code>int</code> "|" operator) two or more of those <code>SWT</code> |
|
175 * style constants. The class description lists the style constants that are |
|
176 * applicable to the class. Style bits are also inherited from superclasses. |
|
177 * </p> |
|
178 * |
|
179 * @param parentItem |
|
180 * a tree control which will be the parent of the new instance |
|
181 * (cannot be null) |
|
182 * @param style |
|
183 * the style of control to construct |
|
184 * |
|
185 * @exception IllegalArgumentException |
|
186 * <ul> |
|
187 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> |
|
188 * </ul> |
|
189 * @exception SWTException |
|
190 * <ul> |
|
191 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
192 * thread that created the parent</li> |
|
193 * <li>ERROR_INVALID_SUBCLASS - if this class is not an |
|
194 * allowed subclass</li> |
|
195 * </ul> |
|
196 * |
|
197 * @see SWT |
|
198 * @see Widget#checkSubclass |
|
199 * @see Widget#getStyle |
|
200 */ |
|
201 public TreeItem(TreeItem parent, int style) { |
|
202 this(parent, style, checkNull(parent).getItemCount(), true); |
|
203 } |
|
204 |
|
205 /** |
|
206 * Constructs a new instance of this class given its parent (which must be a |
|
207 * <code>Tree</code> or a <code>TreeItem</code>), a style value describing |
|
208 * its behavior and appearance, and the index at which to place it in the |
|
209 * items maintained by its parent. |
|
210 * <p> |
|
211 * The style value is either one of the style constants defined in class |
|
212 * <code>SWT</code> which is applicable to instances of this class, or must |
|
213 * be built by <em>bitwise OR</em>'ing together (that is, using the |
|
214 * <code>int</code> "|" operator) two or more of those <code>SWT</code> |
|
215 * style constants. The class description lists the style constants that are |
|
216 * applicable to the class. Style bits are also inherited from superclasses. |
|
217 * </p> |
|
218 * |
|
219 * @param parentItem |
|
220 * a tree control which will be the parent of the new instance |
|
221 * (cannot be null) |
|
222 * @param style |
|
223 * the style of control to construct |
|
224 * @param index |
|
225 * the index to store the receiver in its parent |
|
226 * |
|
227 * @exception IllegalArgumentException |
|
228 * <ul> |
|
229 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> |
|
230 * </ul> |
|
231 * @exception SWTException |
|
232 * <ul> |
|
233 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
234 * thread that created the parent</li> |
|
235 * <li>ERROR_INVALID_SUBCLASS - if this class is not an |
|
236 * allowed subclass</li> |
|
237 * </ul> |
|
238 * |
|
239 * @see SWT |
|
240 * @see Widget#checkSubclass |
|
241 * @see Widget#getStyle |
|
242 */ |
|
243 public TreeItem(TreeItem parent, int style, int index) { |
|
244 this(parent, style, index, true); |
|
245 } |
|
246 |
|
247 TreeItem(TreeItem parent, int style, int index, boolean create) { |
|
248 super(parent, style); |
|
249 this.parentItem = parent; |
|
250 this.tree = parentItem.tree; |
|
251 if( create ){ |
|
252 itemHandle = OS.QTreeWidgetItem_new(); |
|
253 |
|
254 OS.QTreeWidgetItem_insertChild(parent.internal_itemHandle(), |
|
255 itemHandle, index); |
|
256 parentItem.addChild(this, index, itemHandle); |
|
257 ensureValid( index ); |
|
258 } |
|
259 } |
|
260 |
|
261 TreeItem _getItem (int index) { |
|
262 if ((tree.getStyle() & SWT.VIRTUAL) == 0) return childrenItems [index]; |
|
263 if (childrenItems [index] != null) return childrenItems [index]; |
|
264 return childrenItems [index] = new TreeItem (this, SWT.NONE, index, false); |
|
265 } |
|
266 |
|
267 int _getItemHandle(){ |
|
268 int newItemHandle = 0; |
|
269 TreeItem parentItem = getParentItem(); |
|
270 if(parentItem!=null) { |
|
271 for(int i=0;i<parentItem.childrenItemCount;i++){ |
|
272 if(this==parentItem.childrenItems[i]){ |
|
273 newItemHandle = parentItem.childrenItemsHandle[i]; |
|
274 break; |
|
275 } |
|
276 } |
|
277 } else { |
|
278 for(int i=0;i<tree.topLevelItemCount;i++){ |
|
279 if(this==tree.topLevelItems[i]){ |
|
280 newItemHandle = tree.topLevelItemsHandle[i]; |
|
281 break; |
|
282 } |
|
283 } |
|
284 } |
|
285 |
|
286 return newItemHandle; |
|
287 } |
|
288 |
|
289 /* Add a new child to the TreeItem's list of children. Add the item at the |
|
290 * given index. An index of -1 implies that the child should be added to the |
|
291 * end of the TreeItem's list of children. |
|
292 */ |
|
293 void addChild(TreeItem item, int index, int itemHandle) { |
|
294 |
|
295 increaseChildrenArraySize(); |
|
296 if (!(0 <= index && index <= childrenItemCount)) |
|
297 error (SWT.ERROR_INVALID_RANGE); |
|
298 |
|
299 // Put the new item in the correct place in item array |
|
300 System.arraycopy (childrenItems, index, childrenItems, |
|
301 index + 1, childrenItemCount+1 - index); |
|
302 childrenItems[index] = item; |
|
303 |
|
304 //itemCount is already increase in the previous line. |
|
305 System.arraycopy (childrenItemsHandle, index, childrenItemsHandle, |
|
306 index + 1, childrenItemCount+1 - index); |
|
307 childrenItemsHandle[index] = itemHandle; |
|
308 |
|
309 childrenItemCount++; |
|
310 |
|
311 } |
|
312 |
|
313 protected void checkSubclass() { |
|
314 if (!isValidSubclass()) |
|
315 error(SWT.ERROR_INVALID_SUBCLASS); |
|
316 } |
|
317 |
|
318 void clearSelection() { |
|
319 for (int i = 0; i < childrenItemCount; ++i) { |
|
320 TreeItem child = _getItem(i); |
|
321 child.selection=false; |
|
322 child.clearSelection(); |
|
323 } |
|
324 } |
|
325 |
|
326 /* |
|
327 * Ensures that the TreeItem has all the native and Java side |
|
328 * resources created. |
|
329 * @param index Index of the item in Tree |
|
330 */ |
|
331 void ensureValid(int index) { |
|
332 if (cached) { |
|
333 return; |
|
334 } |
|
335 cached = true; |
|
336 |
|
337 if(internal_itemHandle() == 0) { |
|
338 if(parentItem == null){ |
|
339 itemHandle = tree.topLevelItemsHandle[index]; |
|
340 } else { |
|
341 itemHandle = parentItem.childrenItemsHandle[index]; |
|
342 } |
|
343 } |
|
344 |
|
345 if ((tree.getStyle() & SWT.CHECK) != 0) { |
|
346 OS.QTreeWidgetItem_setFlags(itemHandle, OS.QT_ITEMISENABLED |
|
347 | OS.QT_ITEMISUSERCHECKABLE | OS.QT_ITEMISSELECTABLE); |
|
348 OS.QTreeWidgetItem_setCheckState(itemHandle, checkedState); |
|
349 } else { |
|
350 OS.QTreeWidgetItem_setFlags(itemHandle, OS.QT_ITEMISENABLED |
|
351 | OS.QT_ITEMISSELECTABLE); |
|
352 } |
|
353 |
|
354 // If the user has set background, foreground or font for the whole item |
|
355 // set that here for the new column also |
|
356 if (background != null) OS.QTreeWidgetItem_swt_setBackground(itemHandle, background.getRed(), background.getGreen(), background.getBlue(), false); |
|
357 if (foreground != null) OS.QTreeWidgetItem_swt_setForeground(itemHandle, foreground.getRed(), foreground.getGreen(), foreground.getBlue(), false); |
|
358 if (font != null) OS.QTreeWidgetItem_swt_setFont(itemHandle, font.handle); |
|
359 if (text != null) OS.QTreeWidgetItem_setText(itemHandle, text); |
|
360 if (image != null) OS.QTreeWidgetItem_setIcon(itemHandle, Internal_GfxPackageSupport.getIconHandle(image)); |
|
361 |
|
362 tree.ignoreSelectionEvent = true; |
|
363 |
|
364 // this code will be executed when we call setSelection(TreeItem[]) in multi style. |
|
365 // if the number of items going to select are 1 and style is single also works |
|
366 if(selection && ((tree.getStyle() & SWT.VIRTUAL) != 0)) { |
|
367 OS.QTreeWidgetItem_setSelected(internal_itemHandle(), selection); |
|
368 // we need to set the selection to false. bcz there is also possible |
|
369 //to deselect the item with mouse |
|
370 selection = false; |
|
371 } |
|
372 tree.ignoreSelectionEvent = false; |
|
373 tree.updateColumnWidth(); |
|
374 } |
|
375 |
|
376 TreeItem findItem(int itemHandle) { |
|
377 TreeItem item = null; |
|
378 for (int i = 0; i < childrenItemCount; i++) { |
|
379 if (childrenItemsHandle[i] == itemHandle) { |
|
380 item = _getItem(i); |
|
381 break; |
|
382 } else { |
|
383 TreeItem childItem = _getItem(i); |
|
384 if(childItem.cached){ |
|
385 if(childItem.getExpanded()) |
|
386 item = childItem.findItem(itemHandle); |
|
387 } |
|
388 if (item != null) |
|
389 break; |
|
390 } |
|
391 } |
|
392 return item; |
|
393 } |
|
394 |
|
395 /** |
|
396 * Returns the receiver's background color. |
|
397 * |
|
398 * @return the background color |
|
399 * |
|
400 * @exception SWTException |
|
401 * <ul> |
|
402 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
403 * disposed</li> |
|
404 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
405 * thread that created the receiver</li> |
|
406 * </ul> |
|
407 * |
|
408 * @since 2.0 |
|
409 * |
|
410 */ |
|
411 public Color getBackground() { |
|
412 checkWidget(); |
|
413 if(cached) { |
|
414 if (!tree.checkData(this, getParentItem())) |
|
415 error(SWT.ERROR_WIDGET_DISPOSED); |
|
416 } |
|
417 |
|
418 if (background != null) |
|
419 return Internal_GfxPackageSupport.newColor(display, background.handle); |
|
420 |
|
421 return tree.getBackground(); |
|
422 } |
|
423 |
|
424 /** |
|
425 * Returns a rectangle describing the receiver's size and location relative |
|
426 * to its parent. |
|
427 * |
|
428 * @return the receiver's bounding rectangle |
|
429 * |
|
430 * @exception SWTException |
|
431 * <ul> |
|
432 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
433 * disposed</li> |
|
434 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
435 * thread that created the receiver</li> |
|
436 * </ul> |
|
437 */ |
|
438 public Rectangle getBounds() { |
|
439 checkWidget(); |
|
440 if(cached){ |
|
441 if (!tree.checkData(this, getParentItem())) |
|
442 error(SWT.ERROR_WIDGET_DISPOSED); |
|
443 return OS.QTreeWidget_visualItemRect(tree.topHandle, |
|
444 internal_itemHandle()); |
|
445 } else { |
|
446 return OS.QTreeWidget_visualItemRect(tree.topHandle, _getItemHandle()); |
|
447 } |
|
448 } |
|
449 |
|
450 /** |
|
451 * Returns <code>true</code> if the receiver is checked, and false |
|
452 * otherwise. When the parent does not have the |
|
453 * <code>CHECK style, return false. |
|
454 * <p> |
|
455 * |
|
456 * @return the checked state |
|
457 * |
|
458 * @exception SWTException |
|
459 * <ul> <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
460 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
461 * called from the thread that created the receiver</li> |
|
462 * </ul> |
|
463 */ |
|
464 public boolean getChecked() { |
|
465 checkWidget(); |
|
466 if(cached){ |
|
467 if (!tree.checkData(this, getParentItem())) |
|
468 error(SWT.ERROR_WIDGET_DISPOSED); |
|
469 |
|
470 if ((tree.style & SWT.CHECK) == 0) |
|
471 return false; |
|
472 return OS.QTreeWidgetItem_checkState(internal_itemHandle()) == OS.QT_CHECKED; |
|
473 } else { |
|
474 if(checkedState == OS.QT_CHECKED) { |
|
475 return true; |
|
476 } else { |
|
477 return false; |
|
478 } |
|
479 } |
|
480 } |
|
481 |
|
482 /** |
|
483 * Gets the index of an item. |
|
484 * <p> |
|
485 * -1 is returned if the item is not found from children. |
|
486 * |
|
487 * @param time |
|
488 * the search item |
|
489 * @return the index of the item |
|
490 * |
|
491 * @exception IllegalArgumentException |
|
492 * <ul> |
|
493 * <li>ERROR_NULL_ARGUMENT - if the item is null</li> |
|
494 * </ul> |
|
495 * @exception SWTException |
|
496 * <ul> |
|
497 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
498 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
499 * called from the thread that created the receiver</li> |
|
500 * </ul> |
|
501 */ |
|
502 int getChildItemIndex(TreeItem item) { |
|
503 if (item == null) |
|
504 error(SWT.ERROR_NULL_ARGUMENT); |
|
505 if (childrenItemCount == 0 || childrenItems == null |
|
506 || item.getParent() != tree) |
|
507 return -1; |
|
508 |
|
509 return OS.QTreeWidgetItem_indexOfChild(internal_itemHandle(), item.internal_itemHandle()); |
|
510 } |
|
511 |
|
512 /** |
|
513 * Returns <code>true</code> if the receiver is expanded, and false |
|
514 * otherwise. |
|
515 * <p> |
|
516 * |
|
517 * @return the expanded state |
|
518 * |
|
519 * @exception SWTException |
|
520 * <ul> |
|
521 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
522 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
523 * called from the thread that created the receiver</li> |
|
524 * </ul> |
|
525 */ |
|
526 public boolean getExpanded() { |
|
527 checkWidget(); |
|
528 if(cached){ |
|
529 if (!tree.checkData(this, getParentItem())) |
|
530 error(SWT.ERROR_WIDGET_DISPOSED); |
|
531 return OS.QTreeWidgetItem_isExpanded(internal_itemHandle()); |
|
532 } else { |
|
533 return false; |
|
534 } |
|
535 } |
|
536 |
|
537 /** |
|
538 * Returns the font that the receiver will use to paint textual information |
|
539 * for this item. |
|
540 * |
|
541 * @return the receiver's font |
|
542 * |
|
543 * @exception SWTException |
|
544 * <ul> |
|
545 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
546 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
547 * called from the thread that created the receiver</li> |
|
548 * </ul> |
|
549 * |
|
550 * @since 3.0 |
|
551 */ |
|
552 public Font getFont() { |
|
553 checkWidget(); |
|
554 if(cached){ |
|
555 if (!tree.checkData(this, getParentItem())) |
|
556 error(SWT.ERROR_WIDGET_DISPOSED); |
|
557 } |
|
558 return (this.font == null) ? getParent().getFont() : this.font; |
|
559 } |
|
560 |
|
561 /** |
|
562 * Returns the foreground color that the receiver will use to draw. |
|
563 * |
|
564 * @return the receiver's foreground color |
|
565 * |
|
566 * @exception SWTException |
|
567 * <ul> |
|
568 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
569 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
570 * called from the thread that created the receiver</li> |
|
571 * </ul> |
|
572 * |
|
573 * @since 2.0 |
|
574 * |
|
575 */ |
|
576 public Color getForeground() { |
|
577 checkWidget(); |
|
578 if(cached){ |
|
579 if (!tree.checkData(this, getParentItem())) |
|
580 error(SWT.ERROR_WIDGET_DISPOSED); |
|
581 } |
|
582 |
|
583 if (foreground != null) |
|
584 return Internal_GfxPackageSupport.newColor(display, foreground.handle); |
|
585 |
|
586 return tree.getForeground(); |
|
587 } |
|
588 |
|
589 /** |
|
590 * Returns <code>true</code> if the receiver is grayed, and false otherwise. |
|
591 * When the parent does not have the <code>CHECK style, return false. |
|
592 * <p> |
|
593 * |
|
594 * @return the grayed state |
|
595 * |
|
596 * @exception SWTException |
|
597 * <ul> <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
598 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
599 * called from the thread that created the receiver</li> |
|
600 * </ul> |
|
601 */ |
|
602 public boolean getGrayed() { |
|
603 checkWidget(); |
|
604 if(cached){ |
|
605 if (!tree.checkData(this, getParentItem())) |
|
606 error(SWT.ERROR_WIDGET_DISPOSED); |
|
607 } |
|
608 if ((tree.getStyle() & SWT.CHECK) == 0) |
|
609 return false; |
|
610 |
|
611 return grayed; |
|
612 } |
|
613 |
|
614 |
|
615 TreeItem getItem(int itemHandle) { |
|
616 TreeItem item = null; |
|
617 for (int i = 0; i < childrenItemCount; i++) { |
|
618 if (childrenItemsHandle[i] == itemHandle) { |
|
619 item = _getItem(i); |
|
620 break; |
|
621 } else { |
|
622 item = _getItem(i).getItem(itemHandle); |
|
623 if (item != null) |
|
624 break; |
|
625 } |
|
626 } |
|
627 return item; |
|
628 } |
|
629 |
|
630 /** |
|
631 * Returns the number of items contained in the receiver that are direct |
|
632 * item children of the receiver. |
|
633 * |
|
634 * @return the number of items |
|
635 * |
|
636 * @exception SWTException |
|
637 * <ul> <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
638 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
639 * called from the thread that created the receiver</li> |
|
640 * </ul> |
|
641 */ |
|
642 public int getItemCount() { |
|
643 checkWidget(); |
|
644 return childrenItemCount; |
|
645 } |
|
646 |
|
647 /** |
|
648 * Returns a (possibly empty) array of <code>TreeItem</code>s which are the |
|
649 * direct item children of the receiver. |
|
650 * <p> |
|
651 * Note: This is not the actual structure used by the receiver to maintain |
|
652 * its list of items, so modifying the array will not affect the receiver. |
|
653 * </p> |
|
654 * |
|
655 * @return the receiver's items |
|
656 * |
|
657 * @exception SWTException |
|
658 * <ul> |
|
659 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
660 * disposed</li> |
|
661 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
662 * thread that created the receiver</li> |
|
663 * </ul> |
|
664 */ |
|
665 public TreeItem[] getItems() { |
|
666 checkWidget(); |
|
667 if (childrenItemCount == 0) |
|
668 return new TreeItem[0]; |
|
669 TreeItem[] items = new TreeItem[childrenItemCount]; |
|
670 if ((tree.getStyle() & SWT.VIRTUAL) != 0) { |
|
671 for (int i = 0; i < childrenItemCount; i++) { |
|
672 items[i] = _getItem(i); |
|
673 tree.checkData(items[i], i); |
|
674 } |
|
675 } else { |
|
676 System.arraycopy(childrenItems, 0, items, 0, childrenItemCount); |
|
677 } |
|
678 return items; |
|
679 } |
|
680 |
|
681 /** |
|
682 * Returns the receiver's parent, which must be a <code>Tree</code>. |
|
683 * |
|
684 * @return the receiver's parent |
|
685 * |
|
686 * @exception SWTException |
|
687 * <ul> |
|
688 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
689 * disposed</li> |
|
690 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
691 * thread that created the receiver</li> |
|
692 * </ul> |
|
693 */ |
|
694 public Tree getParent() { |
|
695 checkWidget(); |
|
696 return tree; |
|
697 } |
|
698 |
|
699 /** |
|
700 * Returns the receiver's parent item, which must be a <code>TreeItem</code> |
|
701 * or null when the receiver is a root. |
|
702 * |
|
703 * @return the receiver's parent item |
|
704 * |
|
705 * @exception SWTException |
|
706 * <ul> |
|
707 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
708 * disposed</li> |
|
709 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
710 * thread that created the receiver</li> |
|
711 * </ul> |
|
712 */ |
|
713 public TreeItem getParentItem() { |
|
714 checkWidget(); |
|
715 if(parentItem!=null){ |
|
716 return parentItem; |
|
717 } else { |
|
718 return null; |
|
719 } |
|
720 } |
|
721 |
|
722 void increaseChildrenArraySize(){ |
|
723 if (childrenItems == null) { |
|
724 childrenItems = new TreeItem[4]; |
|
725 } |
|
726 if (childrenItemCount+1 == childrenItems.length) { |
|
727 int length = Math.max (4, childrenItems.length * 3 / 2); |
|
728 TreeItem [] newItems = new TreeItem [length]; |
|
729 System.arraycopy (childrenItems, 0, newItems, 0, childrenItems.length); |
|
730 childrenItems = newItems; |
|
731 } |
|
732 |
|
733 if (childrenItemsHandle == null) { |
|
734 childrenItemsHandle = new int[4]; |
|
735 } |
|
736 if (childrenItemCount+1 == childrenItemsHandle.length) { |
|
737 int length = Math.max (4, childrenItemsHandle.length * 3 / 2); |
|
738 int [] handles = new int[length]; |
|
739 System.arraycopy (childrenItemsHandle, 0, handles, 0, |
|
740 childrenItemsHandle.length); |
|
741 childrenItemsHandle = handles; |
|
742 } |
|
743 } |
|
744 |
|
745 public int indexOf(TreeItem item){ |
|
746 checkWidget(); |
|
747 return getChildItemIndex(item); |
|
748 } |
|
749 |
|
750 public int internal_itemHandle() { |
|
751 return itemHandle; |
|
752 } |
|
753 |
|
754 public boolean isDisposed() { |
|
755 if (tree != null && (tree.style & SWT.VIRTUAL) == 0) { |
|
756 if (itemHandle == 0) |
|
757 return true; |
|
758 } |
|
759 return super.isDisposed(); |
|
760 } |
|
761 |
|
762 boolean isLastItemOfLastChild(){ |
|
763 boolean traverse = false; |
|
764 if(parentItem != null ){ |
|
765 if ((parentItem.childrenItems[parentItem.childrenItemCount-1]== this)){ |
|
766 traverse = parentItem.isLastItemOfLastChild(); |
|
767 } |
|
768 } else { |
|
769 if (tree.topLevelItems[tree.topLevelItemCount-1] == this){ |
|
770 traverse = true; |
|
771 } else { |
|
772 traverse = false; |
|
773 } |
|
774 } |
|
775 return traverse; |
|
776 } |
|
777 |
|
778 void releaseChildren_pp(boolean destroy) { |
|
779 if (childrenItems != null) { |
|
780 for (int i = childrenItemCount-1; i >= 0; i--) { |
|
781 TreeItem item = _getItem(i); |
|
782 |
|
783 if (item != null && !item.isDisposed()) { |
|
784 item.release(destroy); |
|
785 } |
|
786 } |
|
787 } |
|
788 } |
|
789 |
|
790 void releaseHandle_pp() { |
|
791 |
|
792 if(tree !=null){ |
|
793 int newItemHandle = internal_itemHandle(); |
|
794 if((tree.getStyle() & SWT.VIRTUAL)!=0 && !cached){ |
|
795 newItemHandle = _getItemHandle(); |
|
796 } |
|
797 |
|
798 if(cached || ((tree.getStyle() & SWT.VIRTUAL)!=0 && !cached)){ |
|
799 if(getParentItem() != null){ |
|
800 int index = OS.QTreeWidgetItem_indexOfChild(parentItem.internal_itemHandle(), |
|
801 newItemHandle); |
|
802 |
|
803 OS.QTreeWidgetItem_removeChild(parentItem.internal_itemHandle(), newItemHandle); |
|
804 |
|
805 int[] newHandles = new int[parentItem.childrenItemsHandle.length - 1]; |
|
806 System.arraycopy (parentItem.childrenItemsHandle, 0, newHandles, 0, index); |
|
807 System.arraycopy (parentItem.childrenItemsHandle, index + 1, newHandles, |
|
808 index, newHandles.length - index); |
|
809 parentItem.childrenItemsHandle = newHandles; |
|
810 |
|
811 TreeItem[] newItems = new TreeItem [parentItem.childrenItems.length - 1]; |
|
812 System.arraycopy (parentItem.childrenItems, 0, newItems, 0, index); |
|
813 System.arraycopy (parentItem.childrenItems, index + 1, newItems, index, |
|
814 newItems.length - index); |
|
815 |
|
816 parentItem.childrenItems = newItems; |
|
817 parentItem.childrenItemCount--; |
|
818 } else { |
|
819 int index = OS.QTreeWidget_indexOfTopLevelItem(tree.topHandle, |
|
820 newItemHandle); |
|
821 |
|
822 OS.QTreeWidget_takeTopLevelItem(tree.topHandle, index); |
|
823 |
|
824 int[] newHandles = new int[tree.topLevelItemsHandle.length - 1]; |
|
825 System.arraycopy (tree.topLevelItemsHandle, 0, newHandles, 0, index); |
|
826 System.arraycopy (tree.topLevelItemsHandle, index + 1, newHandles, |
|
827 index, newHandles.length - index); |
|
828 tree.topLevelItemsHandle = newHandles; |
|
829 |
|
830 TreeItem[] newItems = new TreeItem [tree.topLevelItems.length - 1]; |
|
831 System.arraycopy (tree.topLevelItems, 0, newItems, 0, index); |
|
832 System.arraycopy (tree.topLevelItems, index + 1, newItems, |
|
833 index, newItems.length - index); |
|
834 |
|
835 tree.topLevelItems = newItems; |
|
836 tree.topLevelItemCount--; |
|
837 } |
|
838 } |
|
839 } |
|
840 childrenItemCount = 0; |
|
841 childrenItems = null; |
|
842 childrenItemsHandle = null; |
|
843 itemHandle = 0; |
|
844 parentItem = null; |
|
845 tree = null; |
|
846 cached = false; |
|
847 super.releaseHandle_pp(); |
|
848 } |
|
849 |
|
850 void releaseWidget_pp() { |
|
851 super.releaseWidget_pp(); |
|
852 font = null; |
|
853 background = null; |
|
854 foreground = null; |
|
855 checkedState = OS.QT_UNCHECKED; |
|
856 selection = false; |
|
857 } |
|
858 |
|
859 void remove (int start, int end) { |
|
860 checkWidget(); |
|
861 if (start > end) return; |
|
862 if (!(0 <= start && start <= end && end < childrenItemCount)) { |
|
863 error (SWT.ERROR_INVALID_RANGE); |
|
864 } |
|
865 |
|
866 int index = end; |
|
867 while (index >= start) { |
|
868 TreeItem item = _getItem(index); |
|
869 if (item != null && !item.isDisposed ()) { |
|
870 item.release(false); |
|
871 } |
|
872 index--; |
|
873 } |
|
874 } |
|
875 |
|
876 /** |
|
877 * Sets the receiver's background color to the color specified by the |
|
878 * argument, or to the default system color for the item if the argument is |
|
879 * null. |
|
880 * |
|
881 * @param color |
|
882 * the new color (or null) |
|
883 * |
|
884 * @exception IllegalArgumentException |
|
885 * <ul> |
|
886 * <li>ERROR_INVALID_ARGUMENT - if the argument has been |
|
887 * disposed</li> |
|
888 * </ul> |
|
889 * @exception SWTException |
|
890 * <ul> |
|
891 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
892 * disposed</li> |
|
893 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the |
|
894 * thread that created the receiver</li> |
|
895 * </ul> |
|
896 * |
|
897 * @since 2.0 |
|
898 * |
|
899 */ |
|
900 public void setBackground(Color color) { |
|
901 checkWidget(); |
|
902 if (color != null && color.isDisposed()) { |
|
903 SWT.error(SWT.ERROR_INVALID_ARGUMENT); |
|
904 } |
|
905 |
|
906 if(color == null) { |
|
907 background = null; |
|
908 } else { |
|
909 // Store a copy |
|
910 background = Internal_GfxPackageSupport.newColor(display, color.handle); |
|
911 } |
|
912 |
|
913 if(cached){ |
|
914 Color itemBg = getBackground(); |
|
915 boolean restore = (itemBg == null); |
|
916 int red = itemBg != null ? itemBg.getRed() : 0; |
|
917 int green = itemBg != null ? itemBg.getGreen() : 0; |
|
918 int blue = itemBg != null ? itemBg.getBlue() : 0; |
|
919 OS.QTreeWidgetItem_swt_setBackground(internal_itemHandle(), red, green, blue, restore); |
|
920 } |
|
921 } |
|
922 |
|
923 /** |
|
924 * Sets the checked state of the receiver. |
|
925 * <p> |
|
926 * |
|
927 * @param checked |
|
928 * the new checked state |
|
929 * |
|
930 * @exception SWTException |
|
931 * <ul> |
|
932 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
933 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
934 * called from the thread that created the receiver</li> |
|
935 * </ul> |
|
936 */ |
|
937 public void setChecked(boolean checked) { |
|
938 checkWidget(); |
|
939 if ((tree.getStyle() & SWT.CHECK) == 0) |
|
940 return; |
|
941 checkedState = checked ? OS.QT_CHECKED : OS.QT_UNCHECKED; |
|
942 if(cached){ |
|
943 OS.QTreeWidgetItem_setCheckState(internal_itemHandle(), checkedState); |
|
944 } |
|
945 } |
|
946 |
|
947 /** |
|
948 * Sets the expanded state of the receiver. |
|
949 * <p> |
|
950 * |
|
951 * @param expanded |
|
952 * the new expanded state |
|
953 * |
|
954 * @exception SWTException |
|
955 * <ul> |
|
956 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
957 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
958 * called from the thread that created the receiver</li> |
|
959 * </ul> |
|
960 */ |
|
961 public void setExpanded(boolean expanded) { |
|
962 checkWidget(); |
|
963 if(cached){ |
|
964 if (childrenItemCount == 0) |
|
965 return; |
|
966 tree.ignoreExpandEvent = true; |
|
967 OS.QTreeWidgetItem_setExpanded(internal_itemHandle(), expanded); |
|
968 tree.ignoreExpandEvent = false; |
|
969 } |
|
970 } |
|
971 |
|
972 /** |
|
973 * Sets the font that the receiver will use to paint textual information for |
|
974 * this item to the font specified by the argument, or to the default font |
|
975 * for that kind of control if the argument is null. |
|
976 * |
|
977 * @param font |
|
978 * the new font (or null) |
|
979 * |
|
980 * @exception IllegalArgumentException |
|
981 * <ul> |
|
982 * <li>ERROR_INVALID_ARGUMENT - if the argument has been |
|
983 * disposed</li> |
|
984 * </ul> |
|
985 * @exception SWTException |
|
986 * <ul> |
|
987 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
988 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
989 * called from the thread that created the receiver</li> |
|
990 * </ul> |
|
991 * |
|
992 * @since 3.0 |
|
993 */ |
|
994 public void setFont(Font font) { |
|
995 checkWidget(); |
|
996 if (font != null && font.isDisposed()) |
|
997 SWT.error(SWT.ERROR_INVALID_ARGUMENT); |
|
998 |
|
999 Font oldFont = this.font; |
|
1000 if (oldFont == font) |
|
1001 return; |
|
1002 this.font = font; |
|
1003 if (oldFont != null && oldFont.equals(font)) |
|
1004 return; |
|
1005 |
|
1006 int fontHandle = font != null ? font.handle : 0; |
|
1007 if(cached){ |
|
1008 OS.QTreeWidgetItem_swt_setFont(internal_itemHandle(), fontHandle); |
|
1009 tree.updateColumnWidth(); |
|
1010 } |
|
1011 } |
|
1012 |
|
1013 /** |
|
1014 * Sets the receiver's foreground color to the color specified by the |
|
1015 * argument, or to the default system color for the item if the argument is |
|
1016 * null. |
|
1017 * |
|
1018 * @param color |
|
1019 * the new color (or null) |
|
1020 * |
|
1021 * @since 2.0 |
|
1022 * |
|
1023 * @exception IllegalArgumentException |
|
1024 * <ul> |
|
1025 * <li>ERROR_INVALID_ARGUMENT - if the argument has been |
|
1026 * disposed</li> |
|
1027 * </ul> |
|
1028 * @exception SWTException |
|
1029 * <ul> |
|
1030 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
1031 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
1032 * called from the thread that created the receiver</li> |
|
1033 * </ul> |
|
1034 * |
|
1035 * @since 2.0 |
|
1036 * |
|
1037 */ |
|
1038 public void setForeground(Color color) { |
|
1039 checkWidget(); |
|
1040 if (color != null && color.isDisposed()) { |
|
1041 SWT.error(SWT.ERROR_INVALID_ARGUMENT); |
|
1042 } |
|
1043 |
|
1044 if(color == null) { |
|
1045 foreground = null; |
|
1046 } else { |
|
1047 // Store a copy |
|
1048 foreground = Internal_GfxPackageSupport.newColor(display, color.handle); |
|
1049 } |
|
1050 |
|
1051 if(cached){ |
|
1052 Color itemFg = getForeground(); |
|
1053 boolean restore = (itemFg == null); |
|
1054 int red = itemFg != null ? itemFg.getRed() : 0; |
|
1055 int green = itemFg != null ? itemFg.getGreen() : 0; |
|
1056 int blue = itemFg != null ? itemFg.getBlue() : 0; |
|
1057 OS.QTreeWidgetItem_swt_setForeground(internal_itemHandle(), red, green, blue, restore); |
|
1058 } |
|
1059 } |
|
1060 |
|
1061 /** |
|
1062 * Sets the grayed state of the receiver. |
|
1063 * <p> |
|
1064 * |
|
1065 * @param grayed |
|
1066 * the new grayed state |
|
1067 * |
|
1068 * @exception SWTException |
|
1069 * <ul> |
|
1070 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
1071 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
1072 * called from the thread that created the receiver</li> |
|
1073 * </ul> |
|
1074 */ |
|
1075 public void setGrayed(boolean grayed) { |
|
1076 checkWidget(); |
|
1077 if ((tree.getStyle() & SWT.CHECK) == 0) |
|
1078 return; |
|
1079 this.grayed = grayed; |
|
1080 } |
|
1081 |
|
1082 /** |
|
1083 * Sets the receiver's image. |
|
1084 * |
|
1085 * @param image |
|
1086 * the new image |
|
1087 * |
|
1088 * @exception IllegalArgumentException |
|
1089 * <ul> |
|
1090 * <li>ERROR_INVALID_ARGUMENT - if the image has been |
|
1091 * disposed</li> |
|
1092 * </ul> |
|
1093 * @exception SWTException |
|
1094 * <ul> |
|
1095 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
1096 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
1097 * called from the thread that created the receiver</li> |
|
1098 * </ul> |
|
1099 * |
|
1100 * @since 3.1 |
|
1101 */ |
|
1102 public void setImage(Image image) { |
|
1103 checkWidget(); |
|
1104 if(cached){ |
|
1105 if (image != null && image.isDisposed()) |
|
1106 error(SWT.ERROR_INVALID_ARGUMENT); |
|
1107 if (image != null) { |
|
1108 OS.QTreeWidgetItem_setIcon(internal_itemHandle(), |
|
1109 Internal_GfxPackageSupport.getIconHandle(image)); |
|
1110 } else { |
|
1111 OS.QTreeWidgetItem_setIcon(internal_itemHandle(), |
|
1112 Internal_GfxPackageSupport.getNullIconHandle()); |
|
1113 } |
|
1114 } |
|
1115 super.setImage(image); |
|
1116 } |
|
1117 |
|
1118 /** |
|
1119 * Sets the number of items contained in the receiver. |
|
1120 * |
|
1121 * @param count the number of items |
|
1122 * |
|
1123 * @exception SWTException <ul> |
|
1124 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|
1125 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
|
1126 * </ul> |
|
1127 * |
|
1128 * @since 3.0 |
|
1129 */ |
|
1130 public void setItemCount (int count) { |
|
1131 checkWidget (); |
|
1132 count = Math.max (0, count); |
|
1133 if (count == childrenItemCount) return; |
|
1134 boolean isVirtual = (tree.style & SWT.VIRTUAL) != 0; |
|
1135 if (!isVirtual) tree.setRedraw (false); |
|
1136 int oldItemCount = childrenItemCount; |
|
1137 remove (count, childrenItemCount - 1); |
|
1138 int length = Math.max (4, (count + 3) / 4 * 4); |
|
1139 TreeItem [] newItems = new TreeItem [length]; |
|
1140 if(childrenItems == null){ |
|
1141 childrenItems = new TreeItem[count]; |
|
1142 } |
|
1143 System.arraycopy (childrenItems, 0, newItems, 0, childrenItemCount); |
|
1144 childrenItems = newItems; |
|
1145 if (isVirtual) { |
|
1146 if(oldItemCount<count){ |
|
1147 int newItemHandle = internal_itemHandle(); |
|
1148 if((tree.getStyle() & SWT.VIRTUAL)!=0 && !cached){ |
|
1149 newItemHandle = _getItemHandle(); |
|
1150 } |
|
1151 int[] handles = OS.QTreeWidgetItem_addChildren(newItemHandle, |
|
1152 count-childrenItemCount); |
|
1153 int[] temp = new int[count]; |
|
1154 if(childrenItemsHandle == null){ |
|
1155 childrenItemsHandle = new int[count]; |
|
1156 } |
|
1157 System.arraycopy (childrenItemsHandle, 0, temp, 0, childrenItemCount); |
|
1158 System.arraycopy (handles, 0, temp, childrenItemCount, handles.length); |
|
1159 childrenItemsHandle = temp; |
|
1160 } |
|
1161 childrenItemCount = count; |
|
1162 } else { |
|
1163 for (int i=childrenItemCount; i<count; i++) { |
|
1164 new TreeItem(this, SWT.NONE, i); |
|
1165 } |
|
1166 } |
|
1167 if (!isVirtual) tree.setRedraw (true); |
|
1168 } |
|
1169 |
|
1170 /** |
|
1171 * Sets the receiver's text at a column |
|
1172 * |
|
1173 * @param index |
|
1174 * the column index |
|
1175 * @param string |
|
1176 * the new text |
|
1177 * |
|
1178 * @exception IllegalArgumentException |
|
1179 * <ul> |
|
1180 * <li>ERROR_NULL_ARGUMENT - if the text is null</li> |
|
1181 * </ul> |
|
1182 * @exception SWTException |
|
1183 * <ul> |
|
1184 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been |
|
1185 * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not |
|
1186 * called from the thread that created the receiver</li> |
|
1187 * </ul> |
|
1188 * |
|
1189 * @since 3.1 |
|
1190 */ |
|
1191 public void setText(String string) { |
|
1192 checkWidget(); |
|
1193 if (string == null) |
|
1194 error(SWT.ERROR_NULL_ARGUMENT); |
|
1195 if (string.equals(text)) |
|
1196 return; |
|
1197 super.setText(string); |
|
1198 if(cached) { |
|
1199 OS.QTreeWidgetItem_setText(this.itemHandle, string); |
|
1200 tree.updateColumnWidth(); |
|
1201 } |
|
1202 } |
|
1203 } |