@EventListener public void onProgress(PercentageOfWorkDoneChangedEvent event) { open.setVisible(false); failed.setVisible(false); if (event.isUndetermined()) { bar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS); } else { bar.setProgress(event.getPercentage().divide(new BigDecimal(100)).doubleValue()); } }
public ModuleFooterPane() { this.getStyleClass().addAll(Style.CLOSE_FOOTER.css()); failed.setGraphic(AwesomeDude.createIconLabel(AwesomeIcon.TIMES_CIRCLE)); failed.getStyleClass().addAll("pdfsam-footer-button", "pdfsam-footer-failed-button"); failed.setVisible(false); failed.setOnAction(e -> eventStudio().broadcast(new ShowStageRequest(), "LogStage")); failed.setTooltip(new Tooltip(DefaultI18nContext.getInstance().i18n("Task execution failed"))); open.setVisible(false); bar.setPrefWidth(280); }
@EventListener(priority = Integer.MIN_VALUE) public void onTaskExecutionRequest(TaskExecutionRequestEvent event) { open.setVisible(false); failed.setVisible(false); bar.setProgress(0); try { if (!isNull(event.getParameters().getOutput())) { event.getParameters().getOutput().accept(open); } } catch (TaskOutputVisitException e) { LOG.warn("This should never happen", e); } }
@EventListener public void onTaskFailed(TaskExecutionFailedEvent event) { open.setVisible(false); failed.setVisible(true); bar.setProgress(1); }