Skip to content

Commit e262a6d

Browse files
committed
removed constant parameter, simplified condition
1 parent d02a78c commit e262a6d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/java/de/doubleslash/keeptime/view/ManageWorkController.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,17 @@ public void changed(final ObservableValue<? extends String> observable, final St
203203
if (comboChange) {
204204
comboChange = false;
205205
isValidProject = true;
206-
207206
return;
208207
}
209208

210209
// is necessary to not autoselect same Project if Project was selected
211-
if (Boolean.TRUE.equals(isValidProject)) {
210+
if (isValidProject) {
212211
isValidProject = false;
213212
projectComboBox.getSelectionModel().clearSelection();
214213
}
214+
215215
// needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700
216216
Platform.runLater(() -> {
217-
218217
projectComboBox.hide();
219218
projectComboBox.setItems(model.getAllProjects().filtered(project -> ProjectsListViewController
220219
.doesProjectMatchSearchFilter(projectComboBox.getEditor().getText(), project)));
@@ -230,7 +229,7 @@ public void changed(final ObservableValue<? extends String> observable, final St
230229
// manages Focusbehaviour
231230
projectComboBox.getEditor().focusedProperty().addListener((final ObservableValue<? extends Boolean> observable,
232231
final Boolean oldIsFocused, final Boolean newIsFocused) -> {
233-
if (Boolean.TRUE.equals(newIsFocused)) {
232+
if (newIsFocused) {
234233
// needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700
235234
Platform.runLater(() -> projectComboBox.getEditor().selectAll());
236235
} else {

src/main/java/de/doubleslash/keeptime/view/ReportController.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class ReportController {
7373

7474
private static final String FX_BACKGROUND_COLOR_NOT_WORKED = "-fx-background-color: #BBBBBB;";
7575

76+
private static final String EDIT_WORK_DIALOG_TITLE = "Edit work";
77+
7678
@FXML
7779
private BorderPane topBorderPane;
7880

@@ -200,8 +202,8 @@ private void updateReport(final LocalDate dateToShow) {
200202
final MenuItem editMenuItem = new MenuItem("edit");
201203

202204
editMenuItem.setOnAction(e -> {
203-
LOG.info("Edit work");
204-
final Dialog<Work> dialog = setupEditWorkDialog("Edit work", work);
205+
LOG.info(EDIT_WORK_DIALOG_TITLE);
206+
final Dialog<Work> dialog = setupEditWorkDialog(work);
205207

206208
final Optional<Work> result = dialog.showAndWait();
207209

@@ -258,12 +260,11 @@ public void updateItem(final LocalDate item, final boolean empty) {
258260

259261
}
260262

261-
private Dialog<Work> setupEditWorkDialog(final String title, final Work work) {
263+
private Dialog<Work> setupEditWorkDialog(final Work work) {
262264
final Dialog<Work> dialog = new Dialog<>();
263-
264265
dialog.initOwner(stage);
265-
dialog.setTitle(title);
266-
dialog.setHeaderText(title);
266+
dialog.setTitle(EDIT_WORK_DIALOG_TITLE);
267+
dialog.setHeaderText(EDIT_WORK_DIALOG_TITLE);
267268
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
268269

269270
final GridPane grid = setUpEditWorkGridPane(work, dialog);

0 commit comments

Comments
 (0)