View Javadoc

1   /*
2    * Copyright (c) 2003-2008 by Cosylab d. d.
3    *
4    * This file is part of CosyBeans-Common.
5    *
6    * CosyBeans-Common 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, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * CosyBeans-Common is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with CosyBeans-Common.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package com.cosylab.gui.components.table;
21  
22  /**
23   * <code>TableRow</code> presents a row in a table.
24   *
25   * @author <a href="mailto:igor.kriznar@cosylab.com">Igor Kriznar</a>
26   * @version $Id: TableRow.java,v 1.6 2008-04-22 12:28:40 jbobnar Exp $
27   *
28   * @since May 3, 2004.
29   */
30  public interface TableRow
31  {
32  	/**
33  	 * Returns value at column index.
34  	 *
35  	 * @param column the column index
36  	 *
37  	 * @return value at column index
38  	 */
39  	public Object getValueAt(int column);
40  
41  	/**
42  	 * Returns the number values int this row.
43  	 *
44  	 * @return the number values int this row
45  	 */
46  	public int getValueCount();
47  
48  	/**
49  	 * This method is called when row is added to model. When row is remove
50  	 * from the model, this method is called with parameter <code>null</code>.
51  	 * 
52  	 * <p>
53  	 * Row can call on parent model method
54  	 * <code>fireRowUpdate(TableRow,int)</code> when want to notify model
55  	 * listeners (specially the JTable) about data changes.
56  	 * </p>
57  	 *
58  	 * @param model the model to which row was added, or <code>null</code>,
59  	 *        when row is removed form model
60  	 *
61  	 * @see TableRowModel#fireRowUpdate(TableRow, int)
62  	 */
63  	public void setParentModel(TableRowModel model);
64  
65  	/**
66  	 * The parent model which contains this row.
67  	 *
68  	 * @return the parent model which contains this row.
69  	 */
70  	public TableRowModel getParentModel();
71  
72  	/**
73  	 * Return <code>true</code> if value at specified column index is editable.
74  	 *
75  	 * @param index the column index
76  	 *
77  	 * @return <code>true</code> if value at the specified column index is
78  	 *         editable
79  	 */
80  	public boolean isValueSettable(int index);
81  
82  	/**
83  	 * Compares this table row with the specified table row for order.  Returns
84  	 * a negative integer, zero, or a positive integer as this row is less
85  	 * than, equal to, or greater than the specified row.
86  	 *
87  	 * @param row a row, to which it is compared
88  	 * @param valueIndex the index of value, which is compared in row
89  	 *
90  	 * @return negative integer, zero, or a positive integer as this row is
91  	 *         less than, equal to, or greater than the specified row.
92  	 */
93  	public int compareTo(TableRow row, int valueIndex);
94  }
95  
96  /* __oOo__ */