-
-
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
Add file description to gui and fix sync bug #3210
Conversation
Add tests for identifying file descr bug
The problem is that the changes in the underlying jabref/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java Lines 74 to 82 in 2c5e7f2
As a solution, I propose to convert the data fields in jabref/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java Lines 109 to 111 in 2c5e7f2
Ps: Can you pls add a screenshot how the file editor now looks like with the description added (especially when the file link is relatively long). Thanks. |
@tobiasdiez I did as you suggested, but still does not work. I think it has something to do with the LIstProperty, but I am not that deep inside javafx binding stuff to know why it is not synced |
} | ||
|
||
public Observable[] getObservables() { | ||
return new Observable[] {this.downloadProgress, this.isAutomaticallyFound}; |
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.
you need to return description, link, fileType
here (and move downloadProgress
and isAutomaticallyFound
back to the viewmodel).
The observable tell javafx which properties mark the object as changed, i.e. if description
is changed this should mark the LinkedFile
as changed and thus also LinkedFileViewModel
and thus finally the list
private final ListProperty<LinkedFileViewModel> files = new SimpleListProperty<>(FXCollections.observableArrayList(LinkedFileViewModel::getObservables)); |
For more details see https://docs.oracle.com/javase/8/javafx/api/javafx/collections/FXCollections.html#observableList-java.util.List-javafx.util.Callback- or https://stackoverflow.com/questions/31687642/callback-and-extractors-for-javafx-observablelist
Fix serializing
add changelog
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.
Codewise this looks good to me (except a few very minor remarks).
However, I'm still not convinced that we should add the description of the file to the list. In my opinion, it now looks cramped and has too much information, without really helping (for long file names, you need to scroll in order to read the description - which is more inconvenient then hovering the link). In my view it would be sufficient to decrease the time until the tooltip appears (which is relatively easy or see disscussion).
return new Observable[] {this.downloadProgress, this.isAutomaticallyFound}; | ||
List<Observable> observables = new ArrayList<>(Arrays.asList(linkedFile.getObservables())); | ||
observables.add(downloadOngoing); | ||
observables.add(downloadProgress); |
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.
also add isAutomaticallyFound
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.
Just budding in here...
The file list would be cleaner if the filenames weren't shown when there is a description, as was done in JabRef 3.x. If there are very long descriptions, it will still be cluttered, but in my opinion, tooltips aren't an improvement.
The problem with descriptions only in tooltips is that you have to mouse over each one. This makes JabRef harder to use:
- It forces you to lift your hands off the keyboard, but more importantly,
- You can't scan the descriptions at a glance. Instead, you have to mouse over the first one, then mouse over the next one (which causes the previous description to vanish), and so on.
You can simulate the user experience by having somebody else make you a JabRef entry with, say five files with slightly different descriptions -- this is what your own entries will look like to you, a couple years after you have made them. You won't remember anything.
Now, try to decide which file to open. With tooltips, you see only one description at a time, like you're viewing them through a straw. Now compare that with the JabRef 3.x experience, where all descriptions are visible; with a glance, you can comprehend them all.
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.
Sounds reasonable!
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 now changed the order: Description is shown first and then the file link
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.
Come to think of it, you could even make the filename a tooltip. Once you've got the description, the filename is probably not so useful, but in some situation, you still might want to know it.
But then again, there is the "see everything at a glance" argument I just made...
@@ -7,7 +7,7 @@ | |||
|
|||
public class FileFieldWriter { | |||
|
|||
private FileFieldWriter() { | |||
FileFieldWriter() { |
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 is this constructor not private anymore?
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.
Was a relict from testing. Didn't see that it had static method on the first try
* upstream/master: Add tests for removal changes Improve telemetry (#3218) Real test linking real other entry (#3214) Check for explicit group at different location Update java-string-similarity from 0.24 -> 1.0.0 Only remove ExplicitGroups from entries, but not keyword-based groups Remove unused import in GroupTreeNode Move getEntriesInGroup to GroupTreeNode Inline Consumer updateViewModel Undo IntelliJ autoformat of FXML annotations Remove unused import Rewrite selection logic to avoid NPEs Clear group selection when a group is removed Also remove a group from entries when you remove it
Show description first then file link remove unnecesary separator
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.
Apart from a few very minor things, the code looks fine. +1 for merge.
@@ -69,6 +69,7 @@ public LinkedFilesEditorViewModel(String fieldName, AutoCompleteSuggestionProvid | |||
text, | |||
LinkedFilesEditorViewModel::getStringRepresentation, | |||
this::parseToFileViewModel); | |||
|
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.
Very minor, but as far as I can see this blank line is unnecessary.
out.writeUTF(getLink()); | ||
out.writeUTF(getDescription()); | ||
out.flush(); | ||
|
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.
Very minor, but as far as I can see this blank line is unnecessary.
fileType = new SimpleStringProperty(in.readUTF()); | ||
link = new SimpleStringProperty(in.readUTF()); | ||
description = new SimpleStringProperty(in.readUTF()); | ||
|
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.
Very minor, but as far as I can see this blank line is unnecessary.
* upstream/master: Don't highlight odd rows in file list editor (#3223) Fix assertion by removing typo (#3220) Update assertion to change of online reference (#3221) Put in null return Reformatted code, renamed method, added try/catch Fix null return Changed from Path to Optional<Path> Added logic to check whether linked file already exists
I just discovered that there is additional space between the icon and the file name if the file doesn't have a description. Can you please fix this. Thanks! |
Fixed in master. |
* upstream/master: (188 commits) Show file description only if not empty Add file description to gui and fix sync bug (#3210) Don't highlight odd rows in file list editor (#3223) Fix assertion by removing typo (#3220) Update assertion to change of online reference (#3221) Put in null return Reformatted code, renamed method, added try/catch Add tests for removal changes Improve telemetry (#3218) Real test linking real other entry (#3214) Check for explicit group at different location Update java-string-similarity from 0.24 -> 1.0.0 Only remove ExplicitGroups from entries, but not keyword-based groups Localization: French: Translation of a new string (#3212) Fix null return Changed from Path to Optional<Path> Fix #2775: Hyphens in last names are properly parsed (#3209) Followup to Issue #3167 (#3202) Remove unused import in GroupTreeNode Move getEntriesInGroup to GroupTreeNode ...
Fixes #3208
gradle localizationUpdate
?