added report reference dialog

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@85444 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-11-13 17:56:13 +00:00
parent e185a39018
commit 87311f7eff
23 changed files with 348 additions and 262 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/reports-4.6.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/reports-4.6.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -31,6 +31,5 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gcube-reporting-library"/>
<classpathentry kind="output" path="target/reports-4.6.1-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/reports-4.6.2-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -2,6 +2,6 @@
<<<<<<<=.mine
>>>>>>>=.r71295
eclipse.preferences.version=1
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.1-SNAPSHOT
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.2-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -5,6 +5,15 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="gcube-reporting-modeler-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-modeler/gcube-reporting-modeler">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-client-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-client/reports-store-gateway-client">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-interface-dto-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-interface-dto/reports-store-gateway-interface-dto">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="reports"/>
</wb-module>

27
pom.xml
View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>reports</artifactId>
<packaging>war</packaging>
<version>4.6.1-SNAPSHOT</version>
<version>4.6.2-SNAPSHOT</version>
<name>gCube Reports Portlet</name>
<description>
gCube Reports Portlet.
@ -85,7 +85,7 @@
<artifactId>gwt-servlet</artifactId>
<scope>${setScope}</scope>
</dependency>
<dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
@ -98,19 +98,13 @@
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<scope>${setScope}</scope>
<scope>${setScope}</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<scope>${setScope}</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>guided-tour-widget</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>${setScope}</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
@ -122,6 +116,21 @@
<version>2.2.5</version>
<scope>${setScope}</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>user-selection-dialog</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>gcube-reporting-modeler</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.application.rsg</groupId>
<artifactId>reports-store-gateway-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>csv4j</artifactId>

View File

