| Revision 2,
1.4 KB
checked in by jdalbey, 10 years ago
(diff) |
|
Initial Import of project files
|
| Line | |
|---|
| 1 | package tmcsim.simulationmanager.actions; |
|---|
| 2 | |
|---|
| 3 | import java.awt.event.ActionEvent; |
|---|
| 4 | |
|---|
| 5 | import javax.swing.AbstractAction; |
|---|
| 6 | |
|---|
| 7 | import tmcsim.common.SimulationException; |
|---|
| 8 | import tmcsim.simulationmanager.SimulationManagerView; |
|---|
| 9 | |
|---|
| 10 | /** |
|---|
| 11 | * ResetSimulationAction is an AbstractAction that is used for resetting |
|---|
| 12 | * the simulation. When the action is performed, the action calls the |
|---|
| 13 | * SimulationManagerModel to reset the simulation. |
|---|
| 14 | * @author Matthew Cechini |
|---|
| 15 | */ |
|---|
| 16 | @SuppressWarnings("serial") |
|---|
| 17 | public class ResetSimulationAction extends AbstractAction { |
|---|
| 18 | |
|---|
| 19 | /** Reference to the SimulationManagerView object. */ |
|---|
| 20 | private SimulationManagerView theSimManagerView = null; |
|---|
| 21 | |
|---|
| 22 | /** |
|---|
| 23 | * Constructor. |
|---|
| 24 | * @param view View class object for the Simulation Manager. |
|---|
| 25 | */ |
|---|
| 26 | public ResetSimulationAction(SimulationManagerView view) { |
|---|
| 27 | super("Reset"); |
|---|
| 28 | |
|---|
| 29 | theSimManagerView = view; |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | public void actionPerformed(ActionEvent evt) { |
|---|
| 33 | Runnable resetRunnable = new Runnable(){ |
|---|
| 34 | public void run() { |
|---|
| 35 | try { |
|---|
| 36 | theSimManagerView.getModel().resetSimulation(); |
|---|
| 37 | } |
|---|
| 38 | catch (SimulationException se) { |
|---|
| 39 | theSimManagerView.SimulationExceptionHandler(se); |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | Thread theThread = new Thread(resetRunnable); |
|---|
| 45 | theThread.start(); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.