Fixed Error Management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-replacebyexternal-widget@101905 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-12-04 16:57:49 +00:00 committed by Giancarlo Panichi
parent 7bcc00902a
commit 1c731d1401
1 changed files with 20 additions and 18 deletions

View File

@ -24,6 +24,7 @@ import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel; import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData; import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer; import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer; import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign; import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
@ -33,15 +34,16 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class ReplaceByExternalOperationInProgressCard extends WizardCard implements public class ReplaceByExternalOperationInProgressCard extends WizardCard
MonitorDialogListener { implements MonitorDialogListener {
protected ReplaceByExternalOperationInProgressCard thisCard; protected ReplaceByExternalOperationInProgressCard thisCard;
protected ReplaceByExternalSession replaceByExternalSession; protected ReplaceByExternalSession replaceByExternalSession;
protected TRId newTrId; protected TRId newTrId;
protected HtmlLayoutContainer resultField; protected HtmlLayoutContainer resultField;
public ReplaceByExternalOperationInProgressCard(final ReplaceByExternalSession replaceByExternalSession) { public ReplaceByExternalOperationInProgressCard(
final ReplaceByExternalSession replaceByExternalSession) {
super("Operation In Progress", ""); super("Operation In Progress", "");
this.replaceByExternalSession = replaceByExternalSession; this.replaceByExternalSession = replaceByExternalSession;
@ -57,17 +59,17 @@ public class ReplaceByExternalOperationInProgressCard extends WizardCard impleme
description.setHTML(0, 0, description.setHTML(0, 0,
"<span style=\"font-weight:bold;\";>Replace with: </span>"); "<span style=\"font-weight:bold;\";>Replace with: </span>");
description.setText(0, 1, replaceByExternalSession.getExternalTabularResource() description.setText(0, 1, replaceByExternalSession
.getName()); .getExternalTabularResource().getName());
description.setHTML(1, 0, description.setHTML(1, 0,
"<span style=\"font-weight:bold;\";>Type: </span>"); "<span style=\"font-weight:bold;\";>Type: </span>");
description.setText(1, 1, replaceByExternalSession.getExternalTabularResource() description.setText(1, 1, replaceByExternalSession
.getTableTypeName()); .getExternalTabularResource().getTableTypeName());
description.setHTML(2, 0, description.setHTML(2, 0,
"<span style=\"font-weight:bold;\";>Owner: </span>"); "<span style=\"font-weight:bold;\";>Owner: </span>");
description.setText(2, 1, replaceByExternalSession.getExternalTabularResource() description.setText(2, 1, replaceByExternalSession
.getOwnerLogin()); .getExternalTabularResource().getOwnerLogin());
FramedPanel summary = new FramedPanel(); FramedPanel summary = new FramedPanel();
summary.setHeadingText("Union Summary"); summary.setHeadingText("Union Summary");
@ -81,7 +83,7 @@ public class ReplaceByExternalOperationInProgressCard extends WizardCard impleme
operationInProgressPanel.add(resultField, new BoxLayoutData( operationInProgressPanel.add(resultField, new BoxLayoutData(
new Margins(10, 5, 10, 5))); new Margins(10, 5, 10, 5)));
setContent(operationInProgressPanel); setCenterWidget(operationInProgressPanel, new MarginData(0));
resultField.setVisible(false); resultField.setVisible(false);
} }
@ -90,8 +92,8 @@ public class ReplaceByExternalOperationInProgressCard extends WizardCard impleme
* *
*/ */
public void startUnion() { public void startUnion() {
TDGWTServiceAsync.INSTANCE.startReplaceByExternal(replaceByExternalSession, TDGWTServiceAsync.INSTANCE.startReplaceByExternal(
new AsyncCallback<String>() { replaceByExternalSession, new AsyncCallback<String>() {
public void onSuccess(String taskId) { public void onSuccess(String taskId) {
openMonitorDialog(taskId); openMonitorDialog(taskId);
@ -108,18 +110,19 @@ public class ReplaceByExternalOperationInProgressCard extends WizardCard impleme
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error Locked", showErrorAndHide("Error Locked",
caught.getLocalizedMessage(), caught); caught.getLocalizedMessage(), "",
caught);
} else { } else {
if (caught instanceof TDGWTIsFinalException) { if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error Final", showErrorAndHide("Error Final",
caught.getLocalizedMessage(), caught.getLocalizedMessage(), "",
caught); caught);
} else { } else {
showErrorAndHide( showErrorAndHide(
"Error in Replace By External", "Error in Replace By External",
"An error occured in Replace By External: " "An error occured in Replace By External.",
+ caught.getLocalizedMessage(), caught.getLocalizedMessage(),
caught); caught);
} }
} }
@ -133,7 +136,6 @@ public class ReplaceByExternalOperationInProgressCard extends WizardCard impleme
public void setup() { public void setup() {
getWizardWindow().setEnableBackButton(false); getWizardWindow().setEnableBackButton(false);
setBackButtonVisible(false); setBackButtonVisible(false);
setNextButtonVisible(false);
getWizardWindow().setEnableNextButton(false); getWizardWindow().setEnableNextButton(false);
getWizardWindow().setNextButtonToFinish(); getWizardWindow().setNextButtonToFinish();
startUnion(); startUnion();
@ -189,7 +191,7 @@ public class ReplaceByExternalOperationInProgressCard extends WizardCard impleme
new SessionExpiredEvent( new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
showErrorAndHide("Error in Replace By External", reason, caught); showErrorAndHide("Error in Replace By External", reason, details, caught);
} }
forceLayout(); forceLayout();