From 14ba6af676cc665f73be9eb3d582876984c202e7 Mon Sep 17 00:00:00 2001 From: tmrd993 Date: Wed, 3 Mar 2021 16:37:47 +0100 Subject: [PATCH 1/4] simplify select entry type form --- CHANGELOG.md | 1 + .../main/org/jabref/gui/EntryType.fxml | 73 +++++++++++++++++++ src/main/java/org/jabref/gui/EntryType.fxml | 8 +- .../java/org/jabref/gui/EntryTypeView.java | 34 ++++++--- .../types/BibtexEntryTypeDefinitions.java | 2 + 5 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 build/resources/main/org/jabref/gui/EntryType.fxml diff --git a/CHANGELOG.md b/CHANGELOG.md index 99b84dd7dbc..a2bd084c448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - The export to MS Office XML now uses the month name for the field `MonthAcessed` instead of the two digit number [#7354](https://github.com/JabRef/jabref/issues/7354) - We included some standalone dialogs from the options menu in the main preference dialog and fixed some visual issues in the preferences dialog. [#7384](https://github.com/JabRef/jabref/pull/7384) - We improved the linking of the `python3` interpreter via the shebang to dynamically use the systems default Python. Related to [JabRef-Browser-Extension #177](https://github.com/JabRef/JabRef-Browser-Extension/issues/177) +- We simplified the select entry type form by splitting it into two parts ("Recommended" and "Others") based on internal usage data. [#6730](https://github.com/JabRef/jabref/issues/6730) ### Fixed diff --git a/build/resources/main/org/jabref/gui/EntryType.fxml b/build/resources/main/org/jabref/gui/EntryType.fxml new file mode 100644 index 00000000000..43f6a88c39b --- /dev/null +++ b/build/resources/main/org/jabref/gui/EntryType.fxml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/jabref/gui/EntryType.fxml b/src/main/java/org/jabref/gui/EntryType.fxml index a2d43feffbd..43f6a88c39b 100644 --- a/src/main/java/org/jabref/gui/EntryType.fxml +++ b/src/main/java/org/jabref/gui/EntryType.fxml @@ -31,14 +31,14 @@ - + - + - + - + diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index 944d2d94ad9..5432450b31b 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -3,6 +3,7 @@ import java.util.Collection; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; import javax.inject.Inject; @@ -51,13 +52,13 @@ public class EntryTypeView extends BaseDialog { @FXML private TextField idTextField; @FXML private ComboBox idBasedFetchers; @FXML private FlowPane biblatexPane; - @FXML private FlowPane bibTexPane; - @FXML private FlowPane ieeetranPane; + @FXML private FlowPane recommendedEntriesPane; + @FXML private FlowPane otherEntriesPane; @FXML private FlowPane customPane; @FXML private FlowPane biblatexSoftwarePane; @FXML private TitledPane biblatexTitlePane; - @FXML private TitledPane bibTexTitlePane; - @FXML private TitledPane ieeeTranTitlePane; + @FXML private TitledPane recommendedEntriesTitlePane; + @FXML private TitledPane otherEntriesTitlePane; @FXML private TitledPane customTitlePane; @FXML private TitledPane biblatexSoftwareTitlePane; @@ -138,18 +139,26 @@ public void initialize() { // we set the managed property so that they will only be rendered when they are visble so that the Nodes only take the space when visible // avoids removing and adding from the scence graph - bibTexTitlePane.managedProperty().bind(bibTexTitlePane.visibleProperty()); - ieeeTranTitlePane.managedProperty().bind(ieeeTranTitlePane.visibleProperty()); + recommendedEntriesTitlePane.managedProperty().bind(recommendedEntriesTitlePane.visibleProperty()); + otherEntriesTitlePane.managedProperty().bind(otherEntriesTitlePane.visibleProperty()); biblatexTitlePane.managedProperty().bind(biblatexTitlePane.visibleProperty()); customTitlePane.managedProperty().bind(customTitlePane.visibleProperty()); biblatexSoftwareTitlePane.managedProperty().bind(biblatexSoftwareTitlePane.visibleProperty()); + otherEntriesTitlePane.expandedProperty().addListener((obs, wasExpanded, isNowExpanded) -> { + if (isNowExpanded) { + this.setHeight(this.getHeight() + otherEntriesPane.getHeight()); + } else { + this.setHeight(this.getHeight() - otherEntriesPane.getHeight()); + } + }); + if (libraryTab.getBibDatabaseContext().isBiblatexMode()) { addEntriesToPane(biblatexPane, BiblatexEntryTypeDefinitions.ALL); addEntriesToPane(biblatexSoftwarePane, BiblatexSoftwareEntryTypeDefinitions.ALL); - bibTexTitlePane.setVisible(false); - ieeeTranTitlePane.setVisible(false); + recommendedEntriesTitlePane.setVisible(false); + otherEntriesTitlePane.setVisible(false); List customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBLATEX); if (customTypes.isEmpty()) { @@ -160,8 +169,13 @@ public void initialize() { } else { biblatexTitlePane.setVisible(false); biblatexSoftwareTitlePane.setVisible(false); - addEntriesToPane(bibTexPane, BibtexEntryTypeDefinitions.ALL); - addEntriesToPane(ieeetranPane, IEEETranEntryTypeDefinitions.ALL); + addEntriesToPane(recommendedEntriesPane, BibtexEntryTypeDefinitions.RECOMMENDED); + addEntriesToPane(otherEntriesPane, IEEETranEntryTypeDefinitions.ALL); + List otherEntriesBibtex = BibtexEntryTypeDefinitions.ALL + .stream() + .filter(e -> !BibtexEntryTypeDefinitions.RECOMMENDED.contains(e)) + .collect(Collectors.toList()); + addEntriesToPane(otherEntriesPane, otherEntriesBibtex); List customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBTEX); if (customTypes.isEmpty()) { diff --git a/src/main/java/org/jabref/model/entry/types/BibtexEntryTypeDefinitions.java b/src/main/java/org/jabref/model/entry/types/BibtexEntryTypeDefinitions.java index 068db83100f..8ee79a27c30 100644 --- a/src/main/java/org/jabref/model/entry/types/BibtexEntryTypeDefinitions.java +++ b/src/main/java/org/jabref/model/entry/types/BibtexEntryTypeDefinitions.java @@ -180,6 +180,8 @@ public class BibtexEntryTypeDefinitions { public static final List ALL = Arrays.asList(ARTICLE, INBOOK, BOOK, BOOKLET, INCOLLECTION, CONFERENCE, INPROCEEDINGS, PROCEEDINGS, MANUAL, MASTERSTHESIS, PHDTHESIS, TECHREPORT, UNPUBLISHED, MISC); + public static final List RECOMMENDED = Arrays.asList(ARTICLE, BOOK, INPROCEEDINGS, TECHREPORT, MISC); + private BibtexEntryTypeDefinitions() { } } From 42e5c9f181f314b215515119f4ac11b95fe0add3 Mon Sep 17 00:00:00 2001 From: tmrd993 Date: Wed, 3 Mar 2021 16:47:13 +0100 Subject: [PATCH 2/4] remove build file --- .../main/org/jabref/gui/EntryType.fxml | 73 ------------------- 1 file changed, 73 deletions(-) delete mode 100644 build/resources/main/org/jabref/gui/EntryType.fxml diff --git a/build/resources/main/org/jabref/gui/EntryType.fxml b/build/resources/main/org/jabref/gui/EntryType.fxml deleted file mode 100644 index 43f6a88c39b..00000000000 --- a/build/resources/main/org/jabref/gui/EntryType.fxml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From bedef5469da173db777ee31c53e8be742fb90089 Mon Sep 17 00:00:00 2001 From: tmrd993 Date: Fri, 5 Mar 2021 12:47:57 +0100 Subject: [PATCH 3/4] simplify biblatex entry type form --- src/main/java/org/jabref/gui/EntryType.fxml | 10 ---- .../java/org/jabref/gui/EntryTypeView.java | 55 ++++++++----------- .../types/BiblatexEntryTypeDefinitions.java | 2 + 3 files changed, 25 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/jabref/gui/EntryType.fxml b/src/main/java/org/jabref/gui/EntryType.fxml index 43f6a88c39b..6919a33747b 100644 --- a/src/main/java/org/jabref/gui/EntryType.fxml +++ b/src/main/java/org/jabref/gui/EntryType.fxml @@ -21,16 +21,6 @@ - - - - - - - - - - diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index 5432450b31b..2c18f008a72 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -51,16 +51,12 @@ public class EntryTypeView extends BaseDialog { @FXML private ButtonType generateButton; @FXML private TextField idTextField; @FXML private ComboBox idBasedFetchers; - @FXML private FlowPane biblatexPane; @FXML private FlowPane recommendedEntriesPane; @FXML private FlowPane otherEntriesPane; @FXML private FlowPane customPane; - @FXML private FlowPane biblatexSoftwarePane; - @FXML private TitledPane biblatexTitlePane; @FXML private TitledPane recommendedEntriesTitlePane; @FXML private TitledPane otherEntriesTitlePane; @FXML private TitledPane customTitlePane; - @FXML private TitledPane biblatexSoftwareTitlePane; private final LibraryTab libraryTab; private final DialogService dialogService; @@ -141,9 +137,7 @@ public void initialize() { // avoids removing and adding from the scence graph recommendedEntriesTitlePane.managedProperty().bind(recommendedEntriesTitlePane.visibleProperty()); otherEntriesTitlePane.managedProperty().bind(otherEntriesTitlePane.visibleProperty()); - biblatexTitlePane.managedProperty().bind(biblatexTitlePane.visibleProperty()); customTitlePane.managedProperty().bind(customTitlePane.visibleProperty()); - biblatexSoftwareTitlePane.managedProperty().bind(biblatexSoftwareTitlePane.visibleProperty()); otherEntriesTitlePane.expandedProperty().addListener((obs, wasExpanded, isNowExpanded) -> { if (isNowExpanded) { @@ -153,36 +147,33 @@ public void initialize() { } }); - if (libraryTab.getBibDatabaseContext().isBiblatexMode()) { - addEntriesToPane(biblatexPane, BiblatexEntryTypeDefinitions.ALL); - addEntriesToPane(biblatexSoftwarePane, BiblatexSoftwareEntryTypeDefinitions.ALL); - - recommendedEntriesTitlePane.setVisible(false); - otherEntriesTitlePane.setVisible(false); - - List customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBLATEX); - if (customTypes.isEmpty()) { - customTitlePane.setVisible(false); - } else { - addEntriesToPane(customPane, customTypes); - } + boolean isBiblatexMode = libraryTab.getBibDatabaseContext().isBiblatexMode(); + List recommendedEntries; + List otherEntries; + if (isBiblatexMode) { + recommendedEntries = BiblatexEntryTypeDefinitions.RECOMMENDED; + otherEntries = BiblatexEntryTypeDefinitions.ALL + .stream() + .filter(e -> !recommendedEntries.contains(e)) + .collect(Collectors.toList()); + otherEntries.addAll(BiblatexSoftwareEntryTypeDefinitions.ALL); } else { - biblatexTitlePane.setVisible(false); - biblatexSoftwareTitlePane.setVisible(false); - addEntriesToPane(recommendedEntriesPane, BibtexEntryTypeDefinitions.RECOMMENDED); - addEntriesToPane(otherEntriesPane, IEEETranEntryTypeDefinitions.ALL); - List otherEntriesBibtex = BibtexEntryTypeDefinitions.ALL + recommendedEntries = BibtexEntryTypeDefinitions.RECOMMENDED; + otherEntries = BibtexEntryTypeDefinitions.ALL .stream() - .filter(e -> !BibtexEntryTypeDefinitions.RECOMMENDED.contains(e)) + .filter(e -> !recommendedEntries.contains(e)) .collect(Collectors.toList()); - addEntriesToPane(otherEntriesPane, otherEntriesBibtex); + otherEntries.addAll(IEEETranEntryTypeDefinitions.ALL); + } + addEntriesToPane(recommendedEntriesPane, recommendedEntries); + addEntriesToPane(otherEntriesPane, otherEntries); - List customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBTEX); - if (customTypes.isEmpty()) { - customTitlePane.setVisible(false); - } else { - addEntriesToPane(customPane, customTypes); - } + BibDatabaseMode customTypeDatabaseMode = isBiblatexMode ? BibDatabaseMode.BIBLATEX : BibDatabaseMode.BIBTEX; + List customTypes = Globals.entryTypesManager.getAllCustomTypes(customTypeDatabaseMode); + if (customTypes.isEmpty()) { + customTitlePane.setVisible(false); + } else { + addEntriesToPane(customPane, customTypes); } Platform.runLater(() -> { diff --git a/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java b/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java index f065c0b3289..87db17e110d 100644 --- a/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java +++ b/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java @@ -442,4 +442,6 @@ public class BiblatexEntryTypeDefinitions { BOOKLET, COLLECTION, MVCOLLECTION, INCOLLECTION, SUPPCOLLECTION, MANUAL, MISC, ONLINE, PATENT, PERIODICAL, SUPPPERIODICAL, PROCEEDINGS, MVPROCEEDINGS, INPROCEEDINGS, REFERENCE, MVREFERENCE, INREFERENCE, REPORT, SET, THESIS, UNPUBLISHED, CONFERENCE, ELECTRONIC, MASTERSTHESIS, PHDTHESIS, TECHREPORT, WWW, SOFTWARE, DATASET); + + public static final List RECOMMENDED = Arrays.asList(ARTICLE, BOOK, INPROCEEDINGS, REPORT, MISC); } From b0f51aa69e68eff4036714bddabbe49ff3f0fac5 Mon Sep 17 00:00:00 2001 From: Timucin Merdin Date: Fri, 5 Mar 2021 13:08:19 +0100 Subject: [PATCH 4/4] add removed flowpanes --- src/main/java/org/jabref/gui/EntryTypeView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index 7dbbeb9b0e2..b82df361511 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -51,6 +51,9 @@ public class EntryTypeView extends BaseDialog { @FXML private ButtonType generateButton; @FXML private TextField idTextField; @FXML private ComboBox idBasedFetchers; + @FXML private FlowPane recommendedEntriesPane; + @FXML private FlowPane otherEntriesPane; + @FXML private FlowPane customPane; @FXML private TitledPane recommendedEntriesTitlePane; @FXML private TitledPane otherEntriesTitlePane; @FXML private TitledPane customTitlePane;