diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-17 21:50:44 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-17 21:50:44 +0000 |
| commit | 8602c18db94281afd5bc0ceb5930a3d99fbe7a38 (patch) | |
| tree | 6883d776ac6d2ead8df8711ed6dac4388680d181 /sources/simulator/VSSimulationPanel.java | |
| parent | dbb780b7295c0df60269ee6f3c85c3056d6262b8 (diff) | |
Manual crash/recover implemented.
Diffstat (limited to 'sources/simulator/VSSimulationPanel.java')
| -rw-r--r-- | sources/simulator/VSSimulationPanel.java | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/sources/simulator/VSSimulationPanel.java b/sources/simulator/VSSimulationPanel.java index e750b0a..8d792a9 100644 --- a/sources/simulator/VSSimulationPanel.java +++ b/sources/simulator/VSSimulationPanel.java @@ -278,14 +278,29 @@ public class VSSimulationPanel extends JPanel implements Runnable, MouseMotionLi g.setColor(process.getColor()); g.fillPolygon(xPoints, yPoints, 5); - if (process.isCrashed()) { - final VSTask crashTask = process.getCrashTask(); - final int crashPos = (int) getTimeXPosition(crashTask.getTaskTime()); - final int xPointsCrashed[] = { crashPos, xoffset_plus_xpaintsize, xoffset_plus_xpaintsize, crashPos, crashPos }; + + if (process.hasCrashed()) { g.setColor(process.getCrashedColor()); - g.fillPolygon(xPointsCrashed, yPoints, 5); + final Long crashHistory[] = process.getCrashHistoryArray(); + final int length = crashHistory.length; + + for (int i = 0; i < length; i += 2) { + final int crashStartPos = (int) getTimeXPosition(crashHistory[i].longValue()); + int crashEndPos; + + if (i == length - 1) + crashEndPos = xoffset_plus_xpaintsize; + else + crashEndPos = (int) getTimeXPosition(crashHistory[i+1].longValue()); + + final int xPointsCrashed[] = { crashStartPos, crashEndPos, + crashEndPos, crashStartPos, crashStartPos + }; + g.fillPolygon(xPointsCrashed, yPoints, 5); + } } + g.setColor(process.getColor()); g.drawString("P" + process.getProcessID() + ":", XOFFSET - 30, yPoints[0] + LINE_WIDTH); final long tmp = localTime > untilTime ? untilTime : localTime; @@ -635,14 +650,14 @@ public class VSSimulationPanel extends JPanel implements Runnable, MouseMotionLi popup.add(item); item = new JMenuItem(prefs.getString("lang.crash")); - if (process.isCrashed() || isPaused || time == 0) + if (process.isCrashed() || isPaused || time == 0 || isFinished) item.setEnabled(false); else item.addActionListener(actionListener); popup.add(item); item = new JMenuItem(prefs.getString("lang.recover")); - if (!process.isCrashed() || isPaused || time == 0) + if (!process.isCrashed() || isPaused || time == 0 || isFinished) item.setEnabled(false); else item.addActionListener(actionListener); |
