01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: * Darrell Meyer <darrell@mygwt.net> - derived implementation
11: *******************************************************************************/package net.mygwt.ui.client.viewer;
12:
13: /**
14: * An interface to content providers for tree-structure-oriented viewers.
15: *
16: * @see TreeViewer
17: */
18: public interface ITreeContentProvider extends IContentProvider {
19:
20: /**
21: * Returns the child elements of the given parent.
22: *
23: * @param parent the parent element
24: * @param callback the content callback
25: */
26: public void getChildren(Object parent,
27: IAsyncContentCallback callback);
28:
29: /**
30: * Returns the parent for the given element, or <code>null</code> indicating
31: * that the parent can't be computed. In this case the tree-structured viewer
32: * can't expand a given node correctly if requested.
33: *
34: * @param element the element
35: * @return the parent element, or <code>null</code> if it has none or if the
36: * parent cannot be computed
37: */
38: public Object getParent(Object element);
39:
40: /**
41: * Returns whether the given element has children.
42: * <p>
43: * Intended as an optimization for when the viewer does not need the actual
44: * children. Clients may be able to implement this more efficiently than
45: * <code>getChildren</code>.
46: * </p>
47: *
48: * @param element the element
49: * @return <code>true</code> if the given element has children, and
50: * <code>false</code> if it has no children
51: */
52: public boolean hasChildren(Object element);
53:
54: }
|