-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 loading and storing of XMP Field Exclusions #4291
Conversation
remove explicit pref size adjustments
* upstream/master: update xmlunit-matchers from 2.6.0 -> 2.6.1 update gradle build-scan from 1.15.2 -> 1.16 checkstyle execute changes only if disk db present fix npe in Merge entries dialog
I am going to merge this now if no further comments are coming ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you were impatient, I was especially nit-picking ;-)
Additional remark: the table and the buttons should be "enabled" only when the check box is checked.
if (tableView.getFocusModel() != null && tableView.getFocusModel().getFocusedIndex() != -1) { | ||
tableChanged = true; | ||
delete.setOnAction(e -> { | ||
if ((tableView.getFocusModel() != null) && (tableView.getFocusModel().getFocusedIndex() != -1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use the focus and not selected item ala tableView.getSelectionModel().getSelectedItem()
?
privacyFilterCheckBox.setSelected(JabRefPreferences.getInstance().getBoolean( | ||
JabRefPreferences.USE_XMP_PRIVACY_FILTER)); | ||
List<XMPPrivacyFilter> xmpExclusions = prefs.getStringList(JabRefPreferences.XMP_PRIVACY_FILTERS).stream().map(XMPPrivacyFilter::new).collect(Collectors.toList()); | ||
fields.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but I thought there is a setAll
method (instead of clear + addAll)
return field.get(); | ||
} | ||
|
||
public StringProperty fieldName() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be field()
List<String> lines = Files.readAllLines(file); | ||
assertEquals(15, lines.size()); | ||
assertEquals("<rdf:li>Alan Turing</rdf:li>", lines.get(4).trim()); | ||
String actual = Files.readAllLines(file).stream().collect(Collectors.joining("\n")); //we are using \n to join, so we need it in the expected string as well, \n would fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the comment, especially the \n would fail
part. You can also simply compare the file contents as arrays, then there is no ambiguity concerning line endings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should have been \r\n
would fail.
I prefer this equals variant because at least eclipse shows the differences highlighted
delete.setOnAction(e-> { | ||
if (tableView.getFocusModel() != null && tableView.getFocusModel().getFocusedIndex() != -1) { | ||
tableChanged = true; | ||
delete.setOnAction(e -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The delete button should be shown in the table per row on hover (e.g. similar to the buttons in the maintable and I guess manage journal abbreviations and/or key bindings)
|
||
private class XMPPrivacyFilter { | ||
|
||
private final SimpleStringProperty field; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really necessary to make this a property instead of a simple get/set java prop? Moreover, I like the idea of creating a new class for this but would go one step further: use it everywhere (i.e. the properties class should set/get a list of privacy filter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your idea but it is necessary as the cellValueFactory expects an Observable.
Edit// I see no other way
disable when checkbox is unchecked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my perspective this look good now.
Fixes #4072
@koppor I am not that into the XMP stuff, are those "fields" I can add there bibtexfields which I can exclude from the export?
Then it would make sense to have a combobox analogous to the Cleanup panel with all fields
Edit// Decided to add the combobox with all fields