diff --git a/CHANGELOG.md b/CHANGELOG.md index 100a20819a4..3bf86e88dc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,13 +14,15 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ### Changed - Added 'Filter All' and 'Filter None' buttons with corresponding functionality to Quality Check tool. +- We increased the size of the keywords and file text areas in the entry editor + ### Fixed - We re-added the "Normalize to BibTeX name format" context menu item [#3136](https://github.com/JabRef/jabref/issues/3136) - We fixed a memory leak in the source tab of the entry editor [#3113](https://github.com/JabRef/jabref/issues/3113) - - We fixed a [java bug](https://bugs.openjdk.java.net/browse/JDK-8185792) where linux users could not enter accented characters in the entry editor and the search bar [#3028](https://github.com/JabRef/jabref/issues/3028) + - We fixed a [java bug](https://bugs.openjdk.java.net/browse/JDK-8185792) where linux users could not enter accented characters in the entry editor and the search bar [#3028](https://github.com/JabRef/jabref/issues/3028) - We fixed a regression introduced in v4.0-beta2: A file can be dropped to the entry preview to attach it to the entry [koppor#245](https://github.com/koppor/jabref/issues/245) - We fixed an issue in the "Replace String" dialog (Ctrl+R where search and replace did not work for the `bibtexkey` field. [#3132](https://github.com/JabRef/jabref/issues/3132) -### Removed + diff --git a/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java b/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java index 6956ba518d3..db7d64534f9 100644 --- a/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java @@ -154,6 +154,8 @@ private Region setupPanel(JabRefFrame frame, BasePanel bPanel, boolean compresse gridPane.getColumnConstraints().addAll(columnDoNotContract, columnExpand, new ColumnConstraints(10), columnDoNotContract, columnExpand); + + setCompressedRowLayout(gridPane, rows); } else { rows = fields.size(); @@ -161,20 +163,10 @@ private Region setupPanel(JabRefFrame frame, BasePanel bPanel, boolean compresse addColumn(gridPane, 1, editors.values().stream().map(FieldEditorFX::getNode)); gridPane.getColumnConstraints().addAll(columnDoNotContract, columnExpand); - } - RowConstraints rowExpand = new RowConstraints(); - rowExpand.setVgrow(Priority.ALWAYS); - rowExpand.setValignment(VPos.TOP); - if (rows == 0) { - rowExpand.setPercentHeight(100); - } else { - rowExpand.setPercentHeight(100 / rows); - } - for (int i = 0; i < rows; i++) { - gridPane.getRowConstraints().add(rowExpand); + setRegularRowLayout(gridPane, rows); } - + if (GUIGlobals.currentFont != null) { gridPane.setStyle( "text-area-background: " + convertToHex(GUIGlobals.validFieldBackgroundColor) + ";" @@ -193,6 +185,36 @@ private Region setupPanel(JabRefFrame frame, BasePanel bPanel, boolean compresse return scrollPane; } + private void setRegularRowLayout(GridPane gridPane, int rows) { + List constraints = new ArrayList<>(rows); + for (String field : fields) { + RowConstraints rowExpand = new RowConstraints(); + rowExpand.setVgrow(Priority.ALWAYS); + rowExpand.setValignment(VPos.TOP); + if (rows == 0) { + rowExpand.setPercentHeight(100); + } else { + rowExpand.setPercentHeight(100 / rows * editors.get(field).getWeight()); + } + constraints.add(rowExpand); + } + gridPane.getRowConstraints().addAll(constraints); + } + + private void setCompressedRowLayout(GridPane gridPane, int rows) { + RowConstraints rowExpand = new RowConstraints(); + rowExpand.setVgrow(Priority.ALWAYS); + rowExpand.setValignment(VPos.TOP); + if (rows == 0) { + rowExpand.setPercentHeight(100); + } else { + rowExpand.setPercentHeight(100 / rows); + } + for (int i = 0; i < rows; i++) { + gridPane.getRowConstraints().add(rowExpand); + } + } + private String getPrompt(String field) { Set fieldProperties = InternalBibtexFields.getFieldProperties(field); @@ -205,12 +227,12 @@ private String getPrompt(String field) { } switch (field) { - case FieldName.YEAR: - return "YYYY"; - case FieldName.MONTH: - return "MM or #mmm#"; - case FieldName.URL: - return "https://"; + case FieldName.YEAR: + return "YYYY"; + case FieldName.MONTH: + return "MM or #mmm#"; + case FieldName.URL: + return "https://"; } return ""; diff --git a/src/main/java/org/jabref/gui/fieldeditors/FieldEditorFX.java b/src/main/java/org/jabref/gui/fieldeditors/FieldEditorFX.java index 81bbfd0eadf..3a2978ad060 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/FieldEditorFX.java +++ b/src/main/java/org/jabref/gui/fieldeditors/FieldEditorFX.java @@ -13,4 +13,14 @@ public interface FieldEditorFX { default void requestFocus() { getNode().requestFocus(); } + + /** + * Returns relative size of the field editor in terms of display space. + * + * A value of 1 means that the editor gets exactly as much space as all other regular editors. + * A value of 2 means that the editor gets twice as much space as regular editors. + * + * @return the relative weight of the editor in terms of display space + */ + default double getWeight() { return 1; } } diff --git a/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java b/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java index 20083ef3680..f75e13ebd8f 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java +++ b/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java @@ -14,6 +14,7 @@ import org.jabref.logic.journals.JournalAbbreviationLoader; import org.jabref.logic.journals.JournalAbbreviationPreferences; import org.jabref.model.database.BibDatabaseContext; +import org.jabref.model.entry.FieldName; import org.jabref.model.entry.FieldProperty; import org.jabref.model.entry.InternalBibtexFields; import org.jabref.model.metadata.MetaData; @@ -69,6 +70,8 @@ public static FieldEditorFX getForField(String fieldName, TaskExecutor taskExecu return new LinkedEntriesEditor(fieldName, databaseContext, suggestionProvider, fieldCheckers); } else if (fieldExtras.contains(FieldProperty.PERSON_NAMES)) { return new PersonsEditor(fieldName, suggestionProvider, preferences.getAutoCompletePreferences(), fieldCheckers); + } else if (FieldName.KEYWORDS.equals(fieldName)) { + return new KeywordsEditor(fieldName, suggestionProvider, fieldCheckers); } // default diff --git a/src/main/java/org/jabref/gui/fieldeditors/KeywordsEditor.java b/src/main/java/org/jabref/gui/fieldeditors/KeywordsEditor.java new file mode 100644 index 00000000000..65d0f49e344 --- /dev/null +++ b/src/main/java/org/jabref/gui/fieldeditors/KeywordsEditor.java @@ -0,0 +1,16 @@ +package org.jabref.gui.fieldeditors; + +import org.jabref.gui.autocompleter.AutoCompleteSuggestionProvider; +import org.jabref.logic.integrity.FieldCheckers; + +public class KeywordsEditor extends SimpleEditor implements FieldEditorFX { + + public KeywordsEditor(String fieldName, AutoCompleteSuggestionProvider suggestionProvider, FieldCheckers fieldCheckers) { + super (fieldName, suggestionProvider, fieldCheckers); + } + + @Override + public double getWeight() { + return 2; + } +} diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java index 7a2675f165e..6016f09d21b 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java @@ -166,4 +166,9 @@ private void handleItemMouseClick(LinkedFileViewModel linkedFile, MouseEvent eve linkedFile.edit(); } } + + @Override + public double getWeight() { + return 2; + } }