@Override public TableCellEditor getCellEditor(int row, int column) { if (column == 1) { ActionArgument argument = argumentValuesModel.getValueAt(row); ActionArgumentValue argumentValue = argumentValuesModel.getValues()[row]; return createArgumentValueCellEditor(argument, argumentValue); } return super.getCellEditor(row, column); }
JTable table = (JTable) SwingUtilities.getAncestorOfClass(JTable.class, (Component) e.getSource()); int row = table.getEditingRow(); table.getCellEditor().stopCellEditing(); ((DefaultTableModel) table.getModel()).removeRow(row);
@Override public void mousePressed(MouseEvent arg0) { if (table.isEditing() && table.getCellEditor() == this) { isButtonColumnEditor = true; } }
@Override public void mouseReleased(MouseEvent arg0) { if (isButtonColumnEditor && table.isEditing()) { table.getCellEditor().stopCellEditing(); } isButtonColumnEditor = false; }
/** * Several methods are called, e.g. editCellAt, to get the focus set in the * value column of the specified row. The attribute column has the * parameter name and should not receive focus. */ protected void setTableCellFocus(int row) { propertyTable.editCellAt(row, 1); TableCellEditor editor = propertyTable.getCellEditor(row, 1); Component comp = editor.getTableCellEditorComponent( propertyTable, propertyTable.getValueAt(row, 1), true, row, 1); }
@Override public void save() { TableCellEditor editor = customRemoverTable.getCellEditor(); if (editor != null) { editor.stopCellEditing();
SchemaPropertyCellEditor sce = (SchemaPropertyCellEditor) nestedTableEditor .getCellEditor(); if (sce != null && sce.activeEditor == sce.tableEditor
public class TextFieldCell extends JTextField { public TextFieldCell(JTable cellTable) { super(); // calling parent constructor final JTable table = cellTable; // this one is required to get cell editor and stop editing this.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { } // this function successfully provides cell editing stop // on cell losts focus (but another cell doesn't gain focus) public void focusLost(FocusEvent e) { CellEditor cellEditor = table.getCellEditor(); if (cellEditor != null) if (cellEditor.getCellEditorValue() != null) cellEditor.stopCellEditing(); else cellEditor.cancelCellEditing(); } }); } }
(SchemaPropertyCellEditor) propertyTable.getCellEditor(); if (sce != null) { TreeSelectionEvent e2 = e;
public TableCellEditor getCellEditor(int row,int col) { TableCellEditor tce = (TableCellEditor) cellEditors.get(new Integer(row)); if( tce != null) { return tce; } else { return super.getCellEditor(row,col); } } }
private void cancelCellEditing(JTable jTable) { CellEditor ce = jTable.getCellEditor(); if (ce != null) { ce.cancelCellEditing(); } }
private void deleteMappingItem() { TableCellEditor editor = lstProperties.getCellEditor(); if (editor != null) { editor.stopCellEditing(); } int index = lstProperties.getSelectedRow(); if (index != -1) { ((DefaultTableModel) lstProperties.getModel()).removeRow(index); } }
@Override public TableCellEditor getCellEditor(final int row, final int col) { final FileObject file = getFile(row); // As we follow FileTableModel, 1st column is filename if (col == NAME_COLUMN) return super.getCellEditor(row, col); final Set<GroupAction> actions = files.getValidActions(Collections.singleton(file)); return new DefaultCellEditor(new JComboBox<>(actions.toArray())); }
public void mouseReleased(MouseEvent e) { if (isButtonColumnEditor && table.isEditing()) table.getCellEditor().stopCellEditing(); isButtonColumnEditor = false; }
/** * Convenience method to stop editing a JTable. * * @param table The table. */ public static final void stopEditing(JTable table) { if (table.isEditing()) { table.getCellEditor().stopCellEditing(); } }
public void focusLost(FocusEvent e) { JTable table = (JTable) e.getSource(); TableCellEditor editor = table.getCellEditor(); if (editor != null) { editor.stopCellEditing(); } } });
public static void selectFirstCellOnRow(JTable table, int row, boolean stopEdit) { // select first cell doSelectCell(table, row, 0); if (stopEdit && table.isEditing()) { table.getCellEditor().stopCellEditing(); } }
@Override public void actionPerformed(ActionEvent e) { if (table.isEditing()) { table.getCellEditor().stopCellEditing(); } else { ok = true; dispose(); } } }));
public static void commitChanges(JTable table) { if (table.isEditing()) { String text = ((JTextComponent) table.getEditorComponent()).getText(); table.setValueAt(text, table.getEditingRow(), table.getEditingColumn()); table.getCellEditor().cancelCellEditing(); } }
@Override public void modifyTestElement(TestElement te) { super.modifyTestElement(te); if (grid.isEditing()) { grid.getCellEditor().stopCellEditing(); } if (te instanceof CorrectedResultCollector) { CorrectedResultCollector rc = (CorrectedResultCollector) te; CollectionProperty rows = JMeterPluginsUtils.tableModelRowsToCollectionProperty(tableModel, REGEXPS_PROPERTY); rc.setProperty(rows); } }