From 63634b08b5429f07a7efe3ac017c0aa135f5d622 Mon Sep 17 00:00:00 2001 From: core-master <49909555+core-master@users.noreply.github.com> Date: Mon, 29 Apr 2019 23:22:58 +0200 Subject: [PATCH] Ui preferences global modifications (#4926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rework PosteOpenActions to javafx (custom entry type import) Convert dialog for importing custom entry types to CheckListView Rework threading when opening a database * rework threading stuff simplify code * rework dialog, create fxml etc fix l10n Remove obsolete code * remove dialog service argument * remove dialogService parameter * Fixes throwing an exception when 'id' field is present in bib file (#4918) * Fixes throwing an exception when 'id' field is present in bib file Fixes #4905 * Remove test for id field * Renamed ID_FIELD to INTERNAL_ID_FIELD * Removed unused import * Toggle enable status of menu items (#4872) * Toggle enable status of menu items (prototype) * Use for pushtoapplication * Improve code around push to applications * Set enable status for all actions * Fix tests and checkstyle * Refactorings, move functionality of CustomEntryTypesManager to Preferences Use ObservableList instead of LIstProperty * Fix for the issue #4912 (#4916) * Fix for the issue #4912 Apostrophe character removed from KEY_ILLEGAL_CHARACTERS in BibtexKeyGenerator * Add special character to KEY_ILLEGAL_CHARACTERS สน added to KEY_ILLEGAL_CHARACTERS and an assertion has been added in testMakeLabelAndCheckLegalKeysAccentGrave * Preferences->General Tab : UI improvement * Preferences-> General and File tab : UI improvement * Preferences -> Network tab : UI improvement * Preferences -> Appearance tab : UI improvement * Prefenrences -> Groups tab : UI improvement * Preferences -> EntryEditors tab : separators readjustment * imports simplification for checkstyle * minors imports modifications for checkstyle constraint * minors imports modifications for checkstyle constraint --- .../jabref/gui/preferences/AdvancedTab.java | 14 ++-- .../gui/preferences/AppearancePrefsTab.java | 26 +++++-- .../gui/preferences/EntryEditorPrefsTab.java | 61 +++++++++++----- .../jabref/gui/preferences/ExternalTab.java | 59 ++++++++++----- .../org/jabref/gui/preferences/FileTab.java | 73 +++++++++++-------- .../jabref/gui/preferences/GeneralTab.java | 68 +++++++++-------- .../gui/preferences/GroupsPrefsTab.java | 30 +++++--- .../gui/preferences/ImportSettingsTab.java | 2 - .../jabref/gui/preferences/NetworkTab.java | 47 +++++++++--- .../gui/preferences/PreferencesDialog.fxml | 2 +- 10 files changed, 241 insertions(+), 141 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/AdvancedTab.java b/src/main/java/org/jabref/gui/preferences/AdvancedTab.java index 6bb9afda5e0..829b1a8e97e 100644 --- a/src/main/java/org/jabref/gui/preferences/AdvancedTab.java +++ b/src/main/java/org/jabref/gui/preferences/AdvancedTab.java @@ -2,6 +2,7 @@ import java.util.Optional; +import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; @@ -44,7 +45,8 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) { this.dialogService = dialogService; preferences = prefs; remotePreferences = prefs.getRemotePreferences(); - builder.setVgap(5); + builder.setVgap(7); + useRemoteServer = new CheckBox(Localization.lang("Listen for remote operation on port") + ':'); useIEEEAbrv = new CheckBox(Localization.lang("Use IEEE LaTeX abbreviations")); remoteServerPort = new TextField(); @@ -61,17 +63,15 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) { builder.add(textRemote, 2, 4); HBox p = new HBox(); - p.getChildren().add(useRemoteServer); - p.getChildren().add(remoteServerPort); - + p.setSpacing(8); + p.setAlignment(Pos.CENTER_LEFT); ActionFactory factory = new ActionFactory(preferences.getKeyBindingRepository()); Button help = factory.createIconButton(StandardActions.HELP, new HelpAction(HelpFile.REMOTE)); help.setMaxWidth(Double.MAX_VALUE); - p.getChildren().add(help); - + p.getChildren().setAll(useRemoteServer, remoteServerPort, help); builder.add(p, 2, 6); - builder.add(new Separator(), 2, 11); + builder.add(new Separator(), 2, 11); Label explore = new Label(Localization.lang("Search %0", "IEEEXplore")); explore.getStyleClass().add("sectionHeader"); builder.add(explore, 2, 12); diff --git a/src/main/java/org/jabref/gui/preferences/AppearancePrefsTab.java b/src/main/java/org/jabref/gui/preferences/AppearancePrefsTab.java index 1ad4e79b854..ae697887ca7 100644 --- a/src/main/java/org/jabref/gui/preferences/AppearancePrefsTab.java +++ b/src/main/java/org/jabref/gui/preferences/AppearancePrefsTab.java @@ -1,15 +1,15 @@ package org.jabref.gui.preferences; -import javafx.geometry.Insets; +import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; import javafx.scene.control.ToggleGroup; +import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; import org.jabref.gui.DialogService; import org.jabref.gui.util.ControlHelper; @@ -24,10 +24,10 @@ class AppearancePrefsTab extends Pane implements PrefsTab { private final CheckBox fontTweaksLAF; private final TextField fontSize; private final CheckBox overrideFonts; - private final VBox container = new VBox(); private final DialogService dialogService; private final RadioButton lightTheme; private final RadioButton darkTheme; + private final GridPane builder = new GridPane(); /** * Customization of appearance parameters. @@ -37,14 +37,12 @@ class AppearancePrefsTab extends Pane implements PrefsTab { public AppearancePrefsTab(DialogService dialogService, JabRefPreferences prefs) { this.dialogService = dialogService; this.prefs = prefs; + builder.setVgap(8); overrideFonts = new CheckBox(Localization.lang("Override default font settings")); fontSize = new TextField(); fontSize.setTextFormatter(ControlHelper.getIntegerTextFormatter()); Label fontSizeLabel = new Label(Localization.lang("Font size:")); - HBox fontSizeContainer = new HBox(fontSizeLabel, fontSize); - VBox.setMargin(fontSizeContainer, new Insets(0, 0, 0, 35)); - fontSizeContainer.disableProperty().bind(overrideFonts.selectedProperty().not()); fontTweaksLAF = new CheckBox(Localization.lang("Tweak font rendering for entry editor on Linux")); ToggleGroup themeGroup = new ToggleGroup(); @@ -60,12 +58,24 @@ public AppearancePrefsTab(DialogService dialogService, JabRefPreferences prefs) darkTheme.setSelected(true); } - container.getChildren().addAll(overrideFonts, fontSizeContainer, fontTweaksLAF, lightTheme, darkTheme); + // Font configuration + HBox fontBox = new HBox(); + fontBox.setSpacing(10); + fontBox.setAlignment(Pos.CENTER_LEFT); + fontBox.getChildren().setAll(overrideFonts, fontSizeLabel, fontSize); + builder.add(fontBox, 1, 2); + + // Theme configuration + HBox themeBox = new HBox(); + themeBox.setSpacing(10); + themeBox.setAlignment(Pos.CENTER_LEFT); + themeBox.getChildren().setAll(lightTheme, darkTheme); + builder.add(themeBox, 1, 4); } @Override public Node getBuilder() { - return container; + return builder; } @Override diff --git a/src/main/java/org/jabref/gui/preferences/EntryEditorPrefsTab.java b/src/main/java/org/jabref/gui/preferences/EntryEditorPrefsTab.java index 2fd8a9a6653..4b7b840306c 100644 --- a/src/main/java/org/jabref/gui/preferences/EntryEditorPrefsTab.java +++ b/src/main/java/org/jabref/gui/preferences/EntryEditorPrefsTab.java @@ -50,6 +50,7 @@ class EntryEditorPrefsTab extends Pane implements PrefsTab { public EntryEditorPrefsTab(JabRefPreferences prefs) { this.prefs = prefs; autoCompletePreferences = prefs.getAutoCompletePreferences(); + builder.setVgap(7); autoOpenForm = new CheckBox(Localization.lang("Open editor when a new entry is created")); defSource = new CheckBox(Localization.lang("Show BibTeX source by default")); @@ -82,10 +83,12 @@ public EntryEditorPrefsTab(JabRefPreferences prefs) { // autoCompFields text field: autoComplete.setOnAction(event -> setAutoCompleteElementsEnabled(autoComplete.isSelected())); + // Editor options title Label editorOptions = new Label(Localization.lang("Editor options")); editorOptions.getStyleClass().add("sectionHeader"); builder.add(editorOptions, 1, 1); - builder.add(new Separator(), 2, 1); + + // Editor options configuration builder.add(autoOpenForm, 1, 2); builder.add(defSource, 1, 3); builder.add(emacsMode, 1, 4); @@ -96,49 +99,67 @@ public EntryEditorPrefsTab(JabRefPreferences prefs) { builder.add(validation, 1, 9); builder.add(new Label(""), 1, 10); + builder.add(new Separator(), 1, 13); + + // Autocompletion options title Label autocompletionOptions = new Label(Localization.lang("Autocompletion options")); autocompletionOptions.getStyleClass().add("sectionHeader"); - builder.add(autocompletionOptions, 1, 10); - builder.add(autoComplete, 1, 11); + builder.add(autocompletionOptions, 1, 15); + builder.add(autoComplete, 1, 16); Label useFields = new Label(" " + Localization.lang("Use autocompletion for the following fields") + ":"); - builder.add(useFields, 1, 12); - builder.add(autoCompFields, 2, 12); - builder.add(new Label(""), 1, 13); + builder.add(useFields, 1, 17); + builder.add(autoCompFields, 2, 17); + builder.add(new Label(""), 1, 18); + builder.add(new Separator(), 1, 21); + + // Name format title Label nameFormat = new Label(Localization.lang("Name format used for autocompletion")); nameFormat.getStyleClass().add("sectionHeader"); + builder.add(nameFormat, 1, 23); + + // Name format configuration final ToggleGroup autocompletionToggleGroup = new ToggleGroup(); - builder.add(nameFormat, 1, 14); - builder.add(autoCompFF, 1, 15); - builder.add(autoCompLF, 1, 16); - builder.add(autoCompBoth, 1, 17); + builder.add(autoCompFF, 1, 24); + builder.add(autoCompLF, 1, 25); + builder.add(autoCompBoth, 1, 26); autoCompFF.setToggleGroup(autocompletionToggleGroup); autoCompLF.setToggleGroup(autocompletionToggleGroup); autoCompBoth.setToggleGroup(autocompletionToggleGroup); - builder.add(new Label(""), 1, 18); + builder.add(new Label(""), 1, 27); + builder.add(new Separator(), 1, 30); + + // Treatement of first names title Label treatment = new Label(Localization.lang("Treatment of first names")); treatment.getStyleClass().add("sectionHeader"); + builder.add(treatment, 1, 32); + + // Treatment of first names configuration final ToggleGroup treatmentOfFirstNamesToggleGroup = new ToggleGroup(); - builder.add(treatment, 1, 19); - builder.add(firstNameModeAbbr, 1, 20); - builder.add(firstNameModeFull, 1, 21); - builder.add(firstNameModeBoth, 1, 22); + builder.add(firstNameModeAbbr, 1, 33); + builder.add(firstNameModeFull, 1, 34); + builder.add(firstNameModeBoth, 1, 35); firstNameModeAbbr.setToggleGroup(treatmentOfFirstNamesToggleGroup); firstNameModeFull.setToggleGroup(treatmentOfFirstNamesToggleGroup); firstNameModeBoth.setToggleGroup(treatmentOfFirstNamesToggleGroup); - final ToggleGroup group = new ToggleGroup(); + builder.add(new Separator(), 1, 38); + + // Default drag & drop title Label linkFileOptions = new Label(Localization.lang("Default drag & drop action")); linkFileOptions.getStyleClass().add("sectionHeader"); + builder.add(linkFileOptions, 1, 40); + + // Default drag & drop configuration + final ToggleGroup group = new ToggleGroup(); copyFile = new RadioButton(Localization.lang("Copy file to default file folder")); linkFile = new RadioButton(Localization.lang("Link file (without copying)")); renameCopyFile = new RadioButton(Localization.lang("Copy, rename and link file")); - builder.add(linkFileOptions, 1, 23); - builder.add(copyFile, 1, 24); - builder.add(linkFile, 1, 25); - builder.add(renameCopyFile, 1, 26); + builder.add(copyFile, 1, 41); + builder.add(linkFile, 1, 42); + builder.add(renameCopyFile, 1, 43); copyFile.setToggleGroup(group); linkFile.setToggleGroup(group); renameCopyFile.setToggleGroup(group); diff --git a/src/main/java/org/jabref/gui/preferences/ExternalTab.java b/src/main/java/org/jabref/gui/preferences/ExternalTab.java index 381ece611a8..08094d037f5 100644 --- a/src/main/java/org/jabref/gui/preferences/ExternalTab.java +++ b/src/main/java/org/jabref/gui/preferences/ExternalTab.java @@ -1,13 +1,16 @@ package org.jabref.gui.preferences; +import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; +import javafx.scene.control.Separator; import javafx.scene.control.TextField; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; import org.jabref.Globals; import org.jabref.gui.DialogService; @@ -52,6 +55,8 @@ class ExternalTab implements PrefsTab { public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPreferences prefs) { this.prefs = prefs; dialogService = frame.getDialogService(); + builder.setVgap(7); + Button editFileTypes = new Button(Localization.lang("Manage external file types")); citeCommand = new TextField(); editFileTypes.setOnAction(e -> new EditExternalFileTypesAction().execute()); @@ -118,20 +123,28 @@ public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPrefere pdfOptionPanel.add(browseSumatraReader, 3, 2); } + // Sending of emails title Label sendingOfEmails = new Label(Localization.lang("Sending of emails")); sendingOfEmails.getStyleClass().add("sectionHeader"); builder.add(sendingOfEmails, 1, 1); + + // Sending of emails configuration + HBox sendRefMailBox = new HBox(); + sendRefMailBox.setSpacing(8); + sendRefMailBox.setAlignment(Pos.CENTER_LEFT); Label subject = new Label(Localization.lang("Subject for sending an email with references").concat(":")); builder.add(subject, 1, 2); - emailSubject = new TextField(); - builder.add(emailSubject, 2, 2); openFoldersOfAttachedFiles = new CheckBox(Localization.lang("Automatically open folders of attached files")); - builder.add(openFoldersOfAttachedFiles, 1, 3); + emailSubject = new TextField(); + sendRefMailBox.getChildren().setAll(openFoldersOfAttachedFiles, emailSubject); + builder.add(sendRefMailBox, 1, 3); + + builder.add(new Separator(), 1, 7); - builder.add(new Label(""), 1, 4); + // External programs title Label externalPrograms = new Label(Localization.lang("External programs")); externalPrograms.getStyleClass().add("sectionHeader"); - builder.add(externalPrograms, 1, 5); + builder.add(externalPrograms, 1, 9); GridPane butpan = new GridPane(); int index = 0; @@ -139,32 +152,42 @@ public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPrefere addSettingsButton(pushToApplication, butpan, index); index++; } + builder.add(butpan, 1, 10); - builder.add(butpan, 1, 6); - + // Cite command configuration + HBox citeCommandBox = new HBox(); + citeCommandBox.setSpacing(10); + citeCommandBox.setAlignment(Pos.CENTER_LEFT); Label citeCommandLabel = new Label(Localization.lang("Cite command") + ':'); - builder.add(citeCommandLabel, 1, 7); - builder.add(citeCommand, 2, 7); - builder.add(editFileTypes, 1, 8); - builder.add(new Label(""), 1, 9); + citeCommandBox.getChildren().setAll(citeCommandLabel, citeCommand, editFileTypes); + builder.add(citeCommandBox, 1, 12); + + builder.add(new Separator(), 1, 16); + + // Open console title Label openConsole = new Label(Localization.lang("Open console")); openConsole.getStyleClass().add("sectionHeader"); - builder.add(openConsole, 1, 10); + builder.add(openConsole, 1, 18); - builder.add(consoleOptionPanel, 1, 11); - builder.add(new Label(""), 1, 12); + builder.add(consoleOptionPanel, 1, 21); + builder.add(new Separator(), 1, 25); + + // Open PDF title Label openPdf = new Label(Localization.lang("Open PDF")); openPdf.getStyleClass().add("sectionHeader"); - builder.add(openPdf, 1, 12); + builder.add(openPdf, 1, 27); + + builder.add(pdfOptionPanel, 1, 29); - builder.add(pdfOptionPanel, 1, 13); + builder.add(new Separator(), 1, 33); + // Open file browser title Label openFileBrowser = new Label(Localization.lang("Open File Browser")); openFileBrowser.getStyleClass().add("sectionHeader"); - builder.add(openFileBrowser, 1, 14); + builder.add(openFileBrowser, 1, 35); - builder.add(fileBrowserOptionPanel, 1, 15); + builder.add(fileBrowserOptionPanel, 1, 36); } diff --git a/src/main/java/org/jabref/gui/preferences/FileTab.java b/src/main/java/org/jabref/gui/preferences/FileTab.java index 060afb272cd..6f005da305a 100644 --- a/src/main/java/org/jabref/gui/preferences/FileTab.java +++ b/src/main/java/org/jabref/gui/preferences/FileTab.java @@ -5,15 +5,18 @@ import java.nio.file.Paths; import javafx.collections.FXCollections; +import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; +import javafx.scene.control.Separator; import javafx.scene.control.TextField; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import org.jabref.gui.DialogService; @@ -62,18 +65,15 @@ class FileTab extends Pane implements PrefsTab { public FileTab(DialogService dialogService, JabRefPreferences prefs) { this.dialogService = dialogService; this.prefs = prefs; + builder.setVgap(7); ActionFactory factory = new ActionFactory(prefs.getKeyBindingRepository()); - - fileDir = new TextField(); - bibLocAsPrimaryDir = new CheckBox(Localization.lang("Use the BIB file location as primary file directory")); bibLocAsPrimaryDir.setAccessibleText(Localization.lang("When downloading files, or moving linked files to the " + "file directory, prefer the BIB file location rather than the file directory set above")); - runAutoFileSearch = new CheckBox( - Localization.lang("When opening file link, search for matching file if no link is defined")); - allowFileAutoOpenBrowse = new CheckBox( - Localization.lang("Automatically open browse dialog when creating new file link")); + + runAutoFileSearch = new CheckBox(Localization.lang("When opening file link, search for matching file if no link is defined")); + allowFileAutoOpenBrowse = new CheckBox(Localization.lang("Automatically open browse dialog when creating new file link")); regExpTextField = new TextField(); useRegExpComboBox = new RadioButton(Localization.lang("Use regular expression search")); useRegExpComboBox.setOnAction(e -> regExpTextField.setEditable(useRegExpComboBox.isSelected())); @@ -100,10 +100,15 @@ public FileTab(DialogService dialogService, JabRefPreferences prefs) { builder.add(general, 1, 1); builder.add(openLast, 1, 2); builder.add(backup, 1, 3); + + HBox notWrapBox = new HBox(); + notWrapBox.setSpacing(15); + notWrapBox.setAlignment(Pos.CENTER_LEFT); Label label = new Label(Localization.lang("Do not wrap the following fields when saving") + ":"); - builder.add(label, 1, 4); + notWrapBox.getChildren().setAll(label, nonWrappableFields); + builder.add(notWrapBox, 1, 4); + final ToggleGroup resolveGroup = new ToggleGroup(); - builder.add(nonWrappableFields, 2, 4); builder.add(resolveStringsStandard, 1, 5); builder.add(resolveStringsAll, 1, 6); builder.add(doNotResolveStringsFor, 2, 6); @@ -113,51 +118,55 @@ public FileTab(DialogService dialogService, JabRefPreferences prefs) { builder.add(newlineSeparatorLabel, 1, 7); builder.add(newlineSeparator, 2, 7); builder.add(reformatFileOnSaveAndExport, 1, 8); - Label invisible = new Label(""); - builder.add(invisible, 1, 9); + builder.add(new Separator(), 1, 13); Label externalFileLinks = new Label(Localization.lang("External file links")); externalFileLinks.getStyleClass().add("sectionHeader"); - builder.add(externalFileLinks, 1, 11); + builder.add(externalFileLinks, 1, 14); + // Main File Directory choice + HBox mainFileDirectoryBox = new HBox(); + mainFileDirectoryBox.setSpacing(10); + mainFileDirectoryBox.setAlignment(Pos.CENTER_LEFT); + fileDir = new TextField(); label = new Label(Localization.lang("Main file directory") + ':'); - builder.add(label, 1, 12); - builder.add(fileDir, 2, 12); - Button browse = new Button(Localization.lang("Browse")); browse.setPrefSize(80, 20); browse.setOnAction(e -> { - DirectoryDialogConfiguration dirDialogConfiguration = new DirectoryDialogConfiguration.Builder() - .withInitialDirectory(Paths.get(fileDir.getText())).build(); + DirectoryDialogConfiguration dirDialogConfiguration = + new DirectoryDialogConfiguration.Builder().withInitialDirectory(Paths.get(fileDir.getText())).build(); dialogService.showDirectorySelectionDialog(dirDialogConfiguration) - .ifPresent(f -> fileDir.setText(f.toString())); + .ifPresent(f -> fileDir.setText(f.toString())); }); - builder.add(browse, 3, 12); - builder.add(bibLocAsPrimaryDir, 1, 13); + mainFileDirectoryBox.getChildren().setAll(label, fileDir, browse); + builder.add(mainFileDirectoryBox, 1, 15); + + builder.add(bibLocAsPrimaryDir, 1, 16); final ToggleGroup autolinkGroup = new ToggleGroup(); - builder.add(matchStartsWithKey, 1, 14); - builder.add(matchExactKeyOnly, 1, 15); - builder.add(useRegExpComboBox, 1, 16); - builder.add(regExpTextField, 2, 16); + builder.add(matchStartsWithKey, 1, 17); + builder.add(matchExactKeyOnly, 1, 18); + builder.add(useRegExpComboBox, 1, 19); + builder.add(regExpTextField, 2, 19); matchStartsWithKey.setToggleGroup(autolinkGroup); matchExactKeyOnly.setToggleGroup(autolinkGroup); useRegExpComboBox.setToggleGroup(autolinkGroup); Button help = factory.createIconButton(StandardActions.HELP_REGEX_SEARCH, new HelpAction(HelpFile.REGEX_SEARCH)); builder.add(help, 3, 16); - builder.add(runAutoFileSearch, 1, 17); - builder.add(allowFileAutoOpenBrowse, 1, 18); - - Label invisible1 = new Label(""); - builder.add(invisible1, 1, 19); + builder.add(runAutoFileSearch, 1, 21); + builder.add(allowFileAutoOpenBrowse, 1, 22); + builder.add(new Separator(), 1, 25); Label autosave = new Label(Localization.lang("Autosave")); autosave.getStyleClass().add("sectionHeader"); - builder.add(autosave, 1, 20); - builder.add(localAutoSave, 1, 21); + builder.add(autosave, 1, 27); + HBox saveAutosaveBox = new HBox(); + saveAutosaveBox.setSpacing(7); + saveAutosaveBox.setAlignment(Pos.CENTER_LEFT); Button helpAutosave = factory.createIconButton(StandardActions.HELP, new HelpAction(HelpFile.AUTOSAVE)); - builder.add(helpAutosave, 2, 21); + saveAutosaveBox.getChildren().setAll(localAutoSave, helpAutosave); + builder.add(saveAutosaveBox, 1, 28); } @Override diff --git a/src/main/java/org/jabref/gui/preferences/GeneralTab.java b/src/main/java/org/jabref/gui/preferences/GeneralTab.java index 4dacdd38e8a..d39715dd410 100644 --- a/src/main/java/org/jabref/gui/preferences/GeneralTab.java +++ b/src/main/java/org/jabref/gui/preferences/GeneralTab.java @@ -4,6 +4,7 @@ import java.time.format.DateTimeFormatter; import javafx.collections.FXCollections; +import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; @@ -11,8 +12,8 @@ import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; -import javafx.scene.shape.Line; import org.jabref.gui.DialogService; import org.jabref.gui.actions.ActionFactory; @@ -57,6 +58,7 @@ class GeneralTab extends Pane implements PrefsTab { public GeneralTab(DialogService dialogService, JabRefPreferences prefs) { this.prefs = prefs; this.dialogService = dialogService; + builder.setVgap(7); ActionFactory factory = new ActionFactory(prefs.getKeyBindingRepository()); @@ -81,52 +83,58 @@ public GeneralTab(DialogService dialogService, JabRefPreferences prefs) { Label general = new Label(Localization.lang("General")); general.getStyleClass().add("sectionHeader"); builder.add(general, 1, 1); - builder.add(new Line(), 1, 2); builder.add(inspectionWarnDupli, 1, 3); - builder.add(new Line(), 1, 4); builder.add(confirmDelete, 1, 5); - builder.add(new Line(), 1, 6); builder.add(enforceLegalKeys, 1, 7); - builder.add(new Line(), 1, 8); builder.add(memoryStick, 1, 9); - // Create a new panel with its own FormLayout for the last items: - builder.add(useOwner, 1, 10); - builder.add(defOwnerField, 2, 10); - builder.add(overwriteOwner, 3, 10); - + // Owner name + HBox ownerBox = new HBox(); + ownerBox.setAlignment(Pos.CENTER_LEFT); + ownerBox.setSpacing(7); Button helpOwner = factory.createIconButton(StandardActions.HELP, new HelpAction(HelpFile.OWNER)); - builder.add(helpOwner, 4, 10); + ownerBox.getChildren().addAll(useOwner, defOwnerField, overwriteOwner, helpOwner); + builder.add(ownerBox, 1, 10); - builder.add(useTimeStamp, 1, 13); - builder.add(timeStampFormat, 2, 13); - builder.add(overwriteTimeStamp, 2, 14); + builder.add(useTimeStamp, 1, 14); + builder.add(timeStampFormat, 1, 16); + builder.add(overwriteTimeStamp, 1, 17); Label fieldName = new Label(Localization.lang("Field name") + ':'); - builder.add(fieldName, 3, 13); - builder.add(timeStampField, 4, 13); + builder.add(fieldName, 1, 19); + builder.add(timeStampField, 1, 21); Button helpTimestamp = factory.createIconButton(StandardActions.HELP, new HelpAction(HelpFile.TIMESTAMP)); - builder.add(helpTimestamp, 6, 13); - - builder.add(updateTimeStamp, 1, 14); - builder.add(new Line(), 1, 15); - - builder.add(shouldCollectTelemetry, 1, 15); - builder.add(new Line(), 1, 16); + builder.add(helpTimestamp, 1, 22); + builder.add(updateTimeStamp, 1, 23); + builder.add(shouldCollectTelemetry, 1, 25); + + // Language configuration + HBox languageBox = new HBox(); + languageBox.setSpacing(115); + languageBox.setAlignment(Pos.CENTER_LEFT); Label languageLabel = new Label(Localization.lang("Language") + ':'); - builder.add(languageLabel, 1, 17); languageSelection.setItems(FXCollections.observableArrayList(Language.values())); new ViewModelListCellFactory() .withText(Language::getDisplayName) .install(languageSelection); - builder.add(languageSelection, 2, 17); - builder.add(new Line(), 2, 18); + languageBox.getChildren().addAll(languageLabel, languageSelection); + builder.add(languageBox, 1, 27); + + // Encoding configuration + HBox encodingBox = new HBox(); + encodingBox.setSpacing(68); + encodingBox.setAlignment(Pos.CENTER_LEFT); Label defaultEncoding = new Label(Localization.lang("Default encoding") + ':'); - builder.add(defaultEncoding, 1, 19); - builder.add(encodings, 2, 19); + encodingBox.getChildren().addAll(defaultEncoding, encodings); + builder.add(encodingBox, 1, 28); + + // Bibliography mode configuration + HBox biblioBox = new HBox(); + biblioBox.setSpacing(10); + biblioBox.setAlignment(Pos.CENTER_LEFT); Label defaultBibliographyMode = new Label(Localization.lang("Default bibliography mode")); - builder.add(defaultBibliographyMode, 1, 20); - builder.add(biblatexMode, 2, 20); + biblioBox.getChildren().addAll(defaultBibliographyMode, biblatexMode); + builder.add(biblioBox, 1, 29); } @Override diff --git a/src/main/java/org/jabref/gui/preferences/GroupsPrefsTab.java b/src/main/java/org/jabref/gui/preferences/GroupsPrefsTab.java index e7086e15e0b..a39c1e159a6 100644 --- a/src/main/java/org/jabref/gui/preferences/GroupsPrefsTab.java +++ b/src/main/java/org/jabref/gui/preferences/GroupsPrefsTab.java @@ -6,6 +6,7 @@ import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; +import javafx.scene.control.Separator; import javafx.scene.control.TextField; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.GridPane; @@ -30,6 +31,7 @@ class GroupsPrefsTab extends Pane implements PrefsTab { public GroupsPrefsTab(JabRefPreferences prefs) { this.prefs = prefs; + builder.setVgap(7); keywordSeparator.setOnAction(new EventHandler() { @Override @@ -41,29 +43,35 @@ public void handle(ActionEvent event) { multiSelectionModeIntersection.setText(Localization.lang("Display only entries belonging to all selected groups.")); multiSelectionModeUnion.setText(Localization.lang("Display all entries belonging to one or more of the selected groups.")); + // View title Label view = new Label(Localization.lang("View")); view.getStyleClass().add("sectionHeader"); builder.add(view, 1, 1); - builder.add(hideNonHits, 2, 2); - builder.add(grayOut, 2, 3); + + // View configuration + builder.add(hideNonHits, 1, 3); + builder.add(grayOut, 1, 4); final ToggleGroup selectionModeGroup = new ToggleGroup(); - builder.add(multiSelectionModeIntersection, 2, 4); - builder.add(multiSelectionModeUnion, 2, 5); + builder.add(multiSelectionModeIntersection, 1, 5); + builder.add(multiSelectionModeUnion, 1, 6); multiSelectionModeIntersection.setToggleGroup(selectionModeGroup); multiSelectionModeUnion.setToggleGroup(selectionModeGroup); - builder.add(autoAssignGroup, 2, 6); - builder.add(new Label(""), 1, 7); + builder.add(autoAssignGroup, 1, 7); + + builder.add(new Separator(), 1, 11); + // Dynamic groups title Label dynamicGroups = new Label(Localization.lang("Dynamic groups")); dynamicGroups.getStyleClass().add("sectionHeader"); - builder.add(dynamicGroups, 1, 8); + builder.add(dynamicGroups, 1, 13); + // Dynamic groups configuration Label defaultGrouping = new Label(Localization.lang("Default grouping field") + ":"); - builder.add(defaultGrouping, 1, 9); - builder.add(groupingField, 2, 9); + builder.add(defaultGrouping, 1, 15); + builder.add(groupingField, 2, 15); Label label = new Label(Localization.lang("When adding/removing keywords, separate them by") + ":"); - builder.add(label, 1, 10); - builder.add(keywordSeparator, 2, 10); + builder.add(label, 1, 17); + builder.add(keywordSeparator, 2, 17); } public Node getBuilder() { diff --git a/src/main/java/org/jabref/gui/preferences/ImportSettingsTab.java b/src/main/java/org/jabref/gui/preferences/ImportSettingsTab.java index 80873eab063..1ad522dd4a7 100644 --- a/src/main/java/org/jabref/gui/preferences/ImportSettingsTab.java +++ b/src/main/java/org/jabref/gui/preferences/ImportSettingsTab.java @@ -6,7 +6,6 @@ import javafx.scene.Node; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; -import javafx.scene.control.Separator; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; @@ -41,7 +40,6 @@ public ImportSettingsTab(JabRefPreferences prefs) { Label defaultImportStyle = new Label(Localization.lang("Default import style for drag and drop of PDFs")); defaultImportStyle.getStyleClass().add("sectionHeader"); builder.add(defaultImportStyle, 1, 1); - builder.add(new Separator(), 2, 1); builder.add(new Label(""), 1, 7); Label defaultPdfFileLinkAction = new Label(Localization.lang("Default PDF file link action")); diff --git a/src/main/java/org/jabref/gui/preferences/NetworkTab.java b/src/main/java/org/jabref/gui/preferences/NetworkTab.java index 41e39951aee..30b343140ca 100644 --- a/src/main/java/org/jabref/gui/preferences/NetworkTab.java +++ b/src/main/java/org/jabref/gui/preferences/NetworkTab.java @@ -1,5 +1,6 @@ package org.jabref.gui.preferences; +import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.CheckBox; import javafx.scene.control.Label; @@ -7,6 +8,7 @@ import javafx.scene.control.Separator; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.paint.Paint; @@ -33,6 +35,7 @@ public class NetworkTab extends Pane implements PrefsTab { public NetworkTab(DialogService dialogService, JabRefPreferences preferences) { this.dialogService = dialogService; this.preferences = preferences; + builder.setVgap(8); useProxyCheckBox = new CheckBox(Localization.lang("Use custom proxy configuration")); hostnameTextField = new TextField(); @@ -67,24 +70,44 @@ public NetworkTab(DialogService dialogService, JabRefPreferences preferences) { Label network = new Label(Localization.lang("Network")); network.getStyleClass().add("sectionHeader"); builder.add(network, 1, 1); - builder.add(new Separator(), 2, 1); - builder.add(useProxyCheckBox, 2, 2); + builder.add(useProxyCheckBox, 1, 4); + + // Hostname configuration + HBox hostnameBox = new HBox(); + hostnameBox.setSpacing(10); + hostnameBox.setAlignment(Pos.CENTER_LEFT); Label hostname = new Label(Localization.lang("Hostname") + ':'); - builder.add(hostname, 1, 3); - builder.add(hostnameTextField, 2, 3); + hostnameBox.getChildren().setAll(hostname, hostnameTextField); + builder.add(hostnameBox, 1, 5); + + // Port configuration + HBox portBox = new HBox(); + portBox.setSpacing(50); + portBox.setAlignment(Pos.CENTER_LEFT); Label port = new Label(Localization.lang("Port") + ':'); - builder.add(port, 1, 4); - builder.add(portTextField, 2, 4); - builder.add(useAuthenticationCheckBox, 2, 5); + portBox.getChildren().setAll(port, portTextField, useAuthenticationCheckBox); + builder.add(portBox, 1, 7); + + builder.add(new Separator(), 1, 12); + + // Username configuration + HBox usernameBox = new HBox(); + usernameBox.setSpacing(10); + usernameBox.setAlignment(Pos.CENTER_LEFT); Label username = new Label(Localization.lang("Username") + ':'); - builder.add(username, 2, 6); - builder.add(usernameTextField, 3, 6); + usernameBox.getChildren().setAll(username, usernameTextField); + builder.add(usernameBox, 1, 15); + + // Password configuration + HBox passwordBox = new HBox(); + passwordBox.setSpacing(15); + passwordBox.setAlignment(Pos.CENTER_LEFT); Label password = new Label(Localization.lang("Password") + ':'); - builder.add(password, 2, 7); - builder.add(passwordTextField, 3, 7); - builder.add(passwordWarningLabel, 3, 8); + passwordBox.getChildren().setAll(password, passwordTextField, passwordWarningLabel); + builder.add(passwordBox, 1, 16); } + @Override public Node getBuilder() { return builder; } diff --git a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.fxml b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.fxml index 012dcf66940..367768f7cb9 100644 --- a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.fxml +++ b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.fxml @@ -2,4 +2,4 @@ - +