Integrated CSV import wizard
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@75236 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b425f33161
commit
084f4eaf5b
|
@ -11,6 +11,18 @@
|
||||||
<dependent-module archiveName="sdmx-import-wizard-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/sdmx-import-wizard/sdmx-import-wizard">
|
<dependent-module archiveName="sdmx-import-wizard-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/sdmx-import-wizard/sdmx-import-wizard">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="csv-import-wizard-gxt3-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/csv-import-wizard-gxt3/csv-import-wizard-gxt3">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="csv4j-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/csv4j-custom/csv4j-custom">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="csv-import-wizard-workspace-gxt3-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/csv-import-wizard-workspace-gxt3/csv-import-wizard-workspace-gxt3">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="workspace-light-tree-gxt3-2.9.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-light-tree-gxt3/workspace-light-tree-gxt3">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="tabular-data-portlet"/>
|
<property name="context-root" value="tabular-data-portlet"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
19
pom.xml
19
pom.xml
|
@ -91,6 +91,25 @@
|
||||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- CSV IMPORT WIZARD -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>csv-import-wizard-gxt3</artifactId>
|
||||||
|
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>csv-import-wizard-workspace-gxt3</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>home-library-jcr</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -5,6 +5,9 @@ package org.gcube.portlets.user.td.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.csvimportwizardgxt3.client.ImportWizard;
|
||||||
|
import org.gcube.portlets.user.csvimportwizardgxt3.client.general.WizardListener;
|
||||||
|
import org.gcube.portlets.user.csvimportwizardgxt3.client.source.local.LocalSource;
|
||||||
import org.gcube.portlets.user.sdmximportwizard.client.SDMXImportWizardWindow;
|
import org.gcube.portlets.user.sdmximportwizard.client.SDMXImportWizardWindow;
|
||||||
import org.gcube.portlets.user.sdmximportwizard.client.SDMXWizardSelectionEvent;
|
import org.gcube.portlets.user.sdmximportwizard.client.SDMXWizardSelectionEvent;
|
||||||
import org.gcube.portlets.user.sdmximportwizard.client.SDMXWizardSelectionEvent.WizardSelectionHandler;
|
import org.gcube.portlets.user.sdmximportwizard.client.SDMXWizardSelectionEvent.WizardSelectionHandler;
|
||||||
|
@ -56,14 +59,14 @@ public class TabularDataController {
|
||||||
Log.trace("doImportTable importType: "+importType);
|
Log.trace("doImportTable importType: "+importType);
|
||||||
Info.display("ImportTableEvent", "importType: "+importType);
|
Info.display("ImportTableEvent", "importType: "+importType);
|
||||||
switch (importType) {
|
switch (importType) {
|
||||||
case SDMX: doSDMXDatasetImport(); break;
|
case SDMX: openSDMXDatasetImportWizard(); break;
|
||||||
|
case CSV: openCSVImportWizard(); break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doSDMXDatasetImport()
|
protected void openSDMXDatasetImportWizard()
|
||||||
{
|
{
|
||||||
GWT.runAsync(new RunAsyncCallback() {
|
GWT.runAsync(new RunAsyncCallback() {
|
||||||
|
|
||||||
|
@ -75,7 +78,7 @@ public class TabularDataController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSelected(SDMXWizardSelectionEvent<Dataset> event) {
|
public void onSelected(SDMXWizardSelectionEvent<Dataset> event) {
|
||||||
doDataseImport(event.getSelected());
|
doSDMXDatasetImport(event.getSelected());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -89,15 +92,56 @@ public class TabularDataController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable reason) {
|
public void onFailure(Throwable reason) {
|
||||||
// TODO Auto-generated method stub
|
asyncCodeLoadingFailed(reason);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doDataseImport(List<Dataset> datasets)
|
protected void doSDMXDatasetImport(List<Dataset> datasets)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void openCSVImportWizard()
|
||||||
|
{
|
||||||
|
/*GWT.runAsync(new RunAsyncCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {*/
|
||||||
|
ImportWizard importWizard = new ImportWizard("DemoCSVTarget", LocalSource.INSTANCE);
|
||||||
|
importWizard.addListener(new WizardListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failed(Throwable throwable, String reason, String details) {
|
||||||
|
System.out.println("FAILED reason: "+reason+" details: "+details+" throwable: "+throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void completed() {
|
||||||
|
System.out.println("COMPLETED");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void aborted() {
|
||||||
|
System.out.println("ABORT");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
importWizard.show();
|
||||||
|
|
||||||
|
/*}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable reason) {
|
||||||
|
asyncCodeLoadingFailed(reason);
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void asyncCodeLoadingFailed(Throwable reason)
|
||||||
|
{
|
||||||
|
Log.error("Async code loading failed", reason);
|
||||||
|
Info.display("Async code loading failed", "Please retry to lunch the operation");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package org.gcube.portlets.user.td.server;
|
package org.gcube.portlets.user.td.server;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.CSVTargetRegistry;
|
||||||
|
import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.DemoCSVTarget;
|
||||||
import org.gcube.portlets.user.td.client.rpc.GreetingService;
|
import org.gcube.portlets.user.td.client.rpc.GreetingService;
|
||||||
import org.gcube.portlets.user.td.shared.FieldVerifier;
|
import org.gcube.portlets.user.td.shared.FieldVerifier;
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
@ -8,9 +13,24 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class GreetingServiceImpl extends RemoteServiceServlet implements
|
public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService {
|
||||||
GreetingService {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init() throws ServletException {
|
||||||
|
super.init();
|
||||||
|
//register the demo csv target
|
||||||
|
CSVTargetRegistry.getInstance().add(new DemoCSVTarget());
|
||||||
|
System.out.println("Registered DemoCSVTarget");
|
||||||
|
|
||||||
|
ScopeProvider.instance.set("/gcube/devsec");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
public String greetServer(String input) throws IllegalArgumentException {
|
public String greetServer(String input) throws IllegalArgumentException {
|
||||||
// Verify that the input is valid.
|
// Verify that the input is valid.
|
||||||
if (!FieldVerifier.isValidName(input)) {
|
if (!FieldVerifier.isValidName(input)) {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
<!-- <inherits name='org.gcube.portlets.user.workspace.WorkspaceTree' /> -->
|
<!-- <inherits name='org.gcube.portlets.user.workspace.WorkspaceTree' /> -->
|
||||||
<inherits name="org.gcube.portlets.user.tdw.TabularDataWidget" />
|
<inherits name="org.gcube.portlets.user.tdw.TabularDataWidget" />
|
||||||
<inherits name='org.gcube.portlets.user.sdmximportwizard.sdmximportwizard' />
|
<inherits name='org.gcube.portlets.user.sdmximportwizard.sdmximportwizard' />
|
||||||
|
<inherits name="org.gcube.portlets.user.csvimportwizardgxt3.csvimportwizardgxt3" />
|
||||||
|
<inherits name="org.gcube.portlets.user.csvimportwizardgxt3.ws.csvimportwizardworkspacegxt3" />
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point class='org.gcube.portlets.user.td.client.TabularDataPortlet' />
|
<entry-point class='org.gcube.portlets.user.td.client.TabularDataPortlet' />
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<!-- be added before this line. -->
|
<!-- be added before this line. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<script type="text/javascript" language="javascript" src="tabulardataportlet/tabulardataportlet.nocache.js"></script>
|
<script type="text/javascript" language="javascript" src="tabulardataportlet/tabulardataportlet.nocache.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="gxt/css/gxt-all.css" />
|
<!-- <link rel="stylesheet" type="text/css" href="gxt/css/gxt-all.css" /> -->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>greetServlet</servlet-name>
|
<servlet-name>greetServlet</servlet-name>
|
||||||
<servlet-class>org.gcube.portlets.user.td.server.GreetingServiceImpl</servlet-class>
|
<servlet-class>org.gcube.portlets.user.td.server.GreetingServiceImpl</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
|
@ -61,6 +62,60 @@
|
||||||
<url-pattern>/tabulardataportlet/SDMXImportWizardService</url-pattern>
|
<url-pattern>/tabulardataportlet/SDMXImportWizardService</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- CSV IMPORT WIZARD -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>CSVImportService</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.csvimportwizardgxt3.server.CSVImportServiceImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>CSVImportService</servlet-name>
|
||||||
|
<url-pattern>/tabulardataportlet/CSVImportService</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>LocalUploadServlet</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.csvimportwizardgxt3.server.local.LocalUploadServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>LocalUploadServlet</servlet-name>
|
||||||
|
<url-pattern>/tabulardataportlet/LocalUploadServlet</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>CSVServlet</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.csvimportwizardgxt3.server.CSVServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>CSVServlet</servlet-name>
|
||||||
|
<url-pattern>/tabulardataportlet/CSVServlet</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- Workspace Light Tree -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>WorkspaceLightService</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.workspace.lighttreegxt3.server.WorkspaceServiceImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>WorkspaceLightService</servlet-name>
|
||||||
|
<url-pattern>/tabulardataportlet/WorkspaceLightService</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- CSV Import Wizard Workspace-->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>CSVImportServiceWorkspace</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.csvimportwizardgxt3.ws.server.ImportWizardWSServiceImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>CSVImportServiceWorkspace</servlet-name>
|
||||||
|
<url-pattern>/tabulardataportlet/CSVImportServiceWorkspace</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
<!-- Default page to serve -->
|
<!-- Default page to serve -->
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
<welcome-file>TabularDataPortlet.html</welcome-file>
|
<welcome-file>TabularDataPortlet.html</welcome-file>
|
||||||
|
|
Loading…
Reference in New Issue