Update the online property of JavaFxModel
With the refactoring of the model / chaturbate class, the online property of JavaFxModel was not updated anymore, so that the checkbox in the table would never update.
This commit is contained in:
parent
1dadd6b94b
commit
4cbb855bc6
|
@ -1,6 +1,9 @@
|
||||||
package ctbrec.ui;
|
package ctbrec.ui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import ctbrec.Model;
|
import ctbrec.Model;
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
|
@ -16,6 +19,9 @@ public class JavaFxModel extends Model {
|
||||||
|
|
||||||
public JavaFxModel(Model delegate) {
|
public JavaFxModel(Model delegate) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
|
try {
|
||||||
|
onlineProperty.set(Objects.equals("public", delegate.getOnlineState(true)));
|
||||||
|
} catch (IOException | ExecutionException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -149,8 +150,15 @@ public class RecordedModelsTab extends Tab implements TabSelectionListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Model model : models) {
|
for (Model model : models) {
|
||||||
if (!observableModels.contains(model)) {
|
int index = observableModels.indexOf(model);
|
||||||
|
if (index == -1) {
|
||||||
observableModels.add(new JavaFxModel(model));
|
observableModels.add(new JavaFxModel(model));
|
||||||
|
} else {
|
||||||
|
// make sure to update the JavaFX online property, so that the table cell is updated
|
||||||
|
try {
|
||||||
|
JavaFxModel javaFxModel = observableModels.get(index);
|
||||||
|
javaFxModel.getOnlineProperty().set(Objects.equals("public", javaFxModel.getOnlineState()));
|
||||||
|
} catch (IOException | ExecutionException e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Iterator<JavaFxModel> iterator = observableModels.iterator(); iterator.hasNext();) {
|
for (Iterator<JavaFxModel> iterator = observableModels.iterator(); iterator.hasNext();) {
|
||||||
|
|
Loading…
Reference in New Issue