From 17b18d792692da14631898a80ecc01a9ae554a86 Mon Sep 17 00:00:00 2001 From: Antonio Gioia Date: Thu, 7 Mar 2013 11:00:21 +0000 Subject: [PATCH] Added alert when the export menu is disabled and workspace refresh when the file export is successfully completed git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@70999 82a268e6-3cf1-43bd-a215-b396298e98cf --- .settings/com.google.gdt.eclipse.core.prefs | 3 +-- .../user/reportgenerator/client/Headerbar.java | 10 +++++++--- .../client/Presenter/Presenter.java | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs index 3533b92..19b80c9 100644 --- a/.settings/com.google.gdt.eclipse.core.prefs +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -1,5 +1,4 @@ -#Wed Mar 06 18:58:12 CET 2013 eclipse.preferences.version=1 -lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.1.0-SNAPSHOT +lastWarOutDir=/home/gioia/workspace/reports/target/reports-4.1.0-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Headerbar.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Headerbar.java index c70c6bf..934ff10 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Headerbar.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Headerbar.java @@ -231,7 +231,11 @@ public class Headerbar extends Composite{ public Command getNullCommand() { Command openNothing = new Command() { - public void execute() { } + public void execute() { + + MessageBox.alert("Alert", + "Export is disabled for templates, please save this template as a Report and retry", null); + } }; return openNothing; @@ -377,8 +381,8 @@ public class Headerbar extends Composite{ optionDOCX.setHTML(EXPORT_OPENXML); optionDOCX.setCommand(generateDOCX); - optionPDF.setHTML("Export to PDF"); - optionPDF.setCommand(generatePDF); + optionPDF.setHTML("Export to PDF"); + optionPDF.setCommand(generatePDF); optionHTML.setHTML(EXPORT_HTML); optionHTML.setCommand(generateHTML); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java index 8a38e73..f217704 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java @@ -8,6 +8,8 @@ import org.gcube.portlets.d4sreporting.common.shared.ComponentType; import org.gcube.portlets.d4sreporting.common.shared.Metadata; import org.gcube.portlets.d4sreporting.common.shared.Model; import org.gcube.portlets.user.exporter.client.ReportExporterPopup; +import org.gcube.portlets.user.exporter.client.event.ReportExporterEvent; +import org.gcube.portlets.user.exporter.client.event.ReportExporterEventHandler; import org.gcube.portlets.user.exporter.shared.TypeExporter; import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog; import org.gcube.portlets.user.reportgenerator.client.Headerbar; @@ -53,7 +55,9 @@ import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.shared.EventBus; import com.google.gwt.event.shared.HandlerManager; +import com.google.gwt.event.shared.SimpleEventBus; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; @@ -143,6 +147,16 @@ public class Presenter { // refreshWorkspace(); // } // }); + eventBus.addHandler(ReportExporterEvent.TYPE, new ReportExporterEventHandler() { + + @Override + public void onCompletedExport(ReportExporterEvent event) { + if(event.isSuccssfullyCompleted()) { + refreshWorkspace(); + } + + } + }); eventBus.addHandler(AddCommentEvent.TYPE, new AddCommentEventHandler() { public void onAddComment(AddCommentEvent event) { @@ -661,7 +675,7 @@ public class Presenter { // } - ReportExporterPopup popup = new ReportExporterPopup(); + ReportExporterPopup popup = new ReportExporterPopup(eventBus); Model reportModel = model.getSerializableModel(); switch (type) {