KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > ITreeContentProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 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  *******************************************************************************/

11 package org.eclipse.jface.viewers;
12
13 /**
14  * An interface to content providers for tree-structure-oriented
15  * viewers.
16  *
17  * @see AbstractTreeViewer
18  */

19 public interface ITreeContentProvider extends IStructuredContentProvider {
20     /**
21      * Returns the child elements of the given parent element.
22      * <p>
23      * The difference between this method and <code>IStructuredContentProvider.getElements</code>
24      * is that <code>getElements</code> is called to obtain the
25      * tree viewer's root elements, whereas <code>getChildren</code> is used
26      * to obtain the children of a given parent element in the tree (including a root).
27      * </p>
28      * The result is not modified by the viewer.
29      *
30      * @param parentElement the parent element
31      * @return an array of child elements
32      */

33     public Object JavaDoc[] getChildren(Object JavaDoc parentElement);
34
35     /**
36      * Returns the parent for the given element, or <code>null</code>
37      * indicating that the parent can't be computed.
38      * In this case the tree-structured viewer can't expand
39      * a given node correctly if requested.
40      *
41      * @param element the element
42      * @return the parent element, or <code>null</code> if it
43      * has none or if the parent cannot be computed
44      */

45     public Object JavaDoc getParent(Object JavaDoc element);
46
47     /**
48      * Returns whether the given element has children.
49      * <p>
50      * Intended as an optimization for when the viewer does not
51      * need the actual children. Clients may be able to implement
52      * this more efficiently than <code>getChildren</code>.
53      * </p>
54      *
55      * @param element the element
56      * @return <code>true</code> if the given element has children,
57      * and <code>false</code> if it has no children
58      */

59     public boolean hasChildren(Object JavaDoc element);
60 }
61
Popular Tags