KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > swing > outline > RowModel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.swing.outline;
21
22 /** A model for the rows in an Outline. This is passed the object in
23  * column 0 of an Outline table (the tree column), and provides objects
24  * for the other columns - essentially a model for the data in the
25  * rows of an Outline.
26  * <p>
27  * Note that all column indexes passed to this interface are 0-based -
28  * that is, column 0 is the first column <strong>after</strong> the
29  * tree node column, so the object returned by <code>getValueFor(someObject, 0)</code>
30  * is the object that should appear in column <strong>1</strong> of the
31  * actual table.
32  * <p>
33  *
34  * @author Tim Boudreau
35  */

36 public interface RowModel {
37     /** Get the column count. Do not include the base (nodes) column
38      * of the Outline, only the number of columns in addition to it
39      * that should be displayed.
40      * @return the number of columns this model will contribute to the
41      * OutlineModel, not including the tree column */

42     public int getColumnCount();
43     /** Get the value at a given column.
44      * @param node The node in column 0 of the Outline
45      * @param column The index of the column minus the nodes column
46      * @return the value that should be displayed in the specified column,
47      * given the node in the tree column */

48     public Object JavaDoc getValueFor (Object JavaDoc node, int column);
49     /** Get the object class for the column. Analogous to
50      * <code>TableModel.getColumnClass(int column)</code>
51      * @param column an index into the columns represented by this model (0
52      * based - does not include the tree column of the OutlineModel)
53      * @return the class of object that will be displayed in the specified
54      * column */

55     public Class JavaDoc getColumnClass (int column);
56     /** Determine if the cell in this column is editable for the passed
57      * node.
58      * @param node the object displayed in the tree column of the Outline
59      * @param column the column index into the columns defined by this
60      * RowModel */

61     public boolean isCellEditable (Object JavaDoc node, int column);
62     /** Set the value of the object in this column. Typically this may
63      * call a setter on the node object in column 0. */

64     public void setValueFor (Object JavaDoc node, int column, Object JavaDoc value);
65     /** Get a localized name of this column that can be displayed in
66      * the table header
67      * @param column the column a name is requested for
68      * @return a localized name for the column */

69     public String JavaDoc getColumnName (int column);
70 }
71
Popular Tags