64 |
|
|
65 |
|
|
66 |
/** |
/** |
67 |
* |
* A tabular data model for representing LSCP parameters. |
68 |
|
* @see ParameterTable |
69 |
* @author Grigor Iliev |
* @author Grigor Iliev |
70 |
*/ |
*/ |
71 |
public class ParameterTableModel extends AbstractTableModel { |
public class ParameterTableModel extends AbstractTableModel { |
72 |
public final static int PARAMETER_NAME_COLUMN = 0; |
public final static int PARAMETER_NAME_COLUMN = 0; |
73 |
public final static int PARAMETER_VALUE_COLUMN = 1; |
public final static int PARAMETER_VALUE_COLUMN = 1; |
74 |
|
|
75 |
Parameter[] parameters; |
private Parameter[] parameters; |
76 |
|
|
77 |
private final BooleanCellRenderer booleanRenderer = new BooleanCellRenderer(); |
private final BooleanCellRenderer booleanRenderer = new BooleanCellRenderer(); |
78 |
private final BooleanCellEditor booleanEditor = new BooleanCellEditor(); |
private final BooleanCellEditor booleanEditor = new BooleanCellEditor(); |
152 |
public Parameter |
public Parameter |
153 |
getParameter(int row) { return parameters[row]; } |
getParameter(int row) { return parameters[row]; } |
154 |
|
|
155 |
|
/** |
156 |
|
* Returns an appropriate renderer for the cell specified by |
157 |
|
* <code>row</code> and <code>column</code>. |
158 |
|
* @param row The row of the cell to render, where 0 is the first row. |
159 |
|
* @param column The column of the cell to render, where 0 is the first column. |
160 |
|
*/ |
161 |
public TableCellRenderer |
public TableCellRenderer |
162 |
getCellRenderer(int row, int column) { |
getCellRenderer(int row, int column) { |
163 |
if(column != PARAMETER_VALUE_COLUMN) return null; |
if(column != PARAMETER_VALUE_COLUMN) return null; |
172 |
return null; |
return null; |
173 |
} |
} |
174 |
|
|
175 |
|
/** |
176 |
|
* Returns an appropriate editor for the cell specified by |
177 |
|
* <code>row</code> and <code>column</code>. |
178 |
|
* @param row The row of the cell to edit, where 0 is the first row. |
179 |
|
* @param column The column of the cell to edit, where 0 is the first column. |
180 |
|
*/ |
181 |
public TableCellEditor |
public TableCellEditor |
182 |
getCellEditor(int row, int column) { |
getCellEditor(int row, int column) { |
183 |
if(column != PARAMETER_VALUE_COLUMN) return null; |
if(column != PARAMETER_VALUE_COLUMN) return null; |
271 |
} |
} |
272 |
|
|
273 |
/** |
/** |
274 |
* Sets the value in the cell at <code>columnIndex</code> |
* Sets the value in the cell at <code>col</code> |
275 |
* and <code>rowIndex</code> to <code>value</code>. |
* and <code>row</code> to <code>value</code>. |
276 |
*/ |
*/ |
277 |
public void |
public void |
278 |
setValueAt(Object value, int row, int col) { |
setValueAt(Object value, int row, int col) { |
285 |
|
|
286 |
/** |
/** |
287 |
* Returns <code>true</code> if the cell at |
* Returns <code>true</code> if the cell at |
288 |
* <code>rowIndex</code> and <code>columnIndex</code> is editable. |
* <code>row</code> and <code>col</code> is editable. |
289 |
*/ |
*/ |
290 |
public boolean |
public boolean |
291 |
isCellEditable(int row, int col) { |
isCellEditable(int row, int col) { |