88 lines
2.3 KiB
Java
88 lines
2.3 KiB
Java
|
/**
|
||
|
*
|
||
|
*/
|
||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.progress;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||
|
|
||
|
import com.allen_sauer.gwt.log.client.Log;
|
||
|
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||
|
|
||
|
/**
|
||
|
* Updates a {@link ProgressBar} progress and text based on {@link OperationProgressListener} events.
|
||
|
*
|
||
|
* @author "Giancarlo Panichi"
|
||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||
|
*
|
||
|
*/
|
||
|
public class ImportProgressBarUpdater implements OperationProgressListener {
|
||
|
|
||
|
protected ProgressBar progressBar;
|
||
|
//protected FramedPanel operationResult;
|
||
|
//protected WizardWindow wizardWindow;
|
||
|
/**
|
||
|
* Creates a new {@link ProgressBar} updater.
|
||
|
* @param progressBar the {@link ProgressBar} to update.
|
||
|
*/
|
||
|
public ImportProgressBarUpdater(ProgressBar progressBar) {
|
||
|
this.progressBar = progressBar;
|
||
|
//this.wizardWindow = w;
|
||
|
//this.operationResult = operationResult;
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* {@inheritDoc}
|
||
|
*/
|
||
|
@Override
|
||
|
public void operationComplete(TRId trId) {// TODO Auto-generated method stub
|
||
|
Log.info("Import complete");
|
||
|
progressBar.updateProgress(1, "Import complete.");
|
||
|
/*final FlexTable descriptionResult = new FlexTable();
|
||
|
descriptionResult.setCellSpacing(10);
|
||
|
descriptionResult.setCellPadding(4);
|
||
|
descriptionResult.setBorderWidth(0);
|
||
|
descriptionResult.setText(0, 0, "Result: ");
|
||
|
descriptionResult.setText(0, 1, "Import complete");
|
||
|
|
||
|
operationResult.add(descriptionResult);
|
||
|
operationResult.setVisible(true);
|
||
|
*/
|
||
|
//wizardWindow.setEnableNextButton(true);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* {@inheritDoc}
|
||
|
*/
|
||
|
@Override
|
||
|
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||
|
Log.info("Import failed");
|
||
|
progressBar.updateText("Import failed.");
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void operationInitializing() {
|
||
|
Log.info("Inport inizializing");
|
||
|
progressBar.updateProgress(0, "initializing...");
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void operationUpdate(float elaborated) {
|
||
|
Log.info("Import elaborated: "+elaborated);
|
||
|
if (elaborated == 0) progressBar.updateProgress(0, "initializing...");
|
||
|
if (elaborated>0 && elaborated<1) {
|
||
|
Log.trace("progress "+elaborated);
|
||
|
int elab=new Float(elaborated*100).intValue();
|
||
|
progressBar.updateProgress(elaborated,elab+"% importing...");
|
||
|
}
|
||
|
if (elaborated == 1) progressBar.updateProgress(1, "completing...");
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|