Minor updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@86476 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-12-03 10:05:53 +00:00
parent 8899dbd51c
commit d3555dede3
2 changed files with 122 additions and 137 deletions

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
import org.gcube.portlets.user.td.csvexportwidget.client.CSVExportWizardTD;
import org.gcube.portlets.user.td.csvimportwidget.client.CSVImportWizardTD;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TRId;
import org.gcube.portlets.user.td.informationwidget.client.TabularResourceProperties;
@ -22,6 +23,7 @@ import org.gcube.portlets.user.tdw.shared.model.TableId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
@ -38,8 +40,8 @@ import com.sencha.gxt.widget.core.client.info.Info;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TabularDataController {
@ -122,8 +124,7 @@ public class TabularDataController {
}
protected void alertMessage(String reason, String details) {
AlertMessageBox d = new AlertMessageBox(reason,
details);
AlertMessageBox d = new AlertMessageBox(reason, details);
d.addHideHandler(new HideHandler() {
@Override
@ -145,8 +146,7 @@ public class TabularDataController {
protected void openTable(TRId tabularResourceId) {
trId = tabularResourceId;
tableOpening = new TableId(
Constants.TD_DATASOURCE_FACTORY_ID,
tableOpening = new TableId(Constants.TD_DATASOURCE_FACTORY_ID,
trId.getTableId());
tabularData.openTable(tableOpening);
uiState = UIStateType.TR_OPEN;
@ -171,19 +171,22 @@ public class TabularDataController {
}
protected void deleteTabularResource() {
if (uiState == UIStateType.TR_OPEN) {
tabularData.closeTable();
uiState = UIStateType.TR_CLOSE;
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_CLOSE));
if (uiProperties == UIProperties.OPENED) {
functionalityPanel.collapse();
functionalityPanel.disable();
uiProperties = UIProperties.CLOSED;
functionalityTab.remove(trProperties);
}
}
TDGWTServiceAsync.INSTANCE.removeTabularResource(trId,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
alertMessage("Error", "Error on remove TabResource: "
+ caught.getLocalizedMessage());
}
@Override
public void onSuccess(Void result) {
closeTabularResource();
}
});
}
protected void openWizard() {
eventBus.fireEvent(new UIStateEvent(UIStateType.WIZARD_OPEN));
@ -288,8 +291,7 @@ public class TabularDataController {
openWizard();
SDMXImportWizardTD importWizard = new SDMXImportWizardTD(
"SDMX Import");
importWizard
.addListener(new WizardListener() {
importWizard.addListener(new WizardListener() {
@Override
public void completed(TRId tabularResourceId) {
@ -302,8 +304,8 @@ public class TabularDataController {
}
@Override
public void failed(Throwable throwable,
String reason, String details) {
public void failed(Throwable throwable, String reason,
String details) {
alertMessage(reason, details);
resumeUIState();
}
@ -321,7 +323,6 @@ public class TabularDataController {
}
protected void openCSVExportWizard() {
GWT.runAsync(new RunAsyncCallback() {
@ -331,11 +332,10 @@ public class TabularDataController {
CSVExportWizardTD exportWizard = new CSVExportWizardTD(
"CSV Export");
exportWizard
.addListener(new WizardListener() {
exportWizard.addListener(new WizardListener() {
@Override
public void failed(Throwable throwable,
String reason, String details) {
public void failed(Throwable throwable, String reason,
String details) {
alertMessage(reason, details);
resumeUIState();
}
@ -365,47 +365,35 @@ 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) {
}
@Override
public void completed(TRId id) {
}
@Override
public void aborted() {
}
});
exportWizard.show();
}
@Override
public void onFailure(Throwable reason) {
asyncCodeLoadingFailed(reason);
}
});
* 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) {
*
* }
*
* @Override public void completed(TRId id) {
*
* }
*
* @Override public void aborted() {
*
* } });
*
* exportWizard.show(); }
*
* @Override public void onFailure(Throwable reason) {
* asyncCodeLoadingFailed(reason); } });
*/
}
/**
*
*/
@ -452,12 +440,6 @@ public class TabularDataController {
}
protected void openCSVImportWizard() {
GWT.runAsync(new RunAsyncCallback() {
@ -467,12 +449,11 @@ public class TabularDataController {
CSVImportWizardTD importWizard = new CSVImportWizardTD(
"CSV Import");
importWizard
.addListener(new WizardListener() {
importWizard.addListener(new WizardListener() {
@Override
public void failed(Throwable throwable,
String reason, String details) {
public void failed(Throwable throwable, String reason,
String details) {
alertMessage(reason, details);
resumeUIState();
}

View File

@ -96,6 +96,7 @@ public class FileToolBar {
closeButton = new TextButton("Close",
TabularDataResources.INSTANCE.close32());
closeButton.disable();
closeButton.setId("closeButton");
closeButton.setScale(ButtonScale.LARGE);
closeButton.setIconAlign(IconAlign.TOP);
@ -111,14 +112,14 @@ public class FileToolBar {
}
});
dataLayout.setWidget(0, 1, openButton);
dataLayout.setWidget(0, 1, closeButton);
dataLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
deleteButton = new TextButton("Delete",
TabularDataResources.INSTANCE.close());
TabularDataResources.INSTANCE.delete());
deleteButton.disable();
deleteButton.setId("closeButton");
deleteButton.setToolTip("Delete Tabular Resource");
@ -133,6 +134,9 @@ public class FileToolBar {
}
});
propertiesButton = new TextButton("Properties",
TabularDataResources.INSTANCE.properties());
propertiesButton.disable();