-
-
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 change listener to main table to scroll to imported entry #5421
Changes from 2 commits
cae560e
bb1b11d
12b943d
f233a91
9f53fd5
4f5ebc6
983262c
7d41097
c17d202
aa48000
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
import org.jabref.gui.undo.UndoableInsertEntry; | ||
import org.jabref.gui.util.ControlHelper; | ||
import org.jabref.gui.util.CustomLocalDragboard; | ||
import org.jabref.gui.util.DefaultTaskExecutor; | ||
import org.jabref.gui.util.ViewModelTableRowFactory; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.logic.util.UpdateField; | ||
|
@@ -112,6 +113,15 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, | |
// Enable sorting | ||
model.getEntriesFilteredAndSorted().comparatorProperty().bind(this.comparatorProperty()); | ||
|
||
model.getEntriesFilteredAndSorted().addListener( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although it is a neat idea to use the listener, I'm afraid that it does not work as intended. The listener is also triggered if I clear a search as then a bunch of previously filtered-out entries are readded to the list. What should work is if you add a listener to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran into multiple race conditions after I added a change listener to the internal observable list of bib entries in the database. Therefore I choose to introduce a new event that is sent over the event bus when the insertion of one or many entries is finished. |
||
(ListChangeListener<BibEntryTableViewModel>) change -> { | ||
if (change.next()) { | ||
if (change.wasAdded()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please also add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's covered by |
||
DefaultTaskExecutor.runInJavaFXThread(() -> clearAndSelect(change.getAddedSubList().get(0).getEntry())); | ||
} | ||
} | ||
}); | ||
|
||
this.panel = panel; | ||
|
||
pane = new ScrollPane(this); | ||
|
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 change log is mostly for our users and most of them don't know what a "change listener" is ;-). Please reformulate this a bit more user-friendly.
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.
Done.