v0.2.1 pro-active progress bar added
This commit is contained in:
parent
6198b52ca5
commit
dc73b7ccb2
1 changed files with 11 additions and 2 deletions
|
@ -2,6 +2,7 @@ package nsusbloader;
|
||||||
|
|
||||||
import javafx.animation.AnimationTimer;
|
import javafx.animation.AnimationTimer;
|
||||||
import javafx.scene.control.ProgressBar;
|
import javafx.scene.control.ProgressBar;
|
||||||
|
import javafx.scene.control.ProgressIndicator;
|
||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.TextArea;
|
||||||
import nsusbloader.Controllers.NSTableViewController;
|
import nsusbloader.Controllers.NSTableViewController;
|
||||||
import nsusbloader.NSLDataTypes.EFileStatus;
|
import nsusbloader.NSLDataTypes.EFileStatus;
|
||||||
|
@ -34,6 +35,8 @@ public class MessagesConsumer extends AnimationTimer {
|
||||||
this.tableViewController = MediatorControl.getInstance().getContoller().tableFilesListController;
|
this.tableViewController = MediatorControl.getInstance().getContoller().tableFilesListController;
|
||||||
|
|
||||||
progressBar.setProgress(0.0);
|
progressBar.setProgress(0.0);
|
||||||
|
|
||||||
|
progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||||
MediatorControl.getInstance().setTransferActive(true);
|
MediatorControl.getInstance().setTransferActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +49,14 @@ public class MessagesConsumer extends AnimationTimer {
|
||||||
|
|
||||||
ArrayList<Double> progress = new ArrayList<>();
|
ArrayList<Double> progress = new ArrayList<>();
|
||||||
int progressRecieved = progressQueue.drainTo(progress);
|
int progressRecieved = progressQueue.drainTo(progress);
|
||||||
if (progressRecieved > 0)
|
if (progressRecieved > 0) {
|
||||||
progress.forEach(prg -> progressBar.setProgress(prg));
|
progress.forEach(prg -> {
|
||||||
|
if (prg != 1.0)
|
||||||
|
progressBar.setProgress(prg);
|
||||||
|
else
|
||||||
|
progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (isInterrupted) { // It's safe 'cuz it's could't be interrupted while HashMap populating
|
if (isInterrupted) { // It's safe 'cuz it's could't be interrupted while HashMap populating
|
||||||
MediatorControl.getInstance().setTransferActive(false);
|
MediatorControl.getInstance().setTransferActive(false);
|
||||||
|
|
Loading…
Reference in a new issue