From 4a8e0e3beafe6d5a51129189e2a9d30ac31dd40a Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Sat, 1 Dec 2018 16:52:51 +0100 Subject: [PATCH] Removed buggy optimization for puased checkboxes --- .../java/ctbrec/ui/RecordedModelsTab.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/client/src/main/java/ctbrec/ui/RecordedModelsTab.java b/client/src/main/java/ctbrec/ui/RecordedModelsTab.java index e7a397a8..ec927897 100644 --- a/client/src/main/java/ctbrec/ui/RecordedModelsTab.java +++ b/client/src/main/java/ctbrec/ui/RecordedModelsTab.java @@ -32,8 +32,6 @@ import ctbrec.ui.controls.AutoFillTextField; import ctbrec.ui.controls.Toast; import javafx.application.Platform; import javafx.beans.property.SimpleStringProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.concurrent.ScheduledService; @@ -321,20 +319,11 @@ public class RecordedModelsTab extends Tab implements TabSelectionListener { int index = observableModels.indexOf(updatedModel); if (index == -1) { observableModels.add(updatedModel); - updatedModel.getPausedProperty().addListener(new ChangeListener() { - boolean firstChange = true; - @Override - public void changed(ObservableValue obs, Boolean oldV, Boolean newV) { - if(firstChange) { - // don't react to the first change, because that is made by the recorder and not by the user - firstChange = false; - return; - } - if (newV) { - pauseRecording(Collections.singletonList(updatedModel)); - } else { - resumeRecording(Collections.singletonList(updatedModel)); - } + updatedModel.getPausedProperty().addListener((obs, oldV, newV) -> { + if (newV) { + pauseRecording(Collections.singletonList(updatedModel)); + } else { + resumeRecording(Collections.singletonList(updatedModel)); } }); } else {