Skip to content

Commit

Permalink
Fix binding issue for the regex and case sensitive search buttons (#7125
Browse files Browse the repository at this point in the history
)

Signed-off-by: Dominik Voigt <[email protected]>
  • Loading branch information
DominikVoigt authored Nov 26, 2020
1 parent b19c3e4 commit f1a2fa7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,16 @@ public GlobalSearchBar(JabRefFrame frame, StateManager stateManager, Preferences
// searchModeButton = new Button();
initSearchModifierButtons();

BooleanBinding focusBinding = searchField.focusedProperty()
.or(regularExpressionButton.focusedProperty()
.or(caseSensitiveButton.focusedProperty()));
BooleanBinding focusedOrActive = searchField.focusedProperty()
.or(regularExpressionButton.focusedProperty())
.or(caseSensitiveButton.focusedProperty())
.or(searchField.textProperty()
.isNotEmpty());

regularExpressionButton.visibleProperty().unbind();
regularExpressionButton.visibleProperty().bind(focusBinding);
regularExpressionButton.visibleProperty().bind(focusedOrActive);
caseSensitiveButton.visibleProperty().unbind();
caseSensitiveButton.visibleProperty().bind(focusBinding);
caseSensitiveButton.visibleProperty().bind(focusedOrActive);

StackPane modifierButtons = new StackPane(new HBox(regularExpressionButton, caseSensitiveButton));
modifierButtons.setAlignment(Pos.CENTER);
Expand Down

0 comments on commit f1a2fa7

Please sign in to comment.