Fixed csv file import from workspace
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@85549 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3b1768e07d
commit
39eacbdfec
|
@ -31,6 +31,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
|
||||
protected Item item;
|
||||
protected VerticalLayoutContainer p;
|
||||
protected WorkspacePanel wpanel;
|
||||
|
||||
public CSVWorkSpaceSelectionCard(final CSVImportSession importSession) {
|
||||
super("CSV Import From Workspace", "");
|
||||
|
@ -41,7 +42,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
p=new VerticalLayoutContainer();
|
||||
|
||||
Log.debug("Set Workspace Panel");
|
||||
WorkspacePanel wpanel=new WorkspacePanel();
|
||||
wpanel=new WorkspacePanel();
|
||||
wpanel.setSpWidth("536px");
|
||||
wpanel.setSpHeight("384px");
|
||||
//wpanel.setShowableTypes(ItemType.EXTERNAL_FILE);
|
||||
|
@ -86,20 +87,17 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
|
||||
@Override
|
||||
public void setup() {
|
||||
Log.debug("CSVWorkSpaceSelectionCard Call Setup ");
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Log.debug("CSVWorkSpaceSelectionCard Call sayNextCard wpanel:"+wpanel);
|
||||
wpanel.disable();
|
||||
wpanel.startWaiting();
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
getFileFromWorkspace();
|
||||
//TODO
|
||||
/*importSession.setTabResource(detail);
|
||||
|
||||
CSVOperationInProgressCard csvOperationInProgressCard = new CSVOperationInProgressCard(
|
||||
importSession);
|
||||
getWizardWindow().addCard(csvOperationInProgressCard);*/
|
||||
Log.info("NextCard ");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -111,7 +109,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
try {
|
||||
getWizardWindow().previousCard();
|
||||
getWizardWindow().removeCard(thisCard);
|
||||
Log.info("Remove SDMXTableDetailCard");
|
||||
Log.debug("Remove CSVWorkSpaceSelectionCard");
|
||||
} catch (Exception e) {
|
||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
|
@ -129,6 +127,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
wpanel.endWaiting();
|
||||
thisCard.showErrorAndHide("Error", "Error retrieving the file from the workspace: "+caught.getLocalizedMessage(),
|
||||
caught.toString(), caught);
|
||||
|
||||
|
@ -136,11 +135,22 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
// TODO Auto-generated method stub
|
||||
wpanel.endWaiting();
|
||||
goForward();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void goForward(){
|
||||
CSVConfigCard csvConfigCard = new CSVConfigCard(importSession);
|
||||
getWizardWindow().addCard(csvConfigCard);
|
||||
Log.info("NextCard CSVConfigCard");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,16 +2,46 @@ package org.gcube.portlets.user.td.csvimportwidget.client.workspace;
|
|||
|
||||
import org.gcube.portlets.widgets.lighttree.client.WorkspaceLightTreePanel;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.event.DisableEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.EnableEvent;
|
||||
|
||||
public class WorkspacePanel extends WorkspaceLightTreePanel {
|
||||
|
||||
|
||||
public void setSpWidth(String w){
|
||||
|
||||
AutoProgressMessageBox box;
|
||||
|
||||
public void setSpWidth(String w) {
|
||||
sp.setWidth(w);
|
||||
|
||||
}
|
||||
|
||||
public void setSpHeight(String h){
|
||||
|
||||
public void setSpHeight(String h) {
|
||||
sp.setHeight(h);
|
||||
}
|
||||
|
||||
|
||||
public void disable() {
|
||||
Log.debug("WorkspacePanel Disable");
|
||||
fireEvent(new DisableEvent());
|
||||
}
|
||||
|
||||
public void enable() {
|
||||
Log.debug("WorkspacePanel Enable");
|
||||
fireEvent(new EnableEvent());
|
||||
}
|
||||
|
||||
public void startWaiting() {
|
||||
box= new AutoProgressMessageBox("Loading",
|
||||
"Retriving data from workspace, please wait...");
|
||||
box.setProgressText("Loading...");
|
||||
box.setModal(false);
|
||||
box.auto();
|
||||
box.show();
|
||||
|
||||
}
|
||||
|
||||
public void endWaiting() {
|
||||
box.hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue