kauron/estraba
Archived
1
0
Fork 0

small bugfix + elegant thing

This commit is contained in:
Jesús Vélez Palacios 2016-05-21 19:59:41 +02:00
parent a92c429a95
commit 99b7743934

View file

@ -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() {
if (bundle == null) errorLoading(); super.succeeded();
FXMLLoader loader = new FXMLLoader( DataBundle bundle = getValue();
App.class.getResource("fxml/Dashboard.fxml"), App.GENERAL_BUNDLE); if (bundle == null) errorLoading();
Parent parent = null; FXMLLoader loader = new FXMLLoader(
try { App.class.getResource("fxml/Dashboard.fxml"), App.GENERAL_BUNDLE);
parent = loader.load(); Parent parent = null;
} catch (IOException e) { try {
errorLoading(); parent = loader.load();
loader.<DashboardController>getController().postInit(bundle);
((Stage) root.getScene().getWindow()).setScene(new Scene(parent));
} catch (IOException e) {
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();