diff --git a/pom.xml b/pom.xml index cf5f0a2..ec5c8c2 100644 --- a/pom.xml +++ b/pom.xml @@ -116,14 +116,14 @@ gxt 3.0.1 - + javax.portlet portlet-api provided - + org.gcube.applicationsupportlayer @@ -137,12 +137,12 @@ [1.0.2-SNAPSHOT,2.0.0-SNAPSHOT) compile - + org.gcube.portal custom-portal-handler - + org.gcube.applicationsupportlayer aslcore @@ -173,15 +173,15 @@ provided - - + + org.gcube.data.analysis.tabulardata service-client-impl [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT) - + @@ -213,7 +213,7 @@ [0.2.0-SNAPSHOT,1.0.0-SNAPSHOT) - + org.gcube.portlets.user @@ -241,7 +241,7 @@ tabular-data-wizard-widget [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) - + org.gcube.portlets.user @@ -270,7 +270,7 @@ tabular-data-share-widget [0.0.1-SNAPSHOT,2.0.0-SNAPSHOT) - + org.gcube.portlets.user @@ -284,7 +284,7 @@ tabular-data-sdmx-import-widget [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT) - + org.gcube.portlets.user @@ -305,14 +305,14 @@ tabular-data-sdmx-export-widget [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) - + org.gcube.portlets.user tabular-data-json-export-widget [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) - + org.gcube.portlets.user @@ -362,6 +362,12 @@ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + + + org.gcube.portlets.user + tabular-data-map-widget + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + diff --git a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java index ba356be..02e0fd7 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java +++ b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java @@ -21,6 +21,7 @@ import org.gcube.portlets.user.td.extractcodelistwidget.client.ExtractCodelistWi import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.jsonexportwidget.client.JSONExportWidgetTD; +import org.gcube.portlets.user.td.mapwidget.client.MapWidgetTD; import org.gcube.portlets.user.td.openwidget.client.TDOpen; import org.gcube.portlets.user.td.sdmxexportwidget.client.SDMXExportWizardTD; import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD; @@ -95,10 +96,17 @@ public class TabularDataController { protected ContentPanel toolBoxPanel; protected BorderLayoutData westData; + /** + * Current user + */ + protected String userName; + /** * Tabular Resource Id */ protected TRId trId; + + /** * Grid TableId @@ -151,6 +159,8 @@ public class TabularDataController { protected void callHello() { TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback() { + + @Override public void onFailure(Throwable caught) { Log.info("No valid user found: " + caught.getMessage()); @@ -164,6 +174,7 @@ public class TabularDataController { @Override public void onSuccess(String result) { + userName=result; Log.info("Hello: " + result); } @@ -660,7 +671,8 @@ public class TabularDataController { break; case SPREAD: break; - case GIS: + case CREATEGISMAP: + openCreateMapWizard(); break; default: break; @@ -1000,6 +1012,8 @@ public class TabularDataController { }); } + + protected void openTableUnionWizard() { GWT.runAsync(new RunAsyncCallback() { @@ -1041,6 +1055,49 @@ public class TabularDataController { } + protected void openCreateMapWizard() { + GWT.runAsync(new RunAsyncCallback() { + + public void onSuccess() { + openWizard(); + MapWidgetTD mapWizard = new MapWidgetTD(trId, userName, "Map Creation", + eventBus); + + mapWizard.addListener(new WizardListener() { + public void failed(String title, String message, + Throwable throwable) { + UtilsGXT3.alert(title, message); + resumeUIState(); + } + + public void completed(TRId id) { + openTable(id); + + } + + @Override + public void putInBackground() { + Log.debug("PutInBakground"); + } + + public void aborted() { + resumeUIState(); + } + }); + + + } + + public void onFailure(Throwable reason) { + asyncCodeLoadingFailed(reason); + } + }); + + } + + + + /** * @param switchState * diff --git a/src/main/java/org/gcube/portlets/user/td/client/ribbon/AnalyseToolBar.java b/src/main/java/org/gcube/portlets/user/td/client/ribbon/AnalyseToolBar.java index 61f82d7..447755a 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/ribbon/AnalyseToolBar.java +++ b/src/main/java/org/gcube/portlets/user/td/client/ribbon/AnalyseToolBar.java @@ -4,7 +4,12 @@ package org.gcube.portlets.user.td.client.ribbon; import org.gcube.portlets.user.td.client.resource.TabularDataResources; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType; +import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NodeList; import com.google.gwt.user.client.ui.FlexTable; @@ -44,7 +49,7 @@ public class AnalyseToolBar { protected TextButton addRowButton; protected TextButton deleteRowButton; protected TextButton deleteDuplicateButton; - //protected TextButton annotationButton; + // protected TextButton annotationButton; protected TextButton filterColumnButton; protected TextButton replaceValueBatchButton; @@ -83,7 +88,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -100,7 +105,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -117,7 +122,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -134,7 +139,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -151,7 +156,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -168,7 +173,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -185,31 +190,12 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); tableLayout.setWidget(0, 6, deleteDuplicateButton); tableLayout.getFlexCellFormatter().setRowSpan(0, 6, 2); - - /* - annotationButton = new TextButton("Annotation", - TabularDataResources.INSTANCE.annotationAdd32()); - annotationButton.setScale(ButtonScale.LARGE); - annotationButton.setIconAlign(IconAlign.TOP); - annotationButton.setToolTip("Add annotation column"); - annotationButton.setArrowAlign(ButtonArrowAlign.BOTTOM); - annotationButton.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); - } - }); - - tableLayout.setWidget(0, 7, annotationButton); - tableLayout.getFlexCellFormatter().setRowSpan(0, 7, 2); - */ cleanCells(tableLayout.getElement()); // Column Group @@ -234,7 +220,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -245,14 +231,13 @@ public class AnalyseToolBar { TabularDataResources.INSTANCE.columnReplaceBatch32()); replaceValueBatchButton.setScale(ButtonScale.LARGE); replaceValueBatchButton.setIconAlign(IconAlign.TOP); - replaceValueBatchButton - .setToolTip("Replace column values in batch"); + replaceValueBatchButton.setToolTip("Replace column values in batch"); replaceValueBatchButton.setArrowAlign(ButtonArrowAlign.BOTTOM); replaceValueBatchButton.addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -282,7 +267,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -299,7 +284,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -316,7 +301,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -333,7 +318,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -363,7 +348,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -380,7 +365,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -397,7 +382,7 @@ public class AnalyseToolBar { public void onSelect(SelectEvent event) { // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + // RibbonEvent(RibbonType.TABLEAGGREAGETE)); } }); @@ -406,33 +391,43 @@ public class AnalyseToolBar { cleanCells(processLayout.getElement()); - // Project - ButtonGroup projectGroup = new ButtonGroup(); - projectGroup.setId("Project"); - projectGroup.setStyleName("ribbon"); - projectGroup.setHeadingText("Project"); - projectGroup.disable(); - toolBar.add(projectGroup); + // GIS + ButtonGroup gisGroup = new ButtonGroup(); + gisGroup.setId("GIS"); + gisGroup.setStyleName("ribbon"); + gisGroup.setHeadingText("GIS"); + toolBar.add(gisGroup); - FlexTable projectLayout = new FlexTable(); - projectGroup.add(projectLayout); + FlexTable gisLayout = new FlexTable(); + gisGroup.add(gisLayout); - gisButton = new TextButton("GIS", TabularDataResources.INSTANCE.gis32()); + gisButton = new TextButton("Create Map", + TabularDataResources.INSTANCE.gis32()); gisButton.setScale(ButtonScale.LARGE); gisButton.setIconAlign(IconAlign.TOP); - gisButton.setToolTip("GIS"); + gisButton.setToolTip("Create Map"); + gisButton.disable(); gisButton.setArrowAlign(ButtonArrowAlign.BOTTOM); gisButton.addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { - // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); + eventBus.fireEvent(new RibbonEvent(RibbonType.CREATEGISMAP)); } }); - projectLayout.setWidget(0, 0, gisButton); - projectLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); - cleanCells(projectLayout.getElement()); + gisLayout.setWidget(0, 0, gisButton); + gisLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); + cleanCells(gisLayout.getElement()); + + eventBus.addHandler(UIStateEvent.TYPE, + new UIStateEvent.UIStateHandler() { + + public void onUIState(UIStateEvent event) { + setUI(event); + + } + } + ); } @@ -447,4 +442,32 @@ public class AnalyseToolBar { } } + public void setUI(UIStateEvent event) { + UIStateType uiStateType = event.getUIStateType(); + try { + switch (uiStateType) { + case START: + gisButton.disable(); + break; + case TR_CLOSE: + case TR_READONLY: + gisButton.disable(); + break; + case TR_OPEN: + case TABLEUPDATE: + case TABLECURATION: + gisButton.enable(); + break; + case WIZARD_OPEN: + gisButton.disable(); + break; + default: + break; + } + } catch (Exception e) { + Log.error("setUI Error on Ribbon Curation: " + + e.getLocalizedMessage()); + } + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml b/src/main/java/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml index 2952875..45e2301 100644 --- a/src/main/java/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml +++ b/src/main/java/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml @@ -45,7 +45,7 @@ - + - +