1/*
2 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package javax.swing.tree;
27
28import java.awt.Component;
29import javax.swing.CellEditor;
30import javax.swing.JTree;
31
32/**
33  * Adds to CellEditor the extensions necessary to configure an editor
34  * in a tree.
35  *
36  * @see javax.swing.JTree
37  *
38  * @author Scott Violet
39  */
40
41public interface TreeCellEditor extends CellEditor
42{
43    /**
44     * Sets an initial <I>value</I> for the editor.  This will cause
45     * the editor to stopEditing and lose any partially edited value
46     * if the editor is editing when this method is called. <p>
47     *
48     * Returns the component that should be added to the client's
49     * Component hierarchy.  Once installed in the client's hierarchy
50     * this component will then be able to draw and receive user input.
51     *
52     * @param   tree            the JTree that is asking the editor to edit;
53     *                          this parameter can be null
54     * @param   value           the value of the cell to be edited
55     * @param   isSelected      true if the cell is to be rendered with
56     *                          selection highlighting
57     * @param   expanded        true if the node is expanded
58     * @param   leaf            true if the node is a leaf node
59     * @param   row             the row index of the node being edited
60     * @return  the component for editing
61     */
62    Component getTreeCellEditorComponent(JTree tree, Object value,
63                                         boolean isSelected, boolean expanded,
64                                         boolean leaf, int row);
65}
66