Updated progress bar to support Validation state

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-export-widget@95289 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-02 08:21:41 +00:00
parent e1bff4ae2a
commit 77ca8f02ba
4 changed files with 32 additions and 3 deletions

View File

@ -189,4 +189,10 @@ public class CSVOperationInProgressCard extends WizardCard implements
}
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
}

View File

@ -54,9 +54,9 @@ public class CSVExportProgressBarUpdater implements CSVExportProgressListener {
progressBar.updateProgress(0, "Initializing...");
}
@Override
public void operationUpdate(float elaborated) {
Log.info("Export elaborated: "+elaborated);
Log.info("Elaborated: "+elaborated);
if (elaborated == 0) progressBar.updateProgress(0, "Initializing...");
if (elaborated>0 && elaborated<1) {
Log.trace("progress "+elaborated);
@ -67,6 +67,19 @@ public class CSVExportProgressBarUpdater implements CSVExportProgressListener {
}
@Override
public void operationValidate(float elaborated) {
Log.info("Validation Elaborated: "+elaborated);
if (elaborated == 0) progressBar.updateProgress(0, "Start Validation...");
if (elaborated>0 && elaborated<1) {
Log.trace("Validation progress "+elaborated);
int elab=new Float(elaborated*100).intValue();
progressBar.updateProgress(elaborated,elab+"% Validation Progress...");
}
if (elaborated == 1) progressBar.updateProgress(1, "Validation...");
}
@Override
public void operationStopped(TRId trId,String reason, String details) {
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");

View File

@ -28,6 +28,11 @@ public interface CSVExportProgressListener {
*/
public void operationUpdate(float elaborated);
/**
* Called when there is a validate for the operation.
* @param elaborated the elaborated part.
*/
public void operationValidate(float elaborated);
/**
* Called when the operation is complete.

View File

@ -59,7 +59,7 @@ public class CSVExportProgressUpdater extends Timer {
fireOperationUpdate(result.getProgress());
break;
case VALIDATING_RULES:
fireOperationUpdate(result.getProgress());
fireOperationValidate(result.getProgress());
break;
case GENERATING_VIEW:
Log.info("Generating View...");
@ -146,6 +146,11 @@ public class CSVExportProgressUpdater extends Timer {
for (CSVExportProgressListener listener : listeners)
listener.operationUpdate(elaborated);
}
protected void fireOperationValidate(float elaborated) {
for (CSVExportProgressListener listener : listeners)
listener.operationValidate(elaborated);
}
protected void fireOperationComplete() {
for (CSVExportProgressListener listener : listeners)