summaryrefslogtreecommitdiff
path: root/sources/simulator/VSSimulator.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-06-03 18:13:44 +0000
committerPaul Buetow <paul@buetow.org>2008-06-03 18:13:44 +0000
commitadf861c3d53d32018c6bd5cc0c331a4d541ab4e9 (patch)
treea723cb4c65ae2ad0d5bfc1b4bd3cc41f53e0fe20 /sources/simulator/VSSimulator.java
parent11af1c9fa7fe66e10de0a92878311b4e22befb0f (diff)
All known bugs fixed.
Diffstat (limited to 'sources/simulator/VSSimulator.java')
-rw-r--r--sources/simulator/VSSimulator.java48
1 files changed, 35 insertions, 13 deletions
diff --git a/sources/simulator/VSSimulator.java b/sources/simulator/VSSimulator.java
index 0a7c6c2..1f8f986 100644
--- a/sources/simulator/VSSimulator.java
+++ b/sources/simulator/VSSimulator.java
@@ -1008,7 +1008,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @return the split size
*/
- public int getSplitSize() {
+ public synchronized int getSplitSize() {
return splitPaneH.getDividerLocation();
}
@@ -1017,7 +1017,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @return the paint size
*/
- public int getPaintSize() {
+ public synchronized int getPaintSize() {
return splitPaneV.getDividerLocation();
}
@@ -1065,7 +1065,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
/**
* Update task manager table.
*/
- public void updateTaskManagerTable() {
+ public synchronized void updateTaskManagerTable() {
VSProcess process = getSelectedProcess();
boolean allProcesses = process == null;
@@ -1079,9 +1079,30 @@ public class VSSimulator extends JPanel implements VSSerializable {
}
/**
+ * Update the processes combo box
+ */
+ private void updateProcessesComboBox() {
+ int numProcesses = simulatorCanvas.getNumProcesses();
+
+ String processString = prefs.getString("lang.process");
+
+ for (int i = 0; i < numProcesses; ++i) {
+ int processID = simulatorCanvas.getProcess(i).getProcessID();
+
+ processesComboBox.removeItemAt(i);
+ localPIDComboBox.removeItemAt(i);
+ globalPIDComboBox.removeItemAt(i);
+
+ processesComboBox.insertItemAt(processString + " " + processID, i);
+ localPIDComboBox.insertItemAt("PID: " + processID, i);
+ globalPIDComboBox.insertItemAt("PID: " + processID, i);
+ }
+ }
+
+ /**
* The simulator has finished.
*/
- public void finish() {
+ public synchronized void finish() {
menuItemStates.setStart(false);
menuItemStates.setPause(false);
menuItemStates.setReset(true);
@@ -1094,7 +1115,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @return the simulator num
*/
- public int getSimulatorNum() {
+ public synchronized int getSimulatorNum() {
return simulatorNum;
}
@@ -1103,7 +1124,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @return the menu item states
*/
- public VSMenuItemStates getMenuItemStates() {
+ public synchronized VSMenuItemStates getMenuItemStates() {
return menuItemStates;
}
@@ -1112,7 +1133,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @return the simulator canvas
*/
- public VSSimulatorCanvas getSimulatorCanvas() {
+ public synchronized VSSimulatorCanvas getSimulatorCanvas() {
return simulatorCanvas;
}
@@ -1121,14 +1142,14 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @return the simulator frame
*/
- public VSSimulatorFrame getSimulatorFrame() {
+ public synchronized VSSimulatorFrame getSimulatorFrame() {
return simulatorFrame;
}
/**
* Update from prefs.
*/
- public void updateFromPrefs() {
+ public synchronized void updateFromPrefs() {
simulatorCanvas.setBackground(prefs.getColor("col.background"));
simulatorCanvas.updateFromPrefs();
}
@@ -1138,7 +1159,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @param index the index
*/
- public void removedAProcessAtIndex(int index) {
+ public synchronized void removedAProcessAtIndex(int index) {
if (lastSelectedProcessNum > index)
--lastSelectedProcessNum;
@@ -1159,7 +1180,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @param index the index
*/
- public void addProcessAtIndex(int index) {
+ public synchronized void addProcessAtIndex(int index) {
int processID = simulatorCanvas.getProcess(index).getProcessID();
String processString = prefs.getString("lang.process");
@@ -1176,7 +1197,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
/**
* Fire expert mode changed. Tell, that the expert mode has changed.
*/
- public void fireExpertModeChanged() {
+ public synchronized void fireExpertModeChanged() {
boolean expertMode = prefs.getBoolean("sim.mode.expert");
/* Update the Task Manager GUI */
@@ -1221,7 +1242,7 @@ public class VSSimulator extends JPanel implements VSSerializable {
*
* @return the prefs
*/
- public VSPrefs getPrefs() {
+ public synchronized VSPrefs getPrefs() {
return prefs;
}
@@ -1266,5 +1287,6 @@ public class VSSimulator extends JPanel implements VSSerializable {
updateFromPrefs();
updateTaskManagerTable();
+ updateProcessesComboBox();
}
}