Revision 12504 trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/table/models/TableColorModel.java
TableColorModel.java | ||
---|---|---|
32 | 32 |
private static final long serialVersionUID = 5126848457976272945L; |
33 | 33 |
|
34 | 34 |
boolean[] canEdit = new boolean[] { true, true, false, true, false, true }; |
35 |
Class[] types = new Class[] { JButton.class, String.class, String.class, Double.class, Double.class, JButton.class }; |
|
35 | 36 |
|
36 | 37 |
public TableColorModel(String[] columnNames) { |
37 | 38 |
super(new Object[0][4], columnNames); |
38 | 39 |
} |
39 | 40 |
|
40 |
public Class getColumnClass(int c) { |
|
41 |
if ((c < 1) || (c == 5)) |
|
42 |
return JButton.class; |
|
43 |
|
|
44 |
return String.class; |
|
45 |
} |
|
46 |
|
|
41 |
/* |
|
42 |
* (non-Javadoc) |
|
43 |
* @see javax.swing.table.DefaultTableModel#removeRow(int) |
|
44 |
*/ |
|
45 |
/* |
|
47 | 46 |
public void removeRow(int row) { |
48 | 47 |
super.setValueAt(null, row, 0); |
49 | 48 |
super.setValueAt("", row, 1); |
... | ... | |
52 | 51 |
super.setValueAt("", row, 4); |
53 | 52 |
super.setValueAt(null, row, 5); |
54 | 53 |
super.removeRow(row); |
55 |
} |
|
54 |
}*/
|
|
56 | 55 |
|
56 |
/* |
|
57 |
* (non-Javadoc) |
|
58 |
* @see javax.swing.table.DefaultTableModel#setValueAt(java.lang.Object, int, int) |
|
59 |
*/ |
|
57 | 60 |
public void setValueAt(Object value, int row, int col) { |
58 | 61 |
super.setValueAt(value, row, col); |
59 | 62 |
} |
60 | 63 |
|
64 |
/* |
|
65 |
* (non-Javadoc) |
|
66 |
* @see org.gvsig.gui.beans.table.models.IModel#getNewLine() |
|
67 |
*/ |
|
61 | 68 |
public Object[] getNewLine() { |
62 |
return new Object[] { Color.WHITE, "", "", "", "", "255" };
|
|
69 |
return new Object[] {Color.WHITE, "", "", null, null, "255"};
|
|
63 | 70 |
} |
64 | 71 |
|
72 |
/* |
|
73 |
* (non-Javadoc) |
|
74 |
* @see javax.swing.table.DefaultTableModel#addRow(java.lang.Object[]) |
|
75 |
*/ |
|
65 | 76 |
public void addRow(Object[] list) { |
66 | 77 |
super.addRow(new Object[] { list[0], list[1], list[2], list[3], list[4], list[5] }); |
67 | 78 |
} |
68 | 79 |
|
80 |
/* |
|
81 |
* (non-Javadoc) |
|
82 |
* @see javax.swing.table.AbstractTableModel#getColumnClass(int) |
|
83 |
*/ |
|
84 |
public Class getColumnClass(int columnIndex) { |
|
85 |
return types [columnIndex]; |
|
86 |
} |
|
87 |
|
|
88 |
/* |
|
89 |
* (non-Javadoc) |
|
90 |
* @see javax.swing.table.DefaultTableModel#isCellEditable(int, int) |
|
91 |
*/ |
|
69 | 92 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
70 | 93 |
return canEdit [columnIndex]; |
71 | 94 |
} |
Also available in: Unified diff