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:
parent
8899dbd51c
commit
d3555dede3
|
@ -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.widgetcommonevent.client.type.UIStateType;
|
||||||
import org.gcube.portlets.user.td.csvexportwidget.client.CSVExportWizardTD;
|
import org.gcube.portlets.user.td.csvexportwidget.client.CSVExportWizardTD;
|
||||||
import org.gcube.portlets.user.td.csvimportwidget.client.CSVImportWizardTD;
|
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.gwtservice.shared.tr.TRId;
|
||||||
import org.gcube.portlets.user.td.informationwidget.client.TabularResourceProperties;
|
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.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.RunAsyncCallback;
|
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.gwt.user.client.ui.Widget;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||||
|
@ -38,9 +40,9 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TabularDataController {
|
public class TabularDataController {
|
||||||
// implements HasCloseHandlers<Long>, HasOpenHandlers<Long> {
|
// implements HasCloseHandlers<Long>, HasOpenHandlers<Long> {
|
||||||
|
@ -109,21 +111,20 @@ public class TabularDataController {
|
||||||
protected void bindToEvents() {
|
protected void bindToEvents() {
|
||||||
eventBus.addHandler(RibbonEvent.TYPE,
|
eventBus.addHandler(RibbonEvent.TYPE,
|
||||||
new RibbonEvent.RibbonEventHandler() {
|
new RibbonEvent.RibbonEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRibbon(RibbonEvent event) {
|
public void onRibbon(RibbonEvent event) {
|
||||||
doRibbonCommand(event);
|
doRibbonCommand(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.fireEvent(new UIStateEvent(UIStateType.START));
|
eventBus.fireEvent(new UIStateEvent(UIStateType.START));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void alertMessage(String reason, String details){
|
protected void alertMessage(String reason, String details) {
|
||||||
AlertMessageBox d = new AlertMessageBox(reason,
|
AlertMessageBox d = new AlertMessageBox(reason, details);
|
||||||
details);
|
|
||||||
d.addHideHandler(new HideHandler() {
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,28 +135,27 @@ public class TabularDataController {
|
||||||
});
|
});
|
||||||
d.show();
|
d.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void resumeUIState(){
|
protected void resumeUIState() {
|
||||||
if(uiState==UIStateType.TR_OPEN){
|
if (uiState == UIStateType.TR_OPEN) {
|
||||||
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_OPEN));
|
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_OPEN));
|
||||||
} else {
|
} else {
|
||||||
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_CLOSE));
|
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_CLOSE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openTable(TRId tabularResourceId){
|
protected void openTable(TRId tabularResourceId) {
|
||||||
trId = tabularResourceId;
|
trId = tabularResourceId;
|
||||||
tableOpening = new TableId(
|
tableOpening = new TableId(Constants.TD_DATASOURCE_FACTORY_ID,
|
||||||
Constants.TD_DATASOURCE_FACTORY_ID,
|
|
||||||
trId.getTableId());
|
trId.getTableId());
|
||||||
tabularData.openTable(tableOpening);
|
tabularData.openTable(tableOpening);
|
||||||
uiState = UIStateType.TR_OPEN;
|
uiState = UIStateType.TR_OPEN;
|
||||||
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_OPEN));
|
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_OPEN));
|
||||||
if(uiProperties == UIProperties.OPENED){
|
if (uiProperties == UIProperties.OPENED) {
|
||||||
trProperties.update();
|
trProperties.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeTabularResource() {
|
protected void closeTabularResource() {
|
||||||
if (uiState == UIStateType.TR_OPEN) {
|
if (uiState == UIStateType.TR_OPEN) {
|
||||||
tabularData.closeTable();
|
tabularData.closeTable();
|
||||||
|
@ -169,28 +169,31 @@ public class TabularDataController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void deleteTabularResource() {
|
protected void deleteTabularResource() {
|
||||||
if (uiState == UIStateType.TR_OPEN) {
|
TDGWTServiceAsync.INSTANCE.removeTabularResource(trId,
|
||||||
tabularData.closeTable();
|
new AsyncCallback<Void>() {
|
||||||
uiState = UIStateType.TR_CLOSE;
|
@Override
|
||||||
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_CLOSE));
|
public void onFailure(Throwable caught) {
|
||||||
if (uiProperties == UIProperties.OPENED) {
|
alertMessage("Error", "Error on remove TabResource: "
|
||||||
functionalityPanel.collapse();
|
+ caught.getLocalizedMessage());
|
||||||
functionalityPanel.disable();
|
}
|
||||||
uiProperties = UIProperties.CLOSED;
|
|
||||||
functionalityTab.remove(trProperties);
|
@Override
|
||||||
}
|
public void onSuccess(Void result) {
|
||||||
}
|
closeTabularResource();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void openWizard() {
|
||||||
protected void openWizard(){
|
|
||||||
eventBus.fireEvent(new UIStateEvent(UIStateType.WIZARD_OPEN));
|
eventBus.fireEvent(new UIStateEvent(UIStateType.WIZARD_OPEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doRibbonCommand(RibbonEvent event){
|
public void doRibbonCommand(RibbonEvent event) {
|
||||||
RibbonType type=event.getRibbonType();
|
RibbonType type = event.getRibbonType();
|
||||||
Log.trace("doRibbonEvent ribbonType: " + type);
|
Log.trace("doRibbonEvent ribbonType: " + type);
|
||||||
try {
|
try {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -230,7 +233,7 @@ public class TabularDataController {
|
||||||
+ " \n " + e.getMessage());
|
+ " \n " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openFunctionalityProperties() {
|
protected void openFunctionalityProperties() {
|
||||||
if (uiState == UIStateType.TR_OPEN) {
|
if (uiState == UIStateType.TR_OPEN) {
|
||||||
if (uiProperties == UIProperties.OPENED) {
|
if (uiProperties == UIProperties.OPENED) {
|
||||||
|
@ -288,27 +291,26 @@ public class TabularDataController {
|
||||||
openWizard();
|
openWizard();
|
||||||
SDMXImportWizardTD importWizard = new SDMXImportWizardTD(
|
SDMXImportWizardTD importWizard = new SDMXImportWizardTD(
|
||||||
"SDMX Import");
|
"SDMX Import");
|
||||||
importWizard
|
importWizard.addListener(new WizardListener() {
|
||||||
.addListener(new WizardListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(TRId tabularResourceId) {
|
public void completed(TRId tabularResourceId) {
|
||||||
openTable(tabularResourceId);
|
openTable(tabularResourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void aborted() {
|
public void aborted() {
|
||||||
resumeUIState();
|
resumeUIState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed(Throwable throwable,
|
public void failed(Throwable throwable, String reason,
|
||||||
String reason, String details) {
|
String details) {
|
||||||
alertMessage(reason, details);
|
alertMessage(reason, details);
|
||||||
resumeUIState();
|
resumeUIState();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
importWizard.show();
|
importWizard.show();
|
||||||
}
|
}
|
||||||
|
@ -321,7 +323,6 @@ public class TabularDataController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void openCSVExportWizard() {
|
protected void openCSVExportWizard() {
|
||||||
GWT.runAsync(new RunAsyncCallback() {
|
GWT.runAsync(new RunAsyncCallback() {
|
||||||
|
|
||||||
|
@ -331,26 +332,25 @@ public class TabularDataController {
|
||||||
CSVExportWizardTD exportWizard = new CSVExportWizardTD(
|
CSVExportWizardTD exportWizard = new CSVExportWizardTD(
|
||||||
"CSV Export");
|
"CSV Export");
|
||||||
|
|
||||||
exportWizard
|
exportWizard.addListener(new WizardListener() {
|
||||||
.addListener(new WizardListener() {
|
@Override
|
||||||
@Override
|
public void failed(Throwable throwable, String reason,
|
||||||
public void failed(Throwable throwable,
|
String details) {
|
||||||
String reason, String details) {
|
alertMessage(reason, details);
|
||||||
alertMessage(reason, details);
|
resumeUIState();
|
||||||
resumeUIState();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(TRId id) {
|
public void completed(TRId id) {
|
||||||
resumeUIState();
|
resumeUIState();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void aborted() {
|
public void aborted() {
|
||||||
resumeUIState();
|
resumeUIState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exportWizard.show();
|
exportWizard.show();
|
||||||
}
|
}
|
||||||
|
@ -362,50 +362,38 @@ public class TabularDataController {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openSDMXExportWizard() {
|
protected void openSDMXExportWizard() {
|
||||||
/*
|
/*
|
||||||
GWT.runAsync(new RunAsyncCallback() {
|
* GWT.runAsync(new RunAsyncCallback() {
|
||||||
|
*
|
||||||
@Override
|
* @Override public void onSuccess() { SDMXExportWizardTD exportWizard =
|
||||||
public void onSuccess() {
|
* new SDMXExportWizardTD( "SDMX Export");
|
||||||
SDMXExportWizardTD exportWizard = new SDMXExportWizardTD(
|
*
|
||||||
"SDMX Export");
|
* exportWizard .addListener(new
|
||||||
|
* org.gcube.portlets.user.sdmxexportwizardtd
|
||||||
exportWizard
|
* .client.general.WizardListener() {
|
||||||
.addListener(new org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardListener() {
|
*
|
||||||
|
* @Override public void failed(Throwable throwable, String reason,
|
||||||
@Override
|
* String details) {
|
||||||
public void failed(Throwable throwable,
|
*
|
||||||
String reason, String details) {
|
* }
|
||||||
|
*
|
||||||
}
|
* @Override public void completed(TRId id) {
|
||||||
|
*
|
||||||
@Override
|
* }
|
||||||
public void completed(TRId id) {
|
*
|
||||||
|
* @Override public void aborted() {
|
||||||
}
|
*
|
||||||
|
* } });
|
||||||
@Override
|
*
|
||||||
public void aborted() {
|
* exportWizard.show(); }
|
||||||
|
*
|
||||||
}
|
* @Override public void onFailure(Throwable reason) {
|
||||||
});
|
* asyncCodeLoadingFailed(reason); } });
|
||||||
|
|
||||||
exportWizard.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable reason) {
|
|
||||||
asyncCodeLoadingFailed(reason);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -436,7 +424,7 @@ public class TabularDataController {
|
||||||
@Override
|
@Override
|
||||||
public void completed(TRId tabularResourceId) {
|
public void completed(TRId tabularResourceId) {
|
||||||
openTable(tabularResourceId);
|
openTable(tabularResourceId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -452,12 +440,6 @@ public class TabularDataController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void openCSVImportWizard() {
|
protected void openCSVImportWizard() {
|
||||||
GWT.runAsync(new RunAsyncCallback() {
|
GWT.runAsync(new RunAsyncCallback() {
|
||||||
|
|
||||||
|
@ -467,27 +449,26 @@ public class TabularDataController {
|
||||||
CSVImportWizardTD importWizard = new CSVImportWizardTD(
|
CSVImportWizardTD importWizard = new CSVImportWizardTD(
|
||||||
"CSV Import");
|
"CSV Import");
|
||||||
|
|
||||||
importWizard
|
importWizard.addListener(new WizardListener() {
|
||||||
.addListener(new WizardListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed(Throwable throwable,
|
public void failed(Throwable throwable, String reason,
|
||||||
String reason, String details) {
|
String details) {
|
||||||
alertMessage(reason, details);
|
alertMessage(reason, details);
|
||||||
resumeUIState();
|
resumeUIState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(TRId id) {
|
public void completed(TRId id) {
|
||||||
openTable(id);
|
openTable(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void aborted() {
|
public void aborted() {
|
||||||
resumeUIState();
|
resumeUIState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
importWizard.show();
|
importWizard.show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ public class FileToolBar {
|
||||||
|
|
||||||
closeButton = new TextButton("Close",
|
closeButton = new TextButton("Close",
|
||||||
TabularDataResources.INSTANCE.close32());
|
TabularDataResources.INSTANCE.close32());
|
||||||
|
closeButton.disable();
|
||||||
closeButton.setId("closeButton");
|
closeButton.setId("closeButton");
|
||||||
closeButton.setScale(ButtonScale.LARGE);
|
closeButton.setScale(ButtonScale.LARGE);
|
||||||
closeButton.setIconAlign(IconAlign.TOP);
|
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);
|
dataLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
deleteButton = new TextButton("Delete",
|
deleteButton = new TextButton("Delete",
|
||||||
TabularDataResources.INSTANCE.close());
|
TabularDataResources.INSTANCE.delete());
|
||||||
deleteButton.disable();
|
deleteButton.disable();
|
||||||
deleteButton.setId("closeButton");
|
deleteButton.setId("closeButton");
|
||||||
deleteButton.setToolTip("Delete Tabular Resource");
|
deleteButton.setToolTip("Delete Tabular Resource");
|
||||||
|
@ -132,6 +133,9 @@ public class FileToolBar {
|
||||||
RibbonType.DELETE));
|
RibbonType.DELETE));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
propertiesButton = new TextButton("Properties",
|
propertiesButton = new TextButton("Properties",
|
||||||
TabularDataResources.INSTANCE.properties());
|
TabularDataResources.INSTANCE.properties());
|
||||||
|
|
Loading…
Reference in New Issue