//jtable.getColumnModel().getColumn(7).setMinWidth(100);
// ColumnResizer.adjustColumnPreferredWidths(jtable);
// jtable.getColumn("Value").setMinWidth(200);
RowEditorModel rm = new RowEditorModel();
jtable.setRowEditorModel(rm);
//for DI datapoint, use a combobox for cell editor
String [] di_values = { DataPoint.STR_BOOLEAN_FALSE, DataPoint.STR_BOOLEAN_TRUE };
JComboBox diComboBox = new JComboBox(di_values);
//TODO: configure so that whem the user click on the row, the combo box is
// automatically in open mode (activated).
diComboBox.addFocusListener(new FocusAdapter()
{
public void focusGained(FocusEvent e) {
//TODO: never called
JComboBox cmbBox = (JComboBox)e.getSource();
cmbBox.setEnabled(true);
}
public void focusLost(FocusEvent e) {
//TODO
JComboBox cmbBox = (JComboBox)e.getSource();
cmbBox.setPopupVisible(false);
}
});
for (int row = 0; row < dtm.getRowCount(); row++)
{
if (dtm.getDataPointType(row) == EDataPointType.TYPE_DI)
{
DefaultCellEditor editor = new DefaultCellEditor(diComboBox);
rm.addEditorForRow(row, editor);
}
else
{
//default editor for AI or MI or TI
}