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 loading and storing of XMP Field Exclusions #4291

Merged
merged 9 commits into from
Aug 29, 2018
Merged

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented Aug 23, 2018

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

grafik


  • Change in CHANGELOG.md described
  • Tests created for changes
  • Manually tested changed features in running JabRef
  • Screenshots added in PR description (for bigger UI changes)
  • Ensured that the git commit message is a good one
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)

@Siedlerchr Siedlerchr changed the title fix loading and storing of XMP Field Exlusions fix loading and storing of XMP Field Exclusions Aug 23, 2018
@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Aug 24, 2018
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
@Siedlerchr
Copy link
Member Author

I am going to merge this now if no further comments are coming ;)

Copy link
Member

@tobiasdiez tobiasdiez left a 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)) {
Copy link
Member

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();
Copy link
Member

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() {
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

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 -> {
Copy link
Member

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;
Copy link
Member

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).

Copy link
Member Author

@Siedlerchr Siedlerchr Aug 28, 2018

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
@Siedlerchr
Copy link
Member Author

grafik

Copy link
Member

@LinusDietz LinusDietz left a 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.

@Siedlerchr Siedlerchr merged commit 2d2a0f6 into master Aug 29, 2018
@Siedlerchr Siedlerchr deleted the fixxmppreftabs branch August 29, 2018 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants