List of usage examples for javafx.application Platform exit
public static void exit()
From source file:com.github.xwgou.namesurfer.fxui.JFXNameSurfer.java
@Override public void stop() { logger.debug(Thread.getAllStackTraces().keySet().toString()); Platform.exit(); System.exit(0); }
From source file:de.unibw.inf2.fishification.Launch.java
@Override public void start(Stage primaryStage) { m_log.info("Fishification launched."); // Store JavaFx stage for thread-safe access StageSingleton.injectStage(primaryStage); boolean fullScreenMode = true; int serverPort = 8088; String serverEndpoint = "fishworld"; try {//from w w w. j a v a2 s.com // Load configuration PropertiesConfiguration config = new PropertiesConfiguration("app.properties"); // Assign properties m_serverMode = config.getBoolean("fishification.server.active"); fullScreenMode = config.getBoolean("fishification.fullscreen"); serverPort = config.getInt("fishification.server.port"); serverEndpoint = config.getString("fishification.server.endpoint"); } catch (ConfigurationException e) { m_log.warn(MarkerManager.getMarker("EXCEPTION"), "Error reading configuration.", e); } // Init Server ? if (!m_serverMode) { m_log.info(String.format("Starting in client mode with fullscreen: '%b'", fullScreenMode)); // Create World m_world = new FishWorld(); // Init World Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); m_world.initialize(screenBounds.getWidth(), screenBounds.getHeight()); // Let's go m_world.launch(); } else { // Launch Server m_log.info(String.format("Starting server with port: '%d' endpoint: '%s' fullscreen: '%b'", serverPort, serverEndpoint, fullScreenMode)); try { // Set up server FishificationServer.launch(serverPort, serverEndpoint); } catch (Exception e) { m_log.error(MarkerManager.getMarker("EXCEPTION"), "Error launching the server. Exit application.", e); Platform.exit(); } } // Focus window primaryStage.show(); // Full Screen mode if (fullScreenMode) { primaryStage.setFullScreen(true); } }
From source file:de.chaosfisch.uploader.gui.GUIUploader.java
@Override public void start(final Stage primaryStage) { StyleManager.getInstance().addUserAgentStylesheet( getClass().getResource("/de/chaosfisch/uploader/resources/style.css").toExternalForm()); final boolean useMasterPassword = configuration.getBoolean(IPersistenceService.MASTER_PASSWORD, false); if (useMasterPassword) { dialogHelper.showInputDialog("Masterpasswort", "Masterpasswort:", new Callback() { @Override/*from w w w . j ava 2 s . c o m*/ public void onInput(final InputDialogController controller, final String input) { if (Strings.isNullOrEmpty(input)) { controller.input.getStyleClass().add("input-invalid"); } else { persistenceService.generateBackup(); persistenceService.setMasterPassword(input); controller.closeDialog(null); } } }, true); } if (!persistenceService.loadFromStorage()) { if (useMasterPassword) { dialogHelper.showErrorDialog("Closing..", "Invalid password."); } else { dialogHelper.showErrorDialog("Closing..", "Unknown error occured."); } Platform.exit(); } else { persistenceService.cleanStorage(); Platform.setImplicitExit(false); initApplication(primaryStage); uploadService.resetUnfinishedUploads(); uploadService.startStarttimeCheck(); LOGGER.info("Verifying accounts"); final List<Account> accounts = accountService.getAll(); for (final Account account : accounts) { if (!accountService.verifyAccount(account)) { LOGGER.warn("Account is invalid: {}", account.getName()); dialogHelper.showAccountPermissionsDialog(account); } } } }
From source file:de.unibw.inf2.fishification.Launch.java
@Override public void stop() { m_log.info("Fishification shutting down ..."); // Tidy up/*from w ww . ja v a 2s.co m*/ if (!m_serverMode) { m_world.shutdown(); } else { FishificationServer.shutdown(); } m_log.info("Fishification exit."); Platform.exit(); }
From source file:com.github.drbookings.DrBookingsApplication.java
void exit() { Platform.exit(); }
From source file:com.toyota.carservice.controller.CarMenuManagement.java
@FXML private void aksiClose(ActionEvent event) { Platform.exit(); System.exit(0); }
From source file:org.openbase.display.DisplayView.java
private void init(final Stage primaryStage) throws InterruptedException, InitializationException { Runtime.getRuntime().addShutdownHook(new Thread() { @Override//from w ww . j a v a 2 s . c o m public void run() { Platform.exit(); } }); try { // platform configuration Platform.setImplicitExit(false); primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); this.primaryStage = primaryStage; Scene scene = new Scene(cardsPane); // configure hide key combination final KeyCombination escapeKey = new KeyCodeCombination(KeyCode.ESCAPE); scene.addEventHandler(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if (escapeKey.match(event)) { try { setVisible(false); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory( new CouldNotPerformException("Could not execute key event!", ex), logger); } } } }); primaryStage.setScene(scene); try { broadcastServer = new DisplayServer(this); broadcastServer.init(JPService.getProperty(JPBroadcastDisplayScope.class).getValue()); broadcastServer.activate(); } catch (JPServiceException | CouldNotPerformException ex) { throw new CouldNotPerformException("Could not load display server!", ex); } try { displayServer = new DisplayServer(this); displayServer.init(JPService.getProperty(JPDisplayScope.class).getValue()); displayServer.activate(); } catch (JPServiceException | CouldNotPerformException ex) { throw new CouldNotPerformException("Could not load display server!", ex); } this.htmlLoader.init(getScreen()); } catch (CouldNotPerformException ex) { throw new InitializationException(this, ex); } }
From source file:com.omicronware.streamlet.Main.java
@Override public void start(Stage stage) throws Exception { //register the different type of lists on ObjectFactory stage.setTitle("StreamLET - Omicronware Software (C)"); stage.getIcons().add(new Image( getClass().getResource("/com/omicronware/streamlet/fxml/images/icon_96_96.png").toExternalForm())); stage.setOnHidden((WindowEvent event) -> { if (DATABASE != null) { DATABASE.close();// w ww . j av a2 s. com } if (SETTINGS != null) { StoreObjectManager.getInstance().storeObject(SETTINGS); } Platform.exit(); System.exit(0); }); this.stage = stage; openDatabase(); }
From source file:org.craftercms.social.migration.controllers.MainController.java
@Override public void initialize(final URL location, final ResourceBundle resources) { configTable();//from w ww . ja va 2 s . com mnuQuit.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { stopTasks(); Platform.exit(); } }); ctxClearLog.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { logTable.getItems().clear(); } }); ctxClearProfileSelection.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { lstProfileScripts.getSelectionModel().clearSelection(); } }); ctxClearSocialSelection.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { lstSocialScripts.getSelectionModel().clearSelection(); } }); lstProfileScripts.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); lstSocialScripts.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); lstProfileScripts.setCellFactory(new Callback<ListView, ListCell>() { @Override public ListCell call(final ListView listView) { return new FileListCell(); } }); lstSocialScripts.setCellFactory(new Callback<ListView, ListCell>() { @Override public ListCell call(final ListView listView) { return new FileListCell(); } }); ctxReloadProfileScrp.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { lstProfileScripts.getItems().clear(); try { extractBuildInScripts("profile", lstProfileScripts); } catch (MigrationException e) { log.error("Unable to extract BuildIn scripts"); } loadScripts(MigrationTool.systemProperties.getString("crafter.migration.profile.scripts"), lstProfileScripts); } }); ctxReloadSocialScrp.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { lstSocialScripts.getItems().clear(); try { extractBuildInScripts("profile", lstSocialScripts); } catch (MigrationException e) { log.error("Unable to extract BuildIn scripts"); } loadScripts(MigrationTool.systemProperties.getString("crafter.migration.social.scripts"), lstSocialScripts); } }); final MigrationSelectionAction selectionEventHandler = new MigrationSelectionAction(); rbtMigrateProfile.setOnAction(selectionEventHandler); rbtMigrateSocial.setOnAction(selectionEventHandler); loadScripts(); loadDefaultValues(); saveLog.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN)); saveLog.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Save Migration Log"); fileChooser.setInitialFileName("Crafter-Migration-" + new SimpleDateFormat("yyyy-MM-dd@HH_mm").format(new Date()) + ".html"); final File savedFile = fileChooser.showSaveDialog(scene.getWindow()); if (savedFile == null) { return; } try { getHtml(new FileWriter(savedFile)); log.info("Saved Html log file"); } catch (IOException | TransformerException ex) { log.error("Unable to save file", ex); } } }); mnuStart.setAccelerator(new KeyCodeCombination(KeyCode.F5)); mnuStart.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent event) { if (currentTask == null || !currentTask.isRunning()) { ObservableList scriptsToRun; if (rbtMigrateProfile.isSelected()) { scriptsToRun = lstProfileScripts.getSelectionModel().getSelectedItems(); } else { scriptsToRun = lstSocialScripts.getSelectionModel().getSelectedItems(); } currentTask = new MigrationPipeService(logTable, pgbTaskProgress, srcHost.getText(), srcPort.getText(), srcDb.getText(), dstHost.getText(), dstPort.getText(), dstDb.getText(), scriptsToRun); } if (!currentTask.isRunning()) { final Thread t = new Thread(currentTask, "Migration Task"); t.start(); } } }); }
From source file:pe.edu.system.jcmr.controlador.LoguinController.java
public void closeLoguin() { lblClose.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override/*from ww w . j av a2s. c om*/ public void handle(MouseEvent event) { Platform.exit(); } }); }