Merge pull request #678 from wolsen/issue/677
Check to see if column index is valid
This commit is contained in:
commit
c26dd8cb61
@ -89,7 +89,12 @@ public class FlightConfigurableTableModel<T extends FlightConfigurableComponent>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getColumnIndex(FlightConfigurableComponent comp) {
|
public int getColumnIndex(FlightConfigurableComponent comp) {
|
||||||
return components.indexOf(comp);
|
int index = components.indexOf(comp);
|
||||||
|
if (index >= 0) {
|
||||||
|
// Increment the index to account for the fcid column.
|
||||||
|
index += 1;
|
||||||
|
}
|
||||||
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,14 +83,14 @@ public class RecoveryConfigurationPanel extends FlightConfigurablePanel<Recovery
|
|||||||
final RocketComponent source = cce.getSource();
|
final RocketComponent source = cce.getSource();
|
||||||
if(source instanceof FlightConfigurableComponent) {
|
if(source instanceof FlightConfigurableComponent) {
|
||||||
final int index = recoveryTableModel.getColumnIndex((FlightConfigurableComponent) source);
|
final int index = recoveryTableModel.getColumnIndex((FlightConfigurableComponent) source);
|
||||||
recoveryTable.getColumnModel().getColumn(index).setHeaderValue(source.getName());
|
if (index >= 0) {
|
||||||
|
recoveryTable.getColumnModel().getColumn(index).setHeaderValue(source.getName());
|
||||||
|
}
|
||||||
// you would think this would be enough by itself, but it requires an nudge from the above lines to
|
// you would think this would be enough by itself, but it requires an nudge from the above lines to
|
||||||
// actually update.
|
// actually update.
|
||||||
recoveryTable.getTableHeader().resizeAndRepaint();
|
recoveryTable.getTableHeader().resizeAndRepaint();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// recoveryTable.setColumnModel(recoveryTableModel);
|
|
||||||
recoveryTable.setDefaultRenderer(Object.class, new RecoveryTableCellRenderer());
|
recoveryTable.setDefaultRenderer(Object.class, new RecoveryTableCellRenderer());
|
||||||
|
|
||||||
return recoveryTable;
|
return recoveryTable;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user