Fixed Error Management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@101900 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-12-04 16:41:54 +00:00
parent c0672895c5
commit 03b7238b48
7 changed files with 26 additions and 21 deletions

View File

@ -33,6 +33,7 @@ import com.sencha.gxt.core.client.util.Padding;
import com.sencha.gxt.core.client.util.ToggleGroup; import com.sencha.gxt.core.client.util.ToggleGroup;
import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.StringLabelProvider; import com.sencha.gxt.data.shared.StringLabelProvider;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent;
@ -80,8 +81,8 @@ public class CSVConfigCard extends WizardCard {
this.csvImportSession = csvImportSession; this.csvImportSession = csvImportSession;
FormPanel panel = createPanel(); FormPanel panel = createPanel();
setContent(panel); setCenterWidget(panel,new MarginData(0));
} }
protected FormPanel createPanel() { protected FormPanel createPanel() {
@ -418,7 +419,7 @@ public class CSVConfigCard extends WizardCard {
} else { } else {
Log.error("Error loading charset list", caught); Log.error("Error loading charset list", caught);
showErrorAndHide("Error loading charset list", showErrorAndHide("Error loading charset list",
"Error loading charset list", caught); "Error loading charset list", caught.getLocalizedMessage(), caught);
} }
} }
}); });

View File

@ -22,6 +22,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;
@ -47,7 +48,8 @@ public class CSVOperationInProgressCard extends WizardCard implements
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer(); VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER); operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
//operationInProgressPanel.setHeight(390);
final FlexTable description = new FlexTable(); final FlexTable description = new FlexTable();
// FlexCellFormatter cellFormatter = description.getFlexCellFormatter(); // FlexCellFormatter cellFormatter = description.getFlexCellFormatter();
description.setCellSpacing(10); description.setCellSpacing(10);
@ -78,7 +80,7 @@ public class CSVOperationInProgressCard extends WizardCard implements
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);
} }
@ -101,9 +103,9 @@ public class CSVOperationInProgressCard extends WizardCard implements
} else { } else {
showErrorAndHide( showErrorAndHide(
"Error in importCSV", "Error in importCSV",
"An error occured in importCSV: " "An error occured in importCSV: ",
+ caught.getLocalizedMessage(), caught.getLocalizedMessage(),
caught); caught);
} }
} }
}); });
@ -113,7 +115,6 @@ public class CSVOperationInProgressCard extends WizardCard implements
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();
importCSV(); importCSV();
@ -169,7 +170,7 @@ public class CSVOperationInProgressCard extends WizardCard implements
new SessionExpiredEvent( new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
showErrorAndHide("Error in CSV Import", reason,caught); showErrorAndHide("Error in CSV Import", reason,"", caught);
} }
forceLayout(); forceLayout();
} }

View File

@ -15,7 +15,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
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.wizardwidget.client.WizardCard; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
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.core.client.GWT;
@ -36,6 +35,7 @@ import com.sencha.gxt.data.shared.loader.ListLoader;
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding; import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
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.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.HideEvent; import com.sencha.gxt.widget.core.client.event.HideEvent;
@ -96,6 +96,7 @@ public class CSVTableDetailCard extends WizardCard {
FieldSet fieldSet = new FieldSet(); FieldSet fieldSet = new FieldSet();
fieldSet.setHeadingText("Information"); fieldSet.setHeadingText("Information");
fieldSet.setCollapsible(false); fieldSet.setCollapsible(false);
form.add(fieldSet); form.add(fieldSet);
p = new VerticalLayoutContainer(); p = new VerticalLayoutContainer();
@ -182,7 +183,7 @@ public class CSVTableDetailCard extends WizardCard {
tableDetailPanel.add(form); tableDetailPanel.add(form);
setContent(tableDetailPanel); setCenterWidget(tableDetailPanel, new MarginData(0));
} }
@ -200,8 +201,8 @@ public class CSVTableDetailCard extends WizardCard {
} else { } else {
Log.error("load combo failure:" Log.error("load combo failure:"
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", showErrorAndHide("Error",
"Error retrieving licences."); "Error retrieving licences.",caught.getLocalizedMessage(),caught);
} }
callback.onFailure(caught); callback.onFailure(caught);
} }

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Command;
import com.sencha.gxt.widget.core.client.container.MarginData;
/** /**
* *
@ -27,7 +28,7 @@ public class CSVUploadFileCard extends WizardCard {
this.fileUploadPanel = new FileUploadPanel(res, thisCard,importSession); this.fileUploadPanel = new FileUploadPanel(res, thisCard,importSession);
setContent(fileUploadPanel); setCenterWidget(fileUploadPanel, new MarginData(0));
} }

View File

@ -18,6 +18,7 @@ import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionHandler;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
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;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
/** /**
@ -81,7 +82,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
}); });
p.add(wpanel); p.add(wpanel);
wpanel.loadTree(); wpanel.loadTree();
setContent(p); setCenterWidget(p, new MarginData(0));
} }
@ -133,8 +134,8 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
getEventBus().fireEvent(new SessionExpiredEvent( getEventBus().fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
thisCard.showErrorAndHide("Error", "Error retrieving the file from the workspace: "+caught.getLocalizedMessage(), thisCard.showErrorAndHide("Error", "Error retrieving the file from the workspace.",
caught); caught.getLocalizedMessage(), caught);
} }
} }

View File

@ -160,7 +160,7 @@ public class FileUploadPanel extends FormPanel {
public void operationFailed(Throwable caught, String reason, public void operationFailed(Throwable caught, String reason,
String failureDetails) { String failureDetails) {
card.showErrorAndHide("Error uploading the csv file", reason, card.showErrorAndHide("Error uploading the csv file", reason,
caught); "", caught);
} }
public void operationComplete() { public void operationComplete() {

View File

@ -4,7 +4,6 @@
package org.gcube.portlets.user.td.csvimportwidget.client; package org.gcube.portlets.user.td.csvimportwidget.client;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource; import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource;
import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource; import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource;
@ -16,6 +15,7 @@ import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import com.sencha.gxt.core.client.util.ToggleGroup; import com.sencha.gxt.core.client.util.ToggleGroup;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.form.Radio; import com.sencha.gxt.widget.core.client.form.Radio;
/** /**
@ -95,7 +95,7 @@ public class SourceSelectionCard extends WizardCard {
} }
}); });
setContent(sourceSelectionPanel); setCenterWidget(sourceSelectionPanel, new MarginData(0));
} }