Skip to content

Commit

Permalink
Ui preferences global modifications (#4926)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
core-master authored and tobiasdiez committed Apr 29, 2019
1 parent 83d652c commit 63634b0
Show file tree
Hide file tree
Showing 10 changed files with 241 additions and 141 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/jabref/gui/preferences/AdvancedTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down
26 changes: 18 additions & 8 deletions src/main/java/org/jabref/gui/preferences/AppearancePrefsTab.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
Expand All @@ -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();
Expand All @@ -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
Expand Down
61 changes: 41 additions & 20 deletions src/main/java/org/jabref/gui/preferences/EntryEditorPrefsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
59 changes: 41 additions & 18 deletions src/main/java/org/jabref/gui/preferences/ExternalTab.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -118,53 +123,71 @@ 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;
for (PushToApplication pushToApplication : frame.getPushApplications().getApplications()) {
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);

}

Expand Down
Loading

0 comments on commit 63634b0

Please sign in to comment.