@Override public void actionPerformed(ActionEvent e) { // Object o = table.getModel().getValueAt(table.getSelectedRow(), 0); int row = table.convertRowIndexToModel(table.getEditingRow()); Object o = table.getModel().getValueAt(row, 0); JOptionPane.showMessageDialog(table, "Editing: " + o); }
/** Store changes to table preferences. This method is called when the user clicks Ok. */ public void storeSettings() { _prefs.putBoolean("fileColumn", fileColumn.isSelected()); _prefs.putBoolean("pdfColumn", pdfColumn.isSelected()); _prefs.putBoolean("urlColumn", urlColumn.isSelected()); _prefs.putBoolean("preferUrlDoi", preferDoi.isSelected()); _prefs.putBoolean("arxivColumn", arxivColumn.isSelected()); _prefs.putBoolean( JabRefPreferences.SHOWONELETTERHEADINGFORICONCOLUMNS, showOneLetterHeadingForIconColumns.isSelected()); /** * begin: special fields ** */ boolean newSpecialFieldsEnabled = specialFieldsEnabled.isSelected(), newRankingColumn = rankingColumn.isSelected(), newCompactRankingColumn = compactRankingColumn.isSelected(), newQualityColumn = qualityColumn.isSelected(), newPriorityColumn = priorityColumn.isSelected(), newRelevanceColumn = relevanceColumn.isSelected(), newSyncKeyWords = syncKeywords.isSelected(), newWriteSpecialFields = writeSpecialFields.isSelected(); boolean restartRequired = false; restartRequired = (oldSpecialFieldsEnabled != newSpecialFieldsEnabled) || (oldRankingColumn != newRankingColumn) || (oldCompcatRankingColumn != newCompactRankingColumn) || (oldQualityColumn != newQualityColumn) || (oldPriorityColumn != newPriorityColumn) || (oldRelevanceColumn != newRelevanceColumn) || (oldSyncKeyWords != newSyncKeyWords) || (oldWriteSpecialFields != newWriteSpecialFields); if (restartRequired) { JOptionPane.showMessageDialog( null, Globals.lang("You have changed settings for special fields.") .concat(" ") .concat(Globals.lang("You must restart JabRef for this to come into effect.")), Globals.lang("Changed special field settings"), JOptionPane.WARNING_MESSAGE); } // restart required implies that the settings have been changed // the seetings need to be stored if (restartRequired) { _prefs.putBoolean(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED, newSpecialFieldsEnabled); _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING, newRankingColumn); _prefs.putBoolean(SpecialFieldsUtils.PREF_RANKING_COMPACT, newCompactRankingColumn); _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY, newPriorityColumn); _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY, newQualityColumn); _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE, newRelevanceColumn); _prefs.putBoolean(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS, newSyncKeyWords); _prefs.putBoolean(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS, newWriteSpecialFields); } /** * end: special fields ** */ if (colSetup.isEditing()) { int col = colSetup.getEditingColumn(), row = colSetup.getEditingRow(); colSetup.getCellEditor(row, col).stopCellEditing(); } // _prefs.putStringArray("columnNames", getChoices()); /*String[] cols = tableFields.getText().replaceAll("\\s+","") .replaceAll("\\n+","").toLowerCase().split(";"); if (cols.length > 0) for (int i=0; i<cols.length; i++) cols[i] = cols[i].trim(); else cols = null;*/ // Now we need to make sense of the contents the user has made to the // table setup table. if (tableChanged) { // First we remove all rows with empty names. int i = 0; while (i < tableRows.size()) { if (tableRows.elementAt(i).name.equals("")) tableRows.removeElementAt(i); else i++; } // Then we make arrays String[] names = new String[tableRows.size()], widths = new String[tableRows.size()]; int[] nWidths = new int[tableRows.size()]; _prefs.putInt("numberColWidth", ncWidth); for (i = 0; i < tableRows.size(); i++) { TableRow tr = tableRows.elementAt(i); names[i] = tr.name.toLowerCase(); nWidths[i] = tr.length; widths[i] = "" + tr.length; // Util.pr(names[i]+" "+widths[i]); } // Finally, we store the new preferences. _prefs.putStringArray("columnNames", names); _prefs.putStringArray("columnWidths", widths); } }