Top Description Fields Constructors Methods
org.controlsfx.control

public Class TaskProgressView<T extends Task<?>>

extends ControlsFXControl
Class Inheritance
Imports
impl.org.controlsfx.skin.TaskProgressViewSkin, javafx.beans.property.BooleanProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, javafx.concurrent.Task, .WorkerStateEvent, javafx.event.EventHandler, javafx.scene.Node, javafx.scene.control.Skin, javafx.util.Callback

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());

Field Summary

Modifier and TypeField and Description
private ObjectProperty<Callback<T, Node>>
private final BooleanProperty
private final ObservableList<T>

Constructor Summary

AccessConstructor and Description
public
TaskProgressView()

Constructs a new task progress view.

Method Summary

Modifier and TypeMethod and Description
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final Callback<T, Node>

Returns:

the optional graphic factory
getGraphicFactory
()

Returns the value of graphicFactoryProperty().

public final ObservableList<T>

Returns:

the monitored tasks
getTasks
()

Returns the list of tasks currently monitored by this view.

public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final ObjectProperty<Callback<T, Node>>

Returns:

the graphic factory property
graphicFactoryProperty
()

Returns the property used to store an optional callback for creating custom graphics for each task.

public final boolean

Returns:

boolean determines if tasks will be retained
isRetainTasks
()

Checks if tasks will not be removed when succeeded, cancelled or failed.

public final BooleanProperty

Returns:

BooleanProperty the retainTasks property
retainTasksProperty
()

Do not remove tasks when succeeded, cancelled or failed.

public final void
setGraphicFactory(Callback<T, Node>
an optional graphic factory
factory
)

Sets the value of graphicFactoryProperty().

public final void
setRetainTasks(boolean
determines if tasks will be retained
retainTasks
)

Do not remove tasks when succeeded, cancelled or failed.

Inherited from org.controlsfx.control.ControlsFXControl:
getUserAgentStylesheet

Field Detail

graphicFactoryback to summary
private ObjectProperty<Callback<T, Node>> graphicFactory
retainTasksback to summary
private final BooleanProperty retainTasks
tasksback to summary
private final ObservableList<T> tasks

Constructor Detail

TaskProgressViewback to summary
public TaskProgressView()

Constructs a new task progress view.

Method Detail

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
getGraphicFactoryback to summary
public final Callback<T, Node> getGraphicFactory()

Returns the value of graphicFactoryProperty().

Returns:Callback<T, Node>

the optional graphic factory

getTasksback to summary
public final ObservableList<T> getTasks()

Returns the list of tasks currently monitored by this view.

Returns:ObservableList<T>

the monitored tasks

getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
graphicFactoryPropertyback to summary
public final ObjectProperty<Callback<T, Node>> graphicFactoryProperty()

Returns the property used to store an optional callback for creating custom graphics for each task.

Returns:ObjectProperty<Callback<T, Node>>

the graphic factory property

isRetainTasksback to summary
public final boolean isRetainTasks()

Checks if tasks will not be removed when succeeded, cancelled or failed.

Returns:boolean

boolean determines if tasks will be retained

retainTasksPropertyback to summary
public final BooleanProperty retainTasksProperty()

Do not remove tasks when succeeded, cancelled or failed.

Returns:BooleanProperty

BooleanProperty the retainTasks property

setGraphicFactoryback to summary
public final void setGraphicFactory(Callback<T, Node> factory)

Sets the value of graphicFactoryProperty().

Parameters
factory:Callback<T, Node>

an optional graphic factory

setRetainTasksback to summary
public final void setRetainTasks(boolean retainTasks)

Do not remove tasks when succeeded, cancelled or failed.

Parameters
retainTasks:boolean

determines if tasks will be retained