Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@95771 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-16 12:27:07 +00:00
parent 51daddeefe
commit 0cdae10d3e
5 changed files with 89 additions and 39 deletions

View File

@ -3,12 +3,15 @@ package org.gcube.portlets.user.td.csvimportwidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.csvimportwidget.client.csvgrid.CSVGrid;
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.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.csvimportwidget.client.util.ErrorMessageBox;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
import com.allen_sauer.gwt.log.client.Log;
@ -96,7 +99,6 @@ public class CSVConfigCard extends WizardCard {
encodings.setTriggerAction(TriggerAction.ALL);
encodings.addSelectionHandler(new SelectionHandler<String>() {
public void onSelection(SelectionEvent<String> event) {
updateGrid();
}
@ -236,7 +238,6 @@ public class CSVConfigCard extends WizardCard {
}
});
return panel;
}
@ -248,11 +249,19 @@ public class CSVConfigCard extends WizardCard {
new AsyncCallback<ArrayList<CSVRowError>>() {
public void onFailure(Throwable caught) {
ErrorMessageBox
.showError(
"An error occured checking the file",
"Please retry, if the error perstists change the CSV configuration",
"");
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
ErrorMessageBox
.showError(
"An error occured checking the file",
"Please retry, if the error perstists change the CSV configuration",
"");
}
}
public void onSuccess(ArrayList<CSVRowError> errors) {
@ -287,14 +296,22 @@ public class CSVConfigCard extends WizardCard {
delimiter, commentChar, new AsyncCallback<ArrayList<String>>() {
public void onFailure(Throwable caught) {
Log.error("Failed updating CSV config", caught);
setEnableNextButton(false);
ErrorMessageBox
.showError(
"An error occured checking the file",
"Please retry, if the error perstists change the CSV configuration",
caught.getLocalizedMessage());
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Failed updating CSV config", caught);
setEnableNextButton(false);
ErrorMessageBox
.showError(
"An error occured checking the file",
"Please retry, if the error perstists change the CSV configuration",
caught.getLocalizedMessage());
}
}
public void onSuccess(ArrayList<String> result) {
@ -357,9 +374,16 @@ public class CSVConfigCard extends WizardCard {
* {@inheritDoc}
*/
public void onFailure(Throwable caught) {
GWT.log("Error loading charset list", caught);
showErrorAndHide("Error loading charset list",
"Error loading charset list", "", caught);
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
GWT.log("Error loading charset list", caught);
showErrorAndHide("Error loading charset list",
"Error loading charset list", "", caught);
}
}
});
@ -370,11 +394,10 @@ public class CSVConfigCard extends WizardCard {
public void execute() {
CSVTableDetailCard csvTableDetailCard = new CSVTableDetailCard(
csvImportSession);
getWizardWindow()
.addCard(csvTableDetailCard);
getWizardWindow().addCard(csvTableDetailCard);
Log.info("NextCard SDMXTableDetailCard");
getWizardWindow().nextCard();
}
};
@ -390,7 +413,7 @@ public class CSVConfigCard extends WizardCard {
protected void setCheckErrorMessage(ArrayList<CSVRowError> errors) {
csvCheckPanel.setActiveFailure(errors);
setEnableNextButton(false);
}
protected void setCheckCorrectMessage() {

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.user.td.csvimportwidget.client;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import com.google.web.bindery.event.shared.EventBus;
/**
*
@ -17,8 +17,8 @@ public class CSVImportWizardTD extends WizardWindow {
* @param targetId
*/
public CSVImportWizardTD(String title) {
super(title);
public CSVImportWizardTD(String title, EventBus eventBus) {
super(title,eventBus);
importSession= new CSVImportSession();
//this.wizard=this;

View File

@ -2,12 +2,14 @@ package org.gcube.portlets.user.td.csvimportwidget.client;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.web.bindery.event.shared.SimpleEventBus;
public class CSVImportWizardTDEntry implements EntryPoint {
public void onModuleLoad() {
CSVImportWizardTD importWizard= new CSVImportWizardTD("CSVImport");
SimpleEventBus eventBus=new SimpleEventBus();
CSVImportWizardTD importWizard= new CSVImportWizardTD("CSVImport",eventBus);
Log.info(importWizard.getId());
}
}

View File

@ -3,6 +3,8 @@
*/
package org.gcube.portlets.user.td.csvimportwidget.client;
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.shared.TRId;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.csvimportwidget.client.progress.CSVImportProgressBarUpdater;
@ -10,6 +12,7 @@ import org.gcube.portlets.user.td.csvimportwidget.client.progress.CSVImportProgr
import org.gcube.portlets.user.td.csvimportwidget.client.progress.CSVImportProgressUpdater;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Command;
@ -101,11 +104,18 @@ public class CSVOperationInProgressCard extends WizardCard implements
}
public void onFailure(Throwable caught) {
showErrorAndHide(
"Error in importCSV",
"An error occured in importCSV: "
+ caught.getLocalizedMessage(), caught
.getStackTrace().toString(), caught);
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
showErrorAndHide(
"Error in importCSV",
"An error occured in importCSV: "
+ caught.getLocalizedMessage(),
caught.getStackTrace().toString(), caught);
}
}
});
}
@ -154,12 +164,20 @@ public class CSVOperationInProgressCard extends WizardCard implements
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
AlertMessageBox d = new AlertMessageBox("Error in CSV Import", reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
AlertMessageBox d = new AlertMessageBox("Error in CSV Import",
reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
}
}
@Override
@ -191,13 +209,13 @@ public class CSVOperationInProgressCard extends WizardCard implements
@Override
public void operationGeneratingView() {
// TODO Auto-generated method stub
}
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
}

View File

@ -3,10 +3,13 @@
*/
package org.gcube.portlets.user.td.csvimportwidget.client;
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.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.csvimportwidget.client.workspace.WorkspacePanel;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.widgets.lighttree.client.Item;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionEvent;
@ -126,9 +129,13 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
public void onFailure(Throwable caught) {
wpanel.endWaiting();
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus().fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
thisCard.showErrorAndHide("Error", "Error retrieving the file from the workspace: "+caught.getLocalizedMessage(),
caught.toString(), caught);
}
}
public void onSuccess(Void result) {