diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-24 21:06:15 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-24 21:06:15 +0000 |
| commit | 222d028fac58233a451e2de875353252a3dc9f63 (patch) | |
| tree | 292394f179db68464d9554b71a7ec05368867e33 /sources/prefs/editors/VSSimulatorEditor.java | |
| parent | 61e38d3236ead0b32f8fa1a78901e9d0c75c91ea (diff) | |
PRocesses now get removed properly.
Removed all VSSimulation* classes.
Diffstat (limited to 'sources/prefs/editors/VSSimulatorEditor.java')
| -rw-r--r-- | sources/prefs/editors/VSSimulatorEditor.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/sources/prefs/editors/VSSimulatorEditor.java b/sources/prefs/editors/VSSimulatorEditor.java new file mode 100644 index 0000000..0ea2332 --- /dev/null +++ b/sources/prefs/editors/VSSimulatorEditor.java @@ -0,0 +1,77 @@ +package prefs.editors; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.filechooser.*; +import java.util.*; +import java.io.File; + +import simulator.*; +import utils.*; +import prefs.*; + +public class VSSimulatorEditor extends VSBetterEditor { + private VSSimulatorFrame simulatorFrame; + private VSSimulator simulation; + public static boolean TAKEOVER_BUTTON; + private boolean dontStartNewSimulation; + + public VSSimulatorEditor(VSPrefs prefs, VSSimulatorFrame simulatorFrame, VSSimulator simulation) { + super(prefs, prefs, prefs.getString("lang.name") + + " - " + prefs.getString("lang.prefs")); + this.dontStartNewSimulation = true;//simulation != null; + this.simulatorFrame = simulatorFrame; + this.simulation = simulation; + } + + public VSSimulatorEditor(VSPrefs prefs, VSSimulatorFrame simulatorFrame) { + super(prefs, prefs, prefs.getString("lang.name") + + " - " + prefs.getString("lang.prefs")); + this.simulatorFrame = simulatorFrame; + } + + 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.takeover"))) { + savePrefs(); + + if (simulation != null) { + if (expertModeChanged()) + simulation.fireExpertModeChanged(); + simulation.updateFromPrefs(); + } + + } else if (actionCommand.equals(prefs.getString("lang.cancel"))) { + if (!dontStartNewSimulation) + simulatorFrame.dispose(); + + } else if (actionCommand.equals(prefs.getString("lang.ok"))) { + savePrefs(); + if (expertModeChanged()) { + if (simulation != null) + simulation.fireExpertModeChanged(); + } + if (!dontStartNewSimulation) + simulatorFrame.addSimulation(new VSSimulator(prefsToEdit, simulatorFrame)); + else if (simulation != null) + simulation.updateFromPrefs(); + + } else { + super.actionPerformed(e); + } + } +} |
