Skip to content
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

Preferences ui cleanup B #9866

Merged
merged 37 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cf5f82b
Introduced library preferences tab
calixtus May 8, 2023
d555ffa
Moved language setting to AppearanceTab
calixtus May 9, 2023
75e551a
Changed theme radio buttons to combobox
calixtus May 9, 2023
0d5f846
Moved four settings to AppearanceTab
calixtus May 9, 2023
c1bf900
Removed GeneralTab, moved memory stick button to prefs toolbar
calixtus May 9, 2023
949bff2
Moved default library to EntryTab
calixtus May 9, 2023
ea38b9b
Moved telemetry prefs to AppearanceTab
calixtus May 9, 2023
6cf3d9d
Moved default library to LibraryTab
calixtus May 9, 2023
6dd2c76
Fixed AppearancePreferences
calixtus May 9, 2023
7ea1fdc
Moved memory stick mode to InternalPreferences
calixtus May 9, 2023
70571ba
Moved language to AppearancePreferences
calixtus May 9, 2023
c889560
Renamed GeneralPreferences to LibraryPreferences, moved reformatting …
calixtus May 9, 2023
adf7cdb
Fixed ui
calixtus May 9, 2023
4ce19e4
CHANGELOG.md
calixtus May 9, 2023
137710a
Fixed backup branch merge conflicts
calixtus May 9, 2023
455edf5
Fixed backup branch merge conflicts
calixtus May 9, 2023
5cd19df
Fixed checkstyle
calixtus May 9, 2023
8cf533a
Reworded getGeneralPreferences
calixtus May 9, 2023
0b69aa4
Fixed ThemeManagerTest
calixtus May 9, 2023
8332684
Polished KeyBindingsTab
calixtus May 10, 2023
8106f87
Added missing symbols in CustomImporter/ExporterTab
calixtus May 10, 2023
cbc76f0
Added small border to combobox popups
calixtus May 10, 2023
f857059
Merge remote-tracking branch 'upstream/main' into library_prefs
calixtus May 10, 2023
47e4ef1
CHANGELOG.md
calixtus May 10, 2023
e178ef4
l10n
calixtus May 10, 2023
cb02a2e
Merge remote-tracking branch 'upstream/main' into library_prefs
calixtus May 10, 2023
4a54aa0
Reworded AppearanceTab to WorkspaceTab
calixtus May 10, 2023
aabf62d
Reworded AppearanceTab to WorkspaceTab
calixtus May 10, 2023
c0e52fe
Merged WorkspaceTab and LibraryTab
calixtus May 10, 2023
bc5c4fc
Moved Autocompletion to new tab and moved Custom tab editor to EntryE…
calixtus May 10, 2023
cb5ce9f
CHANGELOG.md
calixtus May 10, 2023
d81d37f
Merge branch 'main' into library_prefs
koppor May 12, 2023
beb59e2
Readded Hint on 9839
koppor May 12, 2023
e488e3b
Merge branch 'main' into library_prefs
calixtus May 15, 2023
57b0649
Renamed workspace tab back to general tab
calixtus May 15, 2023
df6e42f
Update Javadoc
calixtus May 15, 2023
baf2947
Merge branch 'main' into library_prefs
calixtus May 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved default library to EntryTab
  • Loading branch information
calixtus committed May 9, 2023
commit 949bff2e3f0f9cf6f3a69f2f05880722492bdd64
21 changes: 16 additions & 5 deletions src/main/java/org/jabref/gui/preferences/entry/EntryTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,32 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<fx:root spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="org.jabref.gui.preferences.entry.EntryTab">
<Label styleClass="titleHeader" text="%Entry"/>
<GridPane hgap="10.0" vgap="4.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" percentWidth="30.0"/>
<ColumnConstraints hgrow="SOMETIMES"/>
</columnConstraints>
<Label text="%Default library mode" GridPane.rowIndex="0"/>
<ComboBox fx:id="biblatexMode" prefWidth="200.0" GridPane.rowIndex="0" GridPane.columnIndex="1"/>

<Label styleClass="sectionHeader" text="%Field"/>
<HBox spacing="4" alignment="CENTER_LEFT">
<Label text="%Keyword separator"/>
<TextField fx:id="keywordSeparator" minWidth="30.0" maxWidth="30.0" alignment="CENTER"/>
</HBox>
<Label styleClass="sectionHeader" text="%Field" GridPane.rowIndex="1" GridPane.columnSpan="2"/>

