small bugfix + elegant thing
This commit is contained in:
parent
a92c429a95
commit
99b7743934
1 changed files with 16 additions and 17 deletions
|
@ -65,32 +65,31 @@ public class SplashController implements Initializable{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Task<DataBundle> t = new Task<DataBundle>() {
|
Thread th = new Thread(new Task<DataBundle>() {
|
||||||
@Override
|
@Override
|
||||||
protected DataBundle call() throws Exception {
|
protected DataBundle call() throws Exception {
|
||||||
DataBundle db = DataBundle.loadFrom(file);
|
DataBundle db = DataBundle.loadFrom(file);
|
||||||
System.out.println("done");
|
|
||||||
updateProgress(1, 1);
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
t.setOnSucceeded(ev -> {
|
@Override
|
||||||
DataBundle bundle = t.getValue();
|
protected void succeeded() {
|
||||||
|
super.succeeded();
|
||||||
|
DataBundle bundle = getValue();
|
||||||
if (bundle == null) errorLoading();
|
if (bundle == null) errorLoading();
|
||||||
FXMLLoader loader = new FXMLLoader(
|
FXMLLoader loader = new FXMLLoader(
|
||||||
App.class.getResource("fxml/Dashboard.fxml"), App.GENERAL_BUNDLE);
|
App.class.getResource("fxml/Dashboard.fxml"), App.GENERAL_BUNDLE);
|
||||||
Parent parent = null;
|
Parent parent = null;
|
||||||
try {
|
try {
|
||||||
parent = loader.load();
|
parent = loader.load();
|
||||||
|
loader.<DashboardController>getController().postInit(bundle);
|
||||||
|
((Stage) root.getScene().getWindow()).setScene(new Scene(parent));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
errorLoading();
|
errorLoading();
|
||||||
}
|
}
|
||||||
loader.<DashboardController>getController().postInit(bundle);
|
}
|
||||||
((Stage) root.getScene().getWindow()).setScene(new Scene(parent));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Thread th = new Thread(t);
|
|
||||||
th.setDaemon(true);
|
th.setDaemon(true);
|
||||||
th.start();
|
th.start();
|
||||||
|
|
||||||
|
|
Reference in a new issue