Revision 14100
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/table/models/ROIsTableModel.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.table.models; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
|
|
5 |
import javax.swing.JButton; |
|
6 |
import javax.swing.table.DefaultTableModel; |
|
7 |
|
|
8 |
import org.gvsig.gui.beans.table.models.IModel; |
|
9 |
|
|
10 |
public class ROIsTableModel extends DefaultTableModel implements IModel { |
|
11 |
private static final long serialVersionUID = 8716862990277121681L; |
|
12 |
|
|
13 |
|
|
14 |
boolean[] canEdit = new boolean[] { false, false, false, false, true }; |
|
15 |
Class[] types = new Class[] { String.class, Integer.class, Integer.class, Integer.class, JButton.class }; |
|
16 |
|
|
17 |
public ROIsTableModel(String[] columnNames) { |
|
18 |
super(new Object[0][5], columnNames); |
|
19 |
} |
|
20 |
|
|
21 |
/* |
|
22 |
* (non-Javadoc) |
|
23 |
* @see org.gvsig.gui.beans.table.models.IModel#getNewLine() |
|
24 |
*/ |
|
25 |
public Object[] getNewLine() { |
|
26 |
Color color = Color.WHITE; |
|
27 |
if (this.getRowCount() > 0) { |
|
28 |
color = (Color) getValueAt(this.getRowCount() - 1, 4); |
|
29 |
} |
|
30 |
return new Object[] {"", new Integer(0), new Integer(0), new Integer(0), color}; |
|
31 |
} |
|
32 |
|
|
33 |
/* |
|
34 |
* (non-Javadoc) |
|
35 |
* @see javax.swing.table.AbstractTableModel#getColumnClass(int) |
|
36 |
*/ |
|
37 |
public Class getColumnClass(int columnIndex) { |
|
38 |
return types [columnIndex]; |
|
39 |
} |
|
40 |
|
|
41 |
/* |
|
42 |
* (non-Javadoc) |
|
43 |
* @see javax.swing.table.DefaultTableModel#isCellEditable(int, int) |
|
44 |
*/ |
|
45 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
|
46 |
return canEdit [columnIndex]; |
|
47 |
} |
|
48 |
} |
Also available in: Unified diff