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

Improve preferences #4280

Merged
merged 10 commits into from
Aug 22, 2018
25 changes: 18 additions & 7 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
-fx-border-color: rgba(0, 0, 0, 0.54);
-fx-border-width: 2px;
-fx-border-radius: 1px;
-fx-padding: 0.166667em 0.166667em 0.25em 0.25em;
-fx-padding: 0.1em 0.1em 0.2em 0.2em;
}

.check-box:selected > .box {
Expand All @@ -391,8 +391,9 @@

.check-box > .box > .mark {
-fx-background-color: white;
-fx-padding: 0.166667em 0.166667em 0.166667em 0.166667 m;
-fx-padding: 0.2em 0.2em 0.2em 0.2em;
-fx-shape: "M6.61 11.89L3.5 8.78 2.44 9.84 6.61 14l8.95-8.95L14.5 4z";
-fx-stroke-width: 5;
}

.menu-bar {
Expand Down Expand Up @@ -523,9 +524,9 @@
.table-view:focused,
.tree-table-view:focused,
.html-editor:contains-focus {
-fx-background-color: -fx-outer-border, -fx-control-inner-background;
-fx-background-insets: 0, 1;
-fx-background-radius: 0, 0;
-fx-background-color: -fx-control-inner-background;
-fx-background-insets: 0;
-fx-background-radius: 0;
}

/* Selected rows */
Expand All @@ -550,8 +551,7 @@
-fx-background: -jr-selected;
-fx-background-color: -jr-selected;
-fx-table-cell-border-color: transparent;
-fx-fill: white;
-fx-text-fill: green;
-fx-text-fill: -jr-black;
}

.combo-box-base {
Expand Down Expand Up @@ -593,8 +593,11 @@
-fx-text-fill: -fx-text-base-color;
}

.stack-pane,
.scroll-pane,
.scroll-pane > .viewport,
.split-pane {
-fx-background-color: transparent;
-fx-background-insets: 0, 0;
-fx-padding: 0;
}
Expand Down Expand Up @@ -896,3 +899,11 @@ We want to have a look that matches our icons in the tool-bar */
.mainToolbar .context-menu * {
-fx-background-color: -fx-control-inner-background;
}

#sidePane {
-fx-background-color: -jr-sidepane-background;
}

