diff --git a/src/main/java/org/jabref/gui/groups/GroupDialogView.java b/src/main/java/org/jabref/gui/groups/GroupDialogView.java index 4c07436ccb5..ea8922d22a0 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialogView.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialogView.java @@ -203,10 +203,11 @@ public void initialize() { searchRadioButton.selectedProperty().bindBidirectional(viewModel.typeSearchProperty()); autoRadioButton.selectedProperty().bindBidirectional(viewModel.typeAutoProperty()); texRadioButton.selectedProperty().bindBidirectional(viewModel.typeTexProperty()); - popularityButton.selectedProperty().bindBidirectional(viewModel.typePopularityProperty()); + popularityButton.disableProperty().bind(viewModel.trackViewsEnabledProperty().not()); timePeriodCombo.setItems(FXCollections.observableArrayList("Last week", "Last month", "Last year", "All time")); maxEntriesCombo.setItems(FXCollections.observableArrayList(10, 20, 50, 100, 999)); + timePeriodCombo.visibleProperty().bind(popularityButton.selectedProperty()); maxEntriesCombo.visibleProperty().bind(popularityButton.selectedProperty()); diff --git a/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java b/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java index 86218cc802a..5465459a8c1 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java @@ -28,6 +28,7 @@ import org.jabref.gui.icon.IconTheme; import org.jabref.gui.importer.actions.SearchGroupsMigrationAction; import org.jabref.gui.preferences.GuiPreferences; +import org.jabref.gui.preferences.entry.EntryTabViewModel; import org.jabref.gui.util.FileDialogConfiguration; import org.jabref.logic.auxparser.DefaultAuxParser; import org.jabref.logic.groups.DefaultGroupsFactory; @@ -582,10 +583,6 @@ public BooleanProperty typeTexProperty() { return typeTexProperty; } - public BooleanProperty typePopularityProperty(){ - return typePopularityProperty; - } - public StringProperty keywordGroupSearchTermProperty() { return keywordGroupSearchTermProperty; } @@ -649,4 +646,8 @@ private boolean groupOrSubgroupIsSearchGroup(GroupTreeNode groupTreeNode) { } return false; } + + public BooleanProperty trackViewsEnabledProperty() { + return EntryTabViewModel.trackViewsProperty(); + } } diff --git a/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java b/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java index e2202142cbd..a32bfbd551c 100644 --- a/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java +++ b/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java @@ -20,7 +20,7 @@ public class EntryTab extends AbstractPreferenceTabView implements PreferencesTab { - + @FXML public CheckBox trackViews; @FXML private TextField keywordSeparator; @@ -70,6 +70,11 @@ public void initialize() { addCreationDate.selectedProperty().bindBidirectional(viewModel.addCreationDateProperty()); addModificationDate.selectedProperty().bindBidirectional(viewModel.addModificationDateProperty()); + trackViews.selectedProperty().bindBidirectional(viewModel.trackViewsProperty()); + + trackViews.selectedProperty().addListener((observable, oldValue, newValue) -> { + viewModel.setTrackViewsEnabled(newValue); + }); ActionFactory actionFactory = new ActionFactory(); actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.OWNER, dialogService, preferences.getExternalApplicationsPreferences()), markOwnerHelp); @@ -79,4 +84,8 @@ public void initialize() { public String getTabName() { return Localization.lang("Entry"); } + + public CheckBox getTrackViews() { + return trackViews; + } } diff --git a/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java b/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java index 2f6fbbe9aa0..38676759cf8 100644 --- a/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java @@ -26,6 +26,7 @@ public class EntryTabViewModel implements PreferenceTabViewModel { private final BooleanProperty markOwnerOverwriteProperty = new SimpleBooleanProperty(); private final BooleanProperty addCreationDateProperty = new SimpleBooleanProperty(); private final BooleanProperty addModificationDateProperty = new SimpleBooleanProperty(); + private static final BooleanProperty trackViewsProperty = new SimpleBooleanProperty(); private final FieldPreferences fieldPreferences; private final BibEntryPreferences bibEntryPreferences; @@ -110,4 +111,16 @@ public BooleanProperty addCreationDateProperty() { public BooleanProperty addModificationDateProperty() { return addModificationDateProperty; } + + public static BooleanProperty trackViewsProperty() { + return trackViewsProperty; + } + + public boolean isTrackViewsEnabled() { + return trackViewsProperty.get(); + } + + public void setTrackViewsEnabled(boolean enabled) { + trackViewsProperty.set(enabled); + } }