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);
|
||||
if ( mountLength != null & limitLength ) {
|
||||
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--;
|
||||
}
|
||||
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 MotorChooserDialog motorChooserDialog;
|
||||
protected FlightConfigurableTableModel<MotorMount> configurationTableModel;
|
||||
|
||||
MotorConfigurationPanel(final FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
||||
super(flightConfigurationPanel,rocket);
|
||||
|
||||
motorChooserDialog = new MotorChooserDialog(SwingUtilities.getWindowAncestor(flightConfigurationPanel));
|
||||
|
||||
|
||||
{
|
||||
//// Select motor mounts
|
||||
JPanel subpanel = new JPanel(new MigLayout(""));
|
||||
@ -177,13 +181,12 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
||||
|
||||
MotorConfiguration config = mount.getMotorConfiguration().get(id);
|
||||
|
||||
MotorChooserDialog dialog = new MotorChooserDialog(
|
||||
mount,
|
||||
id,
|
||||
SwingUtilities.getWindowAncestor(flightConfigurationPanel));
|
||||
dialog.setVisible(true);
|
||||
Motor m = dialog.getSelectedMotor();
|
||||
double d = dialog.getSelectedDelay();
|
||||
motorChooserDialog.setMotorMountAndConfig(mount, id);
|
||||
|
||||
motorChooserDialog.setVisible(true);
|
||||
|
||||
Motor m = motorChooserDialog.getSelectedMotor();
|
||||
double d = motorChooserDialog.getSelectedDelay();
|
||||
|
||||
if (m != null) {
|
||||
config = new MotorConfiguration();
|
||||
@ -257,7 +260,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
||||
}
|
||||
c.setBorder(b);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table,Object value, boolean isSelected, boolean hasFocus, int row,int column) {
|
||||
switch (column) {
|
||||
@ -289,7 +292,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
||||
label.add(ignitionLabel);
|
||||
label.validate();
|
||||
return label;
|
||||
// label.setText(motorString + " " + ignitionString);
|
||||
// label.setText(motorString + " " + ignitionString);
|
||||
}
|
||||
|
||||
private String getMotorSpecification(MotorMount mount, MotorConfiguration motorConfig) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user