Source code: jgift/ui/treetable/TreeTableModel.java
1 /*
2 * This file is part of jgiFT.
3 * Copyright (c) 2003, Jason Shobe
4 *
5 * jgiFT is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * jgiFT is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with jgiFT; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 package jgift.ui.treetable;
20
21 import javax.swing.tree.TreeModel;
22
23 /**
24 * A model used for tables that wrap a tree view of results. This code borrows
25 * heavily from the JTreeTable example found on the
26 * <a href="http://java.sun.com/projects/jfc/tsc/articles/treetable2/index.html>
27 * Java Developer Connection</a>.
28 *
29 * @author Jason Shobe
30 * @version $Revision: 1.1 $
31 */
32 public interface TreeTableModel extends TreeModel {
33 /**
34 * Get the number of columns in each node of the tree.
35 *
36 * @return the number of columns.
37 */
38 public int getColumnCount();
39
40 /**
41 * Get the name of the specified column.
42 *
43 * @param column the index of the column.
44 *
45 * @return the name of the column.
46 */
47 public String getColumnName(int column);
48
49 /**
50 * Get the most specific superclass for all the cell values in the column.
51 *
52 * @param column the index of the column.
53 *
54 * @return the common ancestor class of the object values in the model.
55 */
56 public Class getColumnClass(int column);
57
58 /**
59 * Get the value in the specified column of a tree node.
60 *
61 * @param node the tree node.
62 * @param column the index of the column.
63 *
64 * @return the value in the specifed location.
65 */
66 public Object getValueAt(Object node, int column);
67
68 /**
69 * Determine if the specified column of a tree node can be modified by the
70 * user.
71 *
72 * @param node the tree node.
73 * @param column the index of the column.
74 *
75 * @return <code>true</code> if the the column may be editied.
76 */
77 public boolean isCellEditable(Object node, int column);
78
79 /**
80 * Set the value of the specified column of a tree node.
81 *
82 * @param value the column value.
83 * @param node the tree node.
84 * @param column the index of the column.
85 */
86 public void setValueAt(Object value, Object node, int column);
87 }
88