Mercurial > projects > dwt-addons
comparison dwtx/jface/viewers/ILazyTreePathContentProvider.d @ 10:b6c35faf97c8
Viewers
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 31 Mar 2008 00:47:19 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:6c14e54dfc11 | 10:b6c35faf97c8 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2005, 2006 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.jface.viewers.ILazyTreePathContentProvider; | |
14 | |
15 import dwtx.jface.viewers.IContentProvider; | |
16 import dwtx.jface.viewers.TreePath; | |
17 | |
18 import dwt.dwthelper.utils; | |
19 | |
20 /** | |
21 * The ILazyTreePathContentProvider is a tree path-based content provider for | |
22 * tree viewers created using the DWT.VIRTUAL flag that only wish to return | |
23 * their contents as they are queried. | |
24 * | |
25 * @since 3.3 | |
26 */ | |
27 public interface ILazyTreePathContentProvider : IContentProvider { | |
28 /** | |
29 * Called when a previously-blank item becomes visible in the TreeViewer. If | |
30 * the content provider knows the child element for the given parent at this | |
31 * index, it should respond by calling | |
32 * {@link TreeViewer#replace(Object, int, Object)}. The content provider | |
33 * should also update the child count for any replaced element by calling | |
34 * {@link TreeViewer#setChildCount(Object, int)}. If the given current child | |
35 * count is already correct, setChildCount does not have to be called since | |
36 * a call to replace will not change the child count. | |
37 * | |
38 * <strong>NOTE</strong> #updateElement(int index) can be used to determine | |
39 * selection values. If TableViewer#replace(Object, int) is not called | |
40 * before returning from this method, selections may have missing or stale | |
41 * elements. In this situation it is suggested that the selection is asked | |
42 * for again after replace() has been called. | |
43 * | |
44 * @param parentPath | |
45 * The tree path of parent of the element, or if the | |
46 * element to update is a root element, an empty tree path | |
47 * @param index | |
48 * The index of the element to update in the tree | |
49 */ | |
50 public void updateElement(TreePath parentPath, int index); | |
51 | |
52 /** | |
53 * Called when the TreeViewer needs an up-to-date child count for the given | |
54 * tree path, for example from {@link TreeViewer#refresh()} and | |
55 * {@link TreeViewer#setInput(Object)}. If the content provider knows the | |
56 * element at the given tree path, it should respond by calling | |
57 * {@link TreeViewer#setChildCount(Object, int)}. If the given current | |
58 * child count is already correct, no action has to be taken by this content | |
59 * provider. | |
60 * | |
61 * @param treePath | |
62 * The tree path for which an up-to-date child count is needed, or | |
63 * if the number of root elements is requested, the empty tree path | |
64 * @param currentChildCount | |
65 * The current child count for the element that needs updating | |
66 */ | |
67 public void updateChildCount(TreePath treePath, int currentChildCount); | |
68 | |
69 /** | |
70 * Called when the TreeViewer needs up-to-date information whether the node | |
71 * at the given tree path can be expanded. If the content provider knows the | |
72 * element at the given tree path, it should respond by calling | |
73 * {@link TreeViewer#setHasChildren(Object, bool)}. The content provider | |
74 * may also choose to call {@link TreeViewer#setChildCount(Object, int)} | |
75 * instead if it knows the number of children. | |
76 * | |
77 * <p> | |
78 * Intended as an optimization for when the viewer does not need the actual | |
79 * children. Clients may be able to implement this more efficiently than | |
80 * <code>updateChildCount</code>. | |
81 * </p> | |
82 * | |
83 * @param path | |
84 * The tree path for which up-to-date information about children | |
85 * is needed | |
86 */ | |
87 public void updateHasChildren(TreePath path); | |
88 | |
89 /** | |
90 * Return the possible parent paths for the given element. An empty array | |
91 * can be returned if the paths cannot be computed. In this case the | |
92 * tree-structured viewer can't expand a given node correctly if requested. | |
93 * If the element is a potential child of the input of the viewer, an empty | |
94 * tree path should be an entry in the returned array. | |
95 * | |
96 * @param element | |
97 * the element | |
98 * @return the possible parent paths for the given element | |
99 */ | |
100 public TreePath[] getParents(Object element); | |
101 } |