78
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2008 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 module org.eclipse.jface.databinding.viewers.TreeStructureAdvisor;
|
|
12
|
|
13 import java.lang.all;
|
|
14
|
|
15 /**
|
|
16 * Instances of this class can be used to improve accuracy and performance of an
|
|
17 * {@link ObservableListTreeContentProvider} or an
|
|
18 * {@link ObservableSetTreeContentProvider}. This class is intended to be
|
|
19 * subclassed by clients.
|
|
20 *
|
|
21 * @since 1.2
|
|
22 *
|
|
23 */
|
|
24 public abstract class TreeStructureAdvisor {
|
|
25
|
|
26 /**
|
|
27 * Returns the parent for the given element, or <code>null</code>
|
|
28 * indicating that the parent can't be computed. In this case the
|
|
29 * tree-structured viewer can't expand a given node correctly if requested.
|
|
30 * The default implementation returns null; clients should override.
|
|
31 *
|
|
32 * @param element
|
|
33 * the element
|
|
34 * @return the parent element, or <code>null</code> if it has none or if
|
|
35 * the parent cannot be computed
|
|
36 */
|
|
37 public Object getParent(Object element) {
|
|
38 return null;
|
|
39 }
|
|
40
|
|
41 /**
|
|
42 * Returns whether the given element has children, or <code>null</code> if
|
|
43 * the actual children collection should be consulted. The default
|
|
44 * implementation returns null; clients should override.
|
|
45 * <p>
|
|
46 * Intended as an optimization for when the viewer does not need the actual
|
|
47 * children. Clients may be able to implement this more efficiently than
|
|
48 * <code>getChildren</code>.
|
|
49 * </p>
|
|
50 *
|
|
51 * @param element
|
|
52 * the element
|
|
53 * @return <code>Boolean.TRUE</code> if the given element has children,
|
|
54 * <code>Boolean.FALSE</code> if it has no children, or
|
|
55 * <code>null</code> if the children collection should be
|
|
56 * consulted.
|
|
57 */
|
|
58 public Boolean hasChildren(Object element) {
|
|
59 return null;
|
|
60 }
|
|
61
|
|
62 }
|