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:
parent
93d6b9daf6
commit
3b1768e07d
|
@ -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.general.WizardCard;
|
||||||
import org.gcube.portlets.user.td.csvimportwidget.client.workspace.WorkspacePanel;
|
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.csv.CSVImportSession;
|
||||||
import org.gcube.portlets.widgets.lighttree.client.Item;
|
import org.gcube.portlets.widgets.lighttree.client.Item;
|
||||||
import org.gcube.portlets.widgets.lighttree.client.ItemType;
|
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.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.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,15 +58,12 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
||||||
if(item.getType()==ItemType.EXTERNAL_FILE){
|
if(item.getType()==ItemType.EXTERNAL_FILE){
|
||||||
String filename=item.getName();
|
String filename=item.getName();
|
||||||
if(filename!=null&&!filename.isEmpty()){
|
if(filename!=null&&!filename.isEmpty()){
|
||||||
if(filename.compareToIgnoreCase("empty")!=0){
|
|
||||||
Log.debug("Item name: "+filename);
|
Log.debug("Item name: "+filename);
|
||||||
Log.debug("Item path: "+item.getPath());
|
Log.debug("Item path: "+item.getPath());
|
||||||
getWizardWindow().setEnableNextButton(true);
|
|
||||||
|
|
||||||
} else {
|
importSession.setItemId(item.getId());
|
||||||
Log.debug("Item"+filename);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
getWizardWindow().setEnableNextButton(false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Log.debug("Item name null or empty");
|
Log.debug("Item name null or empty");
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
@ -91,6 +90,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
getFileFromWorkspace();
|
||||||
//TODO
|
//TODO
|
||||||
/*importSession.setTabResource(detail);
|
/*importSession.setTabResource(detail);
|
||||||
|
|
||||||
|
@ -122,5 +122,25 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
||||||
getWizardWindow().setEnableNextButton(false);
|
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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,19 +185,9 @@ public class FileUploadPanel extends FormPanel {
|
||||||
protected void startUpload() {
|
protected void startUpload() {
|
||||||
disableUpload();
|
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();
|
StringBuilder actionUrl = new StringBuilder();
|
||||||
actionUrl.append(GWT.getModuleBaseURL());
|
actionUrl.append(GWT.getModuleBaseURL());
|
||||||
// actionUrl.append(UPLOAD_SERVLET+"?sessionId=");
|
|
||||||
actionUrl.append(UPLOAD_SERVLET);
|
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());
|
setAction(actionUrl.toString());
|
||||||
Log.info("Start Upload action Url " + actionUrl.toString());
|
Log.info("Start Upload action Url " + actionUrl.toString());
|
||||||
submit();
|
submit();
|
||||||
|
|
Loading…
Reference in New Issue