From 299be27a07ff4b6183c67622cad878261607c5b7 Mon Sep 17 00:00:00 2001 From: Christian Bartsch Date: Mon, 22 Aug 2016 16:13:34 +0200 Subject: [PATCH 01/12] when inserting a duplicate the right entry will be selected --- CHANGELOG.md | 1 + src/main/java/net/sf/jabref/gui/BasePanel.java | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8e5a745b9..fc4b5cf0774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ### Fixed - Fixed [#1760](https://github.com/JabRef/jabref/issues/1760): Preview updated correctly when selecting a single entry after selecting multiple entries - Fixed [#1632](https://github.com/JabRef/jabref/issues/1632): User comments (@Comment) with or without brackets are now kept +- When inserting a duplicate the right entry will be selected - Preview panel height is now saved immediately, thus is shown correctly if the panel height is changed, closed and opened again - Fixed [#1264](https://github.com/JabRef/jabref/issues/1264): S with caron does not render correctly - LaTeX to Unicode converter now handles combining accents diff --git a/src/main/java/net/sf/jabref/gui/BasePanel.java b/src/main/java/net/sf/jabref/gui/BasePanel.java index 43c6f441405..4d2efb42ff7 100644 --- a/src/main/java/net/sf/jabref/gui/BasePanel.java +++ b/src/main/java/net/sf/jabref/gui/BasePanel.java @@ -1721,6 +1721,8 @@ public void hideBottomComponent() { public void highlightEntry(final BibEntry be) { final int row = mainTable.findEntry(be); if (row >= 0) { +// the selection has to be cleared in case that a duplicate later in the list is selected thus the editor doesn't get refreshed + mainTable.clearSelection(); mainTable.setRowSelectionInterval(row, row); mainTable.ensureVisible(row); } @@ -1840,17 +1842,6 @@ private synchronized void markChangedOrUnChanged() { frame.setWindowTitle(); } - /** - * Selects a single entry, and scrolls the table to center it. - * - * @param pos Current position of entry to select. - */ - public void selectSingleEntry(int pos) { - mainTable.clearSelection(); - mainTable.addRowSelectionInterval(pos, pos); - mainTable.scrollToCenter(pos, 0); - } - public BibDatabase getDatabase() { return bibDatabaseContext.getDatabase(); } From f43c005ec021d90576424b4e22471e93531cf82c Mon Sep 17 00:00:00 2001 From: Christian Bartsch Date: Tue, 23 Aug 2016 11:59:55 +0200 Subject: [PATCH 02/12] fix issues and delete a duplicate method --- src/main/java/net/sf/jabref/gui/BasePanel.java | 4 ++-- .../net/sf/jabref/gui/exporter/SaveDatabaseAction.java | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/BasePanel.java b/src/main/java/net/sf/jabref/gui/BasePanel.java index 4d2efb42ff7..dec44571da4 100644 --- a/src/main/java/net/sf/jabref/gui/BasePanel.java +++ b/src/main/java/net/sf/jabref/gui/BasePanel.java @@ -1718,8 +1718,8 @@ public void hideBottomComponent() { * This method selects the given entry, and scrolls it into view in the table. If an entryEditor is shown, it is * given focus afterwards. */ - public void highlightEntry(final BibEntry be) { - final int row = mainTable.findEntry(be); + public void highlightEntry(final BibEntry bibEntry) { + final int row = mainTable.findEntry(bibEntry); if (row >= 0) { // the selection has to be cleared in case that a duplicate later in the list is selected thus the editor doesn't get refreshed mainTable.clearSelection(); diff --git a/src/main/java/net/sf/jabref/gui/exporter/SaveDatabaseAction.java b/src/main/java/net/sf/jabref/gui/exporter/SaveDatabaseAction.java index 50ed37a4cc2..05bd22be2a6 100644 --- a/src/main/java/net/sf/jabref/gui/exporter/SaveDatabaseAction.java +++ b/src/main/java/net/sf/jabref/gui/exporter/SaveDatabaseAction.java @@ -185,7 +185,7 @@ private boolean saveDatabase(File file, boolean selectedOnly, Charset encoding) if (ex.specificEntry()) { BibEntry entry = ex.getEntry(); // Error occured during processing of an entry. Highlight it! - highlightEntry(entry); + panel.highlightEntry(entry); } else { LOGGER.error("A problem occured when trying to save the file", ex); } @@ -254,14 +254,6 @@ private boolean saveDatabase(File file, boolean selectedOnly, Charset encoding) return success; } - private void highlightEntry(BibEntry entry) { - int row = panel.getMainTable().findEntry(entry); - int topShow = Math.max(0, row - 3); - panel.getMainTable().setRowSelectionInterval(row, row); - panel.getMainTable().scrollTo(topShow); - panel.showEntry(entry); - } - /** * Run the "Save" operation. This method offloads the actual save operation to a background thread, but * still runs synchronously using Spin (the method returns only after completing the operation). From 01a5a3ebc36437d23a60a328c3ac8555901eb538 Mon Sep 17 00:00:00 2001 From: Christian Bartsch Date: Tue, 23 Aug 2016 17:06:24 +0200 Subject: [PATCH 03/12] when pasting an entry search the entry from the back, b/c we want to select the duplicate, not the original --- .../java/net/sf/jabref/gui/BasePanel.java | 28 +++++++++++++++---- .../sf/jabref/gui/maintable/MainTable.java | 4 +++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/BasePanel.java b/src/main/java/net/sf/jabref/gui/BasePanel.java index dec44571da4..addb27c2cf5 100644 --- a/src/main/java/net/sf/jabref/gui/BasePanel.java +++ b/src/main/java/net/sf/jabref/gui/BasePanel.java @@ -845,7 +845,9 @@ private void paste() { if (Globals.prefs.getBoolean(JabRefPreferences.AUTO_OPEN_FORM)) { selectionListener.editSignalled(firstBE); } - highlightEntry(firstBE); + +// If we inserted a duplicate we want to select the duplicate + highlightLastEntry(firstBE); } } @@ -1719,12 +1721,26 @@ public void hideBottomComponent() { * given focus afterwards. */ public void highlightEntry(final BibEntry bibEntry) { - final int row = mainTable.findEntry(bibEntry); - if (row >= 0) { -// the selection has to be cleared in case that a duplicate later in the list is selected thus the editor doesn't get refreshed + highlightEntry(mainTable.findEntry(bibEntry)); + } + + /** + * This method selects the given entry (searches from the back), and scrolls it into view in the table. + * If an entryEditor is shown, it is given focus afterwards. + */ + public void highlightLastEntry(final BibEntry bibEntry) { + highlightEntry(mainTable.findLastEntry(bibEntry)); + } + + /** + * This method selects the entry on the given position, and scrolls it into view in the table. + * If an entryEditor is shown, it is given focus afterwards. + */ + public void highlightEntry(int pos) { + if (pos >= 0) { mainTable.clearSelection(); - mainTable.setRowSelectionInterval(row, row); - mainTable.ensureVisible(row); + mainTable.addRowSelectionInterval(pos, pos); + mainTable.ensureVisible(pos); } } diff --git a/src/main/java/net/sf/jabref/gui/maintable/MainTable.java b/src/main/java/net/sf/jabref/gui/maintable/MainTable.java index 94a70630d32..b4aea447051 100644 --- a/src/main/java/net/sf/jabref/gui/maintable/MainTable.java +++ b/src/main/java/net/sf/jabref/gui/maintable/MainTable.java @@ -490,6 +490,10 @@ public int findEntry(BibEntry entry) { return model.getTableRows().indexOf(entry); } + public int findLastEntry(BibEntry entry) { + return model.getTableRows().lastIndexOf(entry); + } + /** * method to check whether a MainTableColumn at the modelIndex refers to the file field (either as a specific * file extension filter or not) From dd0315f5c43a4156dcfb8e6cd176c3e1e038486d Mon Sep 17 00:00:00 2001 From: Christian Bartsch Date: Tue, 23 Aug 2016 17:29:25 +0200 Subject: [PATCH 04/12] fix indent --- src/main/java/net/sf/jabref/gui/BasePanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/sf/jabref/gui/BasePanel.java b/src/main/java/net/sf/jabref/gui/BasePanel.java index addb27c2cf5..f5e48cd7b8d 100644 --- a/src/main/java/net/sf/jabref/gui/BasePanel.java +++ b/src/main/java/net/sf/jabref/gui/BasePanel.java @@ -846,7 +846,7 @@ private void paste() { selectionListener.editSignalled(firstBE); } -// If we inserted a duplicate we want to select the duplicate + // If we inserted a duplicate we want to select the duplicate (thus we have to search from the back) highlightLastEntry(firstBE); } } From 32f829bf9387728dc385f1f1376a9073990f1a42 Mon Sep 17 00:00:00 2001 From: Christian Bartsch Date: Wed, 24 Aug 2016 09:42:50 +0200 Subject: [PATCH 05/12] entry scrolling didn't work if the entry in question was just 1 row outside the table (bottom) (<; <= mistake) --- src/main/java/net/sf/jabref/gui/maintable/MainTable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/sf/jabref/gui/maintable/MainTable.java b/src/main/java/net/sf/jabref/gui/maintable/MainTable.java index b4aea447051..1d70e0a5006 100644 --- a/src/main/java/net/sf/jabref/gui/maintable/MainTable.java +++ b/src/main/java/net/sf/jabref/gui/maintable/MainTable.java @@ -555,7 +555,7 @@ public void updateFont() { public void ensureVisible(int row) { JScrollBar vert = pane.getVerticalScrollBar(); int y = row * getRowHeight(); - if ((y < vert.getValue()) || ((y > (vert.getValue() + vert.getVisibleAmount())) + if ((y < vert.getValue()) || ((y >= (vert.getValue() + vert.getVisibleAmount())) && (model.getSearchState() != MainTableDataModel.DisplayOption.FLOAT))) { scrollToCenter(row, 1); } From eda5411db3ec7ced1bf504f897f11dc86f6c0562 Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 24 Aug 2016 22:54:18 +0200 Subject: [PATCH 06/12] Update German translation (#1829) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update German translation referenziert instead of aufgelöst * Better translation for obsolete structure --- src/main/resources/l10n/JabRef_de.properties | 27 ++++++++++---------- src/main/resources/l10n/Menu_de.properties | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index a2f977861af..3876522896e 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -2457,18 +2457,19 @@ You_must_enter_at_least_one_field_name=Sie_müssen_mindestens_einen_Feldnamen_an Non-ASCII_encoded_character_found=Nicht_ASCII-kodiertes_Zeichen_gefunden -Toggle_web_search_interface= -Background_color_for_resolved_fields= -Color_code_for_resolved_fields= - -%0_files_found= -%0_of_%1= -One_file_found= -The_import_finished_with_warnings\:= -There_was_one_file_that_could_not_be_imported.= -There_were_%0_files_which_could_not_be_imported.= +Toggle_web_search_interface=Websuche_ein-/ausschalten +Background_color_for_resolved_fields=Hintergrundfarbe_für_referenzierte_Felder +Color_code_for_resolved_fields=Farbanzeige_für_referenzierte_Felder + +%0_files_found=%0_Dateien_gefunden +%0_of_%1=%0_von_%1 +One_file_found=Eine_Datei_gefunden +The_import_finished_with_warnings\:=Der Import_wurde_mit_Warnungen_abgeschlossen\: +There_was_one_file_that_could_not_be_imported.=Eine_Datei_konnte_nicht_importiert_werden. +There_were_%0_files_which_could_not_be_imported.=%0_Dateien_konnten_nicht_importiert_werden. + Migration_help_information=Hilfe_zur_Migration -Entered_database_has_obsolete_structure_and_is_no_longer_supported.=Die_eingegebene_Datenbank_ist_veraltet_und_wird_nicht_mehr_unterstützt. -However,_a_new_database_was_created_alongside_the_pre-3.6_one.=Eine_nebenläufige_Datenbank_wurde_erzeugt. +Entered_database_has_obsolete_structure_and_is_no_longer_supported.=Die_gewählte_Datenbank_nutzt_eine_veraltete,_nicht_mehr_unterstützte_Struktur. +However,_a_new_database_was_created_alongside_the_pre-3.6_one.=Dennoch_wurde_eine_neue_Datenbank_neben_der_alten_Datenbank_erzeugt. -Click_here_to_learn_about_the_migration_of_pre-3.6_databases.= +Click_here_to_learn_about_the_migration_of_pre-3.6_databases.=Klicken_um_Informationen_zur_Migration_von_vor-3.6-Datenbanken_zu_erhalten. diff --git a/src/main/resources/l10n/Menu_de.properties b/src/main/resources/l10n/Menu_de.properties index d4bb37b1580..5fb877d5d5c 100644 --- a/src/main/resources/l10n/Menu_de.properties +++ b/src/main/resources/l10n/Menu_de.properties @@ -210,4 +210,4 @@ Disable_highlight_groups_matching_entries=Keine_Gruppen_hervorheben Online_help_forum=Online-Hilfeforum -Manage_protected_terms= +Manage_protected_terms=Geschützte_Terme_verwalten From 867e79948ae2065a5642167fb86038be19ca5fe2 Mon Sep 17 00:00:00 2001 From: Admir Obralija Date: Wed, 24 Aug 2016 23:52:35 +0200 Subject: [PATCH 07/12] Fix localization entry. Replace determinated with terminated. --- .../net/sf/jabref/gui/shared/SharedDatabaseUIManager.java | 4 ++-- src/main/resources/l10n/JabRef_da.properties | 2 +- src/main/resources/l10n/JabRef_de.properties | 2 +- src/main/resources/l10n/JabRef_en.properties | 2 +- src/main/resources/l10n/JabRef_es.properties | 2 +- src/main/resources/l10n/JabRef_fa.properties | 2 +- src/main/resources/l10n/JabRef_fr.properties | 2 +- src/main/resources/l10n/JabRef_in.properties | 2 +- src/main/resources/l10n/JabRef_it.properties | 2 +- src/main/resources/l10n/JabRef_ja.properties | 2 +- src/main/resources/l10n/JabRef_nl.properties | 2 +- src/main/resources/l10n/JabRef_no.properties | 2 +- src/main/resources/l10n/JabRef_pt_BR.properties | 2 +- src/main/resources/l10n/JabRef_ru.properties | 2 +- src/main/resources/l10n/JabRef_sv.properties | 2 +- src/main/resources/l10n/JabRef_tr.properties | 2 +- src/main/resources/l10n/JabRef_vi.properties | 2 +- src/main/resources/l10n/JabRef_zh.properties | 2 +- 18 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/shared/SharedDatabaseUIManager.java b/src/main/java/net/sf/jabref/gui/shared/SharedDatabaseUIManager.java index 60322e63a9c..cadc64f1f9d 100644 --- a/src/main/java/net/sf/jabref/gui/shared/SharedDatabaseUIManager.java +++ b/src/main/java/net/sf/jabref/gui/shared/SharedDatabaseUIManager.java @@ -32,7 +32,7 @@ public void listen(ConnectionLostEvent connectionLostEvent) { Localization.lang("Close database")}; int answer = JOptionPane.showOptionDialog(jabRefFrame, - Localization.lang("The connection to the server has been determinated.") + "\n\n", + Localization.lang("The connection to the server has been terminated.") + "\n\n", Localization.lang("Connection lost"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); @@ -80,4 +80,4 @@ public void listen(SharedEntryNotPresentEvent sharedEntryNotPresentEvent) { dbmsSynchronizer.pullChanges(); } -} \ No newline at end of file +} diff --git a/src/main/resources/l10n/JabRef_da.properties b/src/main/resources/l10n/JabRef_da.properties index 167ba5ac059..e3d4a8a15c9 100644 --- a/src/main/resources/l10n/JabRef_da.properties +++ b/src/main/resources/l10n/JabRef_da.properties @@ -1713,7 +1713,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index a2f977861af..c1a81094434 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -2423,7 +2423,7 @@ Required_field_"%0"_is_empty.=Erforederliches_Feld_"%0"_ist_leer. %0_driver_not_available.=%0-Treiber_nicht_verfügbar. -The_connection_to_the_server_has_been_determinated.=Verbindung_zum_Server_wurde_abgebrochen. +The_connection_to_the_server_has_been_terminated.=Verbindung_zum_Server_wurde_abgebrochen. Connection_lost.=Verbindung_verloren. Reconnect=Neu_verbinden. diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index ded86b187d6..f17bc14d725 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2256,7 +2256,7 @@ Driver_error=Driver_error Connection_to_%0_server_stablished.=Connection_to_%0_server_stablished. Required_field_"%0"_is_empty.=Required_field_"%0"_is_empty. %0_driver_not_available.=%0_driver_not_available. -The_connection_to_the_server_has_been_determinated.=The_connection_to_the_server_has_been_determinated. +The_connection_to_the_server_has_been_terminated.=The_connection_to_the_server_has_been_terminated. Connection_lost.=Connection_lost. Reconnect=Reconnect Work_offline=Work_offline diff --git a/src/main/resources/l10n/JabRef_es.properties b/src/main/resources/l10n/JabRef_es.properties index fee340698d4..c13c12ef705 100644 --- a/src/main/resources/l10n/JabRef_es.properties +++ b/src/main/resources/l10n/JabRef_es.properties @@ -1615,7 +1615,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_fa.properties b/src/main/resources/l10n/JabRef_fa.properties index f0b1113433a..af59695856a 100644 --- a/src/main/resources/l10n/JabRef_fa.properties +++ b/src/main/resources/l10n/JabRef_fa.properties @@ -2395,7 +2395,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index 781958fc4b9..b9026f6cdcd 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -1656,7 +1656,7 @@ Required_field_"%0"_is_empty.=Le_champ_requis_"%0"_est_vide; %0_driver_not_available.=Pilote_%0_non_disponible. -The_connection_to_the_server_has_been_determinated.=La_connexion_au_serveur_a_été_interrompue. +The_connection_to_the_server_has_been_terminated.=La_connexion_au_serveur_a_été_interrompue. Connection_lost.=Connexion_perdue. Reconnect=Reconnexion diff --git a/src/main/resources/l10n/JabRef_in.properties b/src/main/resources/l10n/JabRef_in.properties index 1154eb48d50..cda9eaaafa6 100644 --- a/src/main/resources/l10n/JabRef_in.properties +++ b/src/main/resources/l10n/JabRef_in.properties @@ -1631,7 +1631,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index 6561589dd4f..8775b7ac862 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -1732,7 +1732,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_ja.properties b/src/main/resources/l10n/JabRef_ja.properties index 9a8d677b9e8..3f611f2d7dd 100644 --- a/src/main/resources/l10n/JabRef_ja.properties +++ b/src/main/resources/l10n/JabRef_ja.properties @@ -2372,7 +2372,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_nl.properties b/src/main/resources/l10n/JabRef_nl.properties index d724934c512..78d85ee9021 100644 --- a/src/main/resources/l10n/JabRef_nl.properties +++ b/src/main/resources/l10n/JabRef_nl.properties @@ -2404,7 +2404,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_no.properties b/src/main/resources/l10n/JabRef_no.properties index a52af897cbb..04f19de1330 100644 --- a/src/main/resources/l10n/JabRef_no.properties +++ b/src/main/resources/l10n/JabRef_no.properties @@ -2796,7 +2796,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index 5c79f1d6178..1e4ae241f6b 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -1628,7 +1628,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_ru.properties b/src/main/resources/l10n/JabRef_ru.properties index fc316a9e1a0..eed6e371688 100644 --- a/src/main/resources/l10n/JabRef_ru.properties +++ b/src/main/resources/l10n/JabRef_ru.properties @@ -2373,7 +2373,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_sv.properties b/src/main/resources/l10n/JabRef_sv.properties index 58a2cdc8b0e..56325fd970d 100644 --- a/src/main/resources/l10n/JabRef_sv.properties +++ b/src/main/resources/l10n/JabRef_sv.properties @@ -1573,7 +1573,7 @@ Required_field_"%0"_is_empty.=Det_obligatoriska_fältet_"%0"_är_tomt. %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.=Anslutningen_till_servern_avbröts. +The_connection_to_the_server_has_been_terminated.=Anslutningen_till_servern_avbröts. Connection_lost.=Anslutningen_förlorades. Reconnect=Anslut_igen diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index 0a526c612ad..e297da6de03 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -1646,7 +1646,7 @@ Required_field_"%0"_is_empty.=Gerekli_alan_"%0"_boş. %0_driver_not_available.=%0_sürücüsü_yok -The_connection_to_the_server_has_been_determinated.=Sunucuyla_olan_bağlantı_sonlandırıldı. +The_connection_to_the_server_has_been_terminated.=Sunucuyla_olan_bağlantı_sonlandırıldı. Connection_lost.=Bağlantı_koptu. Reconnect=Yeniden_bağlan diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index e37e88b02f3..a1c630e8acc 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -2399,7 +2399,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index 8a47f957869..279f69ae4d0 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -1640,7 +1640,7 @@ Required_field_"%0"_is_empty.= %0_driver_not_available.= -The_connection_to_the_server_has_been_determinated.= +The_connection_to_the_server_has_been_terminated.= Connection_lost.= Reconnect= From d833261e55c06a80a555f72fa75ea37a184b3cc5 Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Thu, 25 Aug 2016 08:14:48 +0200 Subject: [PATCH 08/12] Fixes #1687 "month" field ascending/descending sorting swapped (#1837) --- CHANGELOG.md | 1 + .../bibtex/comparator/FieldComparator.java | 51 ++--- .../comparator/FieldComparatorTest.java | 182 ++++++++++++++++++ 3 files changed, 199 insertions(+), 35 deletions(-) create mode 100644 src/test/java/net/sf/jabref/logic/bibtex/comparator/FieldComparatorTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8e5a745b9..a4fc5d536ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Fixed [#1531](https://github.com/JabRef/jabref/issues/1531): `\relax` can be used for abbreviation of author names - Fixed [#1771](https://github.com/JabRef/jabref/issues/1771): Show all supported import types as default - Fixed [#1804](https://github.com/JabRef/jabref/issues/1804): Integrity check no longer removes URL field by mistake +- Fixed [#1687](https://github.com/JabRef/jabref/issues/1687): "month" field ascending/descending sorting swapped diff --git a/src/main/java/net/sf/jabref/logic/bibtex/comparator/FieldComparator.java b/src/main/java/net/sf/jabref/logic/bibtex/comparator/FieldComparator.java index e00cd1768ea..beb1af70a9a 100644 --- a/src/main/java/net/sf/jabref/logic/bibtex/comparator/FieldComparator.java +++ b/src/main/java/net/sf/jabref/logic/bibtex/comparator/FieldComparator.java @@ -18,16 +18,7 @@ import net.sf.jabref.model.entry.MonthUtil; /** - * * A comparator for BibEntry fields - * - * Initial Version: - * - * @author alver - * @version Date: Oct 13, 2005 Time: 10:10:04 PM To - * - * TODO: Testcases - * */ public class FieldComparator implements Comparator { @@ -47,26 +38,16 @@ public FieldComparator(String field) { this(field, false); } - public FieldComparator(String field, boolean reversed) { + public FieldComparator(SaveOrderConfig.SortCriterion sortCriterion) { + this(sortCriterion.field, sortCriterion.descending); + } + + public FieldComparator(String field, boolean descending) { this.fieldName = Objects.requireNonNull(field); this.field = fieldName.split(FieldName.FIELD_SEPARATOR); fieldType = determineFieldType(); isNumeric = InternalBibtexFields.isNumeric(this.field[0]); - - if(fieldType == FieldType.MONTH) { - /* - * [ 1598777 ] Month sorting - * - * http://sourceforge.net/tracker/index.php?func=detail&aid=1598777&group_id=92314&atid=600306 - */ - multiplier = reversed ? 1 : -1; - } else { - multiplier = reversed ? -1 : 1; - } - } - - public FieldComparator(SaveOrderConfig.SortCriterion sortCriterion) { - this(sortCriterion.field, sortCriterion.descending); + multiplier = descending ? -1 : 1; } private static Collator getCollator() { @@ -92,6 +73,16 @@ private FieldType determineFieldType() { } } + private String getField(BibEntry entry) { + for (String aField : field) { + Optional o = entry.getFieldOrAlias(aField); + if (o.isPresent()) { + return o.get(); + } + } + return null; + } + @Override public int compare(BibEntry e1, BibEntry e2) { String f1; @@ -154,16 +145,6 @@ public int compare(BibEntry e1, BibEntry e2) { return COLLATOR.compare(ours, theirs) * multiplier; } - private String getField(BibEntry entry) { - for (String aField : field) { - Optional o = entry.getFieldOrAlias(aField); - if (o.isPresent()) { - return o.get(); - } - } - return null; - } - /** * Returns the field this Comparator compares by. * diff --git a/src/test/java/net/sf/jabref/logic/bibtex/comparator/FieldComparatorTest.java b/src/test/java/net/sf/jabref/logic/bibtex/comparator/FieldComparatorTest.java new file mode 100644 index 00000000000..ceb3ef8d98b --- /dev/null +++ b/src/test/java/net/sf/jabref/logic/bibtex/comparator/FieldComparatorTest.java @@ -0,0 +1,182 @@ +package net.sf.jabref.logic.bibtex.comparator; + +import net.sf.jabref.model.entry.BibEntry; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class FieldComparatorTest { + @Test + public void compareMonthFieldIdentity() throws Exception { + FieldComparator comparator = new FieldComparator("month"); + BibEntry equal = new BibEntry(); + equal.setField("month", "1"); + + assertEquals(0, comparator.compare(equal, equal)); + } + + @Test + public void compareMonthFieldEquality() throws Exception { + FieldComparator comparator = new FieldComparator("month"); + BibEntry equal = new BibEntry(); + equal.setField("month", "1"); + BibEntry equal2 = new BibEntry(); + equal2.setField("month", "1"); + + assertEquals(0, comparator.compare(equal, equal2)); + } + + @Test + public void compareMonthFieldBiggerAscending() throws Exception { + FieldComparator comparator = new FieldComparator("month"); + BibEntry smaller = new BibEntry(); + smaller.setField("month", "jan"); + BibEntry bigger = new BibEntry(); + bigger.setField("month", "feb"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void compareMonthFieldBiggerDescending() throws Exception { + FieldComparator comparator = new FieldComparator("month", true); + BibEntry smaller = new BibEntry(); + smaller.setField("month", "feb"); + BibEntry bigger = new BibEntry(); + bigger.setField("month", "jan"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void compareYearFieldIdentity() throws Exception { + FieldComparator comparator = new FieldComparator("year"); + BibEntry equal = new BibEntry(); + equal.setField("year", "2016"); + + assertEquals(0, comparator.compare(equal, equal)); + } + + @Test + public void compareYearFieldEquality() throws Exception { + FieldComparator comparator = new FieldComparator("year"); + BibEntry equal = new BibEntry(); + equal.setField("year", "2016"); + BibEntry equal2 = new BibEntry(); + equal2.setField("year", "2016"); + + assertEquals(0, comparator.compare(equal, equal2)); + } + + @Test + public void compareYearFieldBiggerAscending() throws Exception { + FieldComparator comparator = new FieldComparator("year"); + BibEntry smaller = new BibEntry(); + smaller.setField("year", "2000"); + BibEntry bigger = new BibEntry(); + bigger.setField("year", "2016"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void compareYearFieldBiggerDescending() throws Exception { + FieldComparator comparator = new FieldComparator("year", true); + BibEntry smaller = new BibEntry(); + smaller.setField("year", "2016"); + BibEntry bigger = new BibEntry(); + bigger.setField("year", "2000"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void compareTypeFieldIdentity() throws Exception { + FieldComparator comparator = new FieldComparator("entrytype"); + BibEntry equal = new BibEntry("1", "article"); + + assertEquals(0, comparator.compare(equal, equal)); + } + + @Test + public void compareTypeFieldEquality() throws Exception { + FieldComparator comparator = new FieldComparator("entrytype"); + BibEntry equal = new BibEntry("1", "article"); + BibEntry equal2 = new BibEntry("1", "article"); + + assertEquals(0, comparator.compare(equal, equal2)); + } + + @Test + public void compareTypeFieldBiggerAscending() throws Exception { + FieldComparator comparator = new FieldComparator("entrytype"); + BibEntry smaller = new BibEntry("1", "article"); + BibEntry bigger = new BibEntry("2", "book"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void compareTypeFieldBiggerDescending() throws Exception { + FieldComparator comparator = new FieldComparator("entrytype", true); + BibEntry bigger = new BibEntry("1", "article"); + BibEntry smaller = new BibEntry("2", "book"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void compareStringFieldsIdentity() throws Exception { + FieldComparator comparator = new FieldComparator("title"); + BibEntry equal = new BibEntry(); + equal.setField("title", "title"); + + assertEquals(0, comparator.compare(equal, equal)); + } + + @Test + public void compareStringFieldsEquality() throws Exception { + FieldComparator comparator = new FieldComparator("title"); + BibEntry equal = new BibEntry(); + equal.setField("title", "title"); + BibEntry equal2 = new BibEntry(); + equal2.setField("title", "title"); + + assertEquals(0, comparator.compare(equal, equal2)); + } + + @Test + public void compareStringFieldsBiggerAscending() throws Exception { + FieldComparator comparator = new FieldComparator("title"); + BibEntry bigger = new BibEntry(); + bigger.setField("title", "b"); + BibEntry smaller = new BibEntry(); + smaller.setField("title", "a"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void compareStringFieldsBiggerDescending() throws Exception { + FieldComparator comparator = new FieldComparator("title", true); + BibEntry bigger = new BibEntry(); + bigger.setField("title", "a"); + BibEntry smaller = new BibEntry(); + smaller.setField("title", "b"); + + assertEquals(1, comparator.compare(bigger, smaller)); + } + + @Test + public void nameOfComparisonField() throws Exception { + FieldComparator comparator = new FieldComparator("title"); + assertEquals("title", comparator.getFieldName()); + } + + @Test + public void nameOfComparisonFieldAlias() throws Exception { + FieldComparator comparator = new FieldComparator("author/editor"); + assertEquals("author/editor", comparator.getFieldName()); + } +} From 2b240018ba05125ebefc0b8701728d3dcc267e85 Mon Sep 17 00:00:00 2001 From: MLEP Date: Thu, 25 Aug 2016 08:40:35 +0200 Subject: [PATCH 09/12] French localization: Jabref_fr: empty strings translated (#1847) --- src/main/resources/l10n/JabRef_fr.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index b9026f6cdcd..3f87218cd52 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -1706,8 +1706,8 @@ One_file_found=Un_fichier_trouvé The_import_finished_with_warnings\:=L'importation_s'est_terminée_avec_des_messages_d'avertissement\: There_was_one_file_that_could_not_be_imported.=Un_fichier_n'a_pas_pu_être_importé. There_were_%0_files_which_could_not_be_imported.=%0_fichiers_n'ont_pas_pu_être_importés. -Migration_help_information= -Entered_database_has_obsolete_structure_and_is_no_longer_supported.= -However,_a_new_database_was_created_alongside_the_pre-3.6_one.= +Migration_help_information=Aide_sur_la_migration +Entered_database_has_obsolete_structure_and_is_no_longer_supported.=Cette_base_de_données_a_une_structure_obsolète_qui_n'est_plus_gérée. +However,_a_new_database_was_created_alongside_the_pre-3.6_one.=Ainsi,_une_nouvelle_base_a_été_créée_en_parallèle_de_celle_antérieure_à_la_version_3.6. -Click_here_to_learn_about_the_migration_of_pre-3.6_databases.= +Click_here_to_learn_about_the_migration_of_pre-3.6_databases.=Cliquer_ici_pour_plus_de_détails_sur_la_migration_des_bases_antérieures_à_la_version_3.6. From b73b23630ce5cd7f78167524a2dbbf853ca879b8 Mon Sep 17 00:00:00 2001 From: bartsch-dev Date: Thu, 25 Aug 2016 09:02:25 +0200 Subject: [PATCH 10/12] fix SplitPaneChangeListener (#1840) --- src/main/java/net/sf/jabref/gui/BasePanel.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/BasePanel.java b/src/main/java/net/sf/jabref/gui/BasePanel.java index 43c6f441405..451fbff5b95 100644 --- a/src/main/java/net/sf/jabref/gui/BasePanel.java +++ b/src/main/java/net/sf/jabref/gui/BasePanel.java @@ -246,11 +246,6 @@ public BasePanel(JabRefFrame frame, BibDatabaseContext bibDatabaseContext) { LOGGER.warn("Could not register FileUpdateMonitor", ex); } } - - // saves the divider position as soon as it changes - splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, propertyChangeEvent -> { - saveDividerLocation(); - }); } // Returns a collection of AutoCompleters, which are populated from the current database @@ -1523,6 +1518,9 @@ public void setupMainPanel() { splitPane.revalidate(); revalidate(); repaint(); + + // saves the divider position as soon as it changes + splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, event -> saveDividerLocation()); } public void updateSearchManager() { From 315292f909a867679994f08845217c810353d698 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Thu, 25 Aug 2016 13:30:34 +0200 Subject: [PATCH 11/12] Allow setting the etal-string empty. Implements #1841 (#1848) --- CHANGELOG.md | 1 + .../java/net/sf/jabref/logic/layout/format/Authors.java | 2 +- .../net/sf/jabref/logic/layout/format/AuthorsTest.java | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4fc5d536ad..19e615822b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - [#1758](https://github.com/JabRef/jabref/issues/1758) Added a button to open Database Properties dialog help - Improve focus of the maintable after a sidepane gets closed (Before it would focus the toolbar or it would focus the wrong entry) - File open dialogs now use default extensions as primary file filter +- [#1841](https://github.com/JabRef/jabref/issues/1841) The "etal"-string in the Authors layout formatter can now be empty ### Fixed - Fixed [#1760](https://github.com/JabRef/jabref/issues/1760): Preview updated correctly when selecting a single entry after selecting multiple entries diff --git a/src/main/java/net/sf/jabref/logic/layout/format/Authors.java b/src/main/java/net/sf/jabref/logic/layout/format/Authors.java index 4a4a440cdb7..99b319406d0 100644 --- a/src/main/java/net/sf/jabref/logic/layout/format/Authors.java +++ b/src/main/java/net/sf/jabref/logic/layout/format/Authors.java @@ -198,7 +198,7 @@ else if (Authors.SEPARATORS.contains(key.trim().toLowerCase()) || Authors.LAST_S } else if (comp(key, "LastSep") && !value.isEmpty()) { lastSeparator = value; } - } else if ("etal".equalsIgnoreCase(key.trim()) && !value.isEmpty()) { + } else if ("etal".equalsIgnoreCase(key.trim())) { etAlString = value; } else if (Authors.NUMBER_PATTERN.matcher(key.trim()).matches()) { // Just a number: diff --git a/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java b/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java index b1eb9705c20..2059a3711d5 100644 --- a/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java +++ b/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java @@ -129,4 +129,12 @@ public void testNoPeriod() { Assert.assertEquals("B C Bruce, C K von Manson and J Jumper", a.format("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly")); } + + @Test + public void testEmptyEtAl() { + ParamLayoutFormatter a = new Authors(); + a.setArgument("fullname, LastFirst, Comma, 3, etal="); + Assert.assertEquals("Bruce, Bob Croydon", + a.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles")); + } } From 1b1e489b95bc894c56c633a9851a985f1910bd14 Mon Sep 17 00:00:00 2001 From: Admir Obralija Date: Thu, 25 Aug 2016 13:33:27 +0200 Subject: [PATCH 12/12] Disable incompatible properties for shared database. (#1826) --- src/main/java/net/sf/jabref/gui/JabRefFrame.java | 1 + .../gui/dbproperties/DatabasePropertiesDialog.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/net/sf/jabref/gui/JabRefFrame.java b/src/main/java/net/sf/jabref/gui/JabRefFrame.java index f52b53c144c..9d7c59803fc 100644 --- a/src/main/java/net/sf/jabref/gui/JabRefFrame.java +++ b/src/main/java/net/sf/jabref/gui/JabRefFrame.java @@ -1994,6 +1994,7 @@ public void actionPerformed(ActionEvent e) { propertiesDialog = new DatabasePropertiesDialog(JabRefFrame.this); } propertiesDialog.setPanel(getCurrentBasePanel()); + propertiesDialog.updateEnableStatus(); propertiesDialog.setLocationRelativeTo(JabRefFrame.this); propertiesDialog.setVisible(true); } diff --git a/src/main/java/net/sf/jabref/gui/dbproperties/DatabasePropertiesDialog.java b/src/main/java/net/sf/jabref/gui/dbproperties/DatabasePropertiesDialog.java index 26b82d913eb..57c970ab440 100644 --- a/src/main/java/net/sf/jabref/gui/dbproperties/DatabasePropertiesDialog.java +++ b/src/main/java/net/sf/jabref/gui/dbproperties/DatabasePropertiesDialog.java @@ -34,6 +34,7 @@ import net.sf.jabref.logic.help.HelpFile; import net.sf.jabref.logic.l10n.Encodings; import net.sf.jabref.logic.l10n.Localization; +import net.sf.jabref.model.database.DatabaseLocation; import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.builder.FormBuilder; @@ -79,6 +80,16 @@ public void setPanel(BasePanel panel) { this.metaData = panel.getBibDatabaseContext().getMetaData(); } + public void updateEnableStatus() { + DatabaseLocation location = panel.getBibDatabaseContext().getLocation(); + boolean isShared = (location == DatabaseLocation.SHARED); + encoding.setEnabled(!isShared); // the encoding of shared database is always UTF-8 + saveInOriginalOrder.setEnabled(!isShared); + saveInSpecifiedOrder.setEnabled(!isShared); + saveOrderPanel.setEnabled(!isShared); + protect.setEnabled(!isShared); + } + private void init(JFrame parent) { JButton browseFile = new JButton(Localization.lang("Browse"));