/** * This method is used to run a specified Runnable in the FX Application thread, * it returns before the task finished execution * * @param doRun This is the sepcifed task to be excuted by the FX Application thread * @return Nothing */ public static void runInFX(Runnable doRun) { if (Platform.isFxApplicationThread()) { doRun.run(); return; } Platform.runLater(doRun); }
@FXML private void submit() { if (toolbarPopupList.getSelectionModel().getSelectedIndex() == 1) { Platform.exit(); } } }
@Override public void clearLog() { runLater(outputMessages::clear); }
public NewWorkerView(PresentationModel model) { Validate.notNull(model); setLayout(new BorderLayout()); fxPanel = new JFXPanel(); //Scene dimensions not used by Dialog as it is created later, set on fxPanel as well: fxPanel.setPreferredSize(new Dimension(SCENE_WIDTH, SCENE_HEIGHT)); Platform.setImplicitExit(false); // create JavaFX scene Platform.runLater(new SceneInitializer(model)); add(fxPanel, BorderLayout.CENTER); }
@Override public void actionPerformed() { assertThat("Must not be in the FX thread!", Platform.isFxApplicationThread(), is(false)); } }));
public boolean shutdown() { boolean implicitExit = Platform.isImplicitExit(); Platform.setImplicitExit(false); if (!doShutdown()) { Platform.setImplicitExit(implicitExit); return false; } return true; }
@Override public void start(Stage primaryStage) throws Exception { Platform.setImplicitExit(false); l.countDown(); }
@Override public void clear(){ Platform.runLater(issues::clear); }
/** * This method is used to run a specified Runnable in the FX Application thread, * it waits for the task to finish before returning to the main thread. * * @param doRun This is the sepcifed task to be excuted by the FX Application thread * @return Nothing */ public static void runInFXAndWait(Runnable doRun) { if (Platform.isFxApplicationThread()) { doRun.run(); return; } final CountDownLatch doneLatch = new CountDownLatch(1); Platform.runLater(() -> { try { doRun.run(); } finally { doneLatch.countDown(); } }); try { doneLatch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
@Override public void post(Issue issue) { Platform.runLater( () -> { issues.add(issue); }); }
@Inject AppContextMenu(WorkspaceMenu workspace, ModulesMenu modulesMenu) { MenuItem exit = new MenuItem(DefaultI18nContext.getInstance().i18n("E_xit")); exit.setOnAction(e -> Platform.exit()); exit.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN)); getItems().addAll(workspace, modulesMenu); if (!Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS_DEPRECATED) && !Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS)) { MenuItem settings = new MenuItem(DefaultI18nContext.getInstance().i18n("_Settings")); settings.setOnAction( e -> eventStudio().broadcast(new SetActiveDashboardItemRequest(PreferencesDashboardItem.ID))); getItems().add(settings); } getItems().addAll(new SeparatorMenuItem(), exit); } }
@Override protected void schedule(Runnable runnable) { if (Platform.isFxApplicationThread()) { runnable.run(); } else { Platform.runLater(runnable); } } }
@Override public void log(Label line) { runLater(() -> outputMessages.add(line)); }
@Override public void handle(ActionEvent e) { Platform.exit(); } });
private static void run(Runnable eventHandler) { if (eventHandler == null) { return; } if (javafx.application.Platform.isFxApplicationThread()) { eventHandler.run(); } else { javafx.application.Platform.runLater(eventHandler::run); } } }
private void addToOutputMessages(Node node) { runLater(() -> outputMessages.add(node)); }
@Override public void handle(WindowEvent windowEvent) { Platform.exit(); } };
@Override protected void schedule(Runnable runnable) { requireNonNull(runnable, "Argument 'runnable' must not be null"); if (Platform.isFxApplicationThread()) { runnable.run(); } else { Platform.runLater(runnable); } } }
private void clear(Text text) { final List<Rectangle> rectangles = boxes.get(text); if(rectangles != null && !rectangles.isEmpty()) Platform.runLater(() -> getParentChildren(parent).removeAll(rectangles)); } }
public void exit() { Platform.exit(); System.exit(0); } }