Removed buggy optimization for puased checkboxes

This commit is contained in:
0xboobface 2018-12-01 16:52:51 +01:00
parent f0edfb167c
commit 4a8e0e3bea
1 changed files with 5 additions and 16 deletions

View File

@ -32,8 +32,6 @@ import ctbrec.ui.controls.AutoFillTextField;
import ctbrec.ui.controls.Toast; import ctbrec.ui.controls.Toast;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.concurrent.ScheduledService; import javafx.concurrent.ScheduledService;
@ -321,21 +319,12 @@ public class RecordedModelsTab extends Tab implements TabSelectionListener {
int index = observableModels.indexOf(updatedModel); int index = observableModels.indexOf(updatedModel);
if (index == -1) { if (index == -1) {
observableModels.add(updatedModel); observableModels.add(updatedModel);
updatedModel.getPausedProperty().addListener(new ChangeListener<Boolean>() { updatedModel.getPausedProperty().addListener((obs, oldV, newV) -> {
boolean firstChange = true;
@Override
public void changed(ObservableValue<? extends Boolean> 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) { if (newV) {
pauseRecording(Collections.singletonList(updatedModel)); pauseRecording(Collections.singletonList(updatedModel));
} else { } else {
resumeRecording(Collections.singletonList(updatedModel)); resumeRecording(Collections.singletonList(updatedModel));
} }
}
}); });
} else { } else {
// make sure to update the JavaFX online property, so that the table cell is updated // make sure to update the JavaFX online property, so that the table cell is updated