View Javadoc

1   /*
2    * @(#) DeleteColumnAction.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   * DeleteColumnAction <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 DeleteColumnAction 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 DeleteColumnAction
53  	 * 
54  	 * @param target the target
55  	 */
56  	public DeleteColumnAction(final ChartPanel target)
57  	{
58  		super("DeleteColumn");
59  		this.target = target;
60  		this
61  				.putValue(
62  						Action.SMALL_ICON,
63  						new ImageIcon(
64  								URLResource
65  										.getResource("/toolbarButtonGraphics/table/ColumnDelete24.gif")));
66  		this.setEnabled(true);
67  	}
68  
69  	/***
70  	 * @see java.awt.event.ActionListener
71  	 *      #actionPerformed(java.awt.event.ActionEvent)
72  	 */
73  	public void actionPerformed(final ActionEvent actionEvent)
74  	{
75  		new Worker(this.target).start();
76  	}
77  
78  	/***
79  	 * Worker
80  	 * <p>
81  	 * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628
82  	 * BX Delft, the Netherlands. All rights reserved.
83  	 * 
84  	 * See for project information <a href="http://www.simulation.tudelft.nl/">
85  	 * www.simulation.tudelft.nl </a>.
86  	 * 
87  	 * The source code and binary code of this software is proprietary
88  	 * information of Delft University of Technology.
89  	 * 
90  	 * @author <a
91  	 *         href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
92  	 *         van Houten </a>
93  	 * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:58 $
94  	 * @since 1.1.0
95  	 */
96  	private class Worker extends Thread
97  	{
98  		/*** the source */
99  		private ChartPanel target = null;
100 
101 		/***
102 		 * constructs a new
103 		 * 
104 		 * @param target the target
105 		 */
106 		public Worker(final ChartPanel target)
107 		{
108 			this.target = target;
109 		}
110 
111 		/***
112 		 * @see java.lang.Runnable#run()
113 		 */
114 		public void run()
115 		{
116 			synchronized (this.target)
117 			{
118 				this.target.deleteColumn();
119 			}
120 		}
121 	}
122 }