2018-11-04 08:08:37 +03:00
|
|
|
var app, stage, scene, loginScene, menuScene;
|
|
|
|
var rootPane, loginPane, authPane, menuPane;
|
2018-09-17 10:07:32 +03:00
|
|
|
|
|
|
|
// Override application class
|
|
|
|
var LauncherApp = Java.extend(JSApplication, {
|
|
|
|
init: function() {
|
|
|
|
app = JSApplication.getInstance();
|
|
|
|
cliParams.init(app.getParameters());
|
|
|
|
settings.load();
|
2018-10-21 20:01:23 +03:00
|
|
|
cliParams.applySettings();
|
2018-09-17 10:07:32 +03:00
|
|
|
}, start: function(primaryStage) {
|
|
|
|
stage = primaryStage;
|
2018-11-04 08:08:37 +03:00
|
|
|
stage.initStyle(javafx.stage.StageStyle.TRANSPARENT);
|
2018-10-18 19:20:04 +03:00
|
|
|
stage.setResizable(false);
|
2018-11-04 08:08:37 +03:00
|
|
|
stage.setTitle(config.title);
|
2018-09-17 10:07:32 +03:00
|
|
|
|
|
|
|
// Set icons
|
2018-11-04 08:08:37 +03:00
|
|
|
config.icons.forEach(function(icon) {
|
2018-09-17 10:07:32 +03:00
|
|
|
var iconURL = Launcher.getResourceURL(icon).toString();
|
|
|
|
stage.getIcons().add(new javafx.scene.image.Image(iconURL));
|
2018-11-04 08:08:37 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// Load launcher FXML
|
|
|
|
loginPane = loadFXML("dialog/login.fxml");
|
|
|
|
menuPane = loadFXML("dialog/mainmenu.fxml");
|
|
|
|
|
|
|
|
loginScene = new javafx.scene.Scene(loginPane);
|
|
|
|
loginScene.setFill(javafx.scene.paint.Color.TRANSPARENT);
|
2018-09-17 10:07:32 +03:00
|
|
|
|
2018-11-04 08:08:37 +03:00
|
|
|
menuScene = new javafx.scene.Scene(menuPane);
|
|
|
|
menuScene.setFill(javafx.scene.paint.Color.TRANSPARENT);
|
2018-09-17 10:07:32 +03:00
|
|
|
|
2018-11-04 08:08:37 +03:00
|
|
|
setCurrentScene(loginScene);
|
|
|
|
|
|
|
|
initLauncher();
|
2018-09-17 10:07:32 +03:00
|
|
|
|
|
|
|
}, stop: function() {
|
|
|
|
settings.save();
|
2018-11-04 08:08:37 +03:00
|
|
|
options.save();
|
2018-09-17 10:07:32 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Helper functions
|
|
|
|
function loadFXML(name) {
|
|
|
|
var loader = new javafx.fxml.FXMLLoader(Launcher.getResourceURL(name));
|
|
|
|
loader.setCharset(IOHelper.UNICODE_CHARSET);
|
|
|
|
return loader.load();
|
|
|
|
}
|
|
|
|
|
2018-11-04 08:08:37 +03:00
|
|
|
function setCurrentScene(scene) {
|
|
|
|
stage.setScene(scene);
|
|
|
|
rootPane = scene.getRoot();
|
|
|
|
dimPane = rootPane.lookup("#mask");
|
|
|
|
stage.sizeToScene();
|
|
|
|
stage.centerOnScreen();
|
|
|
|
stage.show();
|
|
|
|
}
|
|
|
|
|
2018-09-17 10:07:32 +03:00
|
|
|
function setRootParent(parent) {
|
|
|
|
scene.setRoot(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start function - there all begins
|
|
|
|
function start(args) {
|
2018-11-04 08:08:37 +03:00
|
|
|
|
2018-09-17 10:07:32 +03:00
|
|
|
// Set font rendering properties
|
|
|
|
LogHelper.debug("Setting FX properties");
|
|
|
|
java.lang.System.setProperty("prism.lcdtext", "false");
|
2018-11-04 08:08:37 +03:00
|
|
|
|
2018-09-17 10:07:32 +03:00
|
|
|
// Start laucher JavaFX stage
|
|
|
|
LogHelper.debug("Launching JavaFX application");
|
|
|
|
javafx.application.Application.launch(LauncherApp.class, args);
|
|
|
|
}
|
2018-11-04 08:08:37 +03:00
|
|
|
launcher.loadScript("dialog/dialog.js");
|