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>
|
||||||
|
|
|
@ -79,6 +79,8 @@ public class Headerbar extends Composite{
|
||||||
private MenuItem optionHTML;
|
private MenuItem optionHTML;
|
||||||
|
|
||||||
private MenuItem optionDOCX;
|
private MenuItem optionDOCX;
|
||||||
|
|
||||||
|
private MenuItem optionPDF;
|
||||||
|
|
||||||
private MenuItem optionFimes;
|
private MenuItem optionFimes;
|
||||||
|
|
||||||
|
@ -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?");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
ReportExporterPopup popup = new ReportExporterPopup();
|
||||||
|
Model reportModel = model.getSerializableModel();
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case DOCX:
|
||||||
|
popup.export(reportModel, TypeExporter.DOCX);
|
||||||
|
break;
|
||||||
|
case HTML:
|
||||||
|
popup.export(reportModel, TypeExporter.HTML);
|
||||||
|
break;
|
||||||
|
case PDF:
|
||||||
|
popup.export(reportModel, TypeExporter.PDF);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//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");
|
|
||||||
|
|
||||||
|
// //continue after warning the user on exporting large TSs
|
||||||
AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {
|
// if (cont) {
|
||||||
|
// final int left = Window.getClientWidth() / 2 - 200;
|
||||||
public void onFailure(Throwable caught) {
|
// final int top = Window.getClientHeight() / 2 + 100;
|
||||||
//MessageBox
|
// final LoadingPopup loading = new LoadingPopup(true);
|
||||||
MessageBox.alert("", "Failed to export: " + caught.getMessage(), null);
|
// loading.setPopupPosition(left, top);
|
||||||
|
// //loading.setStyleName("none");
|
||||||
}
|
//
|
||||||
|
//
|
||||||
public void onSuccess(Boolean result) {
|
// AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {
|
||||||
//MessageBox.hide();
|
//
|
||||||
if (result) {
|
// public void onFailure(Throwable caught) {
|
||||||
refreshWorkspace();
|
// //MessageBox
|
||||||
|
// MessageBox.alert("", "Failed to export: " + caught.getMessage(), null);
|
||||||
|
//
|
||||||
|
// }
|
||||||
final GCubeDialog popupPanel = new GCubeDialog();
|
//
|
||||||
popupPanel.setText("Exporting result");
|
// public void onSuccess(Boolean result) {
|
||||||
String exportedName = model.getTemplateName();
|
// //MessageBox.hide();
|
||||||
exportedName = exportedName.replaceAll(".d4sR", "");
|
// if (result) {
|
||||||
exportedName = exportedName.replaceAll(".d4sT", "");
|
// refreshWorkspace();
|
||||||
|
//
|
||||||
final String urlToOpen = model.getExportedFileURL(type, exportedName);
|
//
|
||||||
|
//
|
||||||
VerticalPanel dlgPanel = new VerticalPanel();
|
// final GCubeDialog popupPanel = new GCubeDialog();
|
||||||
dlgPanel.setSpacing(5);
|
// popupPanel.setText("Exporting result");
|
||||||
dlgPanel.add(new HTML("The Report " + exportedName + " (" + type +") has been successfully saved <br />in your workspace root folder", true));
|
// String exportedName = model.getTemplateName();
|
||||||
CellPanel bPanel = new HorizontalPanel();
|
// exportedName = exportedName.replaceAll(".d4sR", "");
|
||||||
Button close = new Button("close");
|
// exportedName = exportedName.replaceAll(".d4sT", "");
|
||||||
Button preview = new Button("Open");
|
//
|
||||||
bPanel.add(close);
|
// final String urlToOpen = model.getExportedFileURL(type, exportedName);
|
||||||
bPanel.add(preview);
|
//
|
||||||
bPanel.setWidth("100%");
|
// VerticalPanel dlgPanel = new VerticalPanel();
|
||||||
|
// dlgPanel.setSpacing(5);
|
||||||
bPanel.setSpacing(5);
|
// dlgPanel.add(new HTML("The Report " + exportedName + " (" + type +") has been successfully saved <br />in your workspace root folder", true));
|
||||||
bPanel.setCellWidth(close, "50%");
|
// CellPanel bPanel = new HorizontalPanel();
|
||||||
bPanel.setCellWidth(preview, "50%");
|
// Button close = new Button("close");
|
||||||
bPanel.setCellHorizontalAlignment(close, HasHorizontalAlignment.ALIGN_CENTER);
|
// Button preview = new Button("Open");
|
||||||
bPanel.setCellHorizontalAlignment(preview, HasHorizontalAlignment.ALIGN_CENTER);
|
// bPanel.add(close);
|
||||||
|
// bPanel.add(preview);
|
||||||
close.addClickHandler(new ClickHandler() {
|
// bPanel.setWidth("100%");
|
||||||
public void onClick(ClickEvent event) {
|
//
|
||||||
popupPanel.hide();
|
// bPanel.setSpacing(5);
|
||||||
}
|
// bPanel.setCellWidth(close, "50%");
|
||||||
});
|
// bPanel.setCellWidth(preview, "50%");
|
||||||
preview.addClickHandler(new ClickHandler() {
|
// bPanel.setCellHorizontalAlignment(close, HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
public void onClick(ClickEvent event) {
|
// bPanel.setCellHorizontalAlignment(preview, HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
Window.open(urlToOpen, model.getTemplateName(), "");
|
//
|
||||||
}
|
// close.addClickHandler(new ClickHandler() {
|
||||||
});
|
// public void onClick(ClickEvent event) {
|
||||||
dlgPanel.add(bPanel);
|
// popupPanel.hide();
|
||||||
|
// }
|
||||||
popupPanel.setAnimationEnabled(true);
|
// });
|
||||||
popupPanel.setPopupPosition(left, top);
|
// preview.addClickHandler(new ClickHandler() {
|
||||||
popupPanel.setWidget(dlgPanel);
|
// public void onClick(ClickEvent event) {
|
||||||
popupPanel.show();
|
// Window.open(urlToOpen, model.getTemplateName(), "");
|
||||||
}
|
// }
|
||||||
else {
|
// });
|
||||||
MessageBox.alert("", "Server reported errors on exporting Format", null);
|
// dlgPanel.add(bPanel);
|
||||||
}
|
//
|
||||||
}
|
// popupPanel.setAnimationEnabled(true);
|
||||||
|
// popupPanel.setPopupPosition(left, top);
|
||||||
};
|
// popupPanel.setWidget(dlgPanel);
|
||||||
|
// popupPanel.show();
|
||||||
Model toSend = model.getSerializableModel();
|
// }
|
||||||
model.getModelService().generateManifestation(toSend, type, callback);
|
// 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