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() {
|
public void copyConfiguration() {
|
||||||
// currentID is the currently selected configuration.
|
// currentID is the currently selected configuration.
|
||||||
String newConfigId = rocket.newFlightConfigurationID();
|
String newConfigId = rocket.newFlightConfigurationID();
|
||||||
|
String oldName = rocket.getFlightConfigurationName(currentID);
|
||||||
CopyFlightConfigurationVisitor v = new CopyFlightConfigurationVisitor(currentID, newConfigId);
|
CopyFlightConfigurationVisitor v = new CopyFlightConfigurationVisitor(currentID, newConfigId);
|
||||||
v.visit(rocket);
|
v.visit(rocket);
|
||||||
|
// Select the new configuration
|
||||||
|
this.selectConfiguration(newConfigId);
|
||||||
|
// Copy the name.
|
||||||
|
this.changeConfigurationName(oldName);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
flightConfigurationModel.fireContentsUpdated();
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
recoveryConfigurationPanel.fireTableDataChanged();
|
recoveryConfigurationPanel.fireTableDataChanged();
|
||||||
|
@ -80,7 +80,7 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
configurationTableModel = new MotorConfigurationTableModel(this, true);
|
configurationTableModel = new MotorConfigurationTableModel(this, true);
|
||||||
final JTable configurationTable = new JTable(configurationTableModel);
|
final JTable configurationTable = new JTable(configurationTableModel);
|
||||||
configurationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
configurationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
configurationTable.setCellSelectionEnabled(true);
|
configurationTable.setRowSelectionAllowed(true);
|
||||||
|
|
||||||
configurationTable.addMouseListener(new MouseAdapter() {
|
configurationTable.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@ -269,9 +269,9 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
MotorConfiguration.IgnitionEvent ignition = motorConfig.getIgnitionEvent();
|
MotorConfiguration.IgnitionEvent ignition = motorConfig.getIgnitionEvent();
|
||||||
if ( ignition == null ) {
|
if ( ignition == null ) {
|
||||||
sb.append("[").append(mount.getDefaultIgnitionEvent().toString()).append("]");
|
sb.append("[").append(ellipsizeString(mount.getDefaultIgnitionEvent().toString(),15)).append("]");
|
||||||
} else {
|
} else {
|
||||||
sb.append(ignition.toString());
|
sb.append(ellipsizeString(ignition.toString(),15));
|
||||||
}
|
}
|
||||||
Double ignitionDelay = motorConfig.getIgnitionDelay();
|
Double ignitionDelay = motorConfig.getIgnitionDelay();
|
||||||
if ( ignitionDelay == null ) {
|
if ( ignitionDelay == null ) {
|
||||||
@ -286,4 +286,12 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
recoveryTableModel = new RecoveryTableModel();
|
||||||
JTable table = new JTable( recoveryTableModel );
|
JTable table = new JTable( recoveryTableModel );
|
||||||
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
table.setCellSelectionEnabled(true);
|
table.setRowSelectionAllowed(true);
|
||||||
table.addMouseListener(new MouseAdapter() {
|
table.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
JTable table = (JTable) e.getComponent();
|
JTable table = (JTable) e.getComponent();
|
||||||
int row = table.getSelectedRow();
|
int row = table.getSelectedRow();
|
||||||
int column = table.getSelectedColumn();
|
|
||||||
|
|
||||||
if ( row >= 0 & column == 1) {
|
if ( row >= 0 ) {
|
||||||
selectedComponent = findRecoveryDevice(row);
|
selectedComponent = findRecoveryDevice(row);
|
||||||
} else {
|
} else {
|
||||||
selectedComponent = null;
|
selectedComponent = null;
|
||||||
|
@ -57,7 +57,7 @@ public class SeparationConfigurationPanel extends JPanel {
|
|||||||
separationTableModel = new SeparationTableModel();
|
separationTableModel = new SeparationTableModel();
|
||||||
JTable table = new JTable( separationTableModel );
|
JTable table = new JTable( separationTableModel );
|
||||||
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
table.setCellSelectionEnabled(true);
|
table.setRowSelectionAllowed(true);
|
||||||
table.addMouseListener(new MouseAdapter() {
|
table.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user