protected String placeholderText;
public TaskProgressView() {
this( null );
}
public TaskProgressView( final String pPlaceholderText ) {
getStyleClass().add( "task-progress-view" );
placeholderText = pPlaceholderText;
.
.
.
}
@Override
protected Skin< ? > createDefaultSkin() {
return new TaskProgressViewSkin<>( this, placeholderText );
}
public TaskProgressViewSkin( final TaskProgressView< T > monitor,
final String placeholderText ) {
super( monitor );
final BorderPane borderPane = new BorderPane();
borderPane.getStyleClass().add( "box" );
// Use a List View for the monitored Tasks.
final ListView< T > listView = new ListView<>();
listView.setPrefSize( 500d, 400d );
final Label placeholderLabel = new Label( ( placeholderText != null )
? placeholderText
: "No tasks running" );
listView.setPlaceholder( placeholderLabel );
listView.setCellFactory( param -> new TaskCell() );
listView.setFocusTraversable( false );
Bindings.bindContent( listView.getItems(), monitor.getTasks() );
borderPane.setCenter( listView );
getChildren().add( listView );
}