Minor updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@85515 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-11-14 18:46:21 +00:00
parent 93d6b9daf6
commit 3b1768e07d
2 changed files with 26 additions and 16 deletions

View File

@ -5,6 +5,7 @@ package org.gcube.portlets.user.td.csvimportwidget.client;
import org.gcube.portlets.user.td.csvimportwidget.client.general.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.widgets.lighttree.client.Item;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
@ -13,6 +14,7 @@ import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionHandler;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
/**
@ -56,15 +58,12 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
if(item.getType()==ItemType.EXTERNAL_FILE){
String filename=item.getName();
if(filename!=null&&!filename.isEmpty()){
if(filename.compareToIgnoreCase("empty")!=0){
Log.debug("Item name: "+filename);
Log.debug("Item path: "+item.getPath());
getWizardWindow().setEnableNextButton(true);
} else {
Log.debug("Item"+filename);
getWizardWindow().setEnableNextButton(false);
}
importSession.setItemId(item.getId());
getWizardWindow().setEnableNextButton(true);
} else {
Log.debug("Item name null or empty");
getWizardWindow().setEnableNextButton(false);
@ -91,6 +90,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
@Override
public void execute() {
getFileFromWorkspace();
//TODO
/*importSession.setTabResource(detail);
@ -122,5 +122,25 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
getWizardWindow().setEnableNextButton(false);
}
protected void getFileFromWorkspace(){
TDGWTServiceAsync tdGwtServiceAsync=TDGWTServiceAsync.INSTANCE;
tdGwtServiceAsync.getFileFromWorkspace(importSession, new AsyncCallback<Void>(){
@Override
public void onFailure(Throwable caught) {
thisCard.showErrorAndHide("Error", "Error retrieving the file from the workspace: "+caught.getLocalizedMessage(),
caught.toString(), caught);
}
@Override
public void onSuccess(Void result) {
// TODO Auto-generated method stub
}
});
}
}

View File

@ -185,19 +185,9 @@ public class FileUploadPanel extends FormPanel {
protected void startUpload() {
disableUpload();
// we update the action url with the session id
// this is necessary in order to let the servlet retrieve the session id
// before the POST request parsing
StringBuilder actionUrl = new StringBuilder();
actionUrl.append(GWT.getModuleBaseURL());
// actionUrl.append(UPLOAD_SERVLET+"?sessionId=");
actionUrl.append(UPLOAD_SERVLET);
/*
* if(session==null){ Log.info("No valid Session"); AlertMessageBox
* alertMessageBox = new AlertMessageBox("No session valid",
* "Error generating the session"); alertMessageBox.show(); return; }
*/
// actionUrl.append(session.getId());
setAction(actionUrl.toString());
Log.info("Start Upload action Url " + actionUrl.toString());
submit();