View Javadoc

1   /*
2    * @(#) DeleteRowAction.java Oct 29, 2003
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
12   */
13  
14  package org.gscg.common.gui.statistics.actions;
15  
16  import java.awt.event.ActionEvent;
17  
18  import javax.swing.AbstractAction;
19  import javax.swing.Action;
20  import javax.swing.ImageIcon;
21  
22  import nl.tudelft.simulation.language.io.URLResource;
23  
24  import org.gscg.common.gui.statistics.ChartPanel;
25  
26  /***
27   * DeleteRowAction <br>
28   * <p>
29   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
30   * Delft, the Netherlands. All rights reserved.
31   * 
32   * See for project information <a href="http://www.simulation.tudelft.nl/">
33   * www.simulation.tudelft.nl </a>.
34   * 
35   * The source code and binary code of this software is proprietary information
36   * of Delft University of Technology.
37   * 
38   * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
39   *         Jacobs </a>
40   * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:58 $
41   * @since 1.0.0 <br>
42   */
43  public class DeleteRowAction extends AbstractAction
44  {
45  	/*** the serial version uid */
46  	private static final long serialVersionUID = 11L;
47  
48  	/*** target of the chartpanel */
49  	private ChartPanel target = null;
50  
51  	/***
52  	 * constructs a new DeleteRowAction
53  	 * 
54  	 * @param target the target
55  	 */
56  	public DeleteRowAction(final ChartPanel target)
57  	{
58  		super("DeleteRow");
59  		this.target = target;
60  		this.putValue(Action.SMALL_ICON, new ImageIcon(URLResource
61  				.getResource("/toolbarButtonGraphics/table/RowDelete24.gif")));
62  		this.setEnabled(true);
63  	}
64  
65  	/***
66  	 * @see java.awt.event.ActionListener
67  	 *      #actionPerformed(java.awt.event.ActionEvent)
68  	 */
69  	public void actionPerformed(final ActionEvent actionEvent)
70  	{
71  		new Worker(this.target).start();
72  	}
73  
74  	/***
75  	 * Worker
76  	 * <p>
77  	 * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628
78  	 * BX Delft, the Netherlands. All rights reserved.
79  	 * 
80  	 * See for project information <a href="http://www.simulation.tudelft.nl/">
81  	 * www.simulation.tudelft.nl </a>.
82  	 * 
83  	 * The source code and binary code of this software is proprietary
84  	 * information of Delft University of Technology.
85  	 * 
86  	 * @author <a
87  	 *         href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
88  	 *         van Houten </a>
89  	 * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:58 $
90  	 * @since 1.1.0
91  	 */
92  	private class Worker extends Thread
93  	{
94  		/*** the source */
95  		private ChartPanel target = null;
96  
97  		/***
98  		 * constructs a new
99  		 * 
100 		 * @param target the target
101 		 */
102 		public Worker(final ChartPanel target)
103 		{
104 			this.target = target;
105 		}
106 
107 		/***
108 		 * @see java.lang.Runnable#run()
109 		 */
110 		public void run()
111 		{
112 			synchronized (this.target)
113 			{
114 				this.target.deleteRow();
115 			}
116 		}
117 	}
118 }