|
|
@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
|
|
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
|
|
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
|
|
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
|
|
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
|
|
@ -15,6 +16,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|
|
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
|
|
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
|
|
|
|
|
|
|
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
|
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
|
|
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
|
|
|
import com.google.gwt.user.client.Command;
|
|
|
|
import com.google.gwt.user.client.Command;
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
@ -36,19 +38,18 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
MonitorDialogListener {
|
|
|
|
MonitorDialogListener {
|
|
|
|
|
|
|
|
private static CommonMessages msgsCommon=GWT.create(CommonMessages.class);
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
private CSVImportWizardTDMessages msgs;
|
|
|
|
private CSVOperationInProgressCard thisCard;
|
|
|
|
|
|
|
|
private CSVImportSession importSession;
|
|
|
|
private CSVImportSession importSession;
|
|
|
|
private TRId newTrId;
|
|
|
|
private TRId newTrId;
|
|
|
|
private HtmlLayoutContainer resultField;
|
|
|
|
private HtmlLayoutContainer resultField;
|
|
|
|
private AutoProgressBar storageLoading;
|
|
|
|
private AutoProgressBar storageLoading;
|
|
|
|
|
|
|
|
|
|
|
|
public CSVOperationInProgressCard(final CSVImportSession importSession) {
|
|
|
|
|
|
|
|
super("Operation In Progress", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CSVOperationInProgressCard(final CSVImportSession importSession) {
|
|
|
|
|
|
|
|
super(msgsCommon.operationInProgress(), "");
|
|
|
|
this.importSession = importSession;
|
|
|
|
this.importSession = importSession;
|
|
|
|
thisCard = this;
|
|
|
|
initMessages();
|
|
|
|
|
|
|
|
|
|
|
|
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
|
|
|
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
|
|
|
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
|
|
|
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
|
|
@ -62,18 +63,18 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
|
|
|
|
|
|
|
|
// display:block;vertical-align:text-top;
|
|
|
|
// display:block;vertical-align:text-top;
|
|
|
|
description.setHTML(0, 0,
|
|
|
|
description.setHTML(0, 0,
|
|
|
|
"<span style=\"font-weight:bold;\";>Document: </span>");
|
|
|
|
"<span style=\"font-weight:bold;\";>"+msgs.csvOperationInProgressDocumentLabel()+"</span>");
|
|
|
|
description.setText(0, 1, "CSV File");
|
|
|
|
description.setText(0, 1, msgs.csvOperationInProgressCSVFile());
|
|
|
|
description.setHTML(1, 0,
|
|
|
|
description.setHTML(1, 0,
|
|
|
|
"<span style=\"font-weight:bold;\";>Source: </span>");
|
|
|
|
"<span style=\"font-weight:bold;\";>"+msgs.csvOperationInProgressSourceLabel()+"</span>");
|
|
|
|
description.setText(1, 1, importSession.getSource().getName());
|
|
|
|
description.setText(1, 1, importSession.getSource().getName());
|
|
|
|
|
|
|
|
|
|
|
|
description.setHTML(2, 0,
|
|
|
|
description.setHTML(2, 0,
|
|
|
|
"<span style=\"font-weight:bold;\";>File: </span>");
|
|
|
|
"<span style=\"font-weight:bold;\";>"+msgs.csvOperationInProgressFileLabel()+"</span>");
|
|
|
|
description.setText(2, 1, importSession.getTabResource().getName());
|
|
|
|
description.setText(2, 1, importSession.getTabResource().getName());
|
|
|
|
|
|
|
|
|
|
|
|
FramedPanel summary = new FramedPanel();
|
|
|
|
FramedPanel summary = new FramedPanel();
|
|
|
|
summary.setHeadingText("Import Summary");
|
|
|
|
summary.setHeadingText(msgs.summaryImport());
|
|
|
|
summary.setWidth(400);
|
|
|
|
summary.setWidth(400);
|
|
|
|
summary.add(description);
|
|
|
|
summary.add(description);
|
|
|
|
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
|
|
|
|
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
|
|
|
@ -97,11 +98,15 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initMessages() {
|
|
|
|
|
|
|
|
msgs = GWT.create(CSVImportWizardTDMessages.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void importCSV() {
|
|
|
|
public void importCSV() {
|
|
|
|
//mask("Loading on Storage...");
|
|
|
|
//mask("Loading on Storage...");
|
|
|
|
storageLoading.setVisible(true);
|
|
|
|
storageLoading.setVisible(true);
|
|
|
|
forceLayout();
|
|
|
|
forceLayout();
|
|
|
|
storageLoading.updateText("Loading on Storage...");
|
|
|
|
storageLoading.updateText(msgsCommon.loadingOnStorage());
|
|
|
|
storageLoading.redraw();
|
|
|
|
storageLoading.redraw();
|
|
|
|
storageLoading.auto();
|
|
|
|
storageLoading.auto();
|
|
|
|
|
|
|
|
|
|
|
@ -125,8 +130,8 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
showErrorAndHide(
|
|
|
|
showErrorAndHide(
|
|
|
|
"Error in importCSV",
|
|
|
|
msgsCommon.error(),
|
|
|
|
"An error occured in importCSV: ",
|
|
|
|
msgs.errorInImportCSV(),
|
|
|
|
caught.getLocalizedMessage(),
|
|
|
|
caught.getLocalizedMessage(),
|
|
|
|
caught);
|
|
|
|
caught);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -155,7 +160,7 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
newTrId = operationResult.getTrId();
|
|
|
|
newTrId = operationResult.getTrId();
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
safeHtmlBuilder
|
|
|
|
safeHtmlBuilder
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed</div>");
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>"+msgsCommon.operationCompleted()+"</div>");
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setVisible(true);
|
|
|
|
resultField.setVisible(true);
|
|
|
|
Command sayComplete = new Command() {
|
|
|
|
Command sayComplete = new Command() {
|
|
|
@ -184,7 +189,7 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
public void operationFailed(Throwable caught, String reason, String details) {
|
|
|
|
public void operationFailed(Throwable caught, String reason, String details) {
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
safeHtmlBuilder
|
|
|
|
safeHtmlBuilder
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color:red;'>Operation Failed</div>");
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color:red;'>"+msgsCommon.operationFailed()+"</div>");
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setVisible(true);
|
|
|
|
resultField.setVisible(true);
|
|
|
|
if (caught instanceof TDGWTSessionExpiredException) {
|
|
|
|
if (caught instanceof TDGWTSessionExpiredException) {
|
|
|
@ -203,7 +208,7 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
newTrId = operationResult.getTrId();
|
|
|
|
newTrId = operationResult.getTrId();
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
safeHtmlBuilder
|
|
|
|
safeHtmlBuilder
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #FF9900;'>Problems in the Operation</div>");
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #FF9900;'>"+msgsCommon.operationProblem()+"</div>");
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setVisible(true);
|
|
|
|
resultField.setVisible(true);
|
|
|
|
|
|
|
|
|
|
|
@ -234,7 +239,7 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
public void operationAborted() {
|
|
|
|
public void operationAborted() {
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
safeHtmlBuilder
|
|
|
|
safeHtmlBuilder
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #AA00AA;'>Operation Aborted</div>");
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #AA00AA;'>"+msgsCommon.operationAborted()+"</div>");
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setVisible(true);
|
|
|
|
resultField.setVisible(true);
|
|
|
|
|
|
|
|
|
|
|
@ -264,7 +269,7 @@ public class CSVOperationInProgressCard extends WizardCard implements
|
|
|
|
public void operationPutInBackground() {
|
|
|
|
public void operationPutInBackground() {
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
|
|
|
safeHtmlBuilder
|
|
|
|
safeHtmlBuilder
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #00AAAA;'>Operation in Background</div>");
|
|
|
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #00AAAA;'>"+msgsCommon.operationInBackground()+"</div>");
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
|
|
|
resultField.setVisible(true);
|
|
|
|
resultField.setVisible(true);
|
|
|
|
|
|
|
|
|
|
|
|