Skip to content

Commit

Permalink
Minor code improvements in library properties dialog (#9265)
Browse files Browse the repository at this point in the history
Mainly changing an observable list to an ordinary readonly list, which is sufficient and slightly more performant.
  • Loading branch information
tobiasdiez authored Oct 20, 2022
1 parent b969f6f commit eee8322
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.jabref.gui.libraryproperties;

import javafx.beans.property.ReadOnlyListWrapper;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import java.util.List;

import org.jabref.gui.libraryproperties.constants.ConstantsPropertiesView;
import org.jabref.gui.libraryproperties.general.GeneralPropertiesView;
Expand All @@ -12,10 +10,10 @@

public class LibraryPropertiesViewModel {

private final ObservableList<PropertiesTab> propertiesTabs;
private final List<PropertiesTab> propertiesTabs;

public LibraryPropertiesViewModel(BibDatabaseContext databaseContext) {
propertiesTabs = FXCollections.observableArrayList(
propertiesTabs = List.of(
new GeneralPropertiesView(databaseContext),
new SavingPropertiesView(databaseContext),
new ConstantsPropertiesView(databaseContext),
Expand All @@ -35,7 +33,7 @@ public void storeAllSettings() {
}
}

public ObservableList<PropertiesTab> getPropertiesTabs() {
return new ReadOnlyListWrapper<>(propertiesTabs);
public List<PropertiesTab> getPropertiesTabs() {
return propertiesTabs;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import javafx.scene.control.TextField;

import org.jabref.gui.libraryproperties.AbstractPropertiesTabView;
import org.jabref.gui.libraryproperties.PropertiesTab;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
Expand All @@ -20,7 +19,7 @@
import com.airhacks.afterburner.views.ViewLoader;
import jakarta.inject.Inject;

public class GeneralPropertiesView extends AbstractPropertiesTabView<GeneralPropertiesViewModel> implements PropertiesTab {
public class GeneralPropertiesView extends AbstractPropertiesTabView<GeneralPropertiesViewModel> {
@FXML private ComboBox<Charset> encoding;
@FXML private ComboBox<BibDatabaseMode> databaseMode;
@FXML private TextField generalFileDirectory;
Expand Down

0 comments on commit eee8322

Please sign in to comment.