summaryrefslogtreecommitdiff
path: root/sources/prefs/editors/VSSimulationEditor.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-21 19:01:48 +0000
committerPaul Buetow <paul@buetow.org>2008-05-21 19:01:48 +0000
commitdb4ae1c41883f6f78d8107429f7f4871c45f47d5 (patch)
treed84d754176060afddc89b00d6cf7d4b97d3d049f /sources/prefs/editors/VSSimulationEditor.java
parent004458bb854fe4376fe35ec55d7f08853e08895b (diff)
Ok inline editor seems to work.
Diffstat (limited to 'sources/prefs/editors/VSSimulationEditor.java')
-rw-r--r--sources/prefs/editors/VSSimulationEditor.java48
1 files changed, 17 insertions, 31 deletions
diff --git a/sources/prefs/editors/VSSimulationEditor.java b/sources/prefs/editors/VSSimulationEditor.java
index b4566ef..dc81c67 100644
--- a/sources/prefs/editors/VSSimulationEditor.java
+++ b/sources/prefs/editors/VSSimulationEditor.java
@@ -13,54 +13,40 @@ import utils.*;
import prefs.*;
public class VSSimulationEditor extends VSBetterEditor {
- private boolean startNewSimulation;
private VSSimulatorFrame simulatorFrame;
+ public static boolean TAKEOVER_BUTTON;
public VSSimulationEditor(VSPrefs prefs, VSSimulatorFrame simulatorFrame) {
super(prefs, prefs, prefs.getString("name")
+ " - " + prefs.getString("lang.prefs"));
this.simulatorFrame = simulatorFrame;
-
- startNewSimulation = true;
- init();
- }
-
- public VSSimulationEditor(VSPrefs prefs, int prefsCategory) {
- super(prefs, prefs, prefs.getString("name")
- + " - " + prefs.getString("lang.prefs"
- + (prefsCategory == ALL_PREFERENCES ? ".ext" : "")),
- prefsCategory);
-
- startNewSimulation = false;
- init();
+ getInfoArea().setText(prefs.getString("lang.prefs.info!"));
}
- private void init() {
- infoArea.setText(prefs.getString("lang.prefs.info!"));
+ protected void addToButtonPanelFront(JPanel buttonPanel) {
+ if (TAKEOVER_BUTTON) {
+ TAKEOVER_BUTTON = false;
+ JButton takeoverButton = new JButton(
+ prefs.getString("lang.takeover"));
+ takeoverButton.setMnemonic(prefs.getInteger("keyevent.takeover"));
+ takeoverButton.addActionListener(this);
+ buttonPanel.add(takeoverButton);
+ }
}
public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
- if (actionCommand.equals(prefs.getString("lang.ok"))) {
- super.actionPerformed(e);
- prefsToEdit.saveFile();
-
- VSFrame frame = getFrame();
- if (frame != null)
- frame.dispose();
+ if (actionCommand.equals(prefs.getString("lang.takeover"))) {
+ savePrefs();
+ simulatorFrame.getCurrentSimulation().updateFromPrefs();
- if (startNewSimulation)
- simulatorFrame.addSimulation(
- new VSSimulation(prefs, simulatorFrame));
+ } else if (actionCommand.equals(prefs.getString("lang.ok"))) {
+ savePrefs();
+ simulatorFrame.addSimulation(new VSSimulation(prefsToEdit, simulatorFrame));
} else {
super.actionPerformed(e);
}
}
-
- public void newVSEditorInstance(VSPrefs prefs, VSPrefs prefsToEdit, int prefsCategory) {
- VSPrefs newPrefs = VSDefaultPrefs.init();
- new VSEditorFrame(newPrefs, getFrame(), new VSSimulationEditor(prefs, prefsCategory));
- }
}