/** * Cancel running task if there is at the moment. * Launch it again. */ public void restart() { cancel(); Objects.requireNonNull(task, "Task must be specified either in constructor or by passing it to restart() method"); taskHandler = backgroundWorker.handle(task); taskHandler.execute(); }
protected void searchSuggestions(final String query) { BackgroundTask<Long, List<V>> task = getSearchSuggestionsTask(query); if (task != null) { handler = backgroundWorker.handle(task); handler.execute(); } }
protected void searchSuggestions(final String query) { BackgroundTask<Long, List<V>> task = getSearchSuggestionsTask(query); if (task != null) { handler = backgroundWorker.handle(task); handler.execute(); } }
/** * Cancel running task if there is at the moment. * Launch new task specified as parameter. * * @param task task to start, also will be saved for future restarts */ public void restart(BackgroundTask<T, V> task) { cancel(); this.task = task; taskHandler = backgroundWorker.handle(task); taskHandler.execute(); }
@Override public void init(Map<String, Object> params) { @SuppressWarnings("unchecked") BackgroundTask<T, V> task = (BackgroundTask<T, V>) params.get("task"); String title = (String) params.get("title"); if (title != null) { setCaption(title); } String message = (String) params.get("message"); if (message != null) { text.setValue(message); } Boolean cancelAllowedNullable = (Boolean) params.get("cancelAllowed"); cancelAllowed = BooleanUtils.isTrue(cancelAllowedNullable); cancelButton.setVisible(cancelAllowed); getDialogOptions().setCloseable(cancelAllowed); BackgroundTask<T, V> wrapperTask = new LocalizedTaskWrapper<>(task, this); taskHandler = backgroundWorker.handle(wrapperTask); taskHandler.execute(); }
taskHandler = backgroundWorker.handle(wrapperTask); taskHandler.execute();