Reuse the MotorChooserDialog in the MotorConfigurationPanel so previous
settings are remembered.
This commit is contained in:
parent
6aab06fbe2
commit
8da9f275d7
@ -344,8 +344,6 @@ public abstract class MotorFilterPanel extends JPanel {
|
|||||||
((SwingPreferences) Application.getPreferences()).putBoolean("motorFilterLimitLength", limitLength);
|
((SwingPreferences) Application.getPreferences()).putBoolean("motorFilterLimitLength", limitLength);
|
||||||
if ( mountLength != null & limitLength ) {
|
if ( mountLength != null & limitLength ) {
|
||||||
lengthSlider.setValueAt(1, (int) Math.min(1000,Math.round(1000*mountLength)));
|
lengthSlider.setValueAt(1, (int) Math.min(1000,Math.round(1000*mountLength)));
|
||||||
} else {
|
|
||||||
lengthSlider.setValueAt(1, 1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,8 +361,6 @@ public abstract class MotorFilterPanel extends JPanel {
|
|||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
diameterSlider.setValueAt(1, i-1);
|
diameterSlider.setValueAt(1, i-1);
|
||||||
} else {
|
|
||||||
diameterSlider.setValueAt(1, diameterValues.length-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,11 +49,15 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
|
|
||||||
private final JButton selectMotorButton, removeMotorButton, selectIgnitionButton, resetIgnitionButton;
|
private final JButton selectMotorButton, removeMotorButton, selectIgnitionButton, resetIgnitionButton;
|
||||||
|
|
||||||
|
private final MotorChooserDialog motorChooserDialog;
|
||||||
protected FlightConfigurableTableModel<MotorMount> configurationTableModel;
|
protected FlightConfigurableTableModel<MotorMount> configurationTableModel;
|
||||||
|
|
||||||
MotorConfigurationPanel(final FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
MotorConfigurationPanel(final FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
||||||
super(flightConfigurationPanel,rocket);
|
super(flightConfigurationPanel,rocket);
|
||||||
|
|
||||||
|
motorChooserDialog = new MotorChooserDialog(SwingUtilities.getWindowAncestor(flightConfigurationPanel));
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
//// Select motor mounts
|
//// Select motor mounts
|
||||||
JPanel subpanel = new JPanel(new MigLayout(""));
|
JPanel subpanel = new JPanel(new MigLayout(""));
|
||||||
@ -177,13 +181,12 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
|
|
||||||
MotorConfiguration config = mount.getMotorConfiguration().get(id);
|
MotorConfiguration config = mount.getMotorConfiguration().get(id);
|
||||||
|
|
||||||
MotorChooserDialog dialog = new MotorChooserDialog(
|
motorChooserDialog.setMotorMountAndConfig(mount, id);
|
||||||
mount,
|
|
||||||
id,
|
motorChooserDialog.setVisible(true);
|
||||||
SwingUtilities.getWindowAncestor(flightConfigurationPanel));
|
|
||||||
dialog.setVisible(true);
|
Motor m = motorChooserDialog.getSelectedMotor();
|
||||||
Motor m = dialog.getSelectedMotor();
|
double d = motorChooserDialog.getSelectedDelay();
|
||||||
double d = dialog.getSelectedDelay();
|
|
||||||
|
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
config = new MotorConfiguration();
|
config = new MotorConfiguration();
|
||||||
@ -289,7 +292,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
label.add(ignitionLabel);
|
label.add(ignitionLabel);
|
||||||
label.validate();
|
label.validate();
|
||||||
return label;
|
return label;
|
||||||
// label.setText(motorString + " " + ignitionString);
|
// label.setText(motorString + " " + ignitionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMotorSpecification(MotorMount mount, MotorConfiguration motorConfig) {
|
private String getMotorSpecification(MotorMount mount, MotorConfiguration motorConfig) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user