summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-22 16:16:07 +0000
committerPaul Buetow <paul@buetow.org>2008-05-22 16:16:07 +0000
commitbf92cacd3c01a84a751e17b9ab5d42784929b86b (patch)
tree4d3f65e9273235e48e24c58e3e8347bac3c96150
parentd16ef68f4376eec8754d86b134a2f23b4daa13fb (diff)
Expert mode quick checkbox added.
-rw-r--r--sources/core/VSTask.java18
-rw-r--r--sources/prefs/VSDefaultPrefs.java1
-rw-r--r--sources/prefs/editors/VSSimulationEditor.java8
-rw-r--r--sources/simulator/VSSimulation.java35
-rw-r--r--sources/simulator/VSSimulatorFrame.java2
5 files changed, 41 insertions, 23 deletions
diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java
index 131cede..2687ec3 100644
--- a/sources/core/VSTask.java
+++ b/sources/core/VSTask.java
@@ -16,8 +16,8 @@ public class VSTask implements Comparable {
private VSPrefs prefs;
private boolean isProgrammed;
private boolean isGlobalTimed;
- private static int taskCounter;
- private int taskNum;
+ private static int taskCounter;
+ private int taskNum;
public VSTask(long taskTime, VSProcess process, VSEvent event, boolean isLocal) {
this.process = process;
@@ -25,12 +25,12 @@ public class VSTask implements Comparable {
this.event = event;
this.prefs = process.getPrefs();
this.isGlobalTimed = !isLocal;
- this.taskNum = ++taskCounter;
+ this.taskNum = ++taskCounter;
}
- public int getTaskNum() {
- return taskNum;
- }
+ public int getTaskNum() {
+ return taskNum;
+ }
public void isProgrammed(boolean isProgrammed) {
this.isProgrammed = isProgrammed;
@@ -63,13 +63,13 @@ public class VSTask implements Comparable {
}
public boolean equals(VSTask task) {
- return taskNum == task.getTaskNum();
- /*
+ return taskNum == task.getTaskNum();
+ /*
return event.equals(task.getEvent())
&& taskTime == task.getTaskTime()
&& isGlobalTimed == task.isGlobalTimed()
&& isProgrammed == task.isProgrammed;
- */
+ */
}
public boolean isProcess(VSProcess process) {
diff --git a/sources/prefs/VSDefaultPrefs.java b/sources/prefs/VSDefaultPrefs.java
index a06f985..8cc1e30 100644
--- a/sources/prefs/VSDefaultPrefs.java
+++ b/sources/prefs/VSDefaultPrefs.java
@@ -39,6 +39,7 @@ public class VSDefaultPrefs extends VSPrefs {
}
public void fillDefaultStrings() {
+ initString("lang.mode.expert", "Expertenmodus");
initString("lang.about", "About");
initString("lang.about.info!", "Dieses Programm wurde von Paul Bütow im Rahmen der Diplomarbeit \"Objektorientierte Entwicklung eines GUI-basierten Tools für die ereignisbasierte Simulation verteilter Systeme\" bei Prof. Dr.-Ing. Oßmann erstellt. Dieses Programm stellt noch keinesfalls eine fertige Version dar, da es sich noch in Entwicklung befindet und die Diplomarbeit erst mitte August abgeschlossen sein wird! Bei Fehlern bitte eine kurze Mail mitsamt Fehlerbeschreibung an paul@buetow.org schicken! Dieser Simulator wird später außerdem unter einer open source Linzenz (wahrscheinlich der GNU General Public License) freigegeben!");
initString("lang.activate", "aktivieren");
diff --git a/sources/prefs/editors/VSSimulationEditor.java b/sources/prefs/editors/VSSimulationEditor.java
index 86706cb..a45cfa5 100644
--- a/sources/prefs/editors/VSSimulationEditor.java
+++ b/sources/prefs/editors/VSSimulationEditor.java
@@ -51,16 +51,16 @@ public class VSSimulationEditor extends VSBetterEditor {
if (actionCommand.equals(prefs.getString("lang.takeover"))) {
savePrefs();
if (expertModeChanged()) {
- if (simulation != null)
- simulation.fireExpertModeChanged();
+ if (simulation != null)
+ simulation.fireExpertModeChanged();
}
simulation.updateFromPrefs();
} else if (actionCommand.equals(prefs.getString("lang.ok"))) {
savePrefs();
if (expertModeChanged()) {
- if (simulation != null)
- simulation.fireExpertModeChanged();
+ if (simulation != null)
+ simulation.fireExpertModeChanged();
}
if (!dontStartNewSimulation)
simulatorFrame.addSimulation(new VSSimulation(prefsToEdit, simulatorFrame));
diff --git a/sources/simulator/VSSimulation.java b/sources/simulator/VSSimulation.java
index fcdff39..5ca422a 100644
--- a/sources/simulator/VSSimulation.java
+++ b/sources/simulator/VSSimulation.java
@@ -164,12 +164,29 @@ public class VSSimulation extends JPanel {
this.add(splitPaneV, BorderLayout.CENTER);
}
+ private boolean lastExpertState;
private JPanel createToolsPanel() {
JPanel toolsPanel = new JPanel();
boolean expertMode = prefs.getBoolean("sim.mode.expert");
toolsPanel.setLayout(new BoxLayout(toolsPanel, BoxLayout.X_AXIS));
+ JCheckBox expertActiveCheckBox = new JCheckBox(prefs.getString("lang.mode.expert"));
+ expertActiveCheckBox.setSelected(expertMode);
+ expertActiveCheckBox.addChangeListener(new ChangeListener() {
+ public void stateChanged(ChangeEvent ce) {
+ AbstractButton abstractButton = (AbstractButton) ce.getSource();
+ ButtonModel buttonModel = abstractButton.getModel();
+ boolean newState = buttonModel.isSelected();
+ if (lastExpertState != newState) {
+ lastExpertState = newState;
+ prefs.setBoolean("sim.mode.expert", newState);
+ fireExpertModeChanged();
+ }
+ }
+ });
+ toolsPanel.add(expertActiveCheckBox);
+
if (expertMode) {
lamportActiveCheckBox = new JCheckBox(prefs.getString("lang.time.lamport"));
lamportActiveCheckBox.setSelected(false);
@@ -898,12 +915,12 @@ public class VSSimulation extends JPanel {
}
tabbedPane.setSelectedIndex(selectedIndex);
- /* Update the 'Variables tab' */
- if (getSelectedProcessNum() != simulationCanvas.getNumProcesses()) {
- VSProcess process = getSelectedProcess();
- VSProcessEditor editor = new VSProcessEditor(prefs, process);
- tabbedPane.setComponentAt(1, editor.getContentPane());
- }
+ /* Update the 'Variables tab' */
+ if (getSelectedProcessNum() != simulationCanvas.getNumProcesses()) {
+ VSProcess process = getSelectedProcess();
+ VSProcessEditor editor = new VSProcessEditor(prefs, process);
+ tabbedPane.setComponentAt(1, editor.getContentPane());
+ }
/* Update the tools panel */
loggingPanel.remove(1);
@@ -911,7 +928,7 @@ public class VSSimulation extends JPanel {
updateUI();
}
- public VSPrefs getPrefs() {
- return prefs;
- }
+ public VSPrefs getPrefs() {
+ return prefs;
+ }
}
diff --git a/sources/simulator/VSSimulatorFrame.java b/sources/simulator/VSSimulatorFrame.java
index ea67bcf..ce252bd 100644
--- a/sources/simulator/VSSimulatorFrame.java
+++ b/sources/simulator/VSSimulatorFrame.java
@@ -161,7 +161,7 @@ public class VSSimulatorFrame extends VSFrame implements ActionListener {
JMenuItem globalPrefsItem = new JMenuItem(prefs.getString("lang.prefs"));
globalPrefsItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
- VSPrefs simulationPrefs = currentSimulation.getPrefs();
+ VSPrefs simulationPrefs = currentSimulation.getPrefs();
new VSEditorFrame(prefs, VSSimulatorFrame.this,
new VSSimulationEditor(simulationPrefs, VSSimulatorFrame.this,
currentSimulation));