use of net.sf.latexdraw.util.VersionChecker in project latexdraw by arnobl.
the class LaTeXDraw method start.
@Override
public void start(final Stage stage) {
final Task<Void> task = new Task<Void>() {
@Override
protected Void call() throws IOException {
updateProgress(0.1, 1d);
Platform.runLater(() -> {
mainStage = new Stage(StageStyle.DECORATED);
mainStage.setIconified(true);
mainStage.setTitle(LABEL_APP);
});
final Parent root = // NON-NLS
FXMLLoader.load(// NON-NLS
getClass().getResource("/fxml/UI.fxml"), // NON-NLS
LangTool.INSTANCE.getBundle(), new LatexdrawBuilderFactory(injector), instanceCallBack);
updateProgress(0.6, 1d);
final Scene scene = new Scene(root);
updateProgress(0.7, 1d);
// NON-NLS
scene.getStylesheets().add("css/style.css");
updateProgress(0.8, 1d);
Platform.runLater(() -> {
mainStage.setScene(scene);
updateProgress(0.9, 1d);
mainStage.show();
registerScene(scene);
final PreferencesSetter prefSetter = injector.getInstance(PreferencesSetter.class);
prefSetter.readXMLPreferences();
// Preventing the stage to close automatically.
mainStage.addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, WindowEvent::consume);
// NON-NLS
mainStage.getIcons().add(new Image("/res/LaTeXDrawIcon.png"));
mainStage.centerOnScreen();
injector.getInstance(MagneticGrid.class).update();
injector.getInstance(TabSelector.class).centreViewport();
injector.getInstance(Canvas.class).requestFocus();
// Checking a new version if required.
if (VersionChecker.WITH_UPDATE && injector.getInstance(PreferencesSetter.class).isVersionCheckEnable()) {
new Thread(new VersionChecker(injector.getInstance(StatusBarController.class))).start();
}
setModified(false);
});
return null;
}
};
task.setOnFailed(BadaboomCollector.INSTANCE);
showSplash(stage, task);
new Thread(task).start();
}
Aggregations