Fixed Final and Lock error
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-import-widget@100235 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
715c7c52e4
commit
6efa3d5189
|
@ -4,6 +4,7 @@
|
||||||
package org.gcube.portlets.user.td.sdmximportwidget.client;
|
package org.gcube.portlets.user.td.sdmximportwidget.client;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||||
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.gwtservice.shared.sdmx.SDMXImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||||
|
@ -23,14 +24,10 @@ import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
||||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
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.box.AlertMessageBox;
|
|
||||||
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.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;
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -149,11 +146,18 @@ public class SDMXOperationInProgressCard extends WizardCard implements
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
showErrorAndHide("Error Locked",
|
||||||
|
caught.getLocalizedMessage(), caught);
|
||||||
|
} else {
|
||||||
|
|
||||||
showErrorAndHide("Error in importSDMX",
|
showErrorAndHide("Error in importSDMX",
|
||||||
"An error occured in importSDMX", "",
|
"An error occured in importSDMX",
|
||||||
caught);
|
caught);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -218,13 +222,9 @@ public class SDMXOperationInProgressCard extends WizardCard implements
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
AlertMessageBox d = new AlertMessageBox("Error in SDMX Import",
|
showErrorAndHide("Error in SDMX Import",
|
||||||
reason);
|
reason,caught);
|
||||||
d.addHideHandler(new HideHandler() {
|
|
||||||
public void onHide(HideEvent event) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
}
|
}
|
||||||
forceLayout();
|
forceLayout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.td.sdmximportwidget.client.util;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.Callback;
|
|
||||||
import com.google.gwt.user.client.ui.Label;
|
|
||||||
import com.sencha.gxt.widget.core.client.Dialog;
|
|
||||||
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
|
||||||
import com.sencha.gxt.widget.core.client.box.MessageBox;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ErrorMessageBox {
|
|
||||||
|
|
||||||
|
|
||||||
private static final String DETAILS = "Details";
|
|
||||||
|
|
||||||
|
|
||||||
public static void showError(String title, String failureReason, final String failureDetails)
|
|
||||||
{
|
|
||||||
showError(title, failureReason, failureDetails, new NOPCallBack<Dialog, Void>());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showError(String title, String failureReason, final String failureDetails, final Callback<Dialog, Void> callback)
|
|
||||||
{
|
|
||||||
final MessageBox box = new MessageBox(title);
|
|
||||||
box.setMessage(failureReason);
|
|
||||||
box.addHideHandler(new HideHandler() {
|
|
||||||
|
|
||||||
|
|
||||||
public void onHide(HideEvent event) {
|
|
||||||
Dialog dialog = (Dialog) event.getSource();
|
|
||||||
|
|
||||||
if (dialog.getHideButton().getText().equals(DETAILS)){
|
|
||||||
//box.close();
|
|
||||||
showErrorDetails("Error details", failureDetails);
|
|
||||||
} else callback.onSuccess(dialog);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
/*FIXME box.setIcon(MessageBox.ERROR);
|
|
||||||
box.getDialog().cancelText = DETAILS;
|
|
||||||
box.getDialog().setButtons(MessageBox.OKCANCEL);*/
|
|
||||||
box.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showErrorDetails(String title, String failureDetails)
|
|
||||||
{
|
|
||||||
final Dialog simple = new Dialog();
|
|
||||||
simple.setHeadingText(title);
|
|
||||||
simple.setPredefinedButtons(PredefinedButton.OK);
|
|
||||||
simple.setBodyStyleName("pad-text");
|
|
||||||
|
|
||||||
|
|
||||||
simple.add(new Label("<PRE>"+failureDetails+"</PRE>"));
|
|
||||||
//simple.getItem(0).getFocusSupport().setIgnore(true);
|
|
||||||
|
|
||||||
//FIXME simple.setScrollMode(ScrollMode.AUTO);
|
|
||||||
|
|
||||||
simple.setHideOnButtonClick(true);
|
|
||||||
simple.setWidth(400);
|
|
||||||
simple.setHeight(400);
|
|
||||||
simple.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.td.sdmximportwidget.client.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Federico De Faveri defaveri@isti.cnr.it
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Format {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a file size into a {@link String} representation adding the misure unit.
|
|
||||||
* @param size the file size.
|
|
||||||
* @return the textual representation.
|
|
||||||
*/
|
|
||||||
public static String fileSize(long size) {
|
|
||||||
StringBuilder text = new StringBuilder();
|
|
||||||
if (size < 1024) {
|
|
||||||
text.append(size);
|
|
||||||
text.append(" bytes");
|
|
||||||
} else if (size < 1048576) {
|
|
||||||
text.append(Math.round(((size * 10) / 1024)) / 10);
|
|
||||||
text.append(" KB");
|
|
||||||
} else if (size < 1073741824) {
|
|
||||||
text.append(Math.round(((size * 10) / 1048576)) / 10);
|
|
||||||
text.append(" MB");
|
|
||||||
} else {
|
|
||||||
text.append(Math.round(((size * 10) / 1073741824)) / 10);
|
|
||||||
text.append(" GB");
|
|
||||||
}
|
|
||||||
return text.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.td.sdmximportwidget.client.util;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.Callback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* @param <F>
|
|
||||||
*/
|
|
||||||
public class NOPCallBack<T,F> implements Callback<T, F> {
|
|
||||||
|
|
||||||
|
|
||||||
public void onFailure(F reason) {}
|
|
||||||
|
|
||||||
public void onSuccess(T result) {}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.td.sdmximportwidget.client.util;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface WizardResources extends ClientBundle {
|
|
||||||
|
|
||||||
public static final WizardResources INSTANCE = GWT.create(WizardResources.class);
|
|
||||||
|
|
||||||
/* @Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/accept.png")
|
|
||||||
ImageResource csvCheckSuccess();
|
|
||||||
|
|
||||||
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/error.png")
|
|
||||||
ImageResource csvCheckFailure();
|
|
||||||
|
|
||||||
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/loading.gif")
|
|
||||||
ImageResource loading();
|
|
||||||
|
|
||||||
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/information.png")
|
|
||||||
ImageResource information();
|
|
||||||
|
|
||||||
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/Wizard.css")
|
|
||||||
WizardCss wizardCss();
|
|
||||||
*/
|
|
||||||
}
|
|
Loading…
Reference in New Issue