Refine search
@Override public void save() { TableCellEditor editor = customRemoverTable.getCellEditor(); if (editor != null) { editor.stopCellEditing(); DefaultTableModel model = (DefaultTableModel) this.customRemoverTable.getModel(); for (int i = 0; i < customRemoverTable.getRowCount(); i++) { JsonObject args = new JsonObject(); String pattern = model.getValueAt(i, 1).toString();
/** * 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); }
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
public void actionPerformed(ActionEvent e) { int nodeIndex = getEditingTableModel().getNodeIndex(); BayesIm bayesIm = getBayesIm(); if (!existsIncompleteRow(bayesIm, nodeIndex)) { JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "There are no incomplete rows in this table."); return; } BayesEstimatorNodeEditingTable editingTable = BayesEstimatorNodeEditingTable.this; TableCellEditor cellEditor = editingTable.getCellEditor(); if (cellEditor != null) { cellEditor.cancelCellEditing(); } bayesIm.randomizeIncompleteRows(nodeIndex); getEditingTableModel().fireTableDataChanged(); firePropertyChange("modelChanged", null, null); } });
@Override public void persist() { TableCellEditor editor = panel.entryTable.getCellEditor(); if (editor != null) { editor.stopCellEditing(); } Autotext.setList(((AutotextTableModel) panel.entryTable.getModel()).getData()); try { Autotext.save(); } catch (IOException ex) { JOptionPane.showMessageDialog(panel, OStrings.getString("AC_AUTOTEXT_UNABLE_TO_SAVE")); } Preferences.setPreference(Preferences.AC_AUTOTEXT_SORT_BY_LENGTH, panel.sortByLengthCheckBox.isSelected()); Preferences.setPreference(Preferences.AC_AUTOTEXT_SORT_ALPHABETICALLY, panel.sortAlphabeticallyCheckBox.isSelected()); Preferences.setPreference(Preferences.AC_AUTOTEXT_SORT_FULL_TEXT, panel.sortFullTextCheckBox.isSelected()); Preferences.setPreference(Preferences.AC_AUTOTEXT_ENABLED, panel.enabledCheckBox.isSelected()); } }
public void actionPerformed(ActionEvent e) { int nodeIndex = getEditingTableModel().getNodeIndex(); DirichletBayesIm dirichletBayesIm = getDirichletBayesIm(); if (existsCompleteRow(dirichletBayesIm, nodeIndex)) { int ret = JOptionPane.showConfirmDialog( JOptionUtils.centeringComp(), "This will delete all values in the table. " + "Continue?", "Warning", JOptionPane.YES_NO_OPTION); if (ret == JOptionPane.NO_OPTION) { return; } } DirichletBayesImNodeProbsTable editingTable = DirichletBayesImNodeProbsTable.this; TableCellEditor cellEditor = editingTable.getCellEditor(); if (cellEditor != null) { cellEditor.cancelCellEditing(); } dirichletBayesIm.clearTable(nodeIndex); getEditingTableModel().fireTableDataChanged(); } });
@Override public void actionPerformed(ActionEvent e) { boolean doneEditing = Stream.of(dialog.tableMapping, dialog.tableRepositories) .map(JTable::getCellEditor).allMatch(editor -> editor == null || editor.stopCellEditing()); if (!doneEditing) { return; } String r = isValid(); if (r != null) { JOptionPane.showMessageDialog(dialog, r, OStrings.getString("TF_ERROR"), JOptionPane.ERROR_MESSAGE); return; } result = getData(); dialog.dispose(); } });
@Override public void mouseReleased(MouseEvent arg0) { if (isButtonColumnEditor && table.isEditing()) { table.getCellEditor().stopCellEditing(); } isButtonColumnEditor = false; }
/** * Show the dialog and return the status code. * * @return The status code returned from the dialog. */ public int show() { int result = JOptionPane.showOptionDialog(parentFrame, controls, "Edit Properties", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, null); // cancel any edit in the table. If there is a cell editing, the getEditingColumn will // return a non-negative column number. This can be used to retreive the cell editor. // The code then gets the default editor and calls the stopCellEditing. If custom // editors are used, an additional check must be made to get the cell editor // for a specific cell. int column = propertiesTable.getEditingColumn(); if (column > -1) { TableCellEditor editor = propertiesTable.getDefaultEditor(propertiesTable.getColumnClass(column)); if (editor != null) { editor.stopCellEditing(); } } return result; }
/** * Stop any editing that is currently being done on the table. This will * save any changes that have already been made. * * @param table the table to stop on editing */ public static void stopTableEditing(JTable table) { if (table.isEditing()) { TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn()); cellEditor.stopCellEditing(); } }
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(); } }
private void stopTableEditing() { if (table.isEditing()) { TableCellEditor ed = table.getCellEditor(); assert ed != null; boolean success = ed.stopCellEditing(); // we first try to save if (!success) { ed.cancelCellEditing(); } assert !table.isEditing(); } }
/** * {@inheritDoc} * <p> * Overridden to try to stop the edit, if appropiate. Calls super if * succeeded, does not yield otherwise. * */ @Override public void transferFocusBackward() { if (isEditingFocusCycleRoot() && !getCellEditor().stopCellEditing()) return; super.transferFocusBackward(); }
private void randomBindCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_randomBindCheckBoxItemStateChanged boolean selected = randomBindCheckBox.isSelected(); portMappingTable.setEnabled(!selected); addExposedButton.setEnabled(!selected); addButton.setEnabled(!selected); removeButton.setEnabled(!selected); TableCellEditor editor = portMappingTable.getCellEditor(); if (editor != null) { editor.cancelCellEditing(); } portMappingTable.clearSelection(); }//GEN-LAST:event_randomBindCheckBoxItemStateChanged
/** * {@inheritDoc} * <p> * Overridden to try to stop the edit, if appropriate. Calls super if * succeeded, does not yield otherwise. * */ @Override public void transferFocus() { if (isEditingFocusCycleRoot() && !getCellEditor().stopCellEditing()) return; super.transferFocus(); }
@Override public ActionArgumentValue[] getInputValues() { if (inputArgumentsTable == null) return null; // Commit the currently typed value if (inputArgumentsTable.getCellEditor() != null) inputArgumentsTable.getCellEditor().stopCellEditing(); return inputArgumentsTable.getArgumentValuesModel().getValues(); }
public static void stopEditing(JTable table) { TableCellEditor cellEditor = table.getCellEditor(); if (cellEditor != null) { cellEditor.cancelCellEditing(); } }
private void stopCellEditing() { TableCellEditor tce; if ((tce = clusteredCacheTable.getCellEditor()) != null && !tce.stopCellEditing()) { tce.cancelCellEditing(); } if ((tce = standaloneCacheTable.getCellEditor()) != null && !tce.stopCellEditing()) { tce.cancelCellEditing(); } }
@Override public void actionPerformed(ActionEvent e) { if (!isEditing()) return; getCellEditor().cancelCellEditing(); }
@Override public Component getTreeTableCellEditorComponent(TreeTable treeTable, Object value, boolean sel, int row, int col) { return ((TableCellEditor)defaultEditor).getTableCellEditorComponent( table, value, sel, row, col); }