-
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
55e3d1d
Add file description to gui
Siedlerchr d985361
Merge remote-tracking branch 'upstream/master' into fileDescr
Siedlerchr 23c6ac6
add properties to LinkedFiel
Siedlerchr 52b5b42
Fix observable
Siedlerchr 3197713
add tooltip again
Siedlerchr e05f8b0
Merge remote-tracking branch 'upstream/master' into fileDescr
Siedlerchr f767625
add automatically found to observables
Siedlerchr c517843
Merge remote-tracking branch 'upstream/master' into fileDescr
Siedlerchr 4cf1a6d
Remove some empty lines
Siedlerchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/test/java/org/jabref/model/entry/FileFieldBibEntryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.jabref.model.entry; | ||
|
||
import org.jabref.logic.exporter.BibtexDatabaseWriter; | ||
import org.jabref.logic.exporter.SaveException; | ||
import org.jabref.logic.exporter.SavePreferences; | ||
import org.jabref.logic.exporter.StringSaveSession; | ||
import org.jabref.logic.util.OS; | ||
import org.jabref.model.Defaults; | ||
import org.jabref.model.database.BibDatabase; | ||
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.metadata.MetaData; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class FileFieldBibEntryTest { | ||
|
||
private BibEntry emptyEntry; | ||
|
||
@Before | ||
public void setUp() { | ||
emptyEntry = new BibEntry(); | ||
emptyEntry.setType("article"); | ||
emptyEntry.setChanged(false); | ||
} | ||
|
||
@Test | ||
public void testFileFieldSerialization() { | ||
LinkedFile file = new LinkedFile("test", "/home/uers/test.pdf", "PDF"); | ||
emptyEntry.addFile(file); | ||
|
||
assertEquals("@article{,\n" + | ||
" file = {test:/home/uers/test.pdf:PDF}\n" + | ||
"}", emptyEntry.toString()); | ||
} | ||
|
||
@Test | ||
public void testFileFieldSerializationDatabase() throws SaveException { | ||
BibDatabase database = new BibDatabase(); | ||
|
||
LinkedFile file = new LinkedFile("test", "/home/uers/test.pdf", "PDF"); | ||
emptyEntry.addFile(file); | ||
database.insertEntries(emptyEntry); | ||
|
||
BibtexDatabaseWriter<StringSaveSession> databaseWriter = new BibtexDatabaseWriter<>(StringSaveSession::new); | ||
StringSaveSession saveSession = databaseWriter.savePartOfDatabase( | ||
new BibDatabaseContext(database, new MetaData(), new Defaults()), database.getEntries(), | ||
new SavePreferences()); | ||
|
||
assertEquals(OS.NEWLINE + | ||
"@Article{," | ||
+ OS.NEWLINE | ||
+ " file = {test:/home/uers/test.pdf:PDF}," | ||
+ OS.NEWLINE | ||
+ "}" + OS.NEWLINE | ||
+ OS.NEWLINE | ||
+ "@Comment{jabref-meta: databaseType:bibtex;}" + OS.NEWLINE, saveSession.getStringValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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...