View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program 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 this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  /***
21   * Original copyright notice below. Class was slightly adopted for XNap.
22   */
23  /*
24   * TreeTableModel.java
25   *
26   * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
27   *
28   * This software is the confidential and proprietary information of Sun
29   * Microsystems, Inc. ("Confidential Information").  You shall not
30   * disclose such Confidential Information and shall use it only in
31   * accordance with the terms of the license agreement you entered into
32   * with Sun.
33   *
34   * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
35   * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
36   * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37   * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
38   * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
39   * THIS SOFTWARE OR ITS DERIVATIVES.
40   *
41   */
42  package org.xnap.gui.table;
43  
44  import javax.swing.tree.TreeModel;
45  
46  /***
47   * TreeTableModel is the model used by a JTreeTable. It extends TreeModel
48   * to add methods for getting inforamtion about the set of columns each 
49   * node in the TreeTableModel may have. Each column, like a column in 
50   * a TableModel, has a name and a type associated with it. Each node in 
51   * the TreeTableModel can return a value for each of the columns and 
52   * set that value if isCellEditable() returns true. 
53   *
54   * @author Philip Milne 
55   * @author Scott Violet
56   */
57  public interface TreeTableModel extends TreeModel
58  {
59      /***
60       * Returns the number ofs availible column.
61       */
62      int getColumnCount();
63  
64      /***
65       * Returns the name for column number <code>column</code>.
66       */
67      String getColumnName(int column);
68  
69      /***
70       * Returns the type for column number <code>column</code>.
71       */
72      Class getColumnClass(int column);
73  
74      /***
75       * Returns the value to be displayed for node <code>node</code>, 
76       * at column number <code>column</code>.
77       */
78      Object getValueAt(Object node, int column);
79  
80      /***
81       * Indicates whether the the value for node <code>node</code>, 
82       * at column number <code>column</code> is editable.
83       */
84      boolean isCellEditable(Object node, int column);
85  
86      /***
87       * Sets the value for node <code>node</code>, 
88       * at column number <code>column</code>.
89       */
90      void setValueAt(Object aValue, Object node, int column);
91  
92  }