-
-
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
Changes from all commits
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package org.jabref.gui.collab; | ||
|
||
import java.awt.BorderLayout; | ||
import java.awt.Dimension; | ||
import java.awt.FlowLayout; | ||
import java.awt.Insets; | ||
import java.awt.event.ActionListener; | ||
import java.util.Collections; | ||
import java.util.Enumeration; | ||
|
||
|
@@ -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 commentThe 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 |
||
this.setMinimumSize(new Dimension(400, 400)); | ||
JPanel treePanel = new JPanel(new BorderLayout()); | ||
JPanel buttonAlignment = new JPanel(new FlowLayout(FlowLayout.LEADING)); | ||
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 commentThe 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. |
||
boolean accept = event.getSource() == selectAll; | ||
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. Please add braces around the expression:
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. 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". |
||
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 commentThe 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 commentThe 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. |
||
((ChangeViewModel) o).setAccepted(accept); | ||
} | ||
} | ||
cb.setSelected(accept); | ||
if (selected != null) { | ||
cb.setEnabled(selected.isAcceptable()); | ||
} | ||
}; | ||
selectAll.addActionListener(selectEvent); | ||
deselectAll.addActionListener(selectEvent); | ||
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 commentThe 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 commentThe 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. |
||
JPanel infoBorder = new JPanel(); | ||
pane.setRightComponent(infoBorder); | ||
|
||
|
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.