From 2b3a2caa06b0b54231cf48fc8e893751781bbb92 Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Sat, 22 Sep 2018 18:31:46 +0200 Subject: [PATCH] ExtensionForm development --- src/main/extensions/FXApplication.java | 58 -------------------------- 1 file changed, 58 deletions(-) delete mode 100644 src/main/extensions/FXApplication.java diff --git a/src/main/extensions/FXApplication.java b/src/main/extensions/FXApplication.java deleted file mode 100644 index 6d2f030..0000000 --- a/src/main/extensions/FXApplication.java +++ /dev/null @@ -1,58 +0,0 @@ -package main.extensions; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.stage.Stage; - -import java.net.URL; - -/** - * Created by Jonas on 22/09/18. - */ -public class FXApplication extends Application { - - public interface InitStage { - void callback(Stage primaryStage, Parent root); - } - private InitStage initStage; - private URL layoutLocation; - private boolean[] isOpen = {false}; - - public FXApplication(URL layoutLocation, InitStage initStage) { - super(); - - this.layoutLocation = layoutLocation; - this.initStage = initStage; - } - - @Override - public void start(Stage primaryStage) throws Exception { - FXMLLoader loader = new FXMLLoader(layoutLocation); - Parent root = loader.load(); - - initStage.callback(primaryStage, root); - primaryStage.show(); - - primaryStage.setOnCloseRequest(event -> isOpen[0] = false); - isOpen[0] = true; - } - - @Override - public void stop() throws Exception { - super.stop(); - - isOpen[0] = false; - } - - public boolean isOpen() { - return isOpen[0]; - } - - public void open() { - if (!isOpen()) { - launch(); - } - } - -}