gvsig-raster / org.gvsig.raster.tasseledcap / trunk / org.gvsig.raster.tasseledcap / org.gvsig.raster.tasseledcap.swing / org.gvsig.raster.tasseledcap.swing.impl / src / main / java / org / gvsig / raster / tasseledcap / swing / impl / main / ComponentsTableModel.java @ 2381
History | View | Annotate | Download (2.1 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program 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 this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.raster.tasseledcap.swing.impl.main; |
25 |
|
26 |
import javax.swing.table.DefaultTableModel; |
27 |
|
28 |
import org.gvsig.raster.swing.pagedtable.TableModel; |
29 |
/**
|
30 |
* Model for the list of components
|
31 |
*
|
32 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
33 |
*/
|
34 |
public class ComponentsTableModel extends DefaultTableModel implements TableModel { |
35 |
final private static long serialVersionUID = -3370601314380922368L; |
36 |
private int nColumns = 0; |
37 |
|
38 |
public ComponentsTableModel(String[] columnNames) { |
39 |
super(new Object[0][columnNames.length], columnNames); |
40 |
this.nColumns = columnNames.length;
|
41 |
} |
42 |
|
43 |
public Class<?> getColumnClass(int c) { |
44 |
return String.class; |
45 |
} |
46 |
|
47 |
public void setValueAt(Object value, int row, int col) { |
48 |
super.setValueAt(value, row, col);
|
49 |
} |
50 |
|
51 |
public void addNew() { |
52 |
Object[] line = new Object[nColumns]; |
53 |
line[0] = new Boolean(true); |
54 |
for (int i = 0; i < nColumns; i++) |
55 |
line[i] = new String(""); |
56 |
super.addRow(line);
|
57 |
} |
58 |
|
59 |
public Object[] getNewLine() { |
60 |
Object[] o = new Object[nColumns]; |
61 |
o[0] = new Boolean(true); |
62 |
for (int i = 1; i < nColumns; i++) |
63 |
o[i] = "";
|
64 |
return o;
|
65 |
} |
66 |
|
67 |
public void addNewLine() { |
68 |
// TODO Auto-generated method stub
|
69 |
|
70 |
} |
71 |
} |