.sidePaneComponent {
-fx-background-color: -jr-sidepane-background;
}
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/SidePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class SidePane extends BorderPane {
private final VBox mainPanel = new VBox();

public SidePane() {
setId("sidePane");
setCenter(mainPanel);
}

Expand All @@ -21,6 +22,7 @@ public void setComponents(Collection<SidePaneComponent> components) {

for (SidePaneComponent component : components) {
BorderPane node = new BorderPane();
node.getStyleClass().add("sidePaneComponent");
node.setTop(component.getHeader());
node.setCenter(component.getContentPane());
mainPanel.getChildren().add(node);
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/org/jabref/gui/actions/ShowPreferencesAction.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
package org.jabref.gui.actions;

import org.jabref.gui.JabRefFrame;
import org.jabref.gui.preftabs.PreferencesDialog;
import org.jabref.gui.preferences.PreferencesDialog;

public class ShowPreferencesAction extends SimpleCommand {

private PreferencesDialog prefsDialog;
private final JabRefFrame jabRefFrame;

public ShowPreferencesAction(JabRefFrame jabRefFrame) {
this.jabRefFrame = jabRefFrame;
}

@Override
public void execute() {
if (prefsDialog == null) {
prefsDialog = new PreferencesDialog(jabRefFrame);
} else {
prefsDialog.setValues();
}

prefsDialog.showAndWait();
PreferencesDialog preferencesDialog = new PreferencesDialog(jabRefFrame);
preferencesDialog.showAndWait();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Locale;
import java.util.Map;

import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
Expand All @@ -15,7 +16,6 @@
import org.jabref.Globals;
import org.jabref.gui.BasePanel;
import org.jabref.gui.help.HelpAction;
import org.jabref.gui.preftabs.FontSize;
import org.jabref.logic.help.HelpFile;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.EntryTypes;
Expand All @@ -38,7 +38,6 @@ public class BibtexKeyPatternPanel extends Pane {

// one field for each type
private final Map<String, TextField> textFields = new HashMap<>();
private final TextField[] textFieldArray = new TextField[19];
private final BasePanel panel;
private final GridPane gridPane = new GridPane();

Expand All @@ -51,20 +50,16 @@ public BibtexKeyPatternPanel(BasePanel panel) {
private void buildGUI() {
// The header - can be removed
Label label = new Label(Localization.lang("Entry type"));
label.setFont(FontSize.smallFont);
gridPane.add(label, 1, 1);

Label keyPattern = new Label(Localization.lang("Key pattern"));
keyPattern.setFont(FontSize.smallFont);
gridPane.add(keyPattern, 3, 1);

Label defaultPattern = new Label(Localization.lang("Default pattern"));
defaultPattern.setFont(FontSize.smallFont);
gridPane.add(defaultPattern, 1, 2);
gridPane.add(defaultPat, 3, 2);

Button button = new Button("Default");
button.setFont(FontSize.smallFont);
button.setOnAction(e-> defaultPat.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN)));
gridPane.add(button, 4, 2);

Expand All @@ -78,21 +73,15 @@ private void buildGUI() {
}

addExtraText(mode);
int y = 0;
for (EntryType type : EntryTypes.getAllValues(mode)) {
textFields.put(type.getName().toLowerCase(Locale.ROOT), textFieldArray[y]);
y++;
}

Button help1 = new Button("?");
help1.setOnAction(e->new HelpAction(Localization.lang("Help on key patterns"), HelpFile.BIBTEX_KEY_PATTERN).getHelpButton().doClick());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to move this help and the reset all button beneath the loop, with rowindex+3 otherwise it will be somewhere in the middle because it still uses hardcoded value. That's what I discovered while fixing it in the other PR.

gridPane.add(help1, 1, 24);

Button btnDefaultAll1 = new Button(Localization.lang("Reset all"));
btnDefaultAll1.setFont(FontSize.smallFont);
btnDefaultAll1.setOnAction(e-> {
// reset all fields
for (TextField field : textFieldArray) {
for (TextField field : textFields.values()) {
field.setText("");
}
defaultPat.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN));
Expand All @@ -101,25 +90,22 @@ private void buildGUI() {
}

private void addExtraText(BibDatabaseMode mode) {
Label []label = new Label[19];
Button []button = new Button[19];
int i = 0;
for (i = 0; i <= 18; i++) {
textFieldArray[i] = new TextField();
button[i] = new Button("Default");
button[i].setFont(new javafx.scene.text.Font(10));
button[i].setOnAction(e-> defaultPat.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN)));
}
i = 0;
int rowIndex = 0;
for (EntryType type : EntryTypes.getAllValues(mode)) {
label[i] = new Label(type.getName());
i ++;
}
for (i = 0; i <= 18; i++) {
label[i].setFont(FontSize.smallFont);
gridPane.add(label[i], 1, i + 3);
gridPane.add(textFieldArray[i], 3, i + 3);
gridPane.add(button[i], 4, i + 3);
Label label = new Label(type.getName());

TextField textField = new TextField();

Button button = new Button("Default");
button.setOnAction(e -> textField.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN)));

gridPane.add(label, 1, rowIndex + 3);
gridPane.add(textField, 3, rowIndex + 3);
gridPane.add(button, 4, rowIndex + 3);

textFields.put(type.getName().toLowerCase(Locale.ROOT), textField);

rowIndex++;
}
}

Expand Down Expand Up @@ -181,7 +167,7 @@ private static void setValue(TextField tf, String fieldName, AbstractBibtexKeyPa
}
}

public GridPane getPanel() {
public Node getPanel() {
return gridPane;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.preftabs;
package org.jabref.gui.preferences;

import java.util.Optional;

Expand Down Expand Up @@ -44,17 +44,13 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) {
remotePreferences = prefs.getRemotePreferences();

useRemoteServer = new CheckBox(Localization.lang("Listen for remote operation on port") + ':');
useRemoteServer.setFont(FontSize.smallFont);
useIEEEAbrv = new CheckBox(Localization.lang("Use IEEE LaTeX abbreviations"));
useIEEEAbrv.setFont(FontSize.smallFont);
remoteServerPort = new TextField();
useCaseKeeperOnSearch = new CheckBox(Localization.lang("Add {} to specified title words on search to keep the correct case"));
useCaseKeeperOnSearch.setFont(FontSize.smallFont);
useUnitFormatterOnSearch = new CheckBox(Localization.lang("Format units by adding non-breaking separators and keeping the correct case on search"));
useUnitFormatterOnSearch.setFont(FontSize.smallFont);

Label remoteOperation = new Label(Localization.lang("Remote operation") + " -----------------------------");
remoteOperation.setFont(FontSize.bigFont);
Label remoteOperation = new Label(Localization.lang("Remote operation"));
remoteOperation.getStyleClass().add("sectionHeader");
builder.add(remoteOperation, 2, 1);
builder.add(new Separator(), 2, 1);
builder.add(new Pane(), 1, 2);
Expand All @@ -69,13 +65,10 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) {
builder.add(label1, 2, 22);

Label textLabel1 = new Label(" This feature lets new files be opened or imported into an already running instance of JabRef instead of opening a new instance. For");
textLabel1.setFont(FontSize.smallFont);
builder.add(textLabel1, 2, 3);
Label textLabel2 = new Label("instance, this is useful when you open a file in JabRef from your web browser. ");
textLabel2.setFont(FontSize.smallFont);
builder.add(textLabel2, 2, 4);
Label textLabel3 = new Label(" Note that this will prevent you from running more than one instance of JabRef at a time.");
textLabel3.setFont(FontSize.smallFont);
builder.add(textLabel3, 2, 5);
builder.add(new Line(), 2, 6);
builder.add(new Pane(), 2, 7);
Expand All @@ -84,15 +77,14 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) {
p.getChildren().add(useRemoteServer);
p.getChildren().add(remoteServerPort);
Button helpButton = new Button("?");
helpButton.setFont(FontSize.smallFont);
helpButton.setOnAction(event -> new HelpAction(HelpFile.REMOTE).getHelpButton().doClick());
p.getChildren().add(helpButton);

builder.add(p, 2, 9);
builder.add(new Label(""), 1, 10);

Label explore = new Label(Localization.lang("Search %0", "IEEEXplore") + " -----------------------------");
explore.setFont(FontSize.bigFont);
Label explore = new Label(Localization.lang("Search %0", "IEEEXplore"));
explore.getStyleClass().add("sectionHeader");
builder.add(explore, 2, 11);
builder.add(new Separator(), 2, 11);
builder.add(new Pane(), 2, 12);
Expand All @@ -101,8 +93,8 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) {
builder.add(new Line(), 2, 16);
builder.add(new Label(""), 1, 17);

Label importConversions = new Label(Localization.lang("Import conversions") + " ----------------------------");
importConversions.setFont(FontSize.bigFont);
Label importConversions = new Label(Localization.lang("Import conversions"));
importConversions.getStyleClass().add("sectionHeader");
builder.add(importConversions, 2, 18);

builder.add(useCaseKeeperOnSearch, 2, 19);
Expand All @@ -111,6 +103,7 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) {

}

@Override
public Node getBuilder() {
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.preftabs;
package org.jabref.gui.preferences;

import javafx.geometry.Insets;
import javafx.scene.Node;
Expand Down Expand Up @@ -45,7 +45,7 @@ public AppearancePrefsTab(DialogService dialogService, JabRefPreferences prefs)

}

public Node getContainer() {
public Node getBuilder() {
return container;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.preftabs;
package org.jabref.gui.preferences;

import javafx.scene.Node;
import javafx.scene.control.CheckBox;
Expand Down Expand Up @@ -79,16 +79,8 @@ public void storeSettings() {

private void appendKeyGeneratorSettings() {
// Build a panel for checkbox settings:
autoGenerateOnImport.setFont(FontSize.smallFont);
letterStartA.setFont(FontSize.smallFont);
warnBeforeOverwriting.setFont(FontSize.smallFont);
letterStartB.setFont(FontSize.smallFont);
dontOverwrite.setFont(FontSize.smallFont);
alwaysAddLetter.setFont(FontSize.smallFont);
generateOnSave.setFont(FontSize.smallFont);

Label keyGeneratorSettings = new Label(Localization.lang("Key generator settings") + " --------------------------");
keyGeneratorSettings.setFont(FontSize.bigFont);
Label keyGeneratorSettings = new Label(Localization.lang("Key generator settings"));
keyGeneratorSettings.getStyleClass().add("sectionHeader");
builder.add(keyGeneratorSettings, 1, 10);
builder.add(autoGenerateOnImport, 1, 11);
builder.add(letterStartA, 2, 11);
Expand Down
Loading