public void keyPressed(KeyEvent keyEvent) { AppLogger.finest( "keyModifiers=" + keyEvent.getModifiers() + " keyCode=" + keyEvent.getKeyCode()); int keyCode = keyEvent.getKeyCode(); if (keyCode == KeyEvent.VK_SHIFT || keyCode == KeyEvent.VK_CONTROL || keyCode == KeyEvent.VK_ALT || keyCode == KeyEvent.VK_META) return; KeyStroke pressedKeyStroke = KeyStroke.getKeyStrokeForEvent(keyEvent); if (pressedKeyStroke.equals(lastKeyStroke)) { TableCellEditor activeCellEditor = getCellEditor(); if (activeCellEditor != null) activeCellEditor.stopCellEditing(); } else { String actionId; if ((actionId = data.contains(pressedKeyStroke)) != null) { String errorMessage = "The shortcut [" + KeyStrokeUtils.getKeyStrokeDisplayableRepresentation(pressedKeyStroke) + "] is already assigned to '" + ActionProperties.getActionDescription(actionId) + "'"; tooltipBar.showErrorMessage(errorMessage); createCancelEditingStateThread(getCellEditor()); } else { lastKeyStroke = pressedKeyStroke; setText(KeyStrokeUtils.getKeyStrokeDisplayableRepresentation(lastKeyStroke)); } } keyEvent.consume(); }
// region Private Methods private static void stopCellEditing(JTable table) { if (table.getRowCount() > 0) { TableCellEditor editor = table.getCellEditor(); if (editor != null) { editor.stopCellEditing(); } } }
/** Invoked when an action occurs. */ public void actionPerformed(final ActionEvent e) { final TableCellEditor tableCellEditor = parameterMappingTable.getCellEditor(); if (tableCellEditor != null) { tableCellEditor.stopCellEditing(); } final ParameterMappingTableModel tableModel = (ParameterMappingTableModel) parameterMappingTable.getModel(); tableModel.addRow(); }
@Override public void run() { try { Thread.sleep(CELL_EDITING_STATE_PERIOD); } catch (InterruptedException e) { } if (!stopped && cellEditor != null) cellEditor.stopCellEditing(); }
/** Invoked when an action occurs. */ public void actionPerformed(final ActionEvent e) { final TableCellEditor tableCellEditor = parameterMappingTable.getCellEditor(); if (tableCellEditor != null) { tableCellEditor.stopCellEditing(); } final int i = parameterMappingTable.getSelectedRow(); if (i == -1) { return; } final ParameterMappingTableModel tableModel = (ParameterMappingTableModel) parameterMappingTable.getModel(); tableModel.removeRow(i); }
/** * Sets the new figure retrieved from the passed collection. * * @param l The collection to handle. */ void setSelectedFigures(List<ROIShape> l) { FigureTableModel tableModel = (FigureTableModel) fieldTable.getModel(); Iterator<ROIShape> i = l.iterator(); // Register error and notify user. ROIShape shape; try { TableCellEditor editor = fieldTable.getCellEditor(); if (editor != null) editor.stopCellEditing(); while (i.hasNext()) { shape = i.next(); tableModel.setData(shape.getFigure()); fieldTable.repaint(); } } catch (Exception e) { MeasurementAgent.getRegistry().getLogger().info(this, "Figures selection" + e); } }
public EditResult performEdit( final ParameterMapping[] parameterMappings, final String[] reportFields, final String[] declaredParameter) { innerTableCellEditor.setTags(reportFields); outerTableCellEditor.setTags(declaredParameter); final ParameterMappingTableModel parameterMappingTableModel = (ParameterMappingTableModel) parameterMappingTable.getModel(); parameterMappingTableModel.setMappings(parameterMappings); if (super.performEdit() == false) { return null; } final TableCellEditor cellEditor = parameterMappingTable.getCellEditor(); if (cellEditor != null) { cellEditor.stopCellEditing(); } return new EditResult(parameterMappingTableModel.getMappings()); }
public void _commit(boolean finishChosen) throws CommitStepException { // Stop editing if any final TableCellEditor cellEditor = myTable.getCellEditor(); if (cellEditor != null) { cellEditor.stopCellEditing(); } // Check that all included fields are bound to valid bean properties final PsiNameHelper nameHelper = JavaPsiFacade.getInstance(myData.myProject).getNameHelper(); for (int i = 0; i < myData.myBindings.length; i++) { final FormProperty2BeanProperty binding = myData.myBindings[i]; if (binding.myBeanProperty == null) { continue; } if (!nameHelper.isIdentifier(binding.myBeanProperty.myName)) { throw new CommitStepException( UIDesignerBundle.message( "error.X.is.not.a.valid.property.name", binding.myBeanProperty.myName)); } } myData.myGenerateIsModified = myChkIsModified.isSelected(); }
public void stopEditing() { TableCellEditor editor = myTable.getCellEditor(); if (editor != null) { editor.stopCellEditing(); } }
public boolean stopCellEditing() { final TableCellEditor cellEditor = getCellEditor(); return cellEditor != null && cellEditor.stopCellEditing(); }
public void stopCellEditing() { TableCellEditor editor; if ((editor = getCellEditor()) != null) editor.stopCellEditing(); }
/** Commits on-going cell editing */ public void commitEditing() { TableCellEditor editor = getCellEditor(); if (editor != null) { editor.stopCellEditing(); } }
public boolean stopCellEditing() { return editor.stopCellEditing(); }