List of usage examples for javafx.application Platform runLater
public static void runLater(Runnable runnable)
From source file:Dominion.DynamicCard.ClientModelService.java
public ClientModelService(ClientControlV2 controller, final ConnectionManager connection) { super(keywordprototype); this.controller = controller; final ClientModelService that = this; Platform.runLater(new Runnable() { @Override//from www. j a v a2s .com public void run() { confirmationmanager = new ConfirmManager(new Stage(), "ConfirmView.fxml", "Confirm", 640, 740, that, connection); confirmationmanager.hide(); }; }); }
From source file:at.ac.tuwien.qse.sepm.gui.controller.impl.StatusIndicatorImpl.java
@FXML private void initialize() { errorIndicator.setVisible(false);//from w w w.j a v a 2s .c o m progressIndicator.setVisible(false); syncService.subscribeQueue(operation -> Platform.runLater(this::update)); syncService.subscribeComplete(operation -> Platform.runLater(this::update)); syncService.subscribeError((operation, error) -> { errors.add(operation); Platform.runLater(this::update); }); errorIndicator.setOnAction(event -> { errors.clear(); Platform.runLater(this::update); }); }
From source file:ninja.eivind.hotsreplayuploader.files.tempwatcher.RecursiveTempWatcherTest.java
@Before public void setUp() throws Exception { directories = platformService.getBattleLobbyTempDirectories(); if (!(directories.getRoot().exists() || directories.getRoot().mkdirs())) { fail("Could not create tmp root"); }// w w w . j a va 2s. co m // give file creation some time to complete Thread.sleep(250); tempWatcher = new RecursiveTempWatcher(directories); CountDownLatch latch = new CountDownLatch(1); Platform.runLater(new Runnable() { @Override public void run() { tempWatcher.start(); latch.countDown(); } }); if (!latch.await(1, TimeUnit.SECONDS)) { fail("Service did not start."); } // give watchers some time to wind up Thread.sleep(250); }
From source file:ch.unibas.fittingwizard.presentation.base.progress.ProgressPage.java
@Override public void initializeData() { if (task == null) { task = new Task<Boolean>() { @Override// w ww . j a va 2 s. co m protected Boolean call() throws Exception { return ProgressPage.this.run(ProgressPage.this); } }; task.setOnCancelled(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent event) { logger.info("Task canceled."); goBack(); } }); task.setOnSucceeded(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent event) { logger.info("Task succeeded."); final boolean result = task.getValue(); Platform.runLater(new CatchedRunnable() { @Override public void safelyRun() { handleFinishedRun(result); } }); task = null; } }); task.setOnFailed(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent event) { logger.info("Task failed."); String error = "No exception details available."; if (task.getException() != null) { error = ExceptionUtils.getMessage(task.getException()); logger.error("Task failed with exception.", task.getException()); } OverlayDialog.showError("Error in the task execution", "There was an error in the task execution.\n\n" + error); goBack(); } }); } logger.info("Starting task"); new Thread(task).start(); logger.info("Task started."); }
From source file:com.eby.admin.edit.admin.EditAdminController.java
/** * Initializes the controller class./*from ww w. j av a2 s .com*/ */ @Override public void initialize(URL url, ResourceBundle rb) { initModel(); addcbLvl(); //diajalankan apabila hanya diperlukan Platform.runLater(() -> { txtEmail.setOnKeyReleased((KeyEvent event) -> { validator = EmailValidator.getInstance(); if (validator.isValid(txtEmail.getText())) { //mengubah icon menjadi valid-label jika email valid labelEmail.getStyleClass().remove("invalid-label"); labelEmail.getStyleClass().add("valid-label"); } else { //menguah icon menjadi invalid-label jiak email invalid labelEmail.getStyleClass().remove("valid-label"); labelEmail.getStyleClass().add("invalid-label"); } }); }); //nonaktifkan txtNotif txtNotif.setVisible(false); }
From source file:org.mskcc.shenkers.control.track.fasta.FastaViewNGTest.java
@Test public void testGetGraphic() throws InterruptedException { String title = ""; CountDownLatch l = new CountDownLatch(1); Platform.runLater(() -> { String st = "CGATCGCCATTGAGCAAGTAAGCCAACTTTCGGCTCGCGTGTACGCGATAAGTAGGTGCCCTCTGCATCCGACGCACTTCAGCCGAACCACTTGCGGGAATTTGGGGGAGTGCTGATACGACGGCATAGGAATGGAGCTCTTTAAGTGCGTCTACACACGGACCGTACTTGGCCAAATCGGCAGTCAGTTGTATT"; FastaView tp = new FastaView(); tp.flip.setValue(true);/*from w w w .j av a 2s .c o m*/ tp.setSequence(0, st); Scene scene = new Scene(tp, 300, 300, Color.GRAY); Stage stage = new Stage(); stage.setScene(scene); stage.setOnHidden(e -> { l.countDown(); }); stage.show(); }); l.await(); }
From source file:org.mskcc.shenkers.view.IntervalViewNGTest.java
public void testRangeSetIntervalView() throws InterruptedException { System.out.println("testIntervalView"); CountDownLatch l = new CountDownLatch(1); System.out.println("before"); Platform.runLater(() -> { System.out.println("running"); double[][] intervals = { { .1, .2 } }; // Range r = null; RangeSet<Double> rs = TreeRangeSet.create(); rs.add(Range.closed(.1, .2));/*from w w w. ja v a2s .com*/ rs.add(Range.closed(.2, .3)); rs.add(Range.closed(.32, .35)); rs.add(Range.closed(.6, .8)); RangeSetIntervalView p = new RangeSetIntervalView(0, 100); p.setData(Arrays.asList(new Pair(10, 20), new Pair(20, 30), new Pair(32, 35), new Pair(60, 80))); // p.prefTileHeightProperty().bind(p.heightProperty()); Stage stage = new Stage(); stage.setOnHidden(e -> { l.countDown(); System.out.println("count " + l.getCount()); }); Scene scene = new Scene(p, 300, 300, Color.GRAY); stage.setTitle("SimpleIntervalView"); stage.setScene(scene); stage.show(); }); System.out.println("after"); l.await(); Thread.sleep(1000); }
From source file:org.yardstick.spark.util.FXCSSUpdater.java
public void bindCss(final StringProperty cssProperty) { cssProperty.addListener(new ChangeListener<String>() { @Override// w ww. ja v a 2 s .com public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { cssHolder.str = cssProperty.get(); Platform.runLater(new Runnable() { public void run() { scene.getStylesheets().clear(); scene.getStylesheets().add("internal:stylesheet.css"); } }); } }); }
From source file:net.rptools.image.listeners.DrawHandler.java
@Override public boolean handle(final SystemEvent ev, final String[] params) { final Point2D drag = new Point2D(Double.parseDouble(params[X]), Double.parseDouble(params[Y])); Platform.runLater(new Runnable() { @Override/* w ww . ja v a 2 s .c o m*/ public void run() { draw(params[PHASE], drag, params[PEN], params[FILL], Integer.parseInt(params[RADIUS])); } }); return true; }
From source file:de.micromata.mgc.javafx.ControllerService.java
public void runInToolkitThread(final Runnable runnable) { if (Platform.isFxApplicationThread() == true) { runnable.run();/* ww w .j a v a 2 s .c o m*/ return; } Platform.runLater(runnable); }