Skip to content

Commit

Permalink
Simplify biblatex entry type form (#7494)
Browse files Browse the repository at this point in the history
* simplify select entry type form

* remove build file

* simplify biblatex entry type form

* add removed flowpanes
  • Loading branch information
tmrd993 authored Mar 5, 2021
1 parent 90424b3 commit f7de0a6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 42 deletions.
10 changes: 0 additions & 10 deletions src/main/java/org/jabref/gui/EntryType.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@
<content>
<VBox prefHeight="200.0" prefWidth="400.0">
<children>
<TitledPane fx:id="biblatexTitlePane" animated="false" collapsible="false" text="Biblatex">
<content>
<FlowPane fx:id="biblatexPane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<TitledPane fx:id="biblatexSoftwareTitlePane" animated="false" collapsible="false" text="Biblatex-Software">
<content>
<FlowPane fx:id="biblatexSoftwarePane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<TitledPane fx:id="recommendedEntriesTitlePane" animated="false" collapsible="false" text="Recommended">
<content>
<FlowPane fx:id="recommendedEntriesPane" prefHeight="50.0" prefWidth="200.0"/>
Expand Down
55 changes: 23 additions & 32 deletions src/main/java/org/jabref/gui/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,12 @@ public class EntryTypeView extends BaseDialog<EntryType> {
@FXML private ButtonType generateButton;
@FXML private TextField idTextField;
@FXML private ComboBox<IdBasedFetcher> 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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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<BibEntryType> customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBLATEX);
if (customTypes.isEmpty()) {
customTitlePane.setVisible(false);
} else {
addEntriesToPane(customPane, customTypes);
}
boolean isBiblatexMode = libraryTab.getBibDatabaseContext().isBiblatexMode();
List<BibEntryType> recommendedEntries;
List<BibEntryType> 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<BibEntryType> 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<BibEntryType> customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBTEX);
if (customTypes.isEmpty()) {
customTitlePane.setVisible(false);
} else {
addEntriesToPane(customPane, customTypes);
}
BibDatabaseMode customTypeDatabaseMode = isBiblatexMode ? BibDatabaseMode.BIBLATEX : BibDatabaseMode.BIBTEX;
List<BibEntryType> customTypes = Globals.entryTypesManager.getAllCustomTypes(customTypeDatabaseMode);
if (customTypes.isEmpty()) {
customTitlePane.setVisible(false);
} else {
addEntriesToPane(customPane, customTypes);
}

viewModel.idTextProperty().addListener((obs, oldValue, newValue) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<BibEntryType> RECOMMENDED = Arrays.asList(ARTICLE, BOOK, INPROCEEDINGS, REPORT, MISC);
}

0 comments on commit f7de0a6

Please sign in to comment.