package nl.tudelft.simulation.introspection.mapping; import java.awt.Component; import javax.swing.AbstractCellEditor; import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.table.TableCellEditor; import nl.tudelft.simulation.dsol.logger.SimLogger; import nl.tudelft.simulation.introspection.gui.ExpandButton; /** * Implements the pop-up behaviour of the {see nl.tudelft.simulation.introspection.gui.ExpandButton}. *
* Copyright (c) 2002-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights * reserved. See for project information * https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can * be found at * https://simulation.tudelft.nl/dsol/3.0/license.html. *
* @author Peter Jacobs. * @author Alexander Verbraeck. * @author Niels Lang. * @since 1.5 */ public class ExpandButtonEditor extends AbstractCellEditor implements TableCellEditor { /** */ private static final long serialVersionUID = 20140831L; /** the value. */ private JComponent component; /** {@inheritDoc} */ @Override public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) { if (value instanceof ExpandButton) { ((ExpandButton) value).setMyJTable(table); } else { SimLogger.always().warn("getTableCellEditorComponent: Expected value to be an ExpandButton, but found: {}", value); } return (Component) value; } /** {@inheritDoc} */ @Override public Object getCellEditorValue() { return this.component; } }