Search in sources :

Example 61 with TableCellEditor

use of javax.swing.table.TableCellEditor in project processdash by dtuma.

the class ProxyJTable method getCellEditor.

@Override
public TableCellEditor getCellEditor(int row, int column) {
    DataColumn dc = ((ProxyDataModel) getModel()).getColumn(column);
    if (dc instanceof ProxySizeColumn) {
        ProxySizeColumn psc = (ProxySizeColumn) dc;
        TableCellEditor result = psc.getCellEditorForRow(row);
        if (result != null)
            return result;
    }
    return super.getCellEditor(row, column);
}
Also used : ProxySizeColumn(teamdash.wbs.columns.ProxySizeColumn) TableCellEditor(javax.swing.table.TableCellEditor)

Example 62 with TableCellEditor

use of javax.swing.table.TableCellEditor in project processdash by dtuma.

the class DataJTable method editingStopped.

@Override
public void editingStopped(ChangeEvent e) {
    // check to see if the value in this cell actually changed.
    boolean valueChanged = false;
    String columnName = null;
    TableCellEditor editor = getCellEditor();
    if (editor != null) {
        Object valueAfterEditing = editor.getCellEditorValue();
        valueChanged = !equal(valueBeforeEditing, valueAfterEditing);
        columnName = getColumnName(getEditingColumn());
    }
    // stop the editing session
    super.editingStopped(e);
    // if the value was changed, notify the UndoList.
    if (valueChanged)
        UndoList.madeChange(DataJTable.this, "Editing value in '" + columnName + "' column");
}
Also used : TableCellEditor(javax.swing.table.TableCellEditor)

Aggregations

TableCellEditor (javax.swing.table.TableCellEditor)62 JButton (javax.swing.JButton)37 ButtonEditor (jmri.util.table.ButtonEditor)33 ButtonRenderer (jmri.util.table.ButtonRenderer)33 TableColumnModel (javax.swing.table.TableColumnModel)23 JLabel (javax.swing.JLabel)14 JTable (javax.swing.JTable)13 ActionEvent (java.awt.event.ActionEvent)11 ActionListener (java.awt.event.ActionListener)9 BoxLayout (javax.swing.BoxLayout)9 JPanel (javax.swing.JPanel)9 JScrollPane (javax.swing.JScrollPane)9 TableColumn (javax.swing.table.TableColumn)9 TableCellRenderer (javax.swing.table.TableCellRenderer)8 FlowLayout (java.awt.FlowLayout)6 MouseEvent (java.awt.event.MouseEvent)6 XTableColumnModel (jmri.util.swing.XTableColumnModel)6 Container (java.awt.Container)5 JTextField (javax.swing.JTextField)5 JmriJFrame (jmri.util.JmriJFrame)5