From 9d1c448bb828d344aa773a66eaa60ac6bcc1dfad Mon Sep 17 00:00:00 2001 From: Apurva Churi <42309636+apurvachuri@users.noreply.github.com> Date: Wed, 9 Jun 2021 06:02:26 +0930 Subject: [PATCH 1/6] Fix for issue 4682 : Restructuring the side pane structure having additional functionality and merging the remove group menus (#7714) Co-authored-by: John Josipovic Co-authored-by: Khate Damaso Co-authored-by: daolin --- CHANGELOG.md | 5 ++ .../jabref/gui/groups/GroupDialogHeader.java | 5 ++ .../jabref/gui/groups/GroupDialogView.java | 10 +++- .../gui/groups/GroupDialogViewModel.java | 4 +- .../java/org/jabref/gui/groups/GroupTree.css | 18 +++++- .../java/org/jabref/gui/groups/GroupTree.fxml | 21 +++---- .../org/jabref/gui/groups/GroupTreeView.java | 57 ++++++++++++++----- .../jabref/gui/groups/GroupTreeViewModel.java | 11 ++-- .../gui/groups/UndoableAddOrRemoveGroup.java | 6 +- src/main/resources/l10n/JabRef_en.properties | 15 +++-- 10 files changed, 108 insertions(+), 44 deletions(-) create mode 100644 src/main/java/org/jabref/gui/groups/GroupDialogHeader.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 49a2f5b6486..9a5297370c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We added two new fields to track the creation and most recent modification date and time for each entry. [koppor#130](https://github.com/koppor/jabref/issues/130) - We added a feature that allows the user to copy highlighted text in the preview window. [#6962](https://github.com/JabRef/jabref/issues/6962) - We added a feature that allows you to create new BibEntry via paste arxivId [#2292](https://github.com/JabRef/jabref/issues/2292) +- We added a add group functionality at the bottom of the side pane. [#4682](https://github.com/JabRef/jabref/issues/4682) - We added a feature that allows the user to choose whether to trust the target site when unable to find a valid certification path from the file download site. [#7616](https://github.com/JabRef/jabref/issues/7616) - We added a feature that allows the user to open all linked files of multiple selected entries by "Open file" option. [#6966](https://github.com/JabRef/jabref/issues/6966) - We added a keybinding preset for new entries. [#7705](https://github.com/JabRef/jabref/issues/7705) @@ -38,6 +39,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - 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) - Automatically found pdf files now have the linking button to the far left and uses a link icon with a plus instead of a briefcase. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/jabref/issues/3607) - 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) +- We improved the submenu list by merging the'Remove group' having two options, with or without subgroups. [#4682](https://github.com/JabRef/jabref/issues/4682) - The export to MS Office XML now uses the month name for the field `Month` instead of the two digit number [forum#2685](https://discourse.jabref.org/t/export-month-as-text-not-number/2685) - We reintroduced missing default keybindings for new entries. [#7346](https://github.com/JabRef/jabref/issues/7346) [#7439](https://github.com/JabRef/jabref/issues/7439) - Lists of available fields are now sorted alphabetically. [#7716](https://github.com/JabRef/jabref/issues/7716) @@ -88,6 +90,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where font size of the preferences dialog does not update with the rest of the GUI. [#7416](https://github.com/JabRef/jabref/issues/7416) - We fixed an issue in which a linked online file consisting of a web page was saved as an invalid pdf file upon being downloaded. The user is now notified when downloading a linked file results in an HTML file. [#7452](https://github.com/JabRef/jabref/issues/7452) - We fixed an issue where opening BibTex file (doubleclick) from Folder with spaces not working. [#6487](https://github.com/JabRef/jabref/issues/6487) +- We fixed the header title in the Add Group/Subgroup Dialog box. [#4682](https://github.com/JabRef/jabref/issues/4682) - We fixed an issue with saving large `.bib` files [#7265](https://github.com/JabRef/jabref/issues/7265) - We fixed an issue with very large page numbers [#7590](https://github.com/JabRef/jabref/issues/7590) - We fixed an issue where the file extension is missing on saving the library file on linux [#7451](https://github.com/JabRef/jabref/issues/7451) @@ -108,6 +111,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Removed +- We removed add group button beside the filter group tab. [#4682](https://github.com/JabRef/jabref/issues/4682) + ## [5.2] – 2020-12-24 ### Added diff --git a/src/main/java/org/jabref/gui/groups/GroupDialogHeader.java b/src/main/java/org/jabref/gui/groups/GroupDialogHeader.java new file mode 100644 index 00000000000..0cf5d92b173 --- /dev/null +++ b/src/main/java/org/jabref/gui/groups/GroupDialogHeader.java @@ -0,0 +1,5 @@ +package org.jabref.gui.groups; + +public enum GroupDialogHeader { + GROUP, SUBGROUP +} diff --git a/src/main/java/org/jabref/gui/groups/GroupDialogView.java b/src/main/java/org/jabref/gui/groups/GroupDialogView.java index 92883417a99..eaa758de519 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialogView.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialogView.java @@ -67,15 +67,19 @@ public class GroupDialogView extends BaseDialog { private final ControlsFxVisualizer validationVisualizer = new ControlsFxVisualizer(); private final GroupDialogViewModel viewModel; - public GroupDialogView(DialogService dialogService, BibDatabaseContext currentDatabase, PreferencesService preferencesService, AbstractGroup editedGroup) { - viewModel = new GroupDialogViewModel(dialogService, currentDatabase, preferencesService, editedGroup); + public GroupDialogView(DialogService dialogService, BibDatabaseContext currentDatabase, PreferencesService preferencesService, AbstractGroup editedGroup, GroupDialogHeader groupDialogHeader) { + viewModel = new GroupDialogViewModel(dialogService, currentDatabase, preferencesService, editedGroup, groupDialogHeader); ViewLoader.view(this) .load() .setAsDialogPane(this); if (editedGroup == null) { - this.setTitle(Localization.lang("Add subgroup")); + if (groupDialogHeader == GroupDialogHeader.GROUP) { + this.setTitle(Localization.lang("Add group")); + } else if (groupDialogHeader == GroupDialogHeader.SUBGROUP) { + this.setTitle(Localization.lang("Add subgroup")); + } } else { this.setTitle(Localization.lang("Edit group") + " " + editedGroup.getName()); } diff --git a/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java b/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java index 05233f2abdc..ebd95f3a8f1 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java @@ -107,12 +107,14 @@ public class GroupDialogViewModel { private final PreferencesService preferencesService; private final BibDatabaseContext currentDatabase; private final AbstractGroup editedGroup; + private final GroupDialogHeader groupDialogHeader; - public GroupDialogViewModel(DialogService dialogService, BibDatabaseContext currentDatabase, PreferencesService preferencesService, AbstractGroup editedGroup) { + public GroupDialogViewModel(DialogService dialogService, BibDatabaseContext currentDatabase, PreferencesService preferencesService, AbstractGroup editedGroup, GroupDialogHeader groupDialogHeader) { this.dialogService = dialogService; this.preferencesService = preferencesService; this.currentDatabase = currentDatabase; this.editedGroup = editedGroup; + this.groupDialogHeader = groupDialogHeader; setupValidation(); setValues(); diff --git a/src/main/java/org/jabref/gui/groups/GroupTree.css b/src/main/java/org/jabref/gui/groups/GroupTree.css index cfd75e2de0a..c44d65c8db5 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTree.css +++ b/src/main/java/org/jabref/gui/groups/GroupTree.css @@ -102,8 +102,18 @@ -fx-translate-x: -0.4em; } -#newGroupButton { - -fx-padding: 0.1em 1.5em 0.1em 1.5em; +#addNewGroup:active { + -fx-border-width: 0px; + -fx-background-color: -jr-theme; + -fx-padding: 0.5em; + -fx-text-fill: -jr-white; +} + +#addNewGroup:inactive { + -fx-border-width: 0px; + -fx-background-color: -jr-icon-background-active; + -fx-padding: 0.5em; + -fx-text-fill:-jr-black; } #groupFilterBar { @@ -116,3 +126,7 @@ #groupFilterBar .glyph-icon { -fx-font-size: 2em; } + +#groupBar .glyph-icon { + -fx-font-size: 2em; +} diff --git a/src/main/java/org/jabref/gui/groups/GroupTree.fxml b/src/main/java/org/jabref/gui/groups/GroupTree.fxml index 8990ffada01..93e858dba01 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTree.fxml +++ b/src/main/java/org/jabref/gui/groups/GroupTree.fxml @@ -7,22 +7,12 @@ - -
@@ -39,4 +29,15 @@
+ + + + + +
diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/src/main/java/org/jabref/gui/groups/GroupTreeView.java index c44087f1423..efffd504d78 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeView.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeView.java @@ -15,8 +15,10 @@ import javafx.beans.property.ObjectProperty; import javafx.css.PseudoClass; import javafx.fxml.FXML; +import javafx.scene.control.Button; import javafx.scene.control.ContextMenu; import javafx.scene.control.Control; +import javafx.scene.control.Menu; import javafx.scene.control.MenuItem; import javafx.scene.control.SelectionMode; import javafx.scene.control.SeparatorMenuItem; @@ -64,6 +66,7 @@ public class GroupTreeView { @FXML private TreeTableColumn numberColumn; @FXML private TreeTableColumn expansionNodeColumn; @FXML private CustomTextField searchField; + @FXML private Button addNewGroup; @Inject private StateManager stateManager; @Inject private DialogService dialogService; @@ -101,6 +104,8 @@ public void initialize() { }); searchField.textProperty().addListener((observable, oldValue, newValue) -> searchTask.restart()); + setNewGroupButtonStyle(groupTree); + groupTree.rootProperty().bind( EasyBind.map(viewModel.rootGroupProperty(), group -> { @@ -171,6 +176,7 @@ public void initialize() { groupTree.setRowFactory(treeTable -> { TreeTableRow row = new TreeTableRow<>(); row.treeItemProperty().addListener((ov, oldTreeItem, newTreeItem) -> { + setNewGroupButtonStyle(treeTable); boolean isRoot = newTreeItem == treeTable.getRoot(); row.pseudoClassStateChanged(rootPseudoClass, isRoot); @@ -322,7 +328,9 @@ private Optional> getTreeItemByValue(TreeItem { @@ -331,33 +339,43 @@ private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) { groupTree.refresh(); }); + MenuItem removeGroupKeepSubgroups = new MenuItem(Localization.lang("Keep subgroups")); + removeGroupKeepSubgroups.setOnAction(event -> viewModel.removeGroupKeepSubgroups(group)); + + MenuItem removeGroupAndSubgroups = new MenuItem(Localization.lang("Also remove subgroups")); + removeGroupAndSubgroups.setOnAction(event -> viewModel.removeGroupAndSubgroups(group)); + MenuItem addSubgroup = new MenuItem(Localization.lang("Add subgroup")); addSubgroup.setOnAction(event -> { menu.hide(); - viewModel.addNewSubgroup(group); + viewModel.addNewSubgroup(group, GroupDialogHeader.SUBGROUP); }); - MenuItem removeGroupAndSubgroups = new MenuItem(Localization.lang("Remove group and subgroups")); - removeGroupAndSubgroups.setOnAction(event -> viewModel.removeGroupAndSubgroups(group)); - MenuItem removeGroupKeepSubgroups = new MenuItem(Localization.lang("Remove group, keep subgroups")); - removeGroupKeepSubgroups.setOnAction(event -> viewModel.removeGroupKeepSubgroups(group)); + MenuItem removeSubgroups = new MenuItem(Localization.lang("Remove subgroups")); - removeSubgroups.setOnAction(event -> viewModel.removeSubgroups(group)); + removeSubgroups.setOnAction(event -> { + viewModel.removeSubgroups(group); + }); + + MenuItem sortSubgroups = new MenuItem(Localization.lang("Sort subgroups")); + sortSubgroups.setOnAction(event -> viewModel.sortAlphabeticallyRecursive(group)); MenuItem addEntries = new MenuItem(Localization.lang("Add selected entries to this group")); addEntries.setOnAction(event -> viewModel.addSelectedEntries(group)); + MenuItem removeEntries = new MenuItem(Localization.lang("Remove selected entries from this group")); removeEntries.setOnAction(event -> viewModel.removeSelectedEntries(group)); - MenuItem sortAlphabetically = new MenuItem(Localization.lang("Sort all subgroups (recursively)")); - sortAlphabetically.setOnAction(event -> viewModel.sortAlphabeticallyRecursive(group)); - menu.getItems().add(editGroup); + removeGroup.getItems().add(removeGroupKeepSubgroups); + removeGroup.getItems().add(removeGroupAndSubgroups); + menu.getItems().add(removeGroup); menu.getItems().add(new SeparatorMenuItem()); - menu.getItems().addAll(addSubgroup, removeSubgroups, removeGroupAndSubgroups, removeGroupKeepSubgroups); + menu.getItems().add(addSubgroup); + menu.getItems().add(removeSubgroups); + menu.getItems().add(sortSubgroups); menu.getItems().add(new SeparatorMenuItem()); - menu.getItems().addAll(addEntries, removeEntries); - menu.getItems().add(new SeparatorMenuItem()); - menu.getItems().add(sortAlphabetically); + menu.getItems().add(addEntries); + menu.getItems().add(removeEntries); // TODO: Disable some actions under certain conditions // if (group.canBeEdited()) { @@ -397,6 +415,19 @@ private void setupClearButtonField(CustomTextField customTextField) { } } + private void setNewGroupButtonStyle(TreeTableView groupTree) { + PseudoClass active = PseudoClass.getPseudoClass("active"); + PseudoClass inactive = PseudoClass.getPseudoClass("inactive"); + + if (groupTree.getRoot() != null) { + boolean isActive = groupTree.getExpandedItemCount() <= 10; + addNewGroup.pseudoClassStateChanged(active, isActive); + addNewGroup.pseudoClassStateChanged(inactive, !isActive); + } else { + addNewGroup.pseudoClassStateChanged(active, true); + } + } + private static class DragExpansionHandler { private static final long DRAG_TIME_BEFORE_EXPANDING_MS = 1000; private TreeItem draggedItem; diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index d018222c4a3..f295e421b42 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -111,7 +111,7 @@ private void onSelectedGroupChanged(ObservableList newValue) */ public void addNewGroupToRoot() { if (currentDatabase.isPresent()) { - addNewSubgroup(rootGroup.get()); + addNewSubgroup(rootGroup.get(), GroupDialogHeader.GROUP); } else { dialogService.showWarningDialogAndWait(Localization.lang("Cannot create group"), Localization.lang("Cannot create group. Please create a library first.")); } @@ -147,13 +147,15 @@ private void onActiveDatabaseChanged(Optional newDatabase) { /** * Opens "New Group Dialog" and add the resulting group to the specified group */ - public void addNewSubgroup(GroupNodeViewModel parent) { + + public void addNewSubgroup(GroupNodeViewModel parent, GroupDialogHeader groupDialogHeader) { currentDatabase.ifPresent(database -> { Optional newGroup = dialogService.showCustomDialogAndWait(new GroupDialogView( dialogService, database, preferences, - null)); + null, + groupDialogHeader)); newGroup.ifPresent(group -> { parent.addSubgroup(group); @@ -184,7 +186,8 @@ public void editGroup(GroupNodeViewModel oldGroup) { dialogService, database, preferences, - oldGroup.getGroupNode().getGroup())); + oldGroup.getGroupNode().getGroup(), + GroupDialogHeader.SUBGROUP)); newGroup.ifPresent(group -> { // TODO: Keep assignments diff --git a/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java b/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java index f488c69520b..1ff64104841 100644 --- a/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java +++ b/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java @@ -84,11 +84,11 @@ public UndoableAddOrRemoveGroup(GroupTreeNodeViewModel groupsRoot, public String getPresentationName() { switch (m_editType) { case ADD_NODE: - return Localization.lang("add group"); + return Localization.lang("Add group"); case REMOVE_NODE_KEEP_CHILDREN: - return Localization.lang("remove group (keep subgroups)"); + return Localization.lang("Keep subgroups)"); case REMOVE_NODE_AND_CHILDREN: - return Localization.lang("remove group and subgroups"); + return Localization.lang("Also remove subgroups"); default: break; } diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 4fbeb521309..70ddb2bf6d4 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -52,6 +52,8 @@ Added\ string=Added string All\ entries=All entries +Also\ remove\ subgroups=Also remove subgroups + Always\ reformat\ BIB\ file\ on\ save\ and\ export=Always reformat BIB file on save and export and=and @@ -450,6 +452,8 @@ JabRef\ Version\ (Required\ to\ ensure\ backwards\ compatibility\ with\ Mr.\ DLi Journal\ abbreviations=Journal abbreviations Keep\ both=Keep both +Keep\ subgroups=Keep subgroups + Key\ bindings=Key bindings Key\ bindings\ changed=Key bindings changed @@ -664,16 +668,10 @@ Remove\ selected\ entries\ from\ this\ group=Remove selected entries from this g Remove\ group=Remove group -Remove\ group,\ keep\ subgroups=Remove group, keep subgroups - Remove\ group\ "%0"?=Remove group "%0"? Remove\ group\ "%0"\ and\ its\ subgroups?=Remove group "%0" and its subgroups? -remove\ group\ (keep\ subgroups)=remove group (keep subgroups) - -remove\ group\ and\ subgroups=remove group and subgroups - Remove\ group\ and\ subgroups=Remove group and subgroups Remove\ link=Remove link @@ -796,6 +794,8 @@ Skipped\ -\ PDF\ does\ not\ exist=Skipped - PDF does not exist Skipped\ entry.=Skipped entry. +Sort\ subgroups=Sort subgroups + source\ edit=source edit Special\ name\ formatters=Special name formatters @@ -1722,7 +1722,6 @@ Show\ the\ document\ of\ the\ currently\ selected\ entry.=Show the document of t Show\ this\ document\ until\ unlocked.=Show this document until unlocked. Set\ current\ user\ name\ as\ owner.=Set current user name as owner. -Sort\ all\ subgroups\ (recursively)=Sort all subgroups (recursively) Collect\ and\ share\ telemetry\ data\ to\ help\ improve\ JabRef=Collect and share telemetry data to help improve JabRef Don't\ share=Don't share Share\ anonymous\ statistics=Share anonymous statistics @@ -1780,7 +1779,7 @@ No\ full\ text\ document\ found\ for\ entry\ %0.=No full text document found for Delete\ Entry=Delete Entry Next\ library=Next library Previous\ library=Previous library -add\ group=add group +Add\ group=Add group Entry\ is\ contained\ in\ the\ following\ groups\:=Entry is contained in the following groups\: Delete\ entries=Delete entries Keep\ entries=Keep entries From f2b51fb2181063eb560f7f61debc65bc4da7be9c Mon Sep 17 00:00:00 2001 From: brapana <55059816+brapana@users.noreply.github.com> Date: Tue, 8 Jun 2021 23:25:44 -0700 Subject: [PATCH 2/6] Implemented a select all button for the library import function (issue #7786) (#7808) * We added a select all button for the library import function (issue 7786). * Update selectAllEntries() to use .checkAll() --- CHANGELOG.md | 1 + .../java/org/jabref/gui/importer/ImportEntriesDialog.fxml | 1 + .../java/org/jabref/gui/importer/ImportEntriesDialog.java | 5 +++++ src/main/resources/l10n/JabRef_en.properties | 1 + 4 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a5297370c7..909aba23776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We added a feature that allows the user to choose whether to trust the target site when unable to find a valid certification path from the file download site. [#7616](https://github.com/JabRef/jabref/issues/7616) - We added a feature that allows the user to open all linked files of multiple selected entries by "Open file" option. [#6966](https://github.com/JabRef/jabref/issues/6966) - We added a keybinding preset for new entries. [#7705](https://github.com/JabRef/jabref/issues/7705) +- We added a select all button for the library import function. [#7786](https://github.com/JabRef/jabref/issues/7786) ### Changed diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml index a38e76f43b1..d27fdfc7f6c 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml @@ -19,6 +19,7 @@