Add mock 1.0.1-SNAPSHOT

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@81987 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-09-25 15:44:07 +00:00
parent 89b7949744
commit f907c19322
8 changed files with 200 additions and 34 deletions

View File

@ -7,16 +7,13 @@
<dependent-module archiveName="tabular-data-widget-td-source-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-widget-td-source/tabular-data-widget-td-source">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-widget-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-widget/tabular-data-widget">
<dependency-type>uses</dependency-type>
</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="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="SDMXImportWizardTD-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/SDMXImportWizardTD/SDMXImportWizardTD">
<dependent-module archiveName="SDMXExportWizardTD-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/SDMXExportWizardTD/SDMXExportWizardTD">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="TDOpen-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-open/tabular-data-open">

23
pom.xml
View File

@ -87,13 +87,9 @@
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<version>[3.0.0-SNAPSHOT,4.0.0-SNAPSHOT)</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</exclusion>
</exclusions>
<version>[3.2.1-SNAPSHOT,4.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -108,8 +104,6 @@
</dependency>
<dependency>
<groupId>com.extjs.gxt</groupId>
<artifactId>gxt</artifactId>
@ -174,6 +168,14 @@
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- SDMX EXPORT WIZARD -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>SDMXExportWizardTD</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- TABULAR DATA OPEN -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
@ -188,6 +190,7 @@
</dependency>
</dependencies>
<build>
@ -213,7 +216,7 @@
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<!-- Copy static web files before Logexecuting gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>

View File

@ -3,11 +3,15 @@
*/
package org.gcube.portlets.user.td.client;
import org.gcube.portlets.user.sdmxexportwizardtd.client.SDMXExportWizardTD;
import org.gcube.portlets.user.sdmximportwizardtd.client.SDMXImportWizardTD;
import org.gcube.portlets.user.sdmximportwizardtd.client.general.WizardListener;
import org.gcube.portlets.user.sdmximportwizardtd.shared.TRId;
import org.gcube.portlets.user.td.ciw.client.CSVImporterWidget;
import org.gcube.portlets.user.td.client.event.CloseTabularResourceEvent;
import org.gcube.portlets.user.td.client.event.CloseTabularResourceType;
import org.gcube.portlets.user.td.client.event.ExportTableEvent;
import org.gcube.portlets.user.td.client.event.ExportTableType;
import org.gcube.portlets.user.td.client.event.ImportTableEvent;
import org.gcube.portlets.user.td.client.event.ImportTableType;
import org.gcube.portlets.user.td.client.event.OpenTabularResourceEvent;
@ -15,7 +19,6 @@ import org.gcube.portlets.user.td.client.event.OpenTabularResourceType;
import org.gcube.portlets.user.td.importer.client.TabularDataImporterListener;
import org.gcube.portlets.user.td.open.client.TDOpen;
import org.gcube.portlets.user.tdw.client.TabularData;
import org.gcube.portlets.user.tdw.shared.model.TableDefinition;
import org.gcube.portlets.user.tdw.shared.model.TableId;
import com.allen_sauer.gwt.log.client.Log;
@ -34,10 +37,7 @@ public class TabularDataController {
protected SimpleEventBus eventBus;
protected TabularData tabularData;
/**
* Tabular Data Id
*/
protected TableId tableOpening;
/**
* Table Open
@ -45,11 +45,14 @@ public class TabularDataController {
protected boolean tableOpen=false;
/**
* Table Id
* Tabular Resource Id
*/
protected String tableId;
protected TRId trId;
/**
* Grid TableId
*/
protected TableId tableOpening;
public TabularDataController() {
eventBus = new SimpleEventBus();
@ -78,6 +81,14 @@ public class TabularDataController {
doImportTable(event.getImportType());
}
});
eventBus.addHandler(ExportTableEvent.TYPE,
new ExportTableEvent.ExportTableHandler() {
@Override
public void onExportTable(ExportTableEvent event) {
doExportTable(event.getExportType());
}
});
eventBus.addHandler(OpenTabularResourceEvent.TYPE,
new OpenTabularResourceEvent.OpenTabularResourceHandler() {
@ -118,6 +129,29 @@ public class TabularDataController {
Log.error("doImportTable Error : " + e.getLocalizedMessage()+ " \n "+e.getMessage());
}
}
public void doExportTable(ExportTableType exportType) {
Log.trace("doExportTable importType: " + exportType);
Info.display("Export Tabular Resource", "type: " + exportType);
try {
switch (exportType) {
case SDMX:
openSDMXExportWizard();
break;
case CSV:
openSDMXExportWizard();
break;
case JSON:
openSDMXExportWizard();
break;
default:
break;
}
} catch (Exception e) {
Log.error("doImportTable Error : " + e.getLocalizedMessage()+ " \n "+e.getMessage());
}
}
public void doOpenTabularResource(OpenTabularResourceType openType) {
Log.trace("doOpenTabularResource openType: " + openType);
@ -153,7 +187,7 @@ public class TabularDataController {
}
protected void openSDMXImportWizard() {
GWT.runAsync(new RunAsyncCallback() {
@Override
@ -163,9 +197,11 @@ public class TabularDataController {
importWizard.addListener(new WizardListener(){
@Override
public void completed() {
//importWizard.getTable();
public void completed(TRId tabularResourceId) {
trId=tabularResourceId;
tableOpening=new TableId(Constants.TD_DATASOURCE_FACTORY_ID,trId.getTableId());
tabularData.openTable(tableOpening);
tableOpen=true;
}
@ -210,6 +246,48 @@ public class TabularDataController {
}
protected void openSDMXExportWizard() {
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onSuccess() {
SDMXExportWizardTD exportWizard= new SDMXExportWizardTD("SDMX Export");
exportWizard.addListener(new org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardListener() {
@Override
public void failed(Throwable throwable, String reason, String details) {
// TODO Auto-generated method stub
}
@Override
public void completed(
org.gcube.portlets.user.sdmxexportwizardtd.shared.TRId id) {
// TODO Auto-generated method stub
}
@Override
public void aborted() {
// TODO Auto-generated method stub
}
});
exportWizard.show();
}
@Override
public void onFailure(Throwable reason) {
asyncCodeLoadingFailed(reason);
}
});
}
/**
*
*/
@ -230,7 +308,7 @@ public class TabularDataController {
public void onSuccess() {
TDOpen tdOpen= new TDOpen("Tabular Resources Open");
tdOpen.addListener(new org.gcube.portlets.user.td.open.client.general.OpenListener(){
tdOpen.addListener(new org.gcube.portlets.user.td.open.client.general.WizardListener(){
@Override
public void aborted() {
@ -246,14 +324,18 @@ public class TabularDataController {
}
@Override
public void completed(String tablekey) {
tableOpening=new TableId(Constants.TD_DATASOURCE_FACTORY_ID,tablekey);
public void completed(
org.gcube.portlets.user.td.open.shared.TRId tabularResourceId) {
trId= new TRId(tabularResourceId.getId(),tabularResourceId.getTableId());
tableOpening=new TableId(Constants.TD_DATASOURCE_FACTORY_ID,trId.getTableId());
tabularData.openTable(tableOpening);
tableOpen=true;
tableId=tablekey;
}
});
Log.info("TDOpen add Listener");
tdOpen.show();

View File

@ -62,6 +62,8 @@ public class TabularDataPortlet implements EntryPoint {
*/
@Override
public void onModuleLoad() {
/*
* Install an UncaughtExceptionHandler which will produce <code>FATAL</code> log messages
*/

View File

@ -0,0 +1,42 @@
package org.gcube.portlets.user.td.client.event;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
import org.gcube.portlets.user.td.client.event.ExportTableType;
import com.google.gwt.event.shared.HasHandlers;
public class ExportTableEvent extends GwtEvent<ExportTableEvent.ExportTableHandler> {
public static Type<ExportTableHandler> TYPE = new Type<ExportTableHandler>();
private ExportTableType exportType;
public interface ExportTableHandler extends EventHandler {
void onExportTable(ExportTableEvent event);
}
public ExportTableEvent(ExportTableType exportType) {
this.exportType = exportType;
}
public ExportTableType getExportType() {
return exportType;
}
@Override
protected void dispatch(ExportTableHandler handler) {
handler.onExportTable(this);
}
@Override
public Type<ExportTableHandler> getAssociatedType() {
return TYPE;
}
public static Type<ExportTableHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, ExportTableType exportType) {
source.fireEvent(new ExportTableEvent(exportType));
}
}

View File

@ -0,0 +1,14 @@
/**
*
*/
package org.gcube.portlets.user.td.client.event;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public enum ExportTableType {
CSV,
SDMX,
JSON;
}

View File

@ -5,6 +5,8 @@ package org.gcube.portlets.user.td.client.ribbon;
import org.gcube.portlets.user.td.client.event.CloseTabularResourceEvent;
import org.gcube.portlets.user.td.client.event.CloseTabularResourceType;
import org.gcube.portlets.user.td.client.event.ExportTableEvent;
import org.gcube.portlets.user.td.client.event.ExportTableType;
import org.gcube.portlets.user.td.client.event.ImportTableEvent;
import org.gcube.portlets.user.td.client.event.ImportTableType;
import org.gcube.portlets.user.td.client.event.OpenTabularResourceEvent;
@ -166,7 +168,6 @@ public class FileToolBar {
importCSVButton = new TextButton("CSV", TabularDataResources.INSTANCE.csv());
importCSVButton.setToolTip("Import a new table from CSV");
importLayout.setWidget(0, 2, importCSVButton);
importCSVButton.addSelectHandler(new SelectHandler() {
@Override
@ -174,10 +175,10 @@ public class FileToolBar {
eventBus.fireEvent(new ImportTableEvent(ImportTableType.CSV));
}
});
importLayout.setWidget(0, 2, importCSVButton);
importJSONButton = new TextButton("JSON", TabularDataResources.INSTANCE.json());
importJSONButton.setToolTip("Import a new table from JSON");
importLayout.setWidget(1, 2, importJSONButton);
importJSONButton.addSelectHandler(new SelectHandler() {
@Override
@ -185,7 +186,9 @@ public class FileToolBar {
eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON));
}
});
importLayout.setWidget(1, 2, importJSONButton);
cleanCells(importLayout.getElement());
@ -203,14 +206,35 @@ public class FileToolBar {
exportSDMXButton.setScale(ButtonScale.LARGE);
exportSDMXButton.setIconAlign(IconAlign.TOP);
exportSDMXButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
exportSDMXButton.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new ExportTableEvent(ExportTableType.SDMX));
}
});
exportLayout.setWidget(0, 0, exportSDMXButton);
exportLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
exportCSVButton = new TextButton("CSV", TabularDataResources.INSTANCE.csv());
exportCSVButton.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new ExportTableEvent(ExportTableType.CSV));
}
});
exportLayout.setWidget(0, 2, exportCSVButton);
exportJSONButton = new TextButton("JSON", TabularDataResources.INSTANCE.json());
exportJSONButton.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new ExportTableEvent(ExportTableType.JSON));
}
});
exportLayout.setWidget(1, 2, exportJSONButton);
cleanCells(exportLayout.getElement());

View File

@ -9,10 +9,12 @@
<!-- <inherits name='org.gcube.portlets.user.workspace.WorkspaceTree' /> -->
<inherits name="org.gcube.portlets.user.tdw.TabularDataWidget" />
<inherits name='org.gcube.portlets.user.sdmximportwizardtd.SDMXImportWizardTD' />
<inherits name='org.gcube.portlets.user.sdmxexportwizardtd.SDMXExportWizardTD' />
<inherits name='org.gcube.portlets.user.td.open.TDOpen' />
<inherits name='org.gcube.portlets.user.td.ciw.csvimporterwidget' />
<inherits name='org.gcube.portlets.user.workspace.lighttree.WorkspacePortletLightTree' />
<!-- <inherits name='org.gcube.data.analysis.tabulardata.ServiceData'/> -->
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.portlets.user.td.client.TabularDataPortlet' />