Skip to content

Commit

Permalink
Remove UI ThreadList for maintable as it prevents sorting in maintable (
Browse files Browse the repository at this point in the history
#4964)

* Remove UI ThreadList for maintable as it prevents sorting in maintable

Fixes #4886

* fix checkstyle

* wrap around original entries
  • Loading branch information
Siedlerchr authored May 11, 2019
1 parent 2c10284 commit 3baa6bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableInsertEntry;
import org.jabref.gui.util.BindingsHelper;
import org.jabref.gui.util.CustomLocalDragboard;
import org.jabref.gui.util.ViewModelTableRowFactory;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -109,7 +108,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame,
}
this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

this.setItems(BindingsHelper.forUI(model.getEntriesFilteredAndSorted()));
this.setItems(model.getEntriesFilteredAndSorted());
// Enable sorting
model.getEntriesFilteredAndSorted().comparatorProperty().bind(this.comparatorProperty());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public class MainTableDataModel {
private final SortedList<BibEntryTableViewModel> entriesSorted;

public MainTableDataModel(BibDatabaseContext context) {
ObservableList<BibEntry> allEntries = context.getDatabase().getEntries();

ObservableList<BibEntry> allEntries = BindingsHelper.forUI(context.getDatabase().getEntries());
ObservableList<BibEntryTableViewModel> entriesViewModel = BindingsHelper.mapBacked(allEntries, BibEntryTableViewModel::new);

entriesFiltered = new FilteredList<>(entriesViewModel);
entriesFiltered.predicateProperty().bind(
Bindings.createObjectBinding(() -> this::isMatched,
Expand Down

0 comments on commit 3baa6bd

Please sign in to comment.