Class UIFuture
java.lang.Object
org.vaadin.firitin.components.button.UIFuture
This helper class is used to execute long-running actions and provide an easy way to run updates once the action is
finished.
The helper takes care of enabling polling if push is not enabled and synchronizes the UI updates with the UI thread. If the manual push mode is used, the server push is triggered automatically after UI updates are done.
NOTE! This class is still in early development and likely to get some changes still in the future. Suggestions/contributions are more than welcome!
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
<T> CompletableFuture
<T> of
(CompletableFuture<T> task) Returns a completable future whose additional actions are executed and properly synchronized in the UI thread.void
setAsyncUiUpdate
(boolean asyncUiUpdate) void
setExecutor
(Executor executor) Sets the executor that will be used to run the task.<T> CompletableFuture
<T> supplyAsync
(Supplier<T> supplier)
-
Constructor Details
-
UIFuture
public UIFuture(com.vaadin.flow.component.UI ui) -
UIFuture
public UIFuture()
-
-
Method Details
-
isAsyncUiUpdate
public boolean isAsyncUiUpdate() -
setAsyncUiUpdate
public void setAsyncUiUpdate(boolean asyncUiUpdate) -
getExecutor
-
setExecutor
Sets the executor that will be used to run the task. A default by JDK is used if not set.- Parameters:
executor
-
-
of
Returns a completable future whose additional actions are executed and properly synchronized in the UI thread. Note, that if you use the async methods of the completable future, you need to synchronize with the UI thread yourself.- Type Parameters:
T
-- Parameters:
task
-- Returns:
-
supplyAsync
-
runAsync
-