Class ActionButton<T>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<VButton>
org.vaadin.firitin.components.button.ActionButton<T>
Type Parameters:
T - the type of the result of the slow task
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, Serializable

public class ActionButton<T> extends com.vaadin.flow.component.Composite<VButton>
A button that can be used to run a slow action in the background without blocking the UI. Even if you would disable/block other parts of your UI during the action, this can be better approach as the global progress indicator can make people think the app has crashed. A good UI pattern for long-running actions (that can't run on background and keep the UI funtional), is to show for example a dialog with a progress indicator and possibly a cancel button.

NOTE! This class is still in early development and likely to get some changes still in the future. Suggestions/contributions are more than welcome!

The button will be disabled while the task is running and re-enabled when the task is done.

The actual task, set with setAction(Supplier) or setCompletableFutureAction(Supplier), is run in a separate thread. If your task wants to update the UI during its execution, you need to synchronize with the UI thread using UI.access(Command).

UI updates are suggested to be done in #setPostTaskAction(Consumer) which is called after the task has completed or #setPreTaskAction(Runnable) which is called before the task is started. These are run in the UI thread.

The button will automatically enable polling if push is not enabled and call push() if "manual server push" is active.

See Also: