diff --git a/src/main/java/org/jabref/gui/Base.css b/src/main/java/org/jabref/gui/Base.css index 6ec8d5c94827..a03bff116dee 100644 --- a/src/main/java/org/jabref/gui/Base.css +++ b/src/main/java/org/jabref/gui/Base.css @@ -667,6 +667,7 @@ -fx-background-radius: 0em; } + .scroll-bar:horizontal .thumb, .scroll-bar:vertical .thumb { -fx-background-color: -jr-scrollbar-thumb; diff --git a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java index daf7a4ac105a..607b3376df82 100644 --- a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java +++ b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java @@ -2,6 +2,7 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; +import java.util.Collection; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -36,6 +37,8 @@ public class BibtexKeyPatternPanel extends Pane { protected final TextField defaultPat = new TextField(); private final HelpAction help; + private final int COLUMNS = 2; + // one field for each type private final Map textFields = new HashMap<>(); private final BasePanel panel; @@ -44,25 +47,12 @@ public class BibtexKeyPatternPanel extends Pane { public BibtexKeyPatternPanel(BasePanel panel) { this.panel = panel; help = new HelpAction(Localization.lang("Help on key patterns"), HelpFile.BIBTEX_KEY_PATTERN); + gridPane.setHgap(10); + gridPane.setVgap(5); buildGUI(); } private void buildGUI() { - // The header - can be removed - Label label = new Label(Localization.lang("Entry type")); - gridPane.add(label, 1, 1); - - Label keyPattern = new Label(Localization.lang("Key pattern")); - gridPane.add(keyPattern, 3, 1); - - Label defaultPattern = new Label(Localization.lang("Default pattern")); - gridPane.add(defaultPattern, 1, 2); - gridPane.add(defaultPat, 3, 2); - - Button button = new Button("Default"); - button.setOnAction(e-> defaultPat.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN))); - gridPane.add(button, 4, 2); - BibDatabaseMode mode; // check mode of currently used DB if (panel != null) { @@ -72,8 +62,30 @@ private void buildGUI() { mode = Globals.prefs.getDefaultBibDatabaseMode(); } - int rowIndex = 3; - for (EntryType type : EntryTypes.getAllValues(mode)) { + int rowIndex = 1; + int columnIndex = 0; + // The header - can be removed + for (int i = 0; i < COLUMNS; i++) { + Label label = new Label(Localization.lang("Entry type")); + Label keyPattern = new Label(Localization.lang("Key pattern")); + gridPane.add(label, ++columnIndex, rowIndex); + gridPane.add(keyPattern, ++columnIndex, rowIndex); + ++columnIndex; //3 + } + + rowIndex++; + Label defaultPattern = new Label(Localization.lang("Default pattern")); + Button button = new Button("Default"); + button.setOnAction(e-> defaultPat.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN))); + gridPane.add(defaultPattern, 1, rowIndex); + gridPane.add(defaultPat, 2, rowIndex); + gridPane.add(button, 3, rowIndex); + + Object[] entryTypes = EntryTypes.getAllValues(mode).toArray(); + + columnIndex=1; + for(int i=0; i < entryTypes.length; i++){ + EntryType type = (EntryType) entryTypes[i]; Label label1 = new Label(type.getName()); TextField textField = new TextField(); @@ -81,15 +93,21 @@ private void buildGUI() { Button button1 = new Button("Default"); button1.setOnAction(e1 -> textField.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN))); - gridPane.add(label1, 1, rowIndex); - gridPane.add(textField, 3, rowIndex); - gridPane.add(button1, 4, rowIndex); + gridPane.add(label1, 1 + (columnIndex * 3) , rowIndex); + gridPane.add(textField, 2 + (columnIndex * 3), rowIndex); + gridPane.add(button1, 3 + (columnIndex * 3), rowIndex); textFields.put(type.getName().toLowerCase(Locale.ROOT), textField); - rowIndex++; + if(columnIndex == COLUMNS - 1){ + columnIndex = 0; + rowIndex++; + }else + columnIndex++; } + rowIndex++; + Button help1 = new Button("?"); help1.setOnAction(e->new HelpAction(Localization.lang("Help on key patterns"), HelpFile.BIBTEX_KEY_PATTERN).getHelpButton().doClick()); gridPane.add(help1, 1, rowIndex); @@ -102,9 +120,10 @@ private void buildGUI() { } defaultPat.setText((String) Globals.prefs.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN)); }); - gridPane.add(btnDefaultAll1, 3, rowIndex); + gridPane.add(btnDefaultAll1, 2, rowIndex); } + /** * fill the given LabelPattern by values generated from the text fields */ diff --git a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css index 21717a7709ca..eb70ca7b3156 100644 --- a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css +++ b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css @@ -11,6 +11,15 @@ -fx-padding: 0em 1em 0em 3em; } +.preferencePaneContainer .scroll-bar { + -fx-background-color: transparent; + -fx-opacity: 0; +} + +.preferencePaneContainer:hover .scroll-bar { + -fx-opacity: 1; +} + .sectionHeader { -fx-font-size: 1.5em; -fx-padding: 1em 0em 1em 0em; diff --git a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java index db3e8e22a23a..0fe12a13eaff 100644 --- a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java +++ b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java @@ -91,8 +91,7 @@ public PreferencesDialog(JabRefFrame parent) { preferenceTabs.add(new AppearancePrefsTab(dialogService, prefs)); container = new BorderPane(); - ScrollPane scroll = new ScrollPane(container); - getDialogPane().setContent(scroll); + getDialogPane().setContent(container); construct(); }