Skip to content

Commit

Permalink
Merge branch 'master' into office07
Browse files Browse the repository at this point in the history
* master:
  Disable incompatible properties for shared database. (#1826)
  Allow setting the etal-string empty. Implements #1841 (#1848)
  fix SplitPaneChangeListener (#1840)
  French localization: Jabref_fr: empty strings translated (#1847)
  Fixes #1687 "month" field ascending/descending sorting swapped (#1837)
  Fix localization entry.
  Update German translation (#1829)
  entry scrolling  didn't work if the entry in question was just 1 row outside the table (bottom) (<; <= mistake)
  fix indent
  when pasting an entry search the entry from the back, b/c we want to select the duplicate, not the original
  fix issues and delete a duplicate method
  when inserting a duplicate the right entry will be selected
  • Loading branch information
Siedlerchr committed Aug 25, 2016
2 parents 1a6abc2 + 280b577 commit 934fc67
Show file tree
Hide file tree
Showing 29 changed files with 294 additions and 104 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ 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
- 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
Expand Down Expand Up @@ -86,6 +88,9 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Fixed [#1750](https://github.com/JabRef/jabref/issues/1750): BibLaTeX `date` field is now correctly exported as `year` in MS-Office 2007 xml format
- Fixed: LaTeX characters in author names are now converted to Unicode before export in MS-Office 2007 xml format
- Fixed: `volume`, `journaltitle`, `issue` and `number`(for patents) fields are now exported correctly in MS-Office 2007 xml format
- Fixed [#1687](https://github.com/JabRef/jabref/issues/1687): "month" field ascending/descending sorting swapped



### Removed
- It is not longer possible to choose to convert HTML sub- and superscripts to equations
Expand Down
49 changes: 27 additions & 22 deletions src/main/java/net/sf/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -845,7 +840,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 (thus we have to search from the back)
highlightLastEntry(firstBE);
}
}

Expand Down Expand Up @@ -1523,6 +1520,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() {
Expand Down Expand Up @@ -1718,11 +1718,27 @@ 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);
if (row >= 0) {
mainTable.setRowSelectionInterval(row, row);
mainTable.ensureVisible(row);
public void highlightEntry(final BibEntry bibEntry) {
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.addRowSelectionInterval(pos, pos);
mainTable.ensureVisible(pos);
}
}

Expand Down Expand Up @@ -1840,17 +1856,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();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/sf/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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).
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/net/sf/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -551,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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down Expand Up @@ -80,4 +80,4 @@ public void listen(SharedEntryNotPresentEvent sharedEntryNotPresentEvent) {
dbmsSynchronizer.pullChanges();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<BibEntry> {

Expand All @@ -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() {
Expand All @@ -92,6 +73,16 @@ private FieldType determineFieldType() {
}
}

private String getField(BibEntry entry) {
for (String aField : field) {
Optional<String> o = entry.getFieldOrAlias(aField);
if (o.isPresent()) {
return o.get();
}
}
return null;
}

@Override
public int compare(BibEntry e1, BibEntry e2) {
String f1;
Expand Down Expand Up @@ -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<String> o = entry.getFieldOrAlias(aField);
if (o.isPresent()) {
return o.get();
}
}
return null;
}

/**
* Returns the field this Comparator compares by.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
27 changes: 14 additions & 13 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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=
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.

%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.=
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.
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Loading

0 comments on commit 934fc67

Please sign in to comment.