<Label text="%Keyword separator" GridPane.rowIndex="2"/>
<TextField fx:id="keywordSeparator" minWidth="30.0" maxWidth="30.0" alignment="CENTER"
GridPane.rowIndex="2" GridPane.columnIndex="1"/>
</GridPane>

<CheckBox fx:id="resolveStrings" text="%Resolve BibTeX strings"/>
<HBox alignment="CENTER_LEFT" spacing="10.0">
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/jabref/gui/preferences/entry/EntryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;

import org.jabref.gui.actions.ActionFactory;
Expand All @@ -11,14 +12,18 @@
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.preferences.AbstractPreferenceTabView;
import org.jabref.gui.preferences.PreferencesTab;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.help.HelpFile;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;

import com.airhacks.afterburner.views.ViewLoader;
import jakarta.inject.Inject;

public class EntryTab extends AbstractPreferenceTabView<EntryTabViewModel> implements PreferencesTab {

@FXML private ComboBox<BibDatabaseMode> biblatexMode;

@FXML private TextField keywordSeparator;

@FXML private CheckBox resolveStrings;
Expand All @@ -44,6 +49,12 @@ public EntryTab() {
public void initialize() {
this.viewModel = new EntryTabViewModel(preferencesService);

new ViewModelListCellFactory<BibDatabaseMode>()
.withText(BibDatabaseMode::getFormattedName)
.install(biblatexMode);
biblatexMode.itemsProperty().bind(viewModel.biblatexModeListProperty());
biblatexMode.valueProperty().bindBidirectional(viewModel.selectedBiblatexModeProperty());

keywordSeparator.textProperty().bindBidirectional(viewModel.keywordSeparatorProperty());

resolveStrings.selectedProperty().bindBidirectional(viewModel.resolveStringsProperty());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
package org.jabref.gui.preferences.entry;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ListProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;

import org.jabref.gui.preferences.PreferenceTabViewModel;
import org.jabref.logic.bibtex.FieldPreferences;
import org.jabref.logic.preferences.OwnerPreferences;
import org.jabref.logic.preferences.TimestampPreferences;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.preferences.BibEntryPreferences;
import org.jabref.preferences.GeneralPreferences;
import org.jabref.preferences.PreferencesService;

public class EntryTabViewModel implements PreferenceTabViewModel {
private final ListProperty<BibDatabaseMode> bibliographyModeListProperty = new SimpleListProperty<>();
private final ObjectProperty<BibDatabaseMode> selectedBiblatexModeProperty = new SimpleObjectProperty<>();

private final StringProperty keywordSeparatorProperty = new SimpleStringProperty("");

private final BooleanProperty resolveStringsProperty = new SimpleBooleanProperty();
Expand All @@ -30,16 +40,21 @@ public class EntryTabViewModel implements PreferenceTabViewModel {
private final BibEntryPreferences bibEntryPreferences;
private final OwnerPreferences ownerPreferences;
private final TimestampPreferences timestampPreferences;
private final GeneralPreferences generalPreferences;

public EntryTabViewModel(PreferencesService preferencesService) {
this.bibEntryPreferences = preferencesService.getBibEntryPreferences();
this.fieldPreferences = preferencesService.getFieldPreferences();
this.ownerPreferences = preferencesService.getOwnerPreferences();
this.timestampPreferences = preferencesService.getTimestampPreferences();
this.generalPreferences = preferencesService.getGeneralPreferences();
}

@Override
public void setValues() {
bibliographyModeListProperty.setValue(FXCollections.observableArrayList(BibDatabaseMode.values()));
selectedBiblatexModeProperty.setValue(generalPreferences.getDefaultBibDatabaseMode());

keywordSeparatorProperty.setValue(bibEntryPreferences.getKeywordSeparator().toString());

resolveStringsProperty.setValue(fieldPreferences.shouldResolveStrings());
Expand All @@ -56,6 +71,8 @@ public void setValues() {

@Override
public void storeSettings() {
generalPreferences.setDefaultBibDatabaseMode(selectedBiblatexModeProperty.getValue());

bibEntryPreferences.keywordSeparatorProperty().setValue(keywordSeparatorProperty.getValue().charAt(0));

fieldPreferences.setResolveStrings(resolveStringsProperty.getValue());
Expand All @@ -70,6 +87,14 @@ public void storeSettings() {
timestampPreferences.setAddModificationDate(addModificationDateProperty.getValue());
}

public ListProperty<BibDatabaseMode> biblatexModeListProperty() {
return this.bibliographyModeListProperty;
}

public ObjectProperty<BibDatabaseMode> selectedBiblatexModeProperty() {
return this.selectedBiblatexModeProperty;
}

public StringProperty keywordSeparatorProperty() {
return keywordSeparatorProperty;
}
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/jabref/gui/preferences/library/LibraryTab.fxml
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<fx:root spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="org.jabref.gui.preferences.library.LibraryTab">
<Label styleClass="titleHeader" text="%General"/>
<GridPane hgap="10.0" vgap="4.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" percentWidth="30.0"/>
<ColumnConstraints hgrow="SOMETIMES"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
</rowConstraints>

<Label text="%Default library mode" GridPane.rowIndex="2"/>
<ComboBox fx:id="biblatexMode" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
</GridPane>
<CheckBox fx:id="collectTelemetry" text="%Collect and share telemetry data to help improve JabRef"/>

</fx:root>
10 changes: 0 additions & 10 deletions src/main/java/org/jabref/gui/preferences/library/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@

import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;

import org.jabref.gui.preferences.AbstractPreferenceTabView;
import org.jabref.gui.preferences.PreferencesTab;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;

import com.airhacks.afterburner.views.ViewLoader;

public class LibraryTab extends AbstractPreferenceTabView<LibraryTabViewModel> implements PreferencesTab {

@FXML private ComboBox<BibDatabaseMode> biblatexMode;
@FXML private CheckBox collectTelemetry;

public LibraryTab() {
Expand All @@ -31,12 +27,6 @@ public String getTabName() {
public void initialize() {
this.viewModel = new LibraryTabViewModel(dialogService, preferencesService.getGeneralPreferences(), preferencesService.getTelemetryPreferences());

new ViewModelListCellFactory<BibDatabaseMode>()
.withText(BibDatabaseMode::getFormattedName)
.install(biblatexMode);
biblatexMode.itemsProperty().bind(viewModel.biblatexModeListProperty());
biblatexMode.valueProperty().bindBidirectional(viewModel.selectedBiblatexModeProperty());

collectTelemetry.selectedProperty().bindBidirectional(viewModel.collectTelemetryProperty());
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
package org.jabref.gui.preferences.library;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ListProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;

import org.jabref.gui.DialogService;
import org.jabref.gui.preferences.PreferenceTabViewModel;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.preferences.GeneralPreferences;
import org.jabref.preferences.TelemetryPreferences;

public class LibraryTabViewModel implements PreferenceTabViewModel {
private final ListProperty<BibDatabaseMode> bibliographyModeListProperty = new SimpleListProperty<>();
private final ObjectProperty<BibDatabaseMode> selectedBiblatexModeProperty = new SimpleObjectProperty<>();

private final BooleanProperty collectTelemetryProperty = new SimpleBooleanProperty();

Expand All @@ -32,25 +24,13 @@ public LibraryTabViewModel(DialogService dialogService, GeneralPreferences gener
}

public void setValues() {
bibliographyModeListProperty.setValue(FXCollections.observableArrayList(BibDatabaseMode.values()));
selectedBiblatexModeProperty.setValue(generalPreferences.getDefaultBibDatabaseMode());

collectTelemetryProperty.setValue(telemetryPreferences.shouldCollectTelemetry());
}

public void storeSettings() {
generalPreferences.setDefaultBibDatabaseMode(selectedBiblatexModeProperty.getValue());
telemetryPreferences.setCollectTelemetry(collectTelemetryProperty.getValue());
}

public ListProperty<BibDatabaseMode> biblatexModeListProperty() {
return this.bibliographyModeListProperty;
}

public ObjectProperty<BibDatabaseMode> selectedBiblatexModeProperty() {
return this.selectedBiblatexModeProperty;
}

public BooleanProperty collectTelemetryProperty() {
return this.collectTelemetryProperty;
}
Expand Down