Added auto run simulations checkbox to preferences.

This commit is contained in:
Craig Earls 2014-12-19 06:54:43 -07:00
parent c85fe63ed8
commit 233117628d
3 changed files with 30 additions and 5 deletions

View File

@ -265,6 +265,7 @@ pref.dlg.opengl.lbl.useFBO = Use Off-screen Rendering
pref.dlg.lbl.Positiontoinsert = Position to insert new body components: pref.dlg.lbl.Positiontoinsert = Position to insert new body components:
pref.dlg.lbl.Confirmdeletion = Confirm deletion of simulations: pref.dlg.lbl.Confirmdeletion = Confirm deletion of simulations:
pref.dlg.checkbox.Runsimulations = Run all simulations automagically after design changes.
pref.dlg.lbl.User-definedthrust = User-defined thrust curves: pref.dlg.lbl.User-definedthrust = User-defined thrust curves:
pref.dlg.lbl.Windspeed = Wind speed pref.dlg.lbl.Windspeed = Wind speed
pref.dlg.Allthrustcurvefiles = All thrust curve files (*.eng; *.rse; *.zip; directories) pref.dlg.Allthrustcurvefiles = All thrust curve files (*.eng; *.rse; *.zip; directories)

View File

@ -30,6 +30,7 @@ public abstract class Preferences {
public static final String BODY_COMPONENT_INSERT_POSITION_KEY = "BodyComponentInsertPosition"; public static final String BODY_COMPONENT_INSERT_POSITION_KEY = "BodyComponentInsertPosition";
public static final String USER_THRUST_CURVES_KEY = "UserThrustCurves"; public static final String USER_THRUST_CURVES_KEY = "UserThrustCurves";
public static final String CONFIRM_DELETE_SIMULATION = "ConfirmDeleteSimulation"; public static final String CONFIRM_DELETE_SIMULATION = "ConfirmDeleteSimulation";
public static final String AUTO_RUN_SIMULATIONS = "AutoRunSimulations";
// Preferences related to data export // Preferences related to data export
public static final String EXPORT_FIELD_SEPARATOR = "ExportFieldSeparator"; public static final String EXPORT_FIELD_SEPARATOR = "ExportFieldSeparator";
public static final String EXPORT_SIMULATION_COMMENT = "ExportSimulationComment"; public static final String EXPORT_SIMULATION_COMMENT = "ExportSimulationComment";
@ -99,6 +100,14 @@ public abstract class Preferences {
this.putBoolean(CHECK_UPDATES, check); this.putBoolean(CHECK_UPDATES, check);
} }
public final boolean getAutoRunSimulations() {
return this.getBoolean(AUTO_RUN_SIMULATIONS, false);
}
public final void setAutoRunSimulations(boolean check) {
this.putBoolean(AUTO_RUN_SIMULATIONS, check);
}
public final double getDefaultMach() { public final double getDefaultMach() {
// TODO: HIGH: implement custom default mach number // TODO: HIGH: implement custom default mach number
return 0.3; return 0.3;

View File

@ -164,7 +164,7 @@ public class PreferencesDialog extends JDialog {
//// Position to insert new body components: //// Position to insert new body components:
panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para"); panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para");
panel.add(new JComboBox(new PrefChoiseSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY, panel.add(new JComboBox(new PrefChoiceSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
//// Always ask //// Always ask
//// Insert in middle //// Insert in middle
//// Add to end //// Add to end
@ -178,7 +178,9 @@ public class PreferencesDialog extends JDialog {
//// Delete //// Delete
//// Confirm //// Confirm
trans.get("pref.dlg.PrefBooleanSelector1"), trans.get("pref.dlg.PrefBooleanSelector1"),
trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap 40lp, growx, sg combos"); trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap para, growx, sg combos");
//// User-defined thrust curves: //// User-defined thrust curves:
panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap"); panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
@ -285,6 +287,7 @@ public class PreferencesDialog extends JDialog {
//// Check for software updates at startup //// Check for software updates at startup
final JCheckBox softwareUpdateBox = final JCheckBox softwareUpdateBox =
new JCheckBox(trans.get("pref.dlg.checkbox.Checkupdates")); new JCheckBox(trans.get("pref.dlg.checkbox.Checkupdates"));
@ -317,7 +320,19 @@ public class PreferencesDialog extends JDialog {
preferences.setAutoOpenLastDesignOnStartup(autoOpenDesignFile.isSelected()); preferences.setAutoOpenLastDesignOnStartup(autoOpenDesignFile.isSelected());
} }
}); });
panel.add(autoOpenDesignFile); panel.add(autoOpenDesignFile, "wrap, growx, span 2");
//// Automatically run all simulation out-dated by design changes.
final JCheckBox automaticallyRunSimsBox =
new JCheckBox(trans.get("pref.dlg.checkbox.Runsimulations"));
automaticallyRunSimsBox.setSelected(preferences.getAutoRunSimulations());
automaticallyRunSimsBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
preferences.setAutoRunSimulations(automaticallyRunSimsBox.isSelected());
}
});
panel.add(automaticallyRunSimsBox, "wrap, growx, sg combos ");
return panel; return panel;
} }
@ -673,11 +688,11 @@ public class PreferencesDialog extends JDialog {
private class PrefChoiseSelector extends AbstractListModel implements ComboBoxModel { private class PrefChoiceSelector extends AbstractListModel implements ComboBoxModel {
private final String preference; private final String preference;
private final String[] descriptions; private final String[] descriptions;
public PrefChoiseSelector(String preference, String... descriptions) { public PrefChoiceSelector(String preference, String... descriptions) {
this.preference = preference; this.preference = preference;
this.descriptions = descriptions; this.descriptions = descriptions;
} }