-
-
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
[WIP] Added Select all and Deselect all buttons to the "Review changes" dialog #3731
Conversation
@@ -27,6 +27,7 @@ For more details refer to the [field mapping help page](http://help.jabref.org/e | |||
- We improved file saving so that hard links are now preserved when a save is performed [#2633](https://github.com/JabRef/jabref/issues/2633) | |||
- We changed the default dialog option when removing a [file link](http://help.jabref.org/en/FileLinks#adding-external-links-to-an-entry) from an entry. | |||
The new default removes the linked file from the entry instead of deleting the file from disk. [#3679](https://github.com/JabRef/jabref/issues/3679) | |||
- Added a "Select all" [#280](https://github.com/koppor/jabref/issues/280) and "Deselect all" button in the "Review changes" dialog. |
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.
Please look at the other changelog issues and add koppor#280 as link text
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.
To fix the merge conflict, just move the changelog line a view lines above this line. We will sort the CHANGELOG.md entries before a release.
@@ -50,8 +53,36 @@ public ChangeDisplayDialog(JFrame owner, final BasePanel panel, | |||
tree = new JTree(root); | |||
tree.addTreeSelectionListener(this); | |||
|
|||
//start fix issue 280 |
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.
remove your comments as they are useless and don't carry any information
Enumeration<? extends Object> nodes = root.preorderEnumeration(); | ||
while (nodes.hasMoreElements()) { | ||
Object o = nodes.nextElement(); | ||
if ((o instanceof ChangeViewModel) && (o != root)) { |
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.
I am just unsure about the o !=root, but otherwise the code is fine and works
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.
Please add a source code comment at the line above on why this check is necessary.
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.
Minor comments. In general LGTM. The code is straightforward, but better code requires separate methods and I am not sure whether this is worth for 10 SLOC.
buttonAlignment.add(selectAll); | ||
buttonAlignment.add(deselectAll); | ||
treePanel.add(buttonAlignment, BorderLayout.SOUTH); | ||
//end fix issue 280 |
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.
Remove this line
JSplitPane pane = new JSplitPane(); | ||
pane.setLeftComponent(new JScrollPane(tree)); | ||
pane.setLeftComponent(new JScrollPane(treePanel)); //fix issue 280 change: tree -> treePanel |
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.
Remote the comment. You can elaborate on line 58 why you introduce a new treepanel: Code comments should be self-contained.
Enumeration<? extends Object> nodes = root.preorderEnumeration(); | ||
while (nodes.hasMoreElements()) { | ||
Object o = nodes.nextElement(); | ||
if ((o instanceof ChangeViewModel) && (o != root)) { |
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.
Please add a source code comment at the line above on why this check is necessary.
@@ -27,6 +27,7 @@ For more details refer to the [field mapping help page](http://help.jabref.org/e | |||
- We improved file saving so that hard links are now preserved when a save is performed [#2633](https://github.com/JabRef/jabref/issues/2633) | |||
- We changed the default dialog option when removing a [file link](http://help.jabref.org/en/FileLinks#adding-external-links-to-an-entry) from an entry. | |||
The new default removes the linked file from the entry instead of deleting the file from disk. [#3679](https://github.com/JabRef/jabref/issues/3679) | |||
- Added a "Select all" [#280](https://github.com/koppor/jabref/issues/280) and "Deselect all" button in the "Review changes" dialog. |
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.
To fix the merge conflict, just move the changelog line a view lines above this line. We will sort the CHANGELOG.md entries before a release.
JButton selectAll = new JButton(Localization.lang("Select all")); | ||
JButton deselectAll = new JButton(Localization.lang("Deselect all")); | ||
ActionListener selectEvent = (event) -> { | ||
boolean accept = event.getSource() == selectAll; |
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.
Please add braces around the expression:
boolean accept = (event.getSource() == selectAll);
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.
Rename the variable to "selectStateSelectAll" (or similar). "accept" is not a speaking name, but "selectAll" is already taken by the button. Maybe, the button could be named "selectAllButton".
treePanel.add(tree, BorderLayout.CENTER); | ||
JButton selectAll = new JButton(Localization.lang("Select all")); | ||
JButton deselectAll = new JButton(Localization.lang("Deselect all")); | ||
ActionListener selectEvent = (event) -> { |
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.
Maybe the event should be called "selectOrDelesectEvent" to mirror that it is called by both select and deselect button.
Please add a screenshot so that we can compare it with #3742. |
And added to that, please merge with master to resolve the conflicts in the Changelog. |
At my last review, I decided that the code of #3742 looks better at first sight than this code. @Siedlerchr could you please decide whether we continue with this code or the other one? Maybe the code of #3742 is very incomplete? |
Since this is still implemented in Swing, it is probably easier to add the button in the progress (or after) converting the dialog to JavaFX. Hence, I'll close this PR now. |
Added "Select all" and "Deselect all" buttons to the "Review changes" dialog. The "Select all" button is the fix for koppor#280 made by janek greif. The "Deselect all" button is an addition to that issue.