-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for issue 4682 : Restructuring the side pane structure having additional functionality and merging the remove group menus #7714
Changes from 12 commits
4ffcffb
8bd0748
53c75c7
22549b3
f851464
955523f
96f69d4
e196041
783198a
35b9a06
705f29f
f97c656
d8ab8bb
1cc0946
c9cdff3
c69b9cb
29f51b3
9ff3879
fb2ffc8
051c5d6
28b1761
b9f7012
6d9a554
edd440c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,8 +102,8 @@ | |
-fx-translate-x: -0.4em; | ||
} | ||
|
||
#newGroupButton { | ||
-fx-padding: 0.1em 1.5em 0.1em 1.5em; | ||
#addNewGroup { | ||
/*-fx-padding: 0.1em 1.5em 0.1em 1.5em;*/ | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why keeping it, when commented? For version history we got git. |
||
|
||
#groupFilterBar { | ||
|
@@ -116,3 +116,12 @@ | |
#groupFilterBar .glyph-icon { | ||
-fx-font-size: 2em; | ||
} | ||
|
||
#groupBar .glyph-icon { | ||
-fx-font-size: 2em; | ||
} | ||
|
||
.add-group-button:hover { | ||
-fx-background-color: -jr-icon-background-active; | ||
-fx-text-fill: -jr-black; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<GroupNodeViewModel, GroupNodeViewModel> numberColumn; | ||
@FXML private TreeTableColumn<GroupNodeViewModel, GroupNodeViewModel> 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<GroupNodeViewModel> 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<TreeItem<GroupNodeViewModel>> getTreeItemByValue(TreeItem<Group | |
} | ||
|
||
private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) { | ||
|
||
ContextMenu menu = new ContextMenu(); | ||
Menu removeGroup = new Menu(Localization.lang("Remove group")); | ||
|
||
MenuItem editGroup = new MenuItem(Localization.lang("Edit group")); | ||
editGroup.setOnAction(event -> { | ||
|
@@ -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, false); | ||
}); | ||
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 addEntries = new MenuItem(Localization.lang("Add selected entries to this 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)); | ||
MenuItem removeEntries = new MenuItem(Localization.lang("Remove Selected Entries from this Group")); | ||
removeEntries.setOnAction(event -> viewModel.removeSelectedEntries(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,21 @@ private void setupClearButtonField(CustomTextField customTextField) { | |
} | ||
} | ||
|
||
private void setNewGroupButtonStyle(TreeTableView<GroupNodeViewModel> groupTree) { | ||
if (groupTree.getRoot() != null) { | ||
if (groupTree.getExpandedItemCount() <= 10) { | ||
addNewGroup.setStyle("-fx-border-width: 0px; -fx-background-color: -jr-theme;" + | ||
" -fx-padding: 0.5em; -fx-text-fill: -jr-white;"); | ||
} else { | ||
addNewGroup.setStyle("-fx-border-width: 0px; -fx-background-color: -jr-icon-background-active;" + | ||
" -fx-padding: 0.5em; -fx-text-fill: -jr-black;"); | ||
} | ||
} else { | ||
addNewGroup.setStyle("-fx-border-width: 0px; -fx-background-color: -jr-theme;" + | ||
" -fx-padding: 0.5em; -fx-text-fill: -jr-white;"); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of hardcoding the css in the java file, please make this a pseudoclass in css, which should be very easy to implement. See There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @calixtus , i've checked this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The node should be the addNewGroup. |
||
|
||
private static class DragExpansionHandler { | ||
private static final long DRAG_TIME_BEFORE_EXPANDING_MS = 1000; | ||
private TreeItem<GroupNodeViewModel> draggedItem; | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1782,7 +1782,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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Translation string must be consistent with english translation.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||||||
Entry\ is\ contained\ in\ the\ following\ groups\:=Entry is contained in the following groups\: | ||||||
Delete\ entries=Delete entries | ||||||
Keep\ entries=Keep entries | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep a blank line before and after a heading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a blank line after the heading "#Removed"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, Visual Studio Code helps - with following plugin: https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
I am not aware of any similar plugin for IntelliJ.