1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.gui.statistics.actions;
11
12 import java.awt.event.ActionEvent;
13
14 import javax.swing.AbstractAction;
15 import javax.swing.Action;
16 import javax.swing.ImageIcon;
17
18 import nl.tudelft.simulation.dsol.gui.statistics.ChartPanel;
19 import nl.tudelft.simulation.language.io.URLResource;
20
21 /***
22 * DeleteRowAction <br>
23 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
24 * University of Technology </a>, the Netherlands. <br>
25 * See for project information <a href="http://www.simulation.tudelft.nl">
26 * www.simulation.tudelft.nl </a> <br>
27 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
28 * License (GPL) </a>, no warranty <br>
29 *
30 * @version 1.1 05.11.2003 <br>
31 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
32 * Jacobs </a>
33 */
34 public class DeleteRowAction extends AbstractAction
35 {
36 /*** target of the chartpanel */
37 private ChartPanel target = null;
38
39 /***
40 * constructs a new DeleteRowAction
41 *
42 * @param target the target
43 */
44 public DeleteRowAction(final ChartPanel target)
45 {
46 super("DeleteRow");
47 this.target = target;
48 this.putValue(Action.SMALL_ICON, new ImageIcon(URLResource
49 .getResource("/toolbarButtonGraphics/table/RowDelete24.gif")));
50 this.setEnabled(true);
51 }
52
53 /***
54 * @see java.awt.event.ActionListener
55 * #actionPerformed(java.awt.event.ActionEvent)
56 */
57 public void actionPerformed(final ActionEvent actionEvent)
58 {
59 new Worker(this.target).start();
60 }
61
62 /*** SimulatorRunThread extends Thread */
63 private class Worker extends Thread
64 {
65 /*** the source */
66 private ChartPanel target = null;
67
68 /***
69 * constructs a new
70 *
71 * @param target the target
72 */
73 public Worker(final ChartPanel target)
74 {
75 this.target = target;
76 }
77
78 /***
79 * @see java.lang.Runnable#run()
80 */
81 public void run()
82 {
83 synchronized (this.target)
84 {
85 this.target.deleteRow();
86 }
87 }
88 }
89 }