Class TaskProgressView<T extends Task<?>>

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class TaskProgressView<T extends Task<?>> extends Control
The task progress view is used to visualize the progress of long running tasks. These tasks are created via the Task class. This view manages a list of such tasks and displays each one of them with their name, progress, and update messages.

An optional graphic factory can be set to place a graphic in each row. This allows the user to more easily distinguish between different types of tasks.

Screenshots

The picture below shows the default appearance of the task progress view control:
Screenshot of TaskProgressView

Code Sample

 TaskProgressView<MyTask> view = new TaskProgressView<>();
 view.setGraphicFactory(task -> return new ImageView("db-access.png"));
 view.getTasks().add(new MyTask());
 
  • Property Details

  • Constructor Details

    • TaskProgressView

      public TaskProgressView()
      Constructs a new task progress view.
  • Method Details

    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class Control
    • getTasks

      public final ObservableList<T> getTasks()
      Returns the list of tasks currently monitored by this view.
      Returns:
      the monitored tasks
    • graphicFactoryProperty

      public final ObjectProperty<Callback<T,Node>> graphicFactoryProperty()
      Returns the property used to store an optional callback for creating custom graphics for each task.
      See Also:
    • getGraphicFactory

      public final Callback<T,Node> getGraphicFactory()
      Returns the value of graphicFactoryProperty().
      Returns:
      the optional graphic factory
    • setGraphicFactory

      public final void setGraphicFactory(Callback<T,Node> factory)
      Sets the value of graphicFactoryProperty().
      Parameters:
      factory - an optional graphic factory
    • isRetainTasks

      public final boolean isRetainTasks()
      Checks if tasks will not be removed when succeeded, cancelled or failed.
      Returns:
      boolean determines if tasks will be retained
    • retainTasksProperty

      public final BooleanProperty retainTasksProperty()
      Do not remove tasks when succeeded, cancelled or failed.
      See Also:
    • setRetainTasks

      public final void setRetainTasks(boolean retainTasks)
      Do not remove tasks when succeeded, cancelled or failed.
      Parameters:
      retainTasks - determines if tasks will be retained
    • getUserAgentStylesheet

      protected final String getUserAgentStylesheet(Class<?> clazz, String fileName)
      A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once. Caches the external form of the resource.
      Parameters:
      clazz - the class used for the resource lookup
      fileName - the name of the user agent stylesheet
      Returns:
      the external form of the user agent stylesheet (the path)