View Javadoc

1   package nl.tudelft.simulation.introspection.mapping;
2   
3   import java.awt.Component;
4   
5   import javax.swing.AbstractCellEditor;
6   import javax.swing.JComponent;
7   import javax.swing.JTable;
8   import javax.swing.table.TableCellEditor;
9   
10  import nl.tudelft.simulation.introspection.gui.ExpandButton;
11  import nl.tudelft.simulation.logger.Logger;
12  
13  /***
14   * Implements the pop-up behaviour of the {see
15   * nl.tudelft.simulation.introspection.gui.ExpandButton}.
16   * <p>
17   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
18   * University of Technology </a>, the Netherlands. <br>
19   * See for project information <a
20   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
21   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
22   * License (GPL) </a>, no warranty <br>
23   * 
24   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
25   *         Jacobs </a>
26   * @version 1.2 Apr 15, 2004
27   * @since 1.4
28   */
29  public class ExpandButtonEditor extends AbstractCellEditor implements
30  		TableCellEditor
31  {
32  	/*** the value */
33  	private JComponent value;
34  
35  	/***
36  	 * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(JTable,
37  	 *      Object, boolean, int, int)
38  	 */
39  	public Component getTableCellEditorComponent(final JTable table,
40  			final Object value, final boolean isSelected, final int row,
41  			final int column)
42  	{
43  		if (value instanceof ExpandButton)
44  		{
45  			((ExpandButton) value).setMyJTable(table);
46  		} else
47  		{
48  			Logger
49  					.warning(this, "getTableCellEditorComponent",
50  							"Expected value to be an ExpandButton, but found: "
51  									+ value);
52  		}
53  		return (Component) value;
54  	}
55  
56  	/***
57  	 * @see javax.swing.CellEditor#getCellEditorValue()
58  	 */
59  	public Object getCellEditorValue()
60  	{
61  		return this.value;
62  	}
63  }