mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 21:48:22 +02:00
show state and allow exit based on state
This commit is contained in:
@@ -27,9 +27,12 @@
|
||||
package ninja.javafx.smartcsv.fx;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
|
||||
@@ -46,6 +49,8 @@ public class SmartCSV extends Application {
|
||||
String name = appContext.getEnvironment().getProperty("application.name");
|
||||
String version = appContext.getEnvironment().getProperty("application.version");
|
||||
|
||||
Platform.setImplicitExit(false);
|
||||
|
||||
try {
|
||||
showUI(primaryStage, name, version);
|
||||
} catch (Exception e) {
|
||||
@@ -80,6 +85,12 @@ public class SmartCSV extends Application {
|
||||
primaryStage.setTitle(String.format("%s %s", name, version));
|
||||
primaryStage.show();
|
||||
primaryStage.setMaximized(true);
|
||||
|
||||
primaryStage.setOnCloseRequest(event -> {
|
||||
if (!smartCVSController.canExit()) {
|
||||
event.consume();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user