UI improvements for flight configurations. Ellipsize the ignition
delay. Change to using row selection instead of cell selection. Change the copy configuration to select the new configuration and copy the name.
This commit is contained in:
parent
177d40104e
commit
98db1885c2
@ -177,8 +177,13 @@ public class FlightConfigurationDialog extends JDialog {
|
||||
public void copyConfiguration() {
|
||||
// currentID is the currently selected configuration.
|
||||
String newConfigId = rocket.newFlightConfigurationID();
|
||||
String oldName = rocket.getFlightConfigurationName(currentID);
|
||||
CopyFlightConfigurationVisitor v = new CopyFlightConfigurationVisitor(currentID, newConfigId);
|
||||
v.visit(rocket);
|
||||
// Select the new configuration
|
||||
this.selectConfiguration(newConfigId);
|
||||
// Copy the name.
|
||||
this.changeConfigurationName(oldName);
|
||||
motorConfigurationPanel.fireTableDataChanged();
|
||||
flightConfigurationModel.fireContentsUpdated();
|
||||
recoveryConfigurationPanel.fireTableDataChanged();
|
||||
|
@ -80,7 +80,7 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
configurationTableModel = new MotorConfigurationTableModel(this, true);
|
||||
final JTable configurationTable = new JTable(configurationTableModel);
|
||||
configurationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
configurationTable.setCellSelectionEnabled(true);
|
||||
configurationTable.setRowSelectionAllowed(true);
|
||||
|
||||
configurationTable.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
@ -269,9 +269,9 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
MotorConfiguration.IgnitionEvent ignition = motorConfig.getIgnitionEvent();
|
||||
if ( ignition == null ) {
|
||||
sb.append("[").append(mount.getDefaultIgnitionEvent().toString()).append("]");
|
||||
sb.append("[").append(ellipsizeString(mount.getDefaultIgnitionEvent().toString(),15)).append("]");
|
||||
} else {
|
||||
sb.append(ignition.toString());
|
||||
sb.append(ellipsizeString(ignition.toString(),15));
|
||||
}
|
||||
Double ignitionDelay = motorConfig.getIgnitionDelay();
|
||||
if ( ignitionDelay == null ) {
|
||||
@ -284,6 +284,14 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String ellipsizeString( String s, int length ) {
|
||||
if ( s.length() < length ) {
|
||||
return s;
|
||||
}
|
||||
String newString = s.substring(0, length) + "...";
|
||||
return newString;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,15 +40,14 @@ public class RecoveryConfigurationPanel extends JPanel {
|
||||
recoveryTableModel = new RecoveryTableModel();
|
||||
JTable table = new JTable( recoveryTableModel );
|
||||
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
table.setCellSelectionEnabled(true);
|
||||
table.setRowSelectionAllowed(true);
|
||||
table.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
JTable table = (JTable) e.getComponent();
|
||||
int row = table.getSelectedRow();
|
||||
int column = table.getSelectedColumn();
|
||||
|
||||
if ( row >= 0 & column == 1) {
|
||||
if ( row >= 0 ) {
|
||||
selectedComponent = findRecoveryDevice(row);
|
||||
} else {
|
||||
selectedComponent = null;
|
||||
|
@ -57,7 +57,7 @@ public class SeparationConfigurationPanel extends JPanel {
|
||||
separationTableModel = new SeparationTableModel();
|
||||
JTable table = new JTable( separationTableModel );
|
||||
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
table.setCellSelectionEnabled(true);
|
||||
table.setRowSelectionAllowed(true);
|
||||
table.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user