View Javadoc

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