Skip to content

Commit

Permalink
Fixing bug introduced in JabRef#9728 which undid/broke this improveme…
Browse files Browse the repository at this point in the history
…nt: JabRef#8785. Now, once again, the mouse click is handled and consumed at the capture stage if the expansion pane is licked, therefore preventing the node from being selected.
  • Loading branch information
credmond committed Jul 24, 2023
1 parent 1332e29 commit 9f18d3d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Fixed

- We fixed an issue where click the group expansion pane/arrow caused the node to be selected, when it should just expand/detract the node - We fixed an issue when overwriting the owner was disabled. [#10111](https://github.com/JabRef/jabref/pull/10111)
- We fixed an issue where the browser import would add ' characters before the BibTeX entry on Linux. [#9588](https://github.com/JabRef/jabref/issues/9588)
- We fixed an issue where searching for a specific term with the DOAB fetcher lead to an exception. [#9571](https://github.com/JabRef/jabref/issues/9571)
- We fixed an issue where the "Import" -> "Library to import to" did not show the correct library name if two opened libraries had the same suffix. [#9567](https://github.com/JabRef/jabref/issues/9567)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private void initialize() {
event.consume();
}
}
})
}, true)
.withCustomInitializer(row -> {
// Remove disclosure node since we display custom version in separate column
// Simply setting to null is not enough since it would be replaced by the default node on every change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

public class ViewModelTreeTableRowFactory<S> implements Callback<TreeTableView<S>, TreeTableRow<S>> {
private BiConsumer<S, ? super MouseEvent> onMouseClickedEvent;

// True if listener should be at filter stage, otherwise use default Node method
private boolean onMousePressedEventCapturePhase;

private BiConsumer<S, ? super MouseEvent> onMousePressedEvent;
private Consumer<TreeTableRow<S>> toCustomInitializer;
private Function<S, ContextMenu> contextMenuFactory;
Expand All @@ -44,7 +48,12 @@ public ViewModelTreeTableRowFactory<S> withOnMouseClickedEvent(BiConsumer<S, ? s
}

public ViewModelTreeTableRowFactory<S> withOnMousePressedEvent(BiConsumer<S, ? super MouseEvent> event) {
return withOnMousePressedEvent(event, false);
}

public ViewModelTreeTableRowFactory<S> withOnMousePressedEvent(BiConsumer<S, ? super MouseEvent> event, boolean capturePhase) {
this.onMousePressedEvent = event;
this.onMousePressedEventCapturePhase = capturePhase;
return this;
}

Expand Down Expand Up @@ -165,7 +174,11 @@ protected void updateItem(S row, boolean empty) {
}

if (onMousePressedEvent != null) {
setOnMousePressed(event -> onMousePressedEvent.accept(getItem(), event));
if (onMousePressedEventCapturePhase) {
addEventFilter(MouseEvent.MOUSE_PRESSED, event -> onMousePressedEvent.accept(getItem(), event));
} else {
setOnMousePressed(event -> onMousePressedEvent.accept(getItem(), event));
}
}

if (toCustomInitializer != null) {
Expand Down

0 comments on commit 9f18d3d

Please sign in to comment.