428: TDM - Support the new Workspace Explorer
Task-Url: https://support.d4science.org/issues/428 Updated support to workspace explorer git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@117578 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a5edf9072b
commit
9465360319
20
pom.xml
20
pom.xml
|
@ -43,13 +43,13 @@
|
|||
<distroDirectory>distro</distroDirectory>
|
||||
<configDirectory>config</configDirectory>
|
||||
|
||||
|
||||
|
||||
<!-- Next -->
|
||||
<gwtVersion>2.6.1</gwtVersion>
|
||||
<gwtLogVersion>3.3.2</gwtLogVersion>
|
||||
<gxtVersion>3.1.1</gxtVersion>
|
||||
|
||||
|
||||
<gxtVersion>3.1.1</gxtVersion>
|
||||
|
||||
|
||||
<KEYS>${env.KEYS}</KEYS>
|
||||
<!-- GWT needs at least java 1.5 -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -115,7 +115,7 @@
|
|||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- tabular-data-monitor-widget -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
|
@ -140,6 +140,14 @@
|
|||
<version>[2.13.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-explorer</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
|
@ -162,7 +170,7 @@
|
|||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- JUnit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
@ -2,6 +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;
|
||||
|
||||
/**
|
||||
|
@ -10,6 +11,8 @@ import com.google.web.bindery.event.shared.EventBus;
|
|||
public class CSVImportWizardTD extends WizardWindow {
|
||||
|
||||
protected CSVImportSession importSession;
|
||||
protected String WIZARDWIDTH = "712px";
|
||||
protected String WIZARDHEIGHT = "520px";
|
||||
//private CSVImportWizardTD wizard;
|
||||
|
||||
/**
|
||||
|
@ -19,6 +22,7 @@ public class CSVImportWizardTD extends WizardWindow {
|
|||
|
||||
public CSVImportWizardTD(String title, EventBus eventBus) {
|
||||
super(title,eventBus);
|
||||
setWidth(WIZARDWIDTH);
|
||||
|
||||
importSession= new CSVImportSession();
|
||||
//this.wizard=this;
|
||||
|
|
|
@ -3,23 +3,30 @@
|
|||
*/
|
||||
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 java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionHandler;
|
||||
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.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectPanel;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
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.core.client.util.Margins;
|
||||
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.VerticalLayoutData;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -28,76 +35,105 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
|||
*
|
||||
*/
|
||||
public class CSVWorkSpaceSelectionCard extends WizardCard {
|
||||
|
||||
|
||||
protected CSVImportSession importSession;
|
||||
protected CSVWorkSpaceSelectionCard thisCard;
|
||||
|
||||
|
||||
protected Item item;
|
||||
|
||||
protected ItemType item;
|
||||
protected VerticalLayoutContainer p;
|
||||
protected WorkspacePanel wpanel;
|
||||
protected WorkspaceExplorerSelectPanel wpanel;
|
||||
|
||||
public CSVWorkSpaceSelectionCard(final CSVImportSession importSession) {
|
||||
super("CSV Import From Workspace", "");
|
||||
|
||||
this.importSession = importSession;
|
||||
thisCard = this;
|
||||
|
||||
p=new VerticalLayoutContainer();
|
||||
|
||||
p = new VerticalLayoutContainer();
|
||||
|
||||
Log.debug("Set Workspace Panel");
|
||||
wpanel=new WorkspacePanel();
|
||||
wpanel.setSpWidth("536px");
|
||||
wpanel.setSpHeight("384px");
|
||||
//wpanel.setShowableTypes(ItemType.EXTERNAL_FILE);
|
||||
wpanel.setSelectableTypes(ItemType.EXTERNAL_FILE);
|
||||
wpanel.getSelectableTypes().remove(ItemType.ROOT);
|
||||
wpanel.getSelectableTypes().remove(ItemType.FOLDER);
|
||||
wpanel.setAllowedMimeTypes("text/csv", "application/zip", "application/x-zip", "application/x-zip-compressed", "application/octet","application/octet-stream");
|
||||
wpanel.addSelectionHandler(new ItemSelectionHandler() {
|
||||
|
||||
|
||||
public void onSelection(ItemSelectionEvent event) {
|
||||
item=event.getSelectedItem();
|
||||
Log.debug("Selected Item:"+item);
|
||||
if(item.getType()==ItemType.EXTERNAL_FILE){
|
||||
String filename=item.getName();
|
||||
if(filename!=null&&!filename.isEmpty()){
|
||||
Log.debug("Item name: "+filename);
|
||||
Log.debug("Item path: "+item.getPath());
|
||||
|
||||
importSession.setItemId(item.getId());
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
|
||||
List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
||||
selectableTypes.add(ItemType.EXTERNAL_FILE);
|
||||
List<ItemType> showableTypes = new ArrayList<ItemType>();
|
||||
showableTypes.addAll(Arrays.asList(ItemType.values()));
|
||||
|
||||
List<String> allowedMimeTypes = Arrays.asList("text/csv",
|
||||
"application/zip", "application/x-zip",
|
||||
"application/x-zip-compressed", "application/octet",
|
||||
"application/octet-stream");
|
||||
List<String> allowedFileExtensions = Arrays.asList("csv", "zip");
|
||||
|
||||
FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,
|
||||
allowedFileExtensions, new HashMap<String,String>());
|
||||
|
||||
wpanel = new WorkspaceExplorerSelectPanel(new String(
|
||||
"Workspace Selection"), filterCriteria);
|
||||
|
||||
// wpanel.setSpWidth("536px");
|
||||
// wpanel.setSpHeight("384px");
|
||||
// wpanel.setShowableTypes(ItemType.EXTERNAL_FILE);
|
||||
// wpanel.setSelectableTypes(ItemType.EXTERNAL_FILE);
|
||||
// wpanel.getSelectableTypes().remove(ItemType.ROOT);
|
||||
// wpanel.getSelectableTypes().remove(ItemType.FOLDER);
|
||||
// wpanel.setAllowedMimeTypes("text/csv", "application/zip",
|
||||
// "application/x-zip", "application/x-zip-compressed",
|
||||
// "application/octet","application/octet-stream");
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
Log.debug("Selected Item:" + item);
|
||||
if (item.getType() == ItemType.EXTERNAL_FILE) {
|
||||
String filename = item.getName();
|
||||
if (filename != null && !filename.isEmpty()) {
|
||||
Log.debug("Item name: " + filename);
|
||||
Log.debug("Item path: " + item.getPath());
|
||||
|
||||
importSession.setItemId(item.getId());
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
|
||||
} else {
|
||||
Log.debug("Item name null or empty");
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
Log.debug("Item type:"+item.getType());
|
||||
Log.debug("Item type:" + item.getType());
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
p.add(wpanel);
|
||||
wpanel.loadTree();
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error("Error in workspaceExplorer: "
|
||||
+ throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAborted() {
|
||||
Log.debug("WorkspaceExplorer Aborted");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
wpanel.addWorkspaceExplorerSelectNotificationListener(handler);
|
||||
|
||||
p.add(wpanel, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
setCenterWidget(p, new MarginData(0));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Log.debug("CSVWorkSpaceSelectionCard Call Setup ");
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
Log.debug("CSVWorkSpaceSelectionCard Call sayNextCard wpanel:"+wpanel);
|
||||
wpanel.disable();
|
||||
wpanel.startWaiting();
|
||||
Log.debug("CSVWorkSpaceSelectionCard Call sayNextCard wpanel:"
|
||||
+ wpanel);
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
getFileFromWorkspace();
|
||||
|
@ -123,39 +159,41 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
getWizardWindow().setEnableNextButton(false);
|
||||
|
||||
}
|
||||
|
||||
protected void getFileFromWorkspace(){
|
||||
TDGWTServiceAsync tdGwtServiceAsync=TDGWTServiceAsync.INSTANCE;
|
||||
tdGwtServiceAsync.getFileFromWorkspace(importSession, new AsyncCallback<Void>(){
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
protected void getFileFromWorkspace() {
|
||||
TDGWTServiceAsync tdGwtServiceAsync = TDGWTServiceAsync.INSTANCE;
|
||||
tdGwtServiceAsync.getFileFromWorkspace(importSession,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
thisCard.showErrorAndHide(
|
||||
"Error",
|
||||
"Error retrieving the file from the workspace.",
|
||||
caught.getLocalizedMessage(), caught);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
goForward();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void goForward() {
|
||||
CSVConfigCard csvConfigCard = new CSVConfigCard(importSession);
|
||||
getWizardWindow().addCard(csvConfigCard);
|
||||
Log.info("NextCard CSVConfigCard");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
wpanel.endWaiting();
|
||||
goForward();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void goForward(){
|
||||
CSVConfigCard csvConfigCard = new CSVConfigCard(importSession);
|
||||
getWizardWindow().addCard(csvConfigCard);
|
||||
Log.info("NextCard CSVConfigCard");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ public class SourceSelectionCard extends WizardCard {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,36 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='CSVImportWizardTD'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- We need the JUnit module in the main module, -->
|
||||
<!-- otherwise eclipse complains (Google plugin bug?) -->
|
||||
<inherits name='com.google.gwt.junit.JUnit' />
|
||||
<!-- We need the JUnit module in the main module, -->
|
||||
<!-- otherwise eclipse complains (Google plugin bug?) -->
|
||||
<inherits name='com.google.gwt.junit.JUnit' />
|
||||
|
||||
<!-- Inherit the default GWT style sheet. You can change -->
|
||||
<!-- the theme of your GWT application by uncommenting -->
|
||||
<!-- any one of the following lines. -->
|
||||
<inherits name='com.google.gwt.user.theme.standard.Standard' />
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
<!-- Inherit the default GWT style sheet. You can change -->
|
||||
<!-- the theme of your GWT application by uncommenting -->
|
||||
<!-- any one of the following lines. -->
|
||||
<inherits name='com.google.gwt.user.theme.standard.Standard' />
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
|
||||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.SDMXImportWizardTD.client.SDMXImportWizardTDEntry' /> -->
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
|
||||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.SDMXImportWizardTD.client.SDMXImportWizardTDEntry'
|
||||
/> -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<!-- <source path='org.gcube.data.analysis.tabulardata.operation.worker'/> -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<!-- <source path='org.gcube.data.analysis.tabulardata.operation.worker'/> -->
|
||||
|
||||
</module>
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
|
||||
<!-- Servlets -->
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>TDGWTService</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
||||
|
@ -20,8 +20,14 @@
|
|||
<servlet-name>WorkspaceLightService</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.lighttree.server.WorkspaceServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>workspaceExplorer</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
|
||||
|
||||
<!-- Servlets Mapping -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>TDGWTService</servlet-name>
|
||||
|
@ -31,13 +37,19 @@
|
|||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>CSVImportWizardTDManagerWidgets/junithost/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>WorkspaceLightService</servlet-name>
|
||||
<url-pattern>/CSVImportWizardTDManagerWidgets/WorkspaceLightService</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>workspaceExplorer</servlet-name>
|
||||
<url-pattern>/CSVImportWizardTDManagerWidgets/WorkspaceExplorerService</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>CSVImportWizardTD.html</welcome-file>
|
||||
|
|
Loading…
Reference in New Issue