From 44cc5740eb00d52eaeb0e82311a7461097dab6b1 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 22 Jan 2015 11:23:09 +0000 Subject: [PATCH] Added RStudio git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@111436 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/td/client/TabularDataController.java | 16 ++++++++ .../user/td/client/ribbon/AnalyseToolBar.java | 7 +++- .../user/td/client/rstudio/RStudio.java | 41 +++++++++++++++++++ .../user/td/tabulardataportlet.gwt.xml | 8 ++-- src/main/webapp/WEB-INF/web.xml | 12 ++++++ 5 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/client/rstudio/RStudio.java 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 6844945..cbe358b 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 @@ -7,6 +7,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.chartswidget.client.ChartsWidgetTD; import org.gcube.portlets.user.td.client.logs.TDMLogs; +import org.gcube.portlets.user.td.client.rstudio.RStudio; import org.gcube.portlets.user.td.client.template.TemplateApplyDialog; import org.gcube.portlets.user.td.client.template.TemplateDeleteDialog; import org.gcube.portlets.user.td.client.template.TemplateOpenDialog; @@ -878,6 +879,7 @@ public class TabularDataController { openCreateChart(); break; case RSTUDIO: + openRStudio(); break; case STATISTICAL: openStatistical(); @@ -1607,6 +1609,20 @@ public class TabularDataController { HistoryDiscard historyDiscard = new HistoryDiscard(eventBus); historyDiscard.discard(); } + + private void openRStudio() { + Log.debug("Request Open RStudio"); + if (trId != null) { + @SuppressWarnings("unused") + RStudio rStudio=new RStudio(trId, eventBus); + } else { + Log.error("TRId is null"); + UtilsGXT3.alert("Error", "No current tabular resource present"); + } + + } + + private void openStatistical() { GWT.runAsync(new RunAsyncCallback() { 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 7d38182..87c327b 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 @@ -354,8 +354,7 @@ public class AnalyseToolBar { rstudioButton.addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { - // eventBus.fireEvent(new - // RibbonEvent(RibbonType.TABLEAGGREAGETE)); + eventBus.fireEvent(new RibbonEvent(RibbonType.RSTUDIO)); } }); @@ -459,12 +458,14 @@ public class AnalyseToolBar { chartCreateButton.disable(); gisButton.disable(); statisticalButton.disable(); + rstudioButton.disable(); break; case TR_CLOSE: case TR_READONLY: chartCreateButton.disable(); gisButton.disable(); statisticalButton.disable(); + rstudioButton.disable(); break; case TR_OPEN: case TABLEUPDATE: @@ -472,11 +473,13 @@ public class AnalyseToolBar { chartCreateButton.enable(); gisButton.enable(); statisticalButton.enable(); + rstudioButton.enable(); break; case WIZARD_OPEN: chartCreateButton.disable(); gisButton.disable(); statisticalButton.disable(); + rstudioButton.disable(); break; default: break; diff --git a/src/main/java/org/gcube/portlets/user/td/client/rstudio/RStudio.java b/src/main/java/org/gcube/portlets/user/td/client/rstudio/RStudio.java new file mode 100644 index 0000000..580bcea --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/client/rstudio/RStudio.java @@ -0,0 +1,41 @@ +package org.gcube.portlets.user.td.client.rstudio; + +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.Window; +import com.google.web.bindery.event.shared.EventBus; + +/** + * + * RStudio Widget + * + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class RStudio { + private static final String TAB_RESOURCE_ID_PARAMETER = "TabResourceId"; + + + public RStudio(TRId trId, EventBus eventBus) { + callRStudioServlet(trId); + } + + private void callRStudioServlet(TRId trId) { + Log.debug("Request: " + trId); + + String url = GWT.getModuleBaseURL() + "TDRStudioServlet?" + + TAB_RESOURCE_ID_PARAMETER + "=" + + trId.getId(); + Log.debug("Server URL: " + url); + Window.open(url, "RStudio", ""); + + + } + + + +} diff --git a/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml index 066b501..48b4d43 100644 --- a/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml @@ -74,14 +74,14 @@ - + --> - + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 79775ac..fe99c01 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -49,6 +49,13 @@ RetrieveChartFileServlet org.gcube.portlets.user.td.gwtservice.server.RetrieveChartFileServlet + + + + TDRStudioServlet + org.gcube.portlets.user.td.gwtservice.server.TDRStudioServlet + + @@ -199,6 +206,11 @@ /tabulardataportlet/RetrieveChartFileServlet + + + TDRStudioServlet + /tabulardataportlet/TDRStudioServlet +