List of usage examples for javafx.concurrent Service setOnRunning
public final void setOnRunning(EventHandler<WorkerStateEvent> value)
From source file:herudi.controller.controllSplash.java
private void longStart() { Service<ApplicationContext> service = new Service<ApplicationContext>() { @Override// w ww . j a va2s . co m protected Task<ApplicationContext> createTask() { return new Task<ApplicationContext>() { @Override protected ApplicationContext call() throws Exception { ApplicationContext appContex = config.getInstance().getApplicationContext(); int max = appContex.getBeanDefinitionCount(); updateProgress(0, max); for (int k = 0; k < max; k++) { Thread.sleep(50); updateProgress(k + 1, max); } return appContex; } }; } }; service.start(); service.setOnRunning((WorkerStateEvent event) -> { new FadeInLeftTransition(lblWelcome).play(); new FadeInRightTransition(lblRudy).play(); new FadeInTransition(vboxBottom).play(); }); service.setOnSucceeded((WorkerStateEvent event) -> { config2 config = new config2(); config.newStage(stage, lblClose, "/herudi/view/login.fxml", "Sample Apps", true, StageStyle.UNDECORATED, false); }); }
From source file:herudi.controller.microMarketController.java
private void selectWithService() { Service<Integer> service = new Service<Integer>() { @Override//from www. j a v a2s. c om protected Task<Integer> createTask() { selectData(); return new Task<Integer>() { @Override protected Integer call() throws Exception { Integer max = crud.selectData().size(); if (max > 35) { max = 30; } updateProgress(0, max); for (int k = 0; k < max; k++) { Thread.sleep(40); updateProgress(k + 1, max); } return max; } }; } }; service.start(); bar.progressProperty().bind(service.progressProperty()); service.setOnRunning((WorkerStateEvent event) -> { imgLoad.setVisible(true); }); service.setOnSucceeded((WorkerStateEvent event) -> { imgLoad.setVisible(false); new FadeInUpTransition(paneTabel).play(); }); }
From source file:herudi.controller.customerController.java
private void selectWithService() { Service<Integer> service = new Service<Integer>() { @Override/*www .j av a 2 s. co m*/ protected Task<Integer> createTask() { selectData(); return new Task<Integer>() { @Override protected Integer call() throws Exception { Integer max = crud.select().size(); if (max > 35) { max = 30; } updateProgress(0, max); for (int k = 0; k < max; k++) { Thread.sleep(40); updateProgress(k + 1, max); } return max; } }; } }; service.start(); bar.progressProperty().bind(service.progressProperty()); service.setOnRunning((WorkerStateEvent event) -> { imgLoad.setVisible(true); }); service.setOnSucceeded((WorkerStateEvent event) -> { imgLoad.setVisible(false); new FadeInUpTransition(paneTabel).play(); }); }
From source file:com.toyota.carservice.controller.SplashController.java
private void longStart() { Service<ApplicationContext> service = new Service<ApplicationContext>() { @Override// w w w . jav a2 s. c o m protected Task<ApplicationContext> createTask() { return new Task<ApplicationContext>() { @Override protected ApplicationContext call() throws Exception { ApplicationContext appContex = config.getInstance().getApplicationContext(); int max = appContex.getBeanDefinitionCount(); updateProgress(0, max); System.out.println(PathUtil.getRootPath()); File file = new File(PathUtil.getRootPath()); if (!file.exists()) { file.mkdir(); } if (max < 50) { max = 50; } for (int k = 0; k < max; k++) { Thread.sleep(50); updateProgress(k + 1, max); } return appContex; } }; } }; service.start(); service.setOnRunning((WorkerStateEvent event) -> { new FadeInLeftTransition(lblWelcome).play(); new FadeInRightTransition(lblRudy).play(); new FadeInTransition(vboxBottom).play(); }); service.setOnSucceeded((WorkerStateEvent event) -> { config2 config = new config2(); config.newStage(stage, lblClose, "/com/toyota/carservice/view/formSwitchMode.fxml", "Aplikasi Informasi Service", true, StageStyle.UNDECORATED, false); }); }