@ -49,7 +49,8 @@ public class Headerbar extends Composite{
private static final String EXPORT_HTML = "Export to HTML";
private static final String EXPORT_FIMES = "Export to FiMES XML";
private static final String EXPORT_XML = "Export to XML";
private static final String EXPORT_ENCRYPTED_REPORT = "Save an Encrypted Version to Desktop";
private static final String IMPORT_VME = "Import VME Report";
// private static final String EXPORT_ENCRYPTED_REPORT = "Save an Encrypted Version to Desktop";
private static final String VIEW_USER_COMMENTS = "View user comments";
@ -96,6 +97,8 @@ public class Headerbar extends Composite{
private MenuItem discardSection;
private MenuItem importVME;
MenuBar menuBar = new MenuBar();
@ -105,6 +108,7 @@ public class Headerbar extends Composite{
MenuItem sectionsMenu;
MenuItem biblioMenu;
MenuItem exportMenu;
MenuItem importMenu;
MenuItemSeparator separator1;
MenuItemSeparator separator2;
MenuItemSeparator separator3;
@ -135,6 +139,9 @@ public class Headerbar extends Composite{
separator4 = menuBar.addSeparator();
exportMenu = getExportsMenu();
menuBar.addItem(exportMenu);
menuBar.addSeparator();
importMenu = getImportMenu();
menuBar.addItem(importMenu);
mainLayout.setSize("100%", "24px");
mainLayout.setStyleName("menubar");
@ -205,6 +212,8 @@ public class Headerbar extends Composite{
separator4 = menuBar.addSeparator();
exportMenu = getExportsMenu();
menuBar.addItem(exportMenu);
ReportGenerator.get().getToolbarPanel().clear();
ReportGenerator.get().getToolbarPanel().add(new HTML("&nbsp;&nbsp;", true));
enableExports();
@ -330,6 +339,24 @@ public class Headerbar extends Composite{
return toReturn;
}
private MenuItem getImportMenu() {
MenuBar importMenu = new MenuBar(true);
importMenu.setAnimationEnabled(true);
MenuItem toReturn = new MenuItem("Import", importMenu);
Command importVMEReport = new Command() {
public void execute() {
presenter.showVMEImportDialog();
}
};
importVME = new MenuItem(IMPORT_VME, true, importVMEReport);
importMenu.addItem(importVME);
return toReturn;
}
private MenuItem getExportsMenu() {
MenuBar exportsMenu = new MenuBar(true);
@ -342,7 +369,7 @@ public class Headerbar extends Composite{
optionHTML = new MenuItem("<font color=\"gray\">"+ EXPORT_HTML +"</font>", true, getDisabledExportMenuItemCmd());
optionFimes = new MenuItem("<font color=\"gray\">"+ EXPORT_FIMES +"</font>", true, getDisabledExportMenuItemCmd());
optionXML = new MenuItem("<font color=\"gray\">"+ EXPORT_XML +"</font>", true, getDisabledExportMenuItemCmd());
optionEncryptedModel = new MenuItem("<font color=\"gray\">"+ EXPORT_ENCRYPTED_REPORT +"</font>", true, getDisabledExportMenuItemCmd());
// optionEncryptedModel = new MenuItem("<font color=\"gray\">"+ EXPORT_ENCRYPTED_REPORT +"</font>", true, getDisabledExportMenuItemCmd());
exportsMenu.addItem(optionDOCX);
@ -350,7 +377,7 @@ public class Headerbar extends Composite{
exportsMenu.addItem(optionPDF);
exportsMenu.addItem(optionXML);
exportsMenu.addSeparator();
exportsMenu.addItem(optionEncryptedModel);
// exportsMenu.addItem(optionEncryptedModel);
//optionsMenu.addItem(optionPDF);
//exportsMenu.addItem(optionFimes);
@ -375,6 +402,8 @@ public class Headerbar extends Composite{
}
};
// Create the Options menu
MenuBar optionsMenu = new MenuBar(true);
@ -408,7 +437,7 @@ public class Headerbar extends Composite{
optionXML.setHTML(EXPORT_XML);
optionXML.setCommand(generatedXML);
optionEncryptedModel.setHTML(EXPORT_ENCRYPTED_REPORT);
// optionEncryptedModel.setHTML(EXPORT_ENCRYPTED_REPORT);
optionEncryptedModel.setCommand(generateEncryptedModel);
//
importModel.setHTML("Import from Template or Report");

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.reportgenerator.client.Presenter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -8,6 +9,7 @@ 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.reportgenerator.client.Headerbar;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.ReportService;
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
@ -49,12 +51,18 @@ import org.gcube.portlets.user.reportgenerator.client.targets.TextTableImage;
import org.gcube.portlets.user.reportgenerator.client.uibinder.ExportOptions;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import org.gcube.portlets.widgets.exporter.client.ReportExporterPopup;
import org.gcube.portlets.widgets.exporter.client.event.ExportingCompletedEvent;
import org.gcube.portlets.widgets.exporter.client.event.ExportingCompletedEventHandler;
import org.gcube.portlets.widgets.exporter.client.event.ReportExporterEvent;
import org.gcube.portlets.widgets.exporter.client.event.ReportExporterEventHandler;
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
import org.gcube.portlets.widgets.userselection.client.UserSelectionDialog;
import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEvent;
import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEventHandler;
import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent;
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
@ -127,8 +135,21 @@ public class Presenter {
}
private UserSelectionDialog itemSelectionDialog;
private void handleEvents() {
eventBus.addHandler(SelectedUserEvent.TYPE, new SelectedUserEventHandler() {
@Override
public void onSelectedUser(SelectedUserEvent event) {
itemSelectionDialog.hide();
if (event.getSelectedUser().getType().equals(VMETypeIdentifier.Vme.toString()))
importVMEReport(event.getSelectedUser());
else
associateVMRReportRef(event.getSelectedUser());
}
});
eventBus.addHandler(ExportingCompletedEvent.TYPE, new ExportingCompletedEventHandler() {
@Override
public void onExportFinished(ExportingCompletedEvent event) {
@ -187,14 +208,6 @@ public class Presenter {
}
});
// eventBus.addHandler(ImportFinishedEvent.TYPE, new ImportFinishedEventHandler(){
// public void onFinishedImport(ImportFinishedEvent event) {
// importDlg.hide();
// openImportedFimesXML(event.getPathFile());
// }
//
// });
eventBus.addHandler(ItemSelectionEvent.TYPE, new ItemSelectionEventHandler() {
@SuppressWarnings("unchecked")
public void onItemSelected(ItemSelectionEvent event) {
@ -1254,4 +1267,73 @@ public class Presenter {
public void clearExportPanel() {
exportsPanel.clear();
}
/**
*
*/
public void showVMEImportDialog() {
itemSelectionDialog = new UserSelectionDialog("Import: Please select the VME Report", eventBus);
itemSelectionDialog.center();
itemSelectionDialog.show();
reportService.listVMEReports(new AsyncCallback<ArrayList<ItemSelectableBean>>() {
@Override
public void onFailure(Throwable caught) {
//handled by the Widget
}
@Override
public void onSuccess(ArrayList<ItemSelectableBean> result) {
for (ItemSelectableBean item : result) {
item.setIconURL(ReportConstants.REPORT_ICON);
}
eventBus.fireEvent(new UsersFetchedEvent(result));
}
});
}
/**
*
*/
public void showVMERefAssociateDialog(VMETypeIdentifier refType) {
itemSelectionDialog = new UserSelectionDialog("Associate " + refType.toString() + ": Please select one ", eventBus);
itemSelectionDialog.center();
itemSelectionDialog.show();
reportService.listVMEReportRefByType(refType, new AsyncCallback<ArrayList<ItemSelectableBean>>() {
@Override
public void onFailure(Throwable caught) {
//handled by the Widget
}
@Override
public void onSuccess(ArrayList<ItemSelectableBean> result) {
for (ItemSelectableBean item : result) {
item.setIconURL(ReportConstants.REPORT_REF_ICON);
}
eventBus.fireEvent(new UsersFetchedEvent(result));
}
});
}
private void importVMEReport(ItemSelectableBean selectedReport) {
showLoading();
reportService.importVMEReport(selectedReport.getId(), selectedReport.getName(), new AsyncCallback<Model>() {
@Override
public void onFailure(Throwable caught) {
Window.alert("Could not Load template, please try again later: " + caught.getMessage());
}
@Override
public void onSuccess(Model toLoad) {
if (toLoad != null)
loadModel(toLoad);
else
Window.alert("Could not Load template, error on server.");
}
});
}
private void associateVMRReportRef (ItemSelectableBean selectedReport) {
Window.alert("You selected " + selectedReport.getName() + " of type " + selectedReport.getType());
}
}

View File

@ -27,6 +27,7 @@ public class ReportConstants {
*/
public static final String IMAGE_PREV_PAGE = GWT.getModuleBaseURL() + "../images/prev_p.gif";
public static final String REPORT_ICON = GWT.getModuleBaseURL() + "../images/iconReport.png";
public static final String REPORT_REF_ICON = GWT.getModuleBaseURL() + "../images/reportRef.png";
}

View File

@ -1,18 +1,10 @@
package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.toursteps.Intro;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceServiceAsync;
import org.gcube.portlets.widgets.guidedtour.client.GCUBEGuidedTour;
import org.gcube.portlets.widgets.guidedtour.client.steps.GCUBETemplate1Text1Image;
import org.gcube.portlets.widgets.guidedtour.client.steps.GCUBETemplate2Text2Image;
import org.gcube.portlets.widgets.guidedtour.client.steps.TourStep;
import org.gcube.portlets.widgets.guidedtour.client.types.VerticalAlignment;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
@ -173,150 +165,7 @@ public class ReportGenerator implements EntryPoint {
//showGuidedTour() ;
}
private void showGuidedTour() {
GWT.runAsync(GCUBEGuidedTour.class, new RunAsyncCallback() {
public void onSuccess() {
TourStep step1 = new GCUBETemplate1Text1Image(true) {
@Override
public String setStepTitle() {
return "gCube Reporting";
}
@Override
public String setStepImage() {
return "images/tour/tour1.jpg";
}
@Override
public String setStepBody() {
return new Intro().getHTML();
}
};
TourStep step2 = new GCUBETemplate1Text1Image(false) {
@Override
public String setStepTitle() {
return "Structure View";
}
@Override
public String setStepImage() {
return "images/tour/tour2.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; font-size: 16px; padding: 10px;\">" +
"<div style=\"padding-bottom: 90px;\">" +
"Use the <b>Report Structure View</b> to see your report structure. (View > Structure)" +
"</div>" +
"<div style=\"padding-bottom: 80px;\">" +
"Use the <b>Report Structure View</b> to navigate through your report." +
"</div>" +
"</div>";
}
};
TourStep step3 = new GCUBETemplate2Text2Image(false) {
@Override
public String setStepTitle() {
return "User Comments";
}
@Override
public String setStepImage() {
return "images/tour/tourComment.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 10px;\">" +
"Use comments to collaborate with your colleagues." +
"</div>" +
"</div>";
}
@Override
public String setStepOtherImage() {
return "images/tour/tourFormat.jpg";
}
@Override
public String setStepOtherBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 10px;\">" +
"<b>Format text</b> as you would in a word processor using the Formatting Bar." +
"</div>" +
"</div>";
}
};
TourStep step4 = new GCUBETemplate1Text1Image(false) {
@Override
public String setStepTitle() {
return "Bibliography";
}
@Override
public String setStepImage() {
return "images/tour/tourBiblio.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 80px;\">" +
"Use the <b>Bibliography to add references</b>" +
"</div>" +
"</div>";
}
};
TourStep step5 = new GCUBETemplate1Text1Image(false) {
@Override
public String setStepTitle() {
return "Export";
}
@Override
public String setStepImage() {
return "images/tour/tourExports.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 50px;\">" +
"Generate <b>different export formats</b> such as OpenXML (docx) or HTML." +
"</div>" +
"</div>";
}
};
//step1.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step2.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step3.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step4.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step5.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
String guideUrl = "https://gcube.wiki.gcube-system.org/gcube/index.php/Common_Functionality#Report_Generation";
GCUBEGuidedTour gt = new GCUBEGuidedTour("gCube Reports Generator", ReportGenerator.class.getName(), guideUrl, 780, 450, false);
gt.addStep(step1);
gt.addStep(step2);
gt.addStep(step3);
gt.addStep(step4);
gt.addStep(step5);
gt.openTour();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
/**
*

View File

@ -1,12 +1,16 @@
package org.gcube.portlets.user.reportgenerator.client;
import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -16,6 +20,13 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
*/
@RemoteServiceRelativePath("ReportServiceImpl")
public interface ReportService extends RemoteService{
ArrayList<ItemSelectableBean> listVMEReports();
ArrayList<ItemSelectableBean> listVMEReportRefByType(VMETypeIdentifier refType);
Model importVMEReport(String id, String name);
String save(String filePath, String workspaceFolderId, String ItemName,
TypeExporter type, boolean overwrite)
throws SaveReportFileException, SaveReportFileExistException;

View File

@ -1,10 +1,14 @@
package org.gcube.portlets.user.reportgenerator.client;
import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
@ -70,4 +74,8 @@ public interface ReportServiceAsync {
void save(String filePath, String workspaceFolderId, String ItemName,
TypeExporter type, boolean overwrite, AsyncCallback<String> callback);
void renewHTTPSession(AsyncCallback<Void> callback);
void listVMEReports(AsyncCallback<ArrayList<ItemSelectableBean>> callback);
void importVMEReport(String id, String name, AsyncCallback<Model> callback);
void listVMEReportRefByType(VMETypeIdentifier refType,
AsyncCallback<ArrayList<ItemSelectableBean>> callback);
}

View File

@ -29,10 +29,10 @@ public class ToolboxPanel extends SimplePanel {
public ToolboxPanel(AppControllerExplorer appController) {
this.appController = appController;
AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
this.tp = tp;
add(tp);
this.appController.hideSharingFacilities(); //sharing disabled we have problems from Reports
// AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
// this.tp = tp;
// add(tp);
// this.appController.hideSharingFacilities(); //sharing disabled we have problems from Reports
}
public void showExportedVersion(String id, String fileName) {

View File

@ -301,6 +301,9 @@ public class TemplateComponent {
HTML comment = new HTML();
comment.setStyleName("commentArea");
String contentC = (String) sc.getPossibleContent();
if (contentC == null) {
contentC = "Empty Comment";
}
// replace all the line braks by <br/>, and all the double spaces by the html version &nbsp;
String htmlPreservedLineBreaks2 = contentC.replaceAll("(\r\n|\n)","<br />");
htmlPreservedLineBreaks2 = htmlPreservedLineBreaks2.replaceAll("\\s\\s","&nbsp;&nbsp;");
@ -309,6 +312,9 @@ public class TemplateComponent {
break;
case INSTRUCTION:
String content = (String) sc.getPossibleContent();
if (content == null) {
content = "Empty Instruction";
}
// replace all the line braks by <br/>, and all the double spaces by the html version &nbsp;
String htmlPreservedLineBreaks = content.replaceAll("(\r\n|\n)","<br />");
htmlPreservedLineBreaks = htmlPreservedLineBreaks.replaceAll("\\s\\s","&nbsp;&nbsp;");
@ -316,6 +322,7 @@ public class TemplateComponent {
instr.setStyleName("instructionArea");
instr.setHTML(htmlPreservedLineBreaks);
this.content = instr;
break;
case TIME_SERIES:
TSArea tsa;

View File

@ -6,7 +6,9 @@ import org.gcube.portlets.d4sreporting.common.shared.Tuple;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
@ -21,7 +23,7 @@ public class ClientTuple extends Composite implements ClientSequence {
private ArrayList<Tuple> tupleList;
private SequenceWidget first;
private Presenter p;
/**
* s
@ -29,6 +31,7 @@ public class ClientTuple extends Composite implements ClientSequence {
* @param ms
*/
public ClientTuple(Presenter p, ArrayList<Tuple> tupleList) {
this.p = p;
this.tupleList = tupleList;
for (Tuple seq : tupleList) {
if (myPanel.getWidgetCount()==0) { // if is the first one
@ -67,7 +70,22 @@ public class ClientTuple extends Composite implements ClientSequence {
@Override
public boolean add(RepeatableSequence sequence) {
return false;
Tuple tuple = (Tuple) sequence;
VMETypeIdentifier type2Pass = null;
if (tuple.getKey().equals("GENERAL_MEASURE"))
type2Pass = VMETypeIdentifier.GeneralMeasure;
else if (tuple.getKey().equals("INFORMATION_SOURCE"))
type2Pass = VMETypeIdentifier.InformationSource;
else if (tuple.getKey().equals("FISHERY_AREA_HISTORY"))
type2Pass = VMETypeIdentifier.FisheryAreasHistory;
else if (tuple.getKey().equals("VMES_HISTORY"))
type2Pass = VMETypeIdentifier.VmesHistory;
else {
Window.alert("Could not find any valid Report Ref, got " + tuple.getKey());
return false;
}
p.showVMERefAssociateDialog(type2Pass);
return true;
}

View File

@ -13,6 +13,7 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
@ -97,9 +98,15 @@ public class SequenceWidget extends Composite {
addAnother();
}
});
}
}
private void selectNew() {
owner.add(repSequence);
}
public void enableClear() {
Button clearB = new Button("Clear Association");
clearB.getElement().getStyle().setWidth(130, Unit.PX);
@ -137,6 +144,14 @@ public class SequenceWidget extends Composite {
selectEntryB.getElement().getStyle().setWidth(130, Unit.PX);
selectEntryB.getElement().getStyle().setMargin(10, Unit.PX);
selectEntryB.addStyleName("deleteAssociationButton");
selectEntryB.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
selectNew();
}
});
buttonsWrapperPanel.add(selectEntryB);
}

View File

@ -1,26 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.reportgenerator.client.toursteps;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.HTML;
/**
* @author massi
*
*/
public class Intro extends HTML {
private static IntroUiBinder uiBinder = GWT.create(IntroUiBinder.class);
interface IntroUiBinder extends UiBinder<Element, Intro> {
}
public Intro() {
setHTML(uiBinder.createAndBindUi(this).getInnerHTML());
}
}

View File

@ -1,31 +0,0 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder">
<ui:style>
/* Add CSS here. See the GWT docs on UI Binder for more details */
.important {
font-weight: bold;
}
</ui:style>
<div>
<!-- Add HTML content here. The ui:field attribute binds an element to
a field in the owner class. See the GWT docs on UI Binder for more details. -->
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 70px;">
<b>gCube Reporting</b>
allows users to create Reports and generate different
export formats
(OpenXML, HTML, PDF) based on results retrieved from the
infrastructure.
</div>
<div style="padding-bottom: 70px;">
gCube Templates are loaded by this
<b>gCube Report Generator</b>
to produce actual reports.
</div>
<div style="padding-bottom: 10px;">
<b>Discover</b>
gCube Reporting features through this quick tour.
</div>
</div>
</div>
</ui:UiBinder>

View File

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.Vector;
@ -30,6 +31,9 @@ import org.apache.commons.io.IOUtils;
import org.gcube.application.framework.accesslogger.library.impl.AccessLogger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.application.reporting.ReportsModeler;
import org.gcube.application.rsg.service.dto.ReportEntry;
import org.gcube.application.rsg.service.dto.ReportType;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.common.homelibrary.home.HomeLibrary;
@ -72,9 +76,11 @@ import org.gcube.portlets.user.reportgenerator.server.servlet.loggers.OpenWorkfl
import org.gcube.portlets.user.reportgenerator.server.servlet.loggers.SaveWorkflowLogEntry;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -389,13 +395,15 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
_log.debug("seekModel: modelName DIFFERENT upgrading");
File dirToLookIn = new File(templatePath);
File[] innerFiles = dirToLookIn.listFiles();
for (int i = 0; i < innerFiles.length; i++)
for (int i = 0; i < innerFiles.length; i++) {
_log.debug("scanning files in extracted folder: " + innerFiles[i].getName());
if (innerFiles[i].getName().endsWith(".d4st")) {
String toReturn = innerFiles[i].getName();
toReturn = toReturn.substring(0, toReturn.length()-5);
_log.debug("seekModel: returning.. =" + toReturn);
return toReturn;
}
}
}
throw new FileNotFoundException();
}
@ -1443,4 +1451,92 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
HttpSession session = this.getThreadLocalRequest().getSession();
_log.info("HTTP Session renewed" + new Date(session.getLastAccessedTime()));
}
@Override
public ArrayList<ItemSelectableBean> listVMEReports() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
ArrayList<ItemSelectableBean> toReturn = new ArrayList<ItemSelectableBean>();
ReportType type = new ReportType();
type.setTypeIdentifier("Vme");
for (ReportEntry re : getFakeReports(type)) {
toReturn.add(new ItemSelectableBean(""+re.getId(), re.getName(), "", VMETypeIdentifier.Vme.toString()));
}
return toReturn;
}
@Override
public ArrayList<ItemSelectableBean> listVMEReportRefByType(VMETypeIdentifier refType) {
if (refType == VMETypeIdentifier.Vme)
throw new IllegalArgumentException("VME Type is not a reference");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
ArrayList<ItemSelectableBean> toReturn = new ArrayList<ItemSelectableBean>();
ReportType type = new ReportType();
type.setTypeIdentifier(refType.toString());
for (ReportEntry re : getFakeReports(type)) {
toReturn.add(new ItemSelectableBean(""+re.getId(), re.getName(), "", refType.toString()));
}
return toReturn;
}
private List<ReportEntry> getFakeReports(ReportType type) {
Random generator = new Random();
int n = generator.nextInt(15) + 5;
ArrayList<ReportEntry> toReturn = new ArrayList<ReportEntry>();
if (type.equals("Vme")) {
ReportEntry re = new ReportEntry();
for (int i = 0; i < n; i++) {
re = new ReportEntry();
re.setId(i);
re.setName( "VME Name " + i);
toReturn.add(re);
}
} else {
ReportEntry re = new ReportEntry();
for (int i = 0; i < n; i++) {
re = new ReportEntry();
re.setId(i);
re.setName( type.getTypeIdentifier() + "-" + i);
toReturn.add(re);
}
}
return toReturn;
}
@Override
public Model importVMEReport(String id, String name) {
String reportName = "Sample VME Report imported with id: " + id;
ReportsModeler rm = new ReportsModeler(
UUID.randomUUID().toString(),
reportName,
getASLSession().getUsername(),
new Date(),
new Date(),
getASLSession().getUsername()
);
rm.addInstruction(null);
rm.addTitle(name, false);
rm.addHeading(1, "VME Name (Non Editable) ");
rm.addTextInput("Corner Rise Seamounts");
rm.addHeading(2, "This is a Heading of Level 2 that is editable", false);
rm.addTextInput("Corner Rise Seamounts2");
rm.addHeading(3, "This is a Heading of Level 3 that is editable", false);
rm.addTextInput();
try {
return rm.getReportInstance();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,9 @@
package org.gcube.portlets.user.reportgenerator.shared;
public enum VMETypeIdentifier {
Vme,
GeneralMeasure,
InformationSource,
FisheryAreasHistory,
VmesHistory;
}

View File

@ -6,10 +6,11 @@
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<set-property name="user.agent" value="gecko1_8" />
<inherits name='org.gcube.portlets.widgets.exporter.Report_exporter_widget' />
<inherits name='org.gcube.portlets.widgets.guidedtour.GuidedTour' />
<inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
<inherits name='org.gcube.portlets.widgets.userselection.UserSelection' />
<inherits
name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='org.gcube.portlets.d4sreporting.common.Reporting' />
<inherits name='com.extjs.gxt.ui.GXT' />

View File

@ -707,13 +707,13 @@ tableBorder td {
font-size: 20px;
}
gwt-MenuBar {
.gwt-MenuBar {
cursor: default;
border: none;
}
.gwt-MenuBar-vertical {
background: #e3e8f3 url(images/hborder.png) repeat-x 0px -2003px;
background: #e3e8f3 url(images/hborder.png) repeat-x 0px -2003px !important;
border: 1px solid #BBBBBB;
}

View File

@ -15,15 +15,15 @@
</servlet-mapping>
<!-- quicktourServlet -->
<servlet>
<servlet-name>quicktourServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.guidedtour.server.TourServiceImpl</servlet-class>
</servlet>
<!-- <servlet> -->
<!-- <servlet-name>quicktourServlet</servlet-name> -->
<!-- <servlet-class>org.gcube.portlets.widgets.guidedtour.server.TourServiceImpl</servlet-class> -->
<!-- </servlet> -->
<servlet-mapping>
<servlet-name>quicktourServlet</servlet-name>
<url-pattern>/reports/quicktourServlet</url-pattern>
</servlet-mapping>
<!-- <servlet-mapping> -->
<!-- <servlet-name>quicktourServlet</servlet-name> -->
<!-- <url-pattern>/reports/quicktourServlet</url-pattern> -->
<!-- </servlet-mapping> -->
<servlet>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB