Use JFXListView in place of custom components to accelerate rendering
This commit is contained in:
@@ -18,10 +18,7 @@
|
||||
package org.jackhuang.hmcl.task;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.ReadOnlyDoubleProperty;
|
||||
import javafx.beans.property.ReadOnlyDoubleWrapper;
|
||||
import javafx.beans.property.ReadOnlyStringProperty;
|
||||
import javafx.beans.property.ReadOnlyStringWrapper;
|
||||
import javafx.beans.property.*;
|
||||
import org.jackhuang.hmcl.event.EventManager;
|
||||
import org.jackhuang.hmcl.util.AutoTypingMap;
|
||||
import org.jackhuang.hmcl.util.InvocationDispatcher;
|
||||
@@ -58,14 +55,18 @@ public abstract class Task {
|
||||
this.significance = significance;
|
||||
}
|
||||
|
||||
private TaskState state = TaskState.READY;
|
||||
private ReadOnlyObjectWrapper<TaskState> state = new ReadOnlyObjectWrapper<>(this, "state", TaskState.READY);
|
||||
|
||||
public TaskState getState() {
|
||||
return state;
|
||||
return state.get();
|
||||
}
|
||||
|
||||
void setState(TaskState state) {
|
||||
this.state = state;
|
||||
this.state.setValue(state);
|
||||
}
|
||||
|
||||
public ReadOnlyObjectProperty<TaskState> stateProperty() {
|
||||
return state.getReadOnlyProperty();
|
||||
}
|
||||
|
||||
private Throwable lastException = null;
|
||||
|
||||
@@ -211,6 +211,7 @@ public final class TaskExecutor {
|
||||
task.onDone().fireEvent(new TaskEvent(this, task, false));
|
||||
taskListeners.forEach(it -> it.onFinished(task));
|
||||
} catch (InterruptedException e) {
|
||||
task.setLastException(e);
|
||||
if (task.getSignificance().shouldLog()) {
|
||||
Logging.LOG.log(Level.FINE, "Task aborted: " + task.getName());
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public abstract class TaskListener implements EventListener {
|
||||
}
|
||||
|
||||
public void onFailed(Task task, Throwable throwable) {
|
||||
onFinished(task);
|
||||
}
|
||||
|
||||
public void onStop(boolean success, TaskExecutor executor) {
|
||||
|
||||
Reference in New Issue
Block a user