Class MultiProgress
java.lang.Object
com.codename1.cli.MultiProgress
- All Implemented Interfaces:
AutoCloseable
Several progress bars drawn together, one line each, for work that runs in parallel:
try (MultiProgress all = new MultiProgress()) {
ProgressBar a = all.add("images", 120);
ProgressBar b = all.add("videos", 8);
// ... a.step() and b.step() from any thread ...
all.println("skipped broken.png");
}
On a terminal the bars are redrawn ten times a second by a background thread, so a bar that is not stepped still shows its rate and an unknown total still animates; stepping only updates numbers and is cheap from any thread. Off a terminal each bar prints a line as it passes every tenth of its total (at most one a second) and a final line when it completes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a bar fortotalunits of work; a total of 0 or less is unknown and the bar animates without a percentage.voidclose()Stops redrawing and leaves the final state of every bar on screen; bars still running are shown as they are.booleanisLive()Whether the bars redraw in place.voidPrintstextabove the bars.
-
Constructor Details
-
MultiProgress
public MultiProgress()A group on standard output.
-
-
Method Details
-
add
Adds a bar fortotalunits of work; a total of 0 or less is unknown and the bar animates without a percentage. -
println
Printstextabove the bars. -
isLive
public boolean isLive()Whether the bars redraw in place. -
close
public void close()Stops redrawing and leaves the final state of every bar on screen; bars still running are shown as they are.- Specified by:
closein interfaceAutoCloseable
-