Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue #4437 - Some bugs in preference->Entry table columns #4546

Merged
merged 14 commits into from Jan 12, 2019
6 changes: 3 additions & 3 deletions CHANGELOG.md
Expand Up @@ -48,7 +48,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We updated updated the Related Articles tab to accept JSON from the new version of the Mr. DLib service
- We added an option in the preference dialog box that allows user to choose behavior after dragging and dropping files in Entry Editor. [#4356](https://github.com/JabRef/jabref/issues/4356)
- We added the ability to have an export preference where previously "File"-->"Export"/"Export selected entries" would not save the user's preference[#4495](https://github.com/JabRef/jabref/issues/4495)

- We added the ability to add field names from the Preferences Dialog [#4546](https://github.com/JabRef/jabref/issues/4546)
- We added the ability change the column widths directly in the main table. [#4546](https://github.com/JabRef/jabref/issues/4546)



Expand Down Expand Up @@ -91,7 +92,6 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where only one PDF file could be imported [#4422](https://github.com/JabRef/jabref/issues/4422)
- We fixed an issue where "Move to group" would always move the first entry in the library and not the selected [#4414](https://github.com/JabRef/jabref/issues/4414)
- We fixed an issue where an older dialog appears when downloading full texts from the quality menu. [#4489](https://github.com/JabRef/jabref/issues/4489)
- We fixed an issue where uncaught exceptions were logged but the user wasn't informed about their occurance. [#2288] (https://github.com/JabRef/jabref/issues/2288)



Expand All @@ -107,7 +107,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Set/clear/append/rename fields: available through Edit menu
- Manage keywords: available through Edit menu
- Copy linked files to folder: available through File menu

- We removed the option to change the column widths in the preferences dialog. [#4546](https://github.com/JabRef/jabref/issues/4546)



Expand Down
Expand Up @@ -26,7 +26,9 @@ public PersistenceVisualStateTable(final MainTable mainTable, JabRefPreferences
this.preferences = preferences;

mainTable.getColumns().addListener(this::onColumnsChanged);
mainTable.getColumns().forEach(col -> col.sortTypeProperty().addListener(obs -> updateColumnSortType(col.getText(), col.getSortType())));
mainTable.getColumns().forEach(col -> col.sortTypeProperty().addListener(obs ->
updateColumnSortType(col.getText(), col.getSortType())));
mainTable.getColumns().forEach(col -> col.widthProperty().addListener(obs -> updateColumnPreferences()));

}

Expand Down Expand Up @@ -63,8 +65,10 @@ private void updateColumnPreferences() {
}
}

// Finally, we store the new preferences.
preferences.putStringList(JabRefPreferences.COLUMN_NAMES, columnNames);
preferences.putStringList(JabRefPreferences.COLUMN_WIDTHS, columnsWidths);
if (columnNames.size() == columnsWidths.size() &&
columnNames.size() == preferences.getStringList(preferences.COLUMN_NAMES).size()) {
preferences.putStringList(JabRefPreferences.COLUMN_NAMES, columnNames);
preferences.putStringList(JabRefPreferences.COLUMN_WIDTHS, columnsWidths);
}
}
}