Update CSV Import

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@83333 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-10-18 16:43:31 +00:00
parent 6528cddfc4
commit 33dc05db90
1 changed files with 82 additions and 67 deletions

View File

@ -3,10 +3,9 @@
*/
package org.gcube.portlets.user.td.client;
import org.gcube.portlets.user.csvimportwizardtd.client.CSVImportWizardTD;
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.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;
@ -18,7 +17,6 @@ import org.gcube.portlets.user.td.client.event.OpenFunctionalityType;
import org.gcube.portlets.user.td.client.event.OpenTabularResourceEvent;
import org.gcube.portlets.user.td.client.event.OpenTabularResourceType;
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
import org.gcube.portlets.user.td.importer.client.TabularDataImporterListener;
import org.gcube.portlets.user.td.information.client.TabularResourceProperties;
import org.gcube.portlets.user.td.open.client.TDOpen;
import org.gcube.portlets.user.tdw.client.TabularData;
@ -39,8 +37,10 @@ import com.sencha.gxt.widget.core.client.event.BeforeCloseEvent.BeforeCloseHandl
import com.sencha.gxt.widget.core.client.info.Info;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TabularDataController {
// implements HasCloseHandlers<Long>, HasOpenHandlers<Long> {
@ -253,16 +253,15 @@ public class TabularDataController {
if (uiProperties == UIProperties.OPENED) {
functionalityPanel.collapse();
functionalityPanel.disable();
uiProperties=UIProperties.CLOSED;
uiProperties = UIProperties.CLOSED;
functionalityTab.remove(trProperties);
Info.display("Properties", "Closed");
} else {
TabItemConfig propertiesItemConf = new TabItemConfig(
"Properties", true);
trProperties = new TabularResourceProperties(
"TRProperties", eventBus);
trProperties = new TabularResourceProperties("TRProperties",
eventBus);
trProperties.setHeaderVisible(false);
functionalityTab.add(trProperties, propertiesItemConf);
functionalityTab
@ -274,7 +273,7 @@ public class TabularDataController {
if (functionalityTab.getWidgetCount() == 1) {
functionalityPanel.disable();
functionalityPanel.collapse();
uiProperties=UIProperties.CLOSED;
uiProperties = UIProperties.CLOSED;
functionalityTab.remove(trProperties);
}
@ -282,20 +281,17 @@ public class TabularDataController {
});
/*Label taskLabel = new Label("Task Properties");
taskLabel.addStyleName("pad-text");
functionalityTab
.add(taskLabel, new TabItemConfig("Task", true));
*/
/*
* Label taskLabel = new Label("Task Properties");
* taskLabel.addStyleName("pad-text"); functionalityTab
* .add(taskLabel, new TabItemConfig("Task", true));
*/
functionalityTab.setActiveWidget(functionalityTab.getWidget(0));
functionalityPanel.enable();
functionalityPanel.expand();
uiProperties=UIProperties.OPENED;
uiProperties = UIProperties.OPENED;
}
} else {
Info.display("Properties", "No table open");
@ -311,46 +307,34 @@ public class TabularDataController {
SDMXImportWizardTD importWizard = new SDMXImportWizardTD(
"SDMX Import");
importWizard.addListener(new WizardListener() {
importWizard
.addListener(new org.gcube.portlets.user.sdmximportwizardtd.client.general.WizardListener() {
@Override
public void completed(TRId tabularResourceId) {
trId = tabularResourceId;
tableOpening = new TableId(
Constants.TD_DATASOURCE_FACTORY_ID, trId
.getTableId());
tabularData.openTable(tableOpening);
uiState = UIState.TR_OPEN;
@Override
public void completed(TRId tabularResourceId) {
trId = tabularResourceId;
tableOpening = new TableId(
Constants.TD_DATASOURCE_FACTORY_ID,
trId.getTableId());
tabularData.openTable(tableOpening);
uiState = UIState.TR_OPEN;
}
}
@Override
public void aborted() {
// TODO Auto-generated method stub
@Override
public void aborted() {
// TODO Auto-generated method stub
}
}
@Override
public void failed(Throwable throwable, String reason,
String details) {
// TODO Auto-generated method stub
@Override
public void failed(Throwable throwable,
String reason, String details) {
// TODO Auto-generated method stub
}
}
});
/*
* importWizard.addWizardSelectionHandler(new
* WizardSelectionHandler<Dataset>() {
*
* @Override public void onSelected(
* SDMXWizardSelectionEvent<Dataset> event) {
* doSDMXDatasetImport(event.getSelected()); }
*
* @Override public void onClosed(
* SDMXWizardSelectionEvent<Dataset> event) {
*
* } });
*/
});
importWizard.show();
}
@ -413,10 +397,10 @@ public class TabularDataController {
if (uiState == UIState.TR_OPEN) {
tabularData.closeTable();
uiState = UIState.START;
if(uiProperties==UIProperties.OPENED){
if (uiProperties == UIProperties.OPENED) {
functionalityPanel.collapse();
functionalityPanel.disable();
uiProperties=UIProperties.CLOSED;
uiProperties = UIProperties.CLOSED;
functionalityTab.remove(trProperties);
}
}
@ -485,11 +469,48 @@ public class TabularDataController {
*/
protected void openCSVImportWizard() {
/*
* GWT.runAsync(new RunAsyncCallback() {
*
* @Override public void onSuccess() {
*/
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onSuccess() {
CSVImportWizardTD importWizard = new CSVImportWizardTD(
"CSV Import");
importWizard
.addListener(new org.gcube.portlets.user.csvimportwizardtd.client.general.WizardListener() {
@Override
public void failed(Throwable throwable,
String reason, String details) {
// TODO Auto-generated method stub
}
@Override
public void completed(TRId id) {
// TODO Auto-generated method stub
}
@Override
public void aborted() {
// TODO Auto-generated method stub
}
});
importWizard.show();
}
@Override
public void onFailure(Throwable reason) {
asyncCodeLoadingFailed(reason);
}
});
}
/*protected void openOldCSVImportWizard() {
CSVImporterWidget csvImporterWidget = new CSVImporterWidget();
csvImporterWidget.show(new TabularDataImporterListener() {
@ -513,13 +534,7 @@ public class TabularDataController {
}
});
/*
* }
*
* @Override public void onFailure(Throwable reason) {
* asyncCodeLoadingFailed(reason); } });
*/
}
}*/
protected void asyncCodeLoadingFailed(Throwable reason) {
Log.error("Async code loading failed", reason);