Integrated report-exporter-widget
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@70948 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fc3bf84c69
commit
20d91c8e83
|
@ -1,6 +1,5 @@
|
||||||
#Tue Feb 26 17:29:33 CET 2013
|
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
jarsExcludedFromWebInfLib=
|
||||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.0.1-SNAPSHOT
|
lastWarOutDir=/home/gioia/workspace/reports/target/reports-4.0.1-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
<dependent-module archiveName="gcube-docx-generator-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-docx-generator/gcube-docx-generator">
|
<dependent-module archiveName="gcube-docx-generator-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-docx-generator/gcube-docx-generator">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="report-exporter-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/report-exporter-widget/report-exporter-widget">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="reports"/>
|
<property name="context-root" value="reports"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -156,13 +156,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>home-library</artifactId>
|
<artifactId>home-library</artifactId>
|
||||||
<version>4.3.0-SNAPSHOT</version>
|
<version>[4.3.0-SNAPSHOT,5.0.0-SNAPSHOT)</version>
|
||||||
<scope>${setScope}</scope>
|
<scope>${setScope}</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>home-library-jcr</artifactId>
|
<artifactId>home-library-jcr</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>[1.3.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
<classifier>${setClassifier}</classifier>
|
<classifier>${setClassifier}</classifier>
|
||||||
<scope>${setScope}</scope>
|
<scope>${setScope}</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -233,6 +233,11 @@
|
||||||
<classifier>sources</classifier>
|
<classifier>sources</classifier>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>report-exporter-widget</groupId>
|
||||||
|
<artifactId>report-exporter-widget</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -80,6 +80,8 @@ public class Headerbar extends Composite{
|
||||||
|
|
||||||
private MenuItem optionDOCX;
|
private MenuItem optionDOCX;
|
||||||
|
|
||||||
|
private MenuItem optionPDF;
|
||||||
|
|
||||||
private MenuItem optionFimes;
|
private MenuItem optionFimes;
|
||||||
|
|
||||||
private MenuItem viewMetadata;
|
private MenuItem viewMetadata;
|
||||||
|
@ -323,13 +325,13 @@ public class Headerbar extends Composite{
|
||||||
MenuItem toReturn = new MenuItem("Export", exportsMenu);
|
MenuItem toReturn = new MenuItem("Export", exportsMenu);
|
||||||
|
|
||||||
optionDOCX = new MenuItem("<font color=\"gray\">"+ EXPORT_OPENXML +"</font>", true, getNullCommand());
|
optionDOCX = new MenuItem("<font color=\"gray\">"+ EXPORT_OPENXML +"</font>", true, getNullCommand());
|
||||||
// optionPDF = new MenuItem("<font color=\"gray\">Export to PDF</font>", true, getNullCommand());
|
optionPDF = new MenuItem("<font color=\"gray\">Export to PDF</font>", true, getNullCommand());
|
||||||
optionHTML = new MenuItem("<font color=\"gray\">"+ EXPORT_HTML +"</font>", true, getNullCommand());
|
optionHTML = new MenuItem("<font color=\"gray\">"+ EXPORT_HTML +"</font>", true, getNullCommand());
|
||||||
optionFimes = new MenuItem("<font color=\"gray\">"+ EXPORT_FIMES +"</font>", true, getNullCommand());
|
optionFimes = new MenuItem("<font color=\"gray\">"+ EXPORT_FIMES +"</font>", true, getNullCommand());
|
||||||
|
|
||||||
exportsMenu.addItem(optionDOCX);
|
exportsMenu.addItem(optionDOCX);
|
||||||
exportsMenu.addItem(optionHTML);
|
exportsMenu.addItem(optionHTML);
|
||||||
|
exportsMenu.addItem(optionPDF);
|
||||||
//optionsMenu.addItem(optionPDF);
|
//optionsMenu.addItem(optionPDF);
|
||||||
//exportsMenu.addItem(optionFimes);
|
//exportsMenu.addItem(optionFimes);
|
||||||
|
|
||||||
|
@ -375,8 +377,8 @@ public class Headerbar extends Composite{
|
||||||
optionDOCX.setHTML(EXPORT_OPENXML);
|
optionDOCX.setHTML(EXPORT_OPENXML);
|
||||||
optionDOCX.setCommand(generateDOCX);
|
optionDOCX.setCommand(generateDOCX);
|
||||||
|
|
||||||
// optionPDF.setHTML("Export to PDF");
|
optionPDF.setHTML("Export to PDF");
|
||||||
// optionPDF.setCommand(generatePDF);
|
optionPDF.setCommand(generatePDF);
|
||||||
|
|
||||||
optionHTML.setHTML(EXPORT_HTML);
|
optionHTML.setHTML(EXPORT_HTML);
|
||||||
optionHTML.setCommand(generateHTML);
|
optionHTML.setCommand(generateHTML);
|
||||||
|
@ -591,7 +593,7 @@ public class Headerbar extends Composite{
|
||||||
|
|
||||||
Command generatePDF = new Command() {
|
Command generatePDF = new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Window.alert("PDF Exporting may not be fully working, you can also generate a PDF using your Word Processor application starting from the docx exported file");
|
// Window.alert("PDF Exporting may not be fully working, you can also generate a PDF using your Word Processor application starting from the docx exported file");
|
||||||
presenter.generateManifestation(templateModel, ExportManifestationType.PDF);
|
presenter.generateManifestation(templateModel, ExportManifestationType.PDF);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,8 @@ import org.gcube.portlets.d4sreporting.common.client.uicomponents.richtext.RichT
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
||||||
|
import org.gcube.portlets.user.exporter.client.ReportExporterPopup;
|
||||||
|
import org.gcube.portlets.user.exporter.shared.TypeExporter;
|
||||||
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
|
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
|
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
||||||
|
@ -654,85 +656,103 @@ public class Presenter {
|
||||||
* @param type .
|
* @param type .
|
||||||
*/
|
*/
|
||||||
public void generateManifestation(final TemplateModel model, final ExportManifestationType type) {
|
public void generateManifestation(final TemplateModel model, final ExportManifestationType type) {
|
||||||
boolean cont = true;
|
// boolean cont = true;
|
||||||
if (type == ExportManifestationType.HTML && model.containsLargeTS()) {
|
// if (type == ExportManifestationType.HTML && model.containsLargeTS()) {
|
||||||
cont = Window.confirm("Exporting Large Time Series in HTML format can take up to minutes. (about 30 secs for 500 rows)\ndo you want to continue?");
|
// cont = Window.confirm("Exporting Large Time Series in HTML format can take up to minutes. (about 30 secs for 500 rows)\ndo you want to continue?");
|
||||||
}
|
// }
|
||||||
|
|
||||||
//continue after warning the user on exporting large TSs
|
|
||||||
if (cont) {
|
|
||||||
final int left = Window.getClientWidth() / 2 - 200;
|
|
||||||
final int top = Window.getClientHeight() / 2 + 100;
|
|
||||||
final LoadingPopup loading = new LoadingPopup(true);
|
|
||||||
loading.setPopupPosition(left, top);
|
|
||||||
//loading.setStyleName("none");
|
|
||||||
|
|
||||||
|
|
||||||
AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {
|
ReportExporterPopup popup = new ReportExporterPopup();
|
||||||
|
Model reportModel = model.getSerializableModel();
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
switch (type) {
|
||||||
//MessageBox
|
case DOCX:
|
||||||
MessageBox.alert("", "Failed to export: " + caught.getMessage(), null);
|
popup.export(reportModel, TypeExporter.DOCX);
|
||||||
|
break;
|
||||||
|
case HTML:
|
||||||
|
popup.export(reportModel, TypeExporter.HTML);
|
||||||
|
break;
|
||||||
|
case PDF:
|
||||||
|
popup.export(reportModel, TypeExporter.PDF);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Boolean result) {
|
|
||||||
//MessageBox.hide();
|
|
||||||
if (result) {
|
|
||||||
refreshWorkspace();
|
|
||||||
|
|
||||||
|
// //continue after warning the user on exporting large TSs
|
||||||
|
// if (cont) {
|
||||||
final GCubeDialog popupPanel = new GCubeDialog();
|
// final int left = Window.getClientWidth() / 2 - 200;
|
||||||
popupPanel.setText("Exporting result");
|
// final int top = Window.getClientHeight() / 2 + 100;
|
||||||
String exportedName = model.getTemplateName();
|
// final LoadingPopup loading = new LoadingPopup(true);
|
||||||
exportedName = exportedName.replaceAll(".d4sR", "");
|
// loading.setPopupPosition(left, top);
|
||||||
exportedName = exportedName.replaceAll(".d4sT", "");
|
// //loading.setStyleName("none");
|
||||||
|
//
|
||||||
final String urlToOpen = model.getExportedFileURL(type, exportedName);
|
//
|
||||||
|
// AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {
|
||||||
VerticalPanel dlgPanel = new VerticalPanel();
|
//
|
||||||
dlgPanel.setSpacing(5);
|
// public void onFailure(Throwable caught) {
|
||||||
dlgPanel.add(new HTML("The Report " + exportedName + " (" + type +") has been successfully saved <br />in your workspace root folder", true));
|
// //MessageBox
|
||||||
CellPanel bPanel = new HorizontalPanel();
|
// MessageBox.alert("", "Failed to export: " + caught.getMessage(), null);
|
||||||
Button close = new Button("close");
|
//
|
||||||
Button preview = new Button("Open");
|
// }
|
||||||
bPanel.add(close);
|
//
|
||||||
bPanel.add(preview);
|
// public void onSuccess(Boolean result) {
|
||||||
bPanel.setWidth("100%");
|
// //MessageBox.hide();
|
||||||
|
// if (result) {
|
||||||
bPanel.setSpacing(5);
|
// refreshWorkspace();
|
||||||
bPanel.setCellWidth(close, "50%");
|
//
|
||||||
bPanel.setCellWidth(preview, "50%");
|
//
|
||||||
bPanel.setCellHorizontalAlignment(close, HasHorizontalAlignment.ALIGN_CENTER);
|
//
|
||||||
bPanel.setCellHorizontalAlignment(preview, HasHorizontalAlignment.ALIGN_CENTER);
|
// final GCubeDialog popupPanel = new GCubeDialog();
|
||||||
|
// popupPanel.setText("Exporting result");
|
||||||
close.addClickHandler(new ClickHandler() {
|
// String exportedName = model.getTemplateName();
|
||||||
public void onClick(ClickEvent event) {
|
// exportedName = exportedName.replaceAll(".d4sR", "");
|
||||||
popupPanel.hide();
|
// exportedName = exportedName.replaceAll(".d4sT", "");
|
||||||
}
|
//
|
||||||
});
|
// final String urlToOpen = model.getExportedFileURL(type, exportedName);
|
||||||
preview.addClickHandler(new ClickHandler() {
|
//
|
||||||
public void onClick(ClickEvent event) {
|
// VerticalPanel dlgPanel = new VerticalPanel();
|
||||||
Window.open(urlToOpen, model.getTemplateName(), "");
|
// dlgPanel.setSpacing(5);
|
||||||
}
|
// dlgPanel.add(new HTML("The Report " + exportedName + " (" + type +") has been successfully saved <br />in your workspace root folder", true));
|
||||||
});
|
// CellPanel bPanel = new HorizontalPanel();
|
||||||
dlgPanel.add(bPanel);
|
// Button close = new Button("close");
|
||||||
|
// Button preview = new Button("Open");
|
||||||
popupPanel.setAnimationEnabled(true);
|
// bPanel.add(close);
|
||||||
popupPanel.setPopupPosition(left, top);
|
// bPanel.add(preview);
|
||||||
popupPanel.setWidget(dlgPanel);
|
// bPanel.setWidth("100%");
|
||||||
popupPanel.show();
|
//
|
||||||
}
|
// bPanel.setSpacing(5);
|
||||||
else {
|
// bPanel.setCellWidth(close, "50%");
|
||||||
MessageBox.alert("", "Server reported errors on exporting Format", null);
|
// bPanel.setCellWidth(preview, "50%");
|
||||||
}
|
// bPanel.setCellHorizontalAlignment(close, HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
}
|
// bPanel.setCellHorizontalAlignment(preview, HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
|
//
|
||||||
};
|
// close.addClickHandler(new ClickHandler() {
|
||||||
|
// public void onClick(ClickEvent event) {
|
||||||
Model toSend = model.getSerializableModel();
|
// popupPanel.hide();
|
||||||
model.getModelService().generateManifestation(toSend, type, callback);
|
// }
|
||||||
|
// });
|
||||||
|
// preview.addClickHandler(new ClickHandler() {
|
||||||
|
// public void onClick(ClickEvent event) {
|
||||||
|
// Window.open(urlToOpen, model.getTemplateName(), "");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// dlgPanel.add(bPanel);
|
||||||
|
//
|
||||||
|
// popupPanel.setAnimationEnabled(true);
|
||||||
|
// popupPanel.setPopupPosition(left, top);
|
||||||
|
// popupPanel.setWidget(dlgPanel);
|
||||||
|
// popupPanel.show();
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// MessageBox.alert("", "Server reported errors on exporting Format", null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// Model toSend = model.getSerializableModel();
|
||||||
|
// model.getModelService().generateManifestation(toSend, type, callback);
|
||||||
//TODO:
|
//TODO:
|
||||||
// MessageBox.show(new MessageBoxConfig() {
|
// MessageBox.show(new MessageBoxConfig() {
|
||||||
// {
|
// {
|
||||||
|
@ -747,7 +767,7 @@ public class Presenter {
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openAddCitationDialog() {
|
public void openAddCitationDialog() {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
|
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
|
||||||
|
|
||||||
<inherits name='org.gcube.portlets.user.workspace.lighttree.WorkspacePortletLightTree' />
|
<inherits name='org.gcube.portlets.user.workspace.lighttree.WorkspacePortletLightTree' />
|
||||||
|
<inherits name='org.gcube.portlets.user.exporter.Report_exporter_widget' />
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point
|
<entry-point
|
||||||
|
|
|
@ -109,6 +109,15 @@
|
||||||
</servlet> <servlet-mapping> <servlet-name>fileUploaderServlet</servlet-name>
|
</servlet> <servlet-mapping> <servlet-name>fileUploaderServlet</servlet-name>
|
||||||
<url-pattern>/reportgenerator/fimesfileuploaderservlet</url-pattern> </servlet-mapping -->
|
<url-pattern>/reportgenerator/fimesfileuploaderservlet</url-pattern> </servlet-mapping -->
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>convertServlet</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.exporter.server.ReportExporterServiceImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>convertServlet</servlet-name>
|
||||||
|
<url-pattern>/reports/convert</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>DownloadService</servlet-name>
|
<servlet-name>DownloadService</servlet-name>
|
||||||
|
|
Reference in New Issue