List of usage examples for javafx.concurrent Service progressProperty
@Override public final ReadOnlyDoubleProperty progressProperty()
From source file:dtv.controller.FXMLMainController.java
private void handleTask(Service<List<DVBChannel>> task, String zeTitle, String action) throws Exception { pi.visibleProperty().bind(task.runningProperty()); pi.progressProperty().bind(task.progressProperty()); task.setOnSucceeded(t -> {/* ww w . j a va 2 s. c om*/ // print services into tableview List<DVBChannel> dvbServices = task.getValue(); if (dvbServices != null) { if (action.contains(DVB_S2)) { serviceDataS2.setAll(dvbServices); serviceDVBS2Table.setItems(sortedDataS2); } else if (action.contains(DVB_T2)) { serviceDataT2.setAll(dvbServices); serviceDVBT2Table.setItems(sortedDataT2); } } if (zeTitle != null) title.setText(zeTitle); disableComponents(false); }); task.setOnFailed(t -> { LOG.error("Exception while executing task", task.getException()); Message.errorMessage("Error " + action + "\n" + task.getException().getMessage()); }); if (!task.isRunning()) { task.reset(); task.start(); } }
From source file:herudi.controller.microMarketController.java
private void selectWithService() { Service<Integer> service = new Service<Integer>() { @Override/*from w ww .ja v a 2 s.c o m*/ 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//from www . ja va 2 s .c o 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(); }); }