Skip to content

Commit

Permalink
UiThreadHelper package-private and usage of UiThreadListDecorator onl…
Browse files Browse the repository at this point in the history
…y in View not in Model
  • Loading branch information
r0light committed Sep 9, 2019
1 parent c902c1f commit 96b9aa5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.gui.util.uithreadaware.UiThreadListDecorator;
import org.jabref.logic.integrity.FieldCheckers;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
Expand All @@ -51,6 +52,7 @@ public class LinkedFilesEditor extends HBox implements FieldEditorFX {

private final DialogService dialogService;
private final BibDatabaseContext databaseContext;
private final UiThreadListDecorator<LinkedFileViewModel> decoratedModelList;

public LinkedFilesEditor(Field field, DialogService dialogService, BibDatabaseContext databaseContext, TaskExecutor taskExecutor, AutoCompleteSuggestionProvider<?> suggestionProvider,
FieldCheckers fieldCheckers,
Expand All @@ -74,7 +76,8 @@ public LinkedFilesEditor(Field field, DialogService dialogService, BibDatabaseCo

listView.setCellFactory(cellFactory);

Bindings.bindContentBidirectional(listView.itemsProperty().get(), viewModel.filesProperty());
decoratedModelList = new UiThreadListDecorator<>(viewModel.filesProperty());
Bindings.bindContentBidirectional(listView.itemsProperty().get(), decoratedModelList);
setUpKeyBindings();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.jabref.gui.util.BindingsHelper;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.uithreadaware.UiThreadListDecorator;
import org.jabref.logic.importer.FulltextFetchers;
import org.jabref.logic.integrity.FieldCheckers;
import org.jabref.logic.l10n.Localization;
Expand All @@ -44,7 +43,7 @@

public class LinkedFilesEditorViewModel extends AbstractEditorViewModel {

private final ListProperty<LinkedFileViewModel> files = new SimpleListProperty<>(new UiThreadListDecorator<>(FXCollections.observableArrayList(LinkedFileViewModel::getObservables)));
private final ListProperty<LinkedFileViewModel> files = new SimpleListProperty<>(FXCollections.observableArrayList(LinkedFileViewModel::getObservables));
private final BooleanProperty fulltextLookupInProgress = new SimpleBooleanProperty(false);
private final DialogService dialogService;
private final BibDatabaseContext databaseContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import javafx.application.Platform;

public class UiThreadHelper {
class UiThreadHelper {

static void ensureUiThreadExecution(Runnable task) {
if (Platform.isFxApplicationThread()) {
Expand Down

0 comments on commit 96b9aa5

Please sign in to comment.