Skip to content
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

Use action handler #4726

Merged
merged 5 commits into from
Mar 8, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions src/main/java/org/jabref/gui/groups/GroupDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.scene.Node;
Expand Down Expand Up @@ -329,21 +331,17 @@ groupName, getContext(),
return null;
});

ChangeListener<String> caretListener = (ObservableValue<? extends String> ov, String oldValue,
String newValue) -> updateComponents();
ChangeListener<Boolean> itemListener = (ObservableValue<? extends Boolean> ov, Boolean oldBoolean,
Boolean newBoolean) -> updateComponents();

nameField.textProperty().addListener(caretListener);
descriptionField.textProperty().addListener(caretListener);
iconField.textProperty().addListener(caretListener);
keywordGroupSearchField.textProperty().addListener(caretListener);
keywordGroupSearchTerm.textProperty().addListener(caretListener);
keywordGroupCaseSensitive.selectedProperty().addListener(itemListener);
keywordGroupRegExp.selectedProperty().addListener(itemListener);
searchGroupSearchExpression.textProperty().addListener(caretListener);
searchGroupRegExp.selectedProperty().addListener(itemListener);
searchGroupRegExp.selectedProperty().addListener(itemListener);
EventHandler<ActionEvent> actionHandler = (ActionEvent e) -> updateComponents();
nameField.setOnAction(actionHandler);
descriptionField.setOnAction(actionHandler);
iconField.setOnAction(actionHandler);
keywordGroupSearchField.setOnAction(actionHandler);
keywordGroupSearchTerm.setOnAction(actionHandler);
keywordGroupCaseSensitive.setOnAction(actionHandler);
keywordGroupRegExp.setOnAction(actionHandler);
searchGroupSearchExpression.setOnAction(actionHandler);
searchGroupRegExp.setOnAction(actionHandler);
searchGroupRegExp.setOnAction(actionHandler);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searchGroupRegExp is set twice (not your fault, was the case already in the existing code...)


// configure for current type
if (editedGroup == null) {
Expand Down