adapted to the new model refactored

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@70709 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-03-01 18:42:50 +00:00
parent f35ba10645
commit 65b7dbae24
20 changed files with 265 additions and 261 deletions

View File

@ -5,6 +5,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <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="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<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>
</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>

View File

@ -117,7 +117,7 @@
<artifactId>csv4j</artifactId> <artifactId>csv4j</artifactId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.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>workspace-light-tree</artifactId> <artifactId>workspace-light-tree</artifactId>
@ -134,7 +134,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-docx-generator</artifactId> <artifactId>gcube-docx-generator</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>${setScope}</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.portal</groupId> <groupId>org.gcube.portal</groupId>

View File

@ -6,7 +6,7 @@ import java.util.List;
import org.gcube.portlets.d4sreporting.common.client.uicomponents.richtext.RichTextToolbar; import org.gcube.portlets.d4sreporting.common.client.uicomponents.richtext.RichTextToolbar;
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.SerializableModel; import org.gcube.portlets.d4sreporting.common.shared.Model;
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;
@ -31,7 +31,7 @@ import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationT
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent; import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel; import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateSection; import org.gcube.portlets.user.reportgenerator.client.model.TemplateSection;
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeArea; import org.gcube.portlets.user.reportgenerator.client.targets.ClientAttributeArea;
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea; import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.Coords; import org.gcube.portlets.user.reportgenerator.client.targets.Coords;
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea; import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
@ -39,7 +39,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.DroppingArea;
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable; import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea; import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea;
import org.gcube.portlets.user.reportgenerator.client.targets.ImageArea; import org.gcube.portlets.user.reportgenerator.client.targets.ImageArea;
import org.gcube.portlets.user.reportgenerator.client.targets.RepeatableSequence; import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea; import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea; import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo; import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
@ -201,11 +201,11 @@ public class Presenter {
currentUser = sessionInfo.getUsername(); currentUser = sessionInfo.getUsername();
currentScope = sessionInfo.getScope(); currentScope = sessionInfo.getScope();
if (sessionInfo.isWorkflowDocument()) { if (sessionInfo.isWorkflowDocument()) {
model.getModelService().getWorkflowDocumentFromDocumentLibrary(new AsyncCallback<SerializableModel>() { model.getModelService().getWorkflowDocumentFromDocumentLibrary(new AsyncCallback<Model>() {
public void onFailure(Throwable caught) { } public void onFailure(Throwable caught) { }
public void onSuccess(SerializableModel wfReport) { public void onSuccess(Model wfReport) {
loadModel(wfReport); loadModel(wfReport);
header.setMenuForWorkflowDocument(sessionInfo.isEditable()); header.setMenuForWorkflowDocument(sessionInfo.isEditable());
pollServiceForLockRenewal(); pollServiceForLockRenewal();
@ -213,9 +213,9 @@ public class Presenter {
}); });
} }
else { else {
model.getModelService().readTemplateFromSession(new AsyncCallback<SerializableModel>() { model.getModelService().readTemplateFromSession(new AsyncCallback<Model>() {
public void onFailure(Throwable caught) { } public void onFailure(Throwable caught) { }
public void onSuccess(SerializableModel result) { public void onSuccess(Model result) {
if (result != null) { if (result != null) {
loadModel(result); loadModel(result);
header.enableExports(); header.enableExports();
@ -552,7 +552,7 @@ public class Presenter {
* @param beforeSection say where to import this section (before) * @param beforeSection say where to import this section (before)
* @param asLastSection say to import this section as last section in the curren template / report * @param asLastSection say to import this section as last section in the curren template / report
*/ */
public void importSection(SerializableModel toLoad, int sectionNoToimport, int beforeSection, boolean asLastSection) { public void importSection(Model toLoad, int sectionNoToimport, int beforeSection, boolean asLastSection) {
model.importSectionInModel(toLoad, sectionNoToimport, beforeSection, asLastSection); model.importSectionInModel(toLoad, sectionNoToimport, beforeSection, asLastSection);
if (asLastSection) if (asLastSection)
seekLastPage(); seekLastPage();
@ -729,7 +729,7 @@ public class Presenter {
}; };
SerializableModel toSend = model.getSerializableModel(); Model toSend = model.getSerializableModel();
model.getModelService().generateManifestation(toSend, type, callback); model.getModelService().generateManifestation(toSend, type, callback);
//TODO: //TODO:
// MessageBox.show(new MessageBoxConfig() { // MessageBox.show(new MessageBoxConfig() {
@ -823,14 +823,14 @@ public class Presenter {
* @param isTemplate true if you are opening a template false if you are opening a report * @param isTemplate true if you are opening a template false if you are opening a report
*/ */
public void openTemplate(String templateToOpen, String templateObjectID, final boolean isTemplate) { public void openTemplate(String templateToOpen, String templateObjectID, final boolean isTemplate) {
AsyncCallback<SerializableModel> callback = new AsyncCallback<SerializableModel>() { AsyncCallback<Model> callback = new AsyncCallback<Model>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Window.alert("Could not Load template, please try again later: " + caught.getMessage()); Window.alert("Could not Load template, please try again later: " + caught.getMessage());
} }
public void onSuccess(SerializableModel toLoad) { public void onSuccess(Model toLoad) {
if (toLoad.getPageWidth() == TemplateModel.OLD_TEMPLATE_WIDTH) { if (toLoad.getPageWidth() == TemplateModel.OLD_TEMPLATE_WIDTH) {
if (isTemplate) if (isTemplate)
Window.alert("OPS! we think you are trying to open a previuos version template, only gCube Templates 1.5+ are supported"); Window.alert("OPS! we think you are trying to open a previuos version template, only gCube Templates 1.5+ are supported");
@ -850,11 +850,11 @@ public class Presenter {
* @param serializedpath the temp file to open * @param serializedpath the temp file to open
*/ */
public void openImportedFimesXML(String serializedpath) { public void openImportedFimesXML(String serializedpath) {
model.getModelService().readImportedModel(serializedpath, new AsyncCallback<SerializableModel>() { model.getModelService().readImportedModel(serializedpath, new AsyncCallback<Model>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Window.alert("Could not Load report, please try again later: " + caught.getMessage()); Window.alert("Could not Load report, please try again later: " + caught.getMessage());
} }
public void onSuccess(SerializableModel toLoad) { public void onSuccess(Model toLoad) {
loadModel(toLoad); loadModel(toLoad);
} }
}); });
@ -864,7 +864,7 @@ public class Presenter {
* *
* @param toLoad * @param toLoad
*/ */
private void loadModel(SerializableModel toLoad) { private void loadModel(Model toLoad) {
//reset the UI //reset the UI
cleanAllNotSession(); cleanAllNotSession();
@ -1001,7 +1001,7 @@ public class Presenter {
wp.addComponentToLayout(gt, component.isDoubleColLayout()); wp.addComponentToLayout(gt, component.isDoubleColLayout());
break; break;
case ATTRIBUTE_MULTI: case ATTRIBUTE_MULTI:
AttributeArea at = (AttributeArea) component.getContent(); ClientAttributeArea at = (ClientAttributeArea) component.getContent();
wp.addComponentToLayout(at, component.isDoubleColLayout()); wp.addComponentToLayout(at, component.isDoubleColLayout());
setCurrCursorPos(uiY); setCurrCursorPos(uiY);
break; break;
@ -1018,7 +1018,7 @@ public class Presenter {
wp.addComponentToLayout(gpa, component.isDoubleColLayout()); wp.addComponentToLayout(gpa, component.isDoubleColLayout());
break; break;
case REPEAT_SEQUENCE: case REPEAT_SEQUENCE:
RepeatableSequence rps = (RepeatableSequence) component.getContent(); ClientRepeatableSequence rps = (ClientRepeatableSequence) component.getContent();
wp.addComponentToLayout(rps, component.isDoubleColLayout()); wp.addComponentToLayout(rps, component.isDoubleColLayout());
break; break;
} }

View File

@ -1,8 +1,8 @@
package org.gcube.portlets.user.reportgenerator.client; package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel; import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable; import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType; import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo; import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
@ -19,7 +19,7 @@ public interface ReportService extends RemoteService{
* @param sTS . * @param sTS .
* @return . * @return .
*/ */
SerializableTable getSampleTimeSeries(SerializableTimeSeries sTS); Table getSampleTimeSeries(RepTimeSeries sTS);
/** /**
* *
* @return . * @return .
@ -32,7 +32,7 @@ public interface ReportService extends RemoteService{
* @param isImporting says if your importing or youre loading a template in the UI * @param isImporting says if your importing or youre loading a template in the UI
* @return . * @return .
*/ */
SerializableModel readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting); Model readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting);
/** /**
@ -41,7 +41,7 @@ public interface ReportService extends RemoteService{
* @param type . * @param type .
* @return . * @return .
*/ */
boolean generateManifestation(SerializableModel model, ExportManifestationType type); boolean generateManifestation(Model model, ExportManifestationType type);
/** /**
* each portlet instance runs in a scope * each portlet instance runs in a scope
@ -55,14 +55,14 @@ public interface ReportService extends RemoteService{
* *
* @param model . * @param model .
*/ */
void storeTemplateInSession(SerializableModel model); void storeTemplateInSession(Model model);
/** /**
* *
* @return the model previously stored in the session * @return the model previously stored in the session
*/ */
SerializableModel readTemplateFromSession(); Model readTemplateFromSession();
/** /**
* the report model is taken from the session * the report model is taken from the session
@ -75,17 +75,17 @@ public interface ReportService extends RemoteService{
*/ */
void saveReport(); void saveReport();
SerializableModel getWorkflowDocumentFromDocumentLibrary(); Model getWorkflowDocumentFromDocumentLibrary();
void updateWorkflowDocument(boolean update); void updateWorkflowDocument(boolean update);
void renewLock(); void renewLock();
String generateTempDocx(SerializableModel model); String generateTempDocx(Model model);
/** /**
* *
* @param tempPath * @param tempPath
* @return * @return
*/ */
SerializableModel readImportedModel(String tempPath); Model readImportedModel(String tempPath);
} }

View File

@ -1,8 +1,8 @@
package org.gcube.portlets.user.reportgenerator.client; package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel; import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable; import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType; import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo; import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
@ -20,7 +20,7 @@ public interface ReportServiceAsync {
* @param sTS . * @param sTS .
* @param callback . * @param callback .
*/ */
void getSampleTimeSeries(SerializableTimeSeries sTS, AsyncCallback<SerializableTable> callback); void getSampleTimeSeries(RepTimeSeries sTS, AsyncCallback<Table> callback);
/** /**
* *
* @param callback . * @param callback .
@ -35,7 +35,7 @@ public interface ReportServiceAsync {
* @param isImporting says if your importing or youre loading a template in the UI * @param isImporting says if your importing or youre loading a template in the UI
* @param callback . * @param callback .
*/ */
void readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting, AsyncCallback<SerializableModel> callback); void readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting, AsyncCallback<Model> callback);
@ -44,20 +44,20 @@ public interface ReportServiceAsync {
* @param type . * @param type .
* @param callback . * @param callback .
*/ */
void generateManifestation(SerializableModel model, ExportManifestationType type, AsyncCallback<Boolean> callback); void generateManifestation(Model model, ExportManifestationType type, AsyncCallback<Boolean> callback);
/** /**
* *
* @param model . * @param model .
* @param callback . * @param callback .
*/ */
void storeTemplateInSession(SerializableModel model, AsyncCallback<Void> callback); void storeTemplateInSession(Model model, AsyncCallback<Void> callback);
/** /**
* *
* call for the model previously stored in the session * call for the model previously stored in the session
* @param callback . * @param callback .
*/ */
void readTemplateFromSession( AsyncCallback<SerializableModel> callback); void readTemplateFromSession( AsyncCallback<Model> callback);
/** /**
* @param callback . * @param callback .
@ -77,11 +77,11 @@ public interface ReportServiceAsync {
*/ */
void getSessionInfo(String currentHost, AsyncCallback<SessionInfo> callback); void getSessionInfo(String currentHost, AsyncCallback<SessionInfo> callback);
void getWorkflowDocumentFromDocumentLibrary( void getWorkflowDocumentFromDocumentLibrary(
AsyncCallback<SerializableModel> callback); AsyncCallback<Model> callback);
void updateWorkflowDocument(boolean update, AsyncCallback<Void> callback); void updateWorkflowDocument(boolean update, AsyncCallback<Void> callback);
void renewLock(AsyncCallback<Void> callback); void renewLock(AsyncCallback<Void> callback);
void generateTempDocx(SerializableModel model, void generateTempDocx(Model model,
AsyncCallback<String> callback); AsyncCallback<String> callback);
void readImportedModel(String tempPath, void readImportedModel(String tempPath,
AsyncCallback<SerializableModel> callback); AsyncCallback<Model> callback);
} }

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.reportgenerator.client.dialog;
import java.util.ArrayList; import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType; import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent; import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.user.reportgenerator.client.events.RemovedCitationEvent; import org.gcube.portlets.user.reportgenerator.client.events.RemovedCitationEvent;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent; import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateSection; import org.gcube.portlets.user.reportgenerator.client.model.TemplateSection;
@ -62,7 +62,7 @@ public class DeleteCitationsDialog extends Window {
ArrayList<String> citations = new ArrayList<String>(); ArrayList<String> citations = new ArrayList<String>();
for (TemplateComponent tc : bibliosection.getAllComponents()) { for (TemplateComponent tc : bibliosection.getAllComponents()) {
if (tc.getType() == ComponentType.BODY) { if (tc.getType() == ComponentType.BODY) {
SerializableComponent sc = tc.getSerializable(); BasicComponent sc = tc.getSerializable();
citations.add(sc.getPossibleContent().toString()); citations.add(sc.getPossibleContent().toString());
} }
} }

View File

@ -4,9 +4,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent; import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel; import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.SerializableSection; import org.gcube.portlets.d4sreporting.common.shared.BasicSection;
import org.gcube.portlets.user.reportgenerator.client.events.ItemSelectionEvent; import org.gcube.portlets.user.reportgenerator.client.events.ItemSelectionEvent;
import org.gcube.portlets.user.reportgenerator.client.resources.FimesReportTreeStructureResources; import org.gcube.portlets.user.reportgenerator.client.resources.FimesReportTreeStructureResources;
@ -25,7 +25,7 @@ import com.google.gwt.user.client.ui.Widget;
public class FimesReportTreePanel extends ScrollPanel{ public class FimesReportTreePanel extends ScrollPanel{
public FimesReportTreePanel(final HandlerManager eventBus, final SerializableModel report, public FimesReportTreePanel(final HandlerManager eventBus, final Model report,
final String height, final String width) { final String height, final String width) {
this.setWidth(width); this.setWidth(width);
@ -48,15 +48,15 @@ public class FimesReportTreePanel extends ScrollPanel{
this.add(t); this.add(t);
} }
private TreeItem loadReportRootTree(final SerializableModel report) { private TreeItem loadReportRootTree(final Model report) {
// Add root node // Add root node
ImageResource image = FimesReportTreeStructureResources.INSTANCE.root(); ImageResource image = FimesReportTreeStructureResources.INSTANCE.root();
HorizontalPanel node = createNodeWidget(image, report.getTemplateName(),"gwt-label-rootTree"); HorizontalPanel node = createNodeWidget(image, report.getTemplateName(),"gwt-label-rootTree");
TreeItem root = new TreeItem(node); TreeItem root = new TreeItem(node);
Vector<SerializableSection> sections = report.getSections(); Vector<BasicSection> sections = report.getSections();
for(int i = 1; i <= sections.size(); i++) { for(int i = 1; i <= sections.size(); i++) {
SerializableSection s = sections.get(i - 1); BasicSection s = sections.get(i - 1);
// Add section item // Add section item
image = FimesReportTreeStructureResources.INSTANCE.section(); image = FimesReportTreeStructureResources.INSTANCE.section();
node = createNodeWidget(image, "Section" + i,"gwt-label-sectionTree"); node = createNodeWidget(image, "Section" + i,"gwt-label-sectionTree");
@ -69,11 +69,11 @@ public class FimesReportTreePanel extends ScrollPanel{
return root; return root;
} }
private void addItemsComponent(final TreeItem sectionItem,final SerializableSection sectionModel) { private void addItemsComponent(final TreeItem sectionItem,final BasicSection sectionModel) {
List<SerializableComponent> components = sectionModel.getComponents(); List<BasicComponent> components = sectionModel.getComponents();
for(int i = 0; i < components.size(); i++) { for(int i = 0; i < components.size(); i++) {
SerializableComponent c = components.get(i); BasicComponent c = components.get(i);
HorizontalPanel node = null; HorizontalPanel node = null;
switch (c.getType()) { switch (c.getType()) {

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.reportgenerator.client.dialog; package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel; import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants; import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.workspace.lighttree.client.Item; import org.gcube.portlets.user.workspace.lighttree.client.Item;
@ -36,7 +36,7 @@ public class ImporterDialog extends DialogBox {
Image loading = new Image(ReportConstants.LOADING_BAR); Image loading = new Image(ReportConstants.LOADING_BAR);
VerticalPanel toReplace = new VerticalPanel(); VerticalPanel toReplace = new VerticalPanel();
SerializableModel toimportFrom = null; Model toimportFrom = null;
ListBox listbox = new ListBox(); ListBox listbox = new ListBox();
ListBox listboxCurr = new ListBox(); ListBox listboxCurr = new ListBox();
@ -98,12 +98,12 @@ public class ImporterDialog extends DialogBox {
setWidget(dialogPanel); setWidget(dialogPanel);
AsyncCallback<SerializableModel> callback = new AsyncCallback<SerializableModel>() { AsyncCallback<Model> callback = new AsyncCallback<Model>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Window.alert("Could not Import template, please try again later: " + caught.getMessage()); Window.alert("Could not Import template, please try again later: " + caught.getMessage());
} }
public void onSuccess(SerializableModel toLoad) { public void onSuccess(Model toLoad) {
importFinished(toLoad); importFinished(toLoad);
} }
}; };
@ -120,7 +120,7 @@ public class ImporterDialog extends DialogBox {
} }
private void importFinished(SerializableModel toLoad) { private void importFinished(Model toLoad) {
HTML label = new HTML("Importing Complete..."); HTML label = new HTML("Importing Complete...");
Grid grid = new Grid(4, 2); Grid grid = new Grid(4, 2);

View File

@ -19,7 +19,7 @@ public class TSHeader extends HorizontalPanel {
private HTML myHeader; private HTML myHeader;
private int myColNo; private int myColNo;
private FlexTable myTable; private FlexTable myTable;
TimeSeriesFilter caller; TimeSeriesFilterDialog caller;
TSHeader myinstance; TSHeader myinstance;
/** /**
@ -29,7 +29,7 @@ public class TSHeader extends HorizontalPanel {
* @param myColNo . * @param myColNo .
* @param myHeader . * @param myHeader .
*/ */
public TSHeader(TimeSeriesFilter tsf, FlexTable myTable, CheckBox cb, int myColNo, HTML myHeader) { public TSHeader(TimeSeriesFilterDialog tsf, FlexTable myTable, CheckBox cb, int myColNo, HTML myHeader) {
super(); super();
myinstance = this; myinstance = this;
caller = tsf; caller = tsf;

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.reportgenerator.client.dialog; package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSinfo; import org.gcube.portlets.d4sreporting.common.shared.TimeSeriesinfo;
import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.ClickListener;
@ -22,7 +22,7 @@ public class TimeSeriesDialog extends DialogBox {
* *
* @param droppedTS . * @param droppedTS .
*/ */
public TimeSeriesDialog(SerializableTSinfo droppedTS) { public TimeSeriesDialog(TimeSeriesinfo droppedTS) {
setText(droppedTS.getTitle() + " Details"); setText(droppedTS.getTitle() + " Details");
String name = droppedTS.getTitle(); String name = droppedTS.getTitle();
String description = droppedTS.getTimeSeriesDescription(); String description = droppedTS.getTimeSeriesDescription();

View File

@ -4,11 +4,13 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.gcube.portlets.d4sreporting.common.client.CommonConstants; import org.gcube.portlets.d4sreporting.common.client.CommonConstants;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSFilter; import org.gcube.portlets.d4sreporting.common.shared.TimeSeriesFilter;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSinfo; import org.gcube.portlets.d4sreporting.common.shared.TimeSeriesinfo;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea; import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
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.Window;
import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ChangeListener; import com.google.gwt.user.client.ui.ChangeListener;
@ -29,7 +31,7 @@ import com.google.gwt.user.client.ui.Widget;
* @author massi * @author massi
* *
*/ */
public class TimeSeriesFilter extends DialogBox { public class TimeSeriesFilterDialog extends DialogBox {
ScrollPanel scroller = new ScrollPanel(); ScrollPanel scroller = new ScrollPanel();
TextBox from = new TextBox(); TextBox from = new TextBox();
TextBox to = new TextBox(); TextBox to = new TextBox();
@ -41,10 +43,10 @@ public class TimeSeriesFilter extends DialogBox {
* @param sts a ts * @param sts a ts
* @param caller . * @param caller .
*/ */
public TimeSeriesFilter(final TSArea caller, final SerializableTimeSeries sts) { public TimeSeriesFilterDialog(final TSArea caller, final RepTimeSeries sts) {
final SerializableTSinfo droppedTS = sts.getTsMetadata(); final TimeSeriesinfo droppedTS = sts.getTsMetadata();
setText(droppedTS.getTitle() + " Filter"); setText(droppedTS.getTitle() + " Filter");
String name = droppedTS.getTitle(); String name = droppedTS.getTitle();
long rowsNo = droppedTS.getDimension(); long rowsNo = droppedTS.getDimension();
@ -61,7 +63,7 @@ public class TimeSeriesFilter extends DialogBox {
main_panel.addStyleName("bgBlank p8 font_family font_12"); main_panel.addStyleName("bgBlank p8 font_family font_12");
main_panel.add(metadata); main_panel.add(metadata);
List<String> headersString = droppedTS.getHeaderLabels(); List<String> headersString = droppedTS.getHeaderLabels();
/** /**
@ -71,89 +73,82 @@ public class TimeSeriesFilter extends DialogBox {
toAdd.setChecked(true); toAdd.setChecked(true);
compoundHeaders.add(new TSHeader(this, flexTable, toAdd, i, new HTML(headersString.get(i) ))); compoundHeaders.add(new TSHeader(this, flexTable, toAdd, i, new HTML(headersString.get(i) )));
} }
main_panel.add(new HTML("Selected fields: (click to remove)")); main_panel.add(new HTML("Selected fields: (click to remove)"));
flexTable = getTableHeader(compoundHeaders); flexTable = getTableHeader(compoundHeaders);
main_panel.add(flexTable); main_panel.add(flexTable);
main_panel.add(new HTML("Select rows interval:")); main_panel.add(new HTML("Select rows interval:"));
from.setText("1"); from.setText("1");
to.setText("10"); to.setText("10");
to.setMaxLength(6); to.setMaxLength(6);
from.setMaxLength(6); from.setMaxLength(6);
from.addChangeListener(textBoxListener); from.addChangeListener(textBoxListener);
to.addChangeListener(textBoxListener); to.addChangeListener(textBoxListener);
Grid rowsInterval = new Grid(1, 4); Grid rowsInterval = new Grid(1, 4);
rowsInterval.setWidget(0, 0, new HTML("From row:")); rowsInterval.setWidget(0, 0, new HTML("From row:"));
rowsInterval.setWidget(0, 1, from); rowsInterval.setWidget(0, 1, from);
rowsInterval.setWidget(0, 2, new HTML("&nbsp;&nbsp;To row:")); rowsInterval.setWidget(0, 2, new HTML("&nbsp;&nbsp;To row:"));
rowsInterval.setWidget(0, 3, to); rowsInterval.setWidget(0, 3, to);
main_panel.add(rowsInterval); main_panel.add(rowsInterval);
main_panel.add(new HTML("<hr align=\"left\" size=\"1\" width=\"100%\" color=\"gray\" noshade>")); main_panel.add(new HTML("<hr align=\"left\" size=\"1\" width=\"100%\" color=\"gray\" noshade>"));
HorizontalPanel buttonspanel = new HorizontalPanel(); HorizontalPanel buttonspanel = new HorizontalPanel();
buttonspanel.setHeight("50"); buttonspanel.setHeight("50");
buttonspanel.setSpacing(3); buttonspanel.setSpacing(3);
// PopupPanel is a SimplePanel, so you have to set it's widget property to // PopupPanel is a SimplePanel, so you have to set it's widget property to
// whatever you want its contents to be. // whatever you want its contents to be.
Button close = new Button("Close"); Button close = new Button("Close");
close.addClickListener(new ClickListener() { close.addClickHandler(new ClickHandler() {
public void onClick(Widget arg0) { public void onClick(ClickEvent event) {
hide(); hide();
} }
}); });
Button apply = new Button("Apply"); Button apply = new Button("Apply");
apply.addClickListener(new ClickListener() { apply.addClickHandler(new ClickHandler() {
public void onClick(Widget arg0) { @Override
public void onClick(ClickEvent event) {
List<TSHeader> selectedCols = compoundHeaders; List<TSHeader> selectedCols = compoundHeaders;
List<Integer> colsToShow = new LinkedList<Integer>(); List<Integer> colsToShow = new LinkedList<Integer>();
for (TSHeader head : selectedCols) { for (TSHeader head : selectedCols) {
colsToShow.add(new Integer(head.getMyColNo())); colsToShow.add(new Integer(head.getMyColNo()));
} }
int fromInt = Integer.parseInt(from.getText()); int fromInt = Integer.parseInt(from.getText());
int toInt = Integer.parseInt(to.getText()); int toInt = Integer.parseInt(to.getText());
SerializableTSFilter toSet = new SerializableTSFilter(colsToShow, null, null, fromInt, toInt); TimeSeriesFilter toSet = new TimeSeriesFilter(colsToShow, null, null, fromInt, toInt);
caller.setNewFilter(toSet); caller.setNewFilter(toSet);
caller.refreshHeaders(); caller.refreshHeaders();
hide(); hide();
} }
}); });
// Button reset = new Button("Reset");
// close.addClickListener(new ClickListener() {
// public void onClick(Widget arg0) {
// hide();
// show();
// }
// });
//buttonspanel.add(reset);
buttonspanel.add(close); buttonspanel.add(close);
buttonspanel.add(apply); buttonspanel.add(apply);
main_panel.add(buttonspanel); main_panel.add(buttonspanel);
scroller.setPixelSize(550, 280); scroller.setPixelSize(550, 280);
main_panel.setPixelSize(550, 260); main_panel.setPixelSize(550, 260);
scroller.add(main_panel); scroller.add(main_panel);
setWidget(scroller); setWidget(scroller);
} }
/** /**
* *
* @param toRemove . * @param toRemove .
@ -162,8 +157,8 @@ public class TimeSeriesFilter extends DialogBox {
public boolean removeHeader(TSHeader toRemove) { public boolean removeHeader(TSHeader toRemove) {
return compoundHeaders.remove(toRemove); return compoundHeaders.remove(toRemove);
} }
/** /**
* display the header of the ts * display the header of the ts
* @param droppedTS * @param droppedTS
@ -179,10 +174,10 @@ public class TimeSeriesFilter extends DialogBox {
flexTable.getCellFormatter().setStyleName(1, i, "timeSeries_td"); flexTable.getCellFormatter().setStyleName(1, i, "timeSeries_td");
flexTable.setWidget(1, i, new HTML("...")); flexTable.setWidget(1, i, new HTML("..."));
} }
return flexTable; return flexTable;
} }
ChangeListener textBoxListener = new ChangeListener() { ChangeListener textBoxListener = new ChangeListener() {
public void onChange(Widget sender) { public void onChange(Widget sender) {
@ -196,22 +191,22 @@ public class TimeSeriesFilter extends DialogBox {
} }
int start = Integer.parseInt(from.getText()); int start = Integer.parseInt(from.getText());
int end = Integer.parseInt(to.getText()); int end = Integer.parseInt(to.getText());
if (start >= end) { if (start >= end) {
Window.alert("From must be greater than to"); Window.alert("From must be greater than to");
to.setText(""+(start+10)); to.setText(""+(start+10));
} }
} }
}; };
/** /**
* *
*/ */
public void show() { public void show() {
super.show(); super.show();
center(); center();
} }
} }

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.reportgenerator.client.dialog; package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable; import org.gcube.portlets.d4sreporting.common.shared.Table;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
@ -23,7 +23,7 @@ public class TimeSeriesSampleDialog extends DialogBox {
* *
* @param table . * @param table .
*/ */
public TimeSeriesSampleDialog(SerializableTable table) { public TimeSeriesSampleDialog(Table table) {
super(true); super(true);
setText("TS Sample"); setText("TS Sample");
FlexTable flexTable = new FlexTable(); FlexTable flexTable = new FlexTable();

View File

@ -7,14 +7,14 @@ import java.util.List;
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.SerializableAttribute; import org.gcube.portlets.d4sreporting.common.shared.Attribute;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttributeArea; import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent; import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableRepeatableSequence; import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable; import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeArea; import org.gcube.portlets.user.reportgenerator.client.targets.ClientAttributeArea;
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea; import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea; import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
import org.gcube.portlets.user.reportgenerator.client.targets.DropImageListener; import org.gcube.portlets.user.reportgenerator.client.targets.DropImageListener;
@ -24,7 +24,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea; import org.gcube.portlets.user.reportgenerator.client.targets.GroupingDelimiterArea;
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingInnerArea; import org.gcube.portlets.user.reportgenerator.client.targets.GroupingInnerArea;
import org.gcube.portlets.user.reportgenerator.client.targets.ImageArea; import org.gcube.portlets.user.reportgenerator.client.targets.ImageArea;
import org.gcube.portlets.user.reportgenerator.client.targets.RepeatableSequence; import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea; import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea; import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
@ -149,7 +149,7 @@ public class TemplateComponent {
* @param sc the serialiazble to convert * @param sc the serialiazble to convert
* @param presenter . * @param presenter .
*/ */
public TemplateComponent(TemplateModel myModel, SerializableComponent sc, Presenter presenter) { public TemplateComponent(TemplateModel myModel, BasicComponent sc, Presenter presenter) {
this.myModel = myModel; this.myModel = myModel;
// //
//Coords start = new Coords(x, y); //Coords start = new Coords(x, y);
@ -254,18 +254,18 @@ public class TemplateComponent {
this.content = dp4; this.content = dp4;
break; break;
case FLEX_TABLE: case FLEX_TABLE:
SerializableTable st = (SerializableTable) sc.getPossibleContent(); Table st = (Table) sc.getPossibleContent();
GenericTable table = new GenericTable(st, presenter, sc.getX(), sc.getY(), TemplateModel.TEMPLATE_WIDTH - 50, 200); GenericTable table = new GenericTable(st, presenter, sc.getX(), sc.getY(), TemplateModel.TEMPLATE_WIDTH - 50, 200);
this.content = table; this.content = table;
break; break;
case ATTRIBUTE_MULTI: case ATTRIBUTE_MULTI:
AttributeArea ta = null; ClientAttributeArea ta = null;
if (sc.getPossibleContent() instanceof SerializableAttributeArea) { if (sc.getPossibleContent() instanceof AttributeArea) {
SerializableAttributeArea sata = (SerializableAttributeArea) sc.getPossibleContent(); AttributeArea sata = (AttributeArea) sc.getPossibleContent();
ta = new AttributeArea(presenter, sc.getX(), sc.getY(), width, height, sata); ta = new ClientAttributeArea(presenter, sc.getX(), sc.getY(), width, height, sata);
} }
else { else {
ta = new AttributeArea(presenter, sc.getX(), sc.getY(), width, height, sc.getPossibleContent().toString()); ta = new ClientAttributeArea(presenter, sc.getX(), sc.getY(), width, height, sc.getPossibleContent().toString());
} }
this.content = ta; this.content = ta;
break; break;
@ -283,9 +283,9 @@ public class TemplateComponent {
break; break;
case TIME_SERIES: case TIME_SERIES:
TSArea tsa; TSArea tsa;
SerializableTimeSeries sts = null; RepTimeSeries sts = null;
try { try {
sts = ((SerializableTimeSeries) sc.getPossibleContent()); sts = ((RepTimeSeries) sc.getPossibleContent());
} catch (ClassCastException e) { } catch (ClassCastException e) {
} }
@ -311,11 +311,11 @@ public class TemplateComponent {
break; break;
case REPEAT_SEQUENCE: case REPEAT_SEQUENCE:
GWT.log("FOUND SEQUENCE trying getGroup"); GWT.log("FOUND SEQUENCE trying getGroup");
SerializableRepeatableSequence serializableRepeatableSequence = (SerializableRepeatableSequence) sc.getPossibleContent(); RepeatableSequence repeatableSequence = (RepeatableSequence) sc.getPossibleContent();
GWT.log("getGroup: " + serializableRepeatableSequence.toString()); GWT.log("getGroup: " + repeatableSequence.toString());
RepeatableSequence rps = new RepeatableSequence(presenter, serializableRepeatableSequence); ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
this.content = rps; this.content = rps;
break; break;
} }
@ -347,7 +347,7 @@ public class TemplateComponent {
* return a template Component which is serializable * return a template Component which is serializable
* @return . * @return .
*/ */
public SerializableComponent getSerializable() { public BasicComponent getSerializable() {
Serializable content = ""; Serializable content = "";
String id = ""; String id = "";
switch (this.getType()) { switch (this.getType()) {
@ -392,17 +392,17 @@ public class TemplateComponent {
break; break;
case FLEX_TABLE: case FLEX_TABLE:
GenericTable gt = (GenericTable) this.content; GenericTable gt = (GenericTable) this.content;
SerializableTable st = gt.getSerializable(); Table st = gt.getSerializable();
content = st; content = st;
break; break;
case ATTRIBUTE_MULTI: case ATTRIBUTE_MULTI:
AttributeArea att = (AttributeArea) this.content; ClientAttributeArea att = (ClientAttributeArea) this.content;
ArrayList<SerializableAttribute> values = new ArrayList<SerializableAttribute>(); ArrayList<Attribute> values = new ArrayList<Attribute>();
for (CheckBox box : att.getBoxes()) { for (CheckBox box : att.getBoxes()) {
values.add(new SerializableAttribute(box.getText().trim(), box.getValue())); values.add(new Attribute(box.getText().trim(), box.getValue()));
} }
GWT.log("Attr: " + att.getAttrName()); GWT.log("Attr: " + att.getAttrName());
SerializableAttributeArea sat= new SerializableAttributeArea(att.getAttrName().trim(), values); AttributeArea sat= new AttributeArea(att.getAttrName().trim(), values);
content = sat; content = sat;
break; break;
case COMMENT: case COMMENT:
@ -412,12 +412,12 @@ public class TemplateComponent {
content = ((HTML) this.content).getHTML(); content = ((HTML) this.content).getHTML();
break; break;
case REPEAT_SEQUENCE: case REPEAT_SEQUENCE:
RepeatableSequence repSeq = (RepeatableSequence) this.content; ClientRepeatableSequence repSeq = (ClientRepeatableSequence) this.content;
SerializableRepeatableSequence toStore = new SerializableRepeatableSequence(getSerializableSequence(repSeq), height); RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), height);
content = toStore; content = toStore;
break; break;
} }
return new SerializableComponent(x, y, width, height, templatePage, type, idInBasket, "param empty", content, this.doubleColLayout, isLocked(), metadata); return new BasicComponent(x, y, width, height, templatePage, type, idInBasket, "param empty", content, this.doubleColLayout, isLocked(), metadata);
} }
/** /**
@ -425,8 +425,8 @@ public class TemplateComponent {
* @param repSeq * @param repSeq
* @return * @return
*/ */
private ArrayList<SerializableComponent> getSerializableSequence(RepeatableSequence repSeq) { private ArrayList<BasicComponent> getSerializableSequence(ClientRepeatableSequence repSeq) {
ArrayList<SerializableComponent> sComps = new ArrayList<SerializableComponent>(); ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
for (TemplateComponent tc : repSeq.getGroupedComponents()) { for (TemplateComponent tc : repSeq.getGroupedComponents()) {
sComps.add(tc.getSerializable()); sComps.add(tc.getSerializable());
} }

View File

@ -9,10 +9,10 @@ import java.util.Map.Entry;
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.SerializableComponent; import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel; import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.SerializableSection; import org.gcube.portlets.d4sreporting.common.shared.BasicSection;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.ReportService; import org.gcube.portlets.user.reportgenerator.client.ReportService;
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync; import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
@ -199,7 +199,7 @@ public class TemplateModel {
TemplateSection singleSection = new TemplateSection(); TemplateSection singleSection = new TemplateSection();
singleSection.addMetadata(BIBLIO_SECTION, "true"); singleSection.addMetadata(BIBLIO_SECTION, "true");
SerializableComponent references = new SerializableComponent(0, 0,TEMPLATE_WIDTH - 50, 35, BasicComponent references = new BasicComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.HEADING_2, "", "REFERENCES", false, true, singleSection.getAllMetadata()); totalPages, ComponentType.HEADING_2, "", "REFERENCES", false, true, singleSection.getAllMetadata());
TemplateComponent referencesTC = new TemplateComponent(this, references, presenter); TemplateComponent referencesTC = new TemplateComponent(this, references, presenter);
@ -215,11 +215,11 @@ public class TemplateModel {
public void addCitation(String citeKey, String citeText) { public void addCitation(String citeKey, String citeText) {
String citation ="<b>" + citeKey + ".</b>&nbsp;" + citeText; String citation ="<b>" + citeKey + ".</b>&nbsp;" + citeText;
TemplateSection singleSection = getSection(totalPages); TemplateSection singleSection = getSection(totalPages);
SerializableComponent entry = new SerializableComponent(0, 0,TEMPLATE_WIDTH - 50, 35, BasicComponent entry = new BasicComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.HEADING_2, "", "Bibliographic Entry", false, true, singleSection.getAllMetadata()); totalPages, ComponentType.HEADING_2, "", "Bibliographic Entry", false, true, singleSection.getAllMetadata());
TemplateComponent entryTC = new TemplateComponent(this, entry, presenter); TemplateComponent entryTC = new TemplateComponent(this, entry, presenter);
singleSection.addComponent(entryTC); singleSection.addComponent(entryTC);
SerializableComponent entryText = new SerializableComponent(0, 0,TEMPLATE_WIDTH - 50, 35, BasicComponent entryText = new BasicComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.BODY, "", citation, false, false, singleSection.getAllMetadata()); totalPages, ComponentType.BODY, "", citation, false, false, singleSection.getAllMetadata());
TemplateComponent entryTextTC = new TemplateComponent(this, entryText, presenter); TemplateComponent entryTextTC = new TemplateComponent(this, entryText, presenter);
singleSection.addComponent(entryTextTC); singleSection.addComponent(entryTextTC);
@ -235,7 +235,7 @@ public class TemplateModel {
for (int i = 0; i < components.size(); i++) { for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i); TemplateComponent tc = components.get(i);
if (tc.getType() == ComponentType.BODY) { if (tc.getType() == ComponentType.BODY) {
SerializableComponent sc = tc.getSerializable(); BasicComponent sc = tc.getSerializable();
HTML citationHTML = new HTML(sc.getPossibleContent().toString(), true); ///to clean the HTML HTML citationHTML = new HTML(sc.getPossibleContent().toString(), true); ///to clean the HTML
String citation = citationHTML.getText(); String citation = citationHTML.getText();
if (citation.startsWith(citeKey)) { if (citation.startsWith(citeKey)) {
@ -263,7 +263,7 @@ public class TemplateModel {
* @param toLoad the SerializableModel instance to load in the model * @param toLoad the SerializableModel instance to load in the model
* @param presenter . * @param presenter .
*/ */
public void loadModel(SerializableModel toLoad, Presenter presenter) { public void loadModel(Model toLoad, Presenter presenter) {
//loading template from disk //loading template from disk
this.author = toLoad.getAuthor(); this.author = toLoad.getAuthor();
@ -285,17 +285,17 @@ public class TemplateModel {
//the sections to be transferred //the sections to be transferred
Vector<SerializableSection> sectionsSerialized = toLoad.getSections(); Vector<BasicSection> sectionsSerialized = toLoad.getSections();
//reset current sections container //reset current sections container
this.sections = new HashMap<String, TemplateSection>(); this.sections = new HashMap<String, TemplateSection>();
//page Number, this model uses a HashMap for each page, the key is the page number //page Number, this model uses a HashMap for each page, the key is the page number
int pageNo = 1; int pageNo = 1;
for (SerializableSection serialazableSection : sectionsSerialized) { //for each section for (BasicSection serialazableSection : sectionsSerialized) { //for each section
List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>(); List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>();
for (SerializableComponent sc : serialazableSection.getComponents()) { //for each page component for (BasicComponent sc : serialazableSection.getComponents()) { //for each page component
myTemplateSection.add(new TemplateComponent(this, sc, presenter)); myTemplateSection.add(new TemplateComponent(this, sc, presenter));
} }
//TODO: load also metadata //TODO: load also metadata
@ -314,14 +314,14 @@ public class TemplateModel {
* @param beforeSection say where to import this section (before) * @param beforeSection say where to import this section (before)
* @param asLastSection say to import this section as last section in the curren template / report * @param asLastSection say to import this section as last section in the curren template / report
*/ */
public void importSectionInModel(SerializableModel toLoad, int sectionNoToimport, int beforeSection, boolean asLastSection) { public void importSectionInModel(Model toLoad, int sectionNoToimport, int beforeSection, boolean asLastSection) {
int pageNo = totalPages+1; int pageNo = totalPages+1;
//the section to be imported -1 beacuse it stays in a vector //the section to be imported -1 beacuse it stays in a vector
SerializableSection toImport = toLoad.getSections().get(sectionNoToimport-1); BasicSection toImport = toLoad.getSections().get(sectionNoToimport-1);
List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>(); List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>();
for (SerializableComponent sc : toImport.getComponents()) { //for each page component for (BasicComponent sc : toImport.getComponents()) { //for each page component
myTemplateSection.add(new TemplateComponent(this, sc, presenter)); myTemplateSection.add(new TemplateComponent(this, sc, presenter));
} }
//TODO: load also metadata //TODO: load also metadata
@ -369,8 +369,8 @@ public class TemplateModel {
* *
* @return a serialized version od the model * @return a serialized version od the model
*/ */
public SerializableModel getSerializableModel() { public Model getSerializableModel() {
Vector<SerializableSection> serializedsections = new Vector<SerializableSection>(); Vector<BasicSection> serializedsections = new Vector<BasicSection>();
for (int i = 1; i <= sections.size(); i++) { for (int i = 1; i <= sections.size(); i++) {
//the pages //the pages
@ -379,9 +379,9 @@ public class TemplateModel {
TemplateSection singleSection = sections.get(pageNo); TemplateSection singleSection = sections.get(pageNo);
List<TemplateComponent> templateElements = singleSection.getAllComponents(); List<TemplateComponent> templateElements = singleSection.getAllComponents();
List<SerializableComponent> serialazableComponents = new LinkedList<SerializableComponent>(); List<BasicComponent> serialazableComponents = new LinkedList<BasicComponent>();
//construct the serialized section //construct the serialized section
SerializableSection aSection = new SerializableSection(); BasicSection aSection = new BasicSection();
//copy the components //copy the components
for (TemplateComponent tc : templateElements) for (TemplateComponent tc : templateElements)
serialazableComponents.add(tc.getSerializable()); serialazableComponents.add(tc.getSerializable());
@ -395,8 +395,8 @@ public class TemplateModel {
} }
SerializableModel toReturn = Model toReturn =
new SerializableModel("UniqueID", author, dateCreated, lastEdit, lastEditBy, templateName, columnWidth, currentPage, marginBottom, marginLeft, marginRight, marginTop, new Model("UniqueID", author, dateCreated, lastEdit, lastEditBy, templateName, columnWidth, currentPage, marginBottom, marginLeft, marginRight, marginTop,
pageHeight, pageWidth, serializedsections, totalPages, metadata); pageHeight, pageWidth, serializedsections, totalPages, metadata);
return toReturn; return toReturn;
@ -500,7 +500,7 @@ public class TemplateModel {
public void onSuccess(Object result) { } public void onSuccess(Object result) { }
}; };
SerializableModel modelToSend = getSerializableModel(); Model modelToSend = getSerializableModel();
GWT.log("Storing in session: currpage = " + modelToSend.getCurrPage(), null); GWT.log("Storing in session: currpage = " + modelToSend.getCurrPage(), null);
@ -647,8 +647,8 @@ public class TemplateModel {
TemplateSection section = (TemplateSection) entry.getValue(); TemplateSection section = (TemplateSection) entry.getValue();
for (TemplateComponent tc : section.getAllComponents()) { for (TemplateComponent tc : section.getAllComponents()) {
if (tc.getType() == ComponentType.TIME_SERIES) { if (tc.getType() == ComponentType.TIME_SERIES) {
SerializableComponent sc = tc.getSerializable(); BasicComponent sc = tc.getSerializable();
SerializableTimeSeries sts = (SerializableTimeSeries) sc.getPossibleContent(); RepTimeSeries sts = (RepTimeSeries) sc.getPossibleContent();
if (sts.getFilter() != null) { if (sts.getFilter() != null) {
int from = sts.getFilter().getFrom(); int from = sts.getFilter().getFrom();
int to = sts.getFilter().getTo(); int to = sts.getFilter().getTo();

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.targets; package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType; import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttribute; import org.gcube.portlets.d4sreporting.common.shared.Attribute;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttributeArea; import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
@ -19,7 +19,7 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it * @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version April 2011 (1.0) * @version April 2011 (1.0)
*/ */
public class AttributeArea extends Composite { public class ClientAttributeArea extends Composite {
private HorizontalPanel myPanel; private HorizontalPanel myPanel;
private String attrName; private String attrName;
@ -28,7 +28,7 @@ public class AttributeArea extends Composite {
/** /**
* Coming form a template constructor * Coming form a template constructor
*/ */
public AttributeArea(final Presenter presenter, int left, int top, int width, final int height, String textToDisplay) { public ClientAttributeArea(final Presenter presenter, int left, int top, int width, final int height, String textToDisplay) {
myPanel = new HorizontalPanel(); myPanel = new HorizontalPanel();
myPanel.setTitle("Attribute Area"); myPanel.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
@ -51,7 +51,7 @@ public class AttributeArea extends Composite {
/** /**
* Coming form a report constructor * Coming form a report constructor
*/ */
public AttributeArea(final Presenter presenter, int left, int top, int width, final int height, SerializableAttributeArea sata) { public ClientAttributeArea(final Presenter presenter, int left, int top, int width, final int height, AttributeArea sata) {
myPanel = new HorizontalPanel(); myPanel = new HorizontalPanel();
myPanel.setTitle("Attribute Area"); myPanel.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
@ -68,7 +68,7 @@ public class AttributeArea extends Composite {
int values = sata.getValues().size(); int values = sata.getValues().size();
boxes = new CheckBox[values]; boxes = new CheckBox[values];
int j = 0; int j = 0;
for (SerializableAttribute attr: sata.getValues()) { for (Attribute attr: sata.getValues()) {
CheckBox toAdd = new CheckBox(attr.getName()); CheckBox toAdd = new CheckBox(attr.getName());
toAdd.setStyleName("checkAttribute"); toAdd.setStyleName("checkAttribute");
toAdd.setValue(attr.getValue()); toAdd.setValue(attr.getValue());

View File

@ -3,8 +3,8 @@ package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.ArrayList; import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType; import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent; import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableRepeatableSequence; import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent; import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
@ -19,7 +19,7 @@ import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
public class RepeatableSequence extends Composite { public class ClientRepeatableSequence extends Composite {
private ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>(); private ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
private VerticalPanel myPanel; private VerticalPanel myPanel;
@ -31,7 +31,7 @@ public class RepeatableSequence extends Composite {
* constructor used by the system when reading the model * constructor used by the system when reading the model
* @param sRS * @param sRS
*/ */
public RepeatableSequence(Presenter p, SerializableRepeatableSequence sRS) { public ClientRepeatableSequence(Presenter p, RepeatableSequence sRS) {
this.p = p; this.p = p;
addAnotherB.getElement().getStyle().setMargin(10, Unit.PX); addAnotherB.getElement().getStyle().setMargin(10, Unit.PX);
addAnotherB.getElement().getStyle().setHeight(30, Unit.PX); addAnotherB.getElement().getStyle().setHeight(30, Unit.PX);
@ -40,7 +40,7 @@ public class RepeatableSequence extends Composite {
myPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); myPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
int size = sRS.getGroupedComponents().size(); int size = sRS.getGroupedComponents().size();
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
SerializableComponent sComp = sRS.getGroupedComponents().get(j); BasicComponent sComp = sRS.getGroupedComponents().get(j);
if (j == size-1) { if (j == size-1) {
myPanel.add(buttonPanel); //add the button before the last element myPanel.add(buttonPanel); //add the button before the last element
buttonPanel.setWidth("100%"); buttonPanel.setWidth("100%");

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.ArrayList; import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable; import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.TableCell; import org.gcube.portlets.d4sreporting.common.shared.TableCell;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
@ -36,7 +36,7 @@ public class GenericTable extends Composite {
* constructor called when reading the model * constructor called when reading the model
* @param sTable * @param sTable
*/ */
public GenericTable(SerializableTable sTable, Presenter presenter, int top, int left, int width, int height) { public GenericTable(Table sTable, Presenter presenter, int top, int left, int width, int height) {
commonConstructorCode(presenter); commonConstructorCode(presenter);
this.rows = sTable.getRowCount(); this.rows = sTable.getRowCount();
@ -107,8 +107,8 @@ public class GenericTable extends Composite {
* *
* @return * @return
*/ */
public SerializableTable getSerializable() { public Table getSerializable() {
SerializableTable toReturn = new SerializableTable(this.cols); Table toReturn = new Table(this.cols);
for (int i = 0; i < myTable.getRowCount(); i++) { for (int i = 0; i < myTable.getRowCount(); i++) {
toReturn.addRow(getRow(i)); toReturn.addRow(getRow(i));
} }

View File

@ -3,14 +3,14 @@ package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSFilter; import org.gcube.portlets.d4sreporting.common.shared.TimeSeriesFilter;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSinfo; import org.gcube.portlets.d4sreporting.common.shared.TimeSeriesinfo;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable; import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator; import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesDialog; import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesDialog;
import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesFilter; import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesFilterDialog;
import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesSampleDialog; import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesSampleDialog;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem; import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTTimeSeries; import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTTimeSeries;
@ -40,7 +40,7 @@ import com.google.gwt.user.client.ui.Label;
public class TSArea extends Composite { public class TSArea extends Composite {
private VerticalPanel mainPanel; private VerticalPanel mainPanel;
private SerializableTimeSeries sts = new SerializableTimeSeries(); private RepTimeSeries sts = new RepTimeSeries();
private String idInBasket; private String idInBasket;
private Presenter presenter; private Presenter presenter;
private FlexTable flexTable; private FlexTable flexTable;
@ -56,7 +56,7 @@ public class TSArea extends Composite {
* @param height . * @param height .
* @param sts the time series * @param sts the time series
*/ */
public TSArea(Presenter presenter, int width, int height, SerializableTimeSeries sts) { public TSArea(Presenter presenter, int width, int height, RepTimeSeries sts) {
singleton = this; singleton = this;
this.presenter = presenter; this.presenter = presenter;
mainPanel = new VerticalPanel(); mainPanel = new VerticalPanel();
@ -83,7 +83,7 @@ public class TSArea extends Composite {
* called when dropped a TS on the area * called when dropped a TS on the area
* @param toShow the TS to show * @param toShow the TS to show
*/ */
public void showTS(SerializableTSinfo toShow) { public void showTS(TimeSeriesinfo toShow) {
mainPanel.removeAll(); mainPanel.removeAll();
mainPanel.removeStyleName("timeseriesArea_bg"); mainPanel.removeStyleName("timeseriesArea_bg");
tableContainer.removeAll(); tableContainer.removeAll();
@ -152,7 +152,7 @@ public class TSArea extends Composite {
ClickHandler applyFilterTs = new ClickHandler() { ClickHandler applyFilterTs = new ClickHandler() {
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
TimeSeriesFilter dlg = new TimeSeriesFilter(singleton, sts); TimeSeriesFilterDialog dlg = new TimeSeriesFilterDialog(singleton, sts);
//dlg.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop()); //dlg.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop());
dlg.setAnimationEnabled(true); dlg.setAnimationEnabled(true);
dlg.show(); dlg.show();
@ -162,11 +162,11 @@ public class TSArea extends Composite {
ClickHandler showTSSample = new ClickHandler() { ClickHandler showTSSample = new ClickHandler() {
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
presenter.getModel().getModelService().getSampleTimeSeries(sts, new AsyncCallback<SerializableTable>() { presenter.getModel().getModelService().getSampleTimeSeries(sts, new AsyncCallback<Table>() {
public void onFailure(Throwable caught) { Window.alert("There were Problem contacting Server, please try later");} public void onFailure(Throwable caught) { Window.alert("There were Problem contacting Server, please try later");}
public void onSuccess(SerializableTable result) { public void onSuccess(Table result) {
SerializableTable toPass = result; Table toPass = result;
TimeSeriesSampleDialog dlg = new TimeSeriesSampleDialog(toPass); TimeSeriesSampleDialog dlg = new TimeSeriesSampleDialog(toPass);
dlg.setAnimationEnabled(true); dlg.setAnimationEnabled(true);
dlg.show(); dlg.show();
@ -180,8 +180,8 @@ public class TSArea extends Composite {
*/ */
public void dropTS(GWTTimeSeries droppedTS) { public void dropTS(GWTTimeSeries droppedTS) {
idInBasket = droppedTS.getId(); idInBasket = droppedTS.getId();
SerializableTSinfo tsMetadata = convertWSTS2SerialazableTS(droppedTS); TimeSeriesinfo tsMetadata = convertWSTS2SerialazableTS(droppedTS);
sts = new SerializableTimeSeries(null, tsMetadata); sts = new RepTimeSeries(null, tsMetadata);
GWT.log("showTS TS"); GWT.log("showTS TS");
showTS(tsMetadata); showTS(tsMetadata);
} }
@ -208,8 +208,8 @@ public class TSArea extends Composite {
* @param md the TS metadata to convert * @param md the TS metadata to convert
* @return * @return
*/ */
private SerializableTSinfo convertWSTS2SerialazableTS(GWTTimeSeries md) { private TimeSeriesinfo convertWSTS2SerialazableTS(GWTTimeSeries md) {
SerializableTSinfo tsMetadata = new SerializableTSinfo(md.getId(), md.getName(), md.getDescription(), md.getOwner(), TimeSeriesinfo tsMetadata = new TimeSeriesinfo(md.getId(), md.getName(), md.getDescription(), md.getOwner(),
md.getCreationTime(), md.getLastModificationTime(), md.getTimeSeriesId(), md.getTitle(), md.getCreator(), md.getCreationTime(), md.getLastModificationTime(), md.getTimeSeriesId(), md.getTitle(), md.getCreator(),
md.getTimeSeriesDescription(), md.getTimeSeriesCreationDate(), md.getTimeSeriesDescription(), md.getTimeSeriesCreationDate(),
md.getPublisher(), md.getSourceId(), md.getSourceName(), md.getRights(), md.getDimension(), md.getHeaderLabels()); md.getPublisher(), md.getSourceId(), md.getSourceName(), md.getRights(), md.getDimension(), md.getHeaderLabels());
@ -225,7 +225,7 @@ public class TSArea extends Composite {
flexTable = new FlexTable(); flexTable = new FlexTable();
List<String> filteredHeaders = new LinkedList<String>(); List<String> filteredHeaders = new LinkedList<String>();
SerializableTSFilter tf = sts.getFilter(); TimeSeriesFilter tf = sts.getFilter();
for (Integer colNo : tf.getColsNumberToShow()) { for (Integer colNo : tf.getColsNumberToShow()) {
String toAdd = sts.getTsMetadata().getHeaderLabels().get(colNo); String toAdd = sts.getTsMetadata().getHeaderLabels().get(colNo);
@ -292,7 +292,7 @@ public class TSArea extends Composite {
* *
* @return . * @return .
*/ */
public SerializableTimeSeries getSts() { public RepTimeSeries getSts() {
return sts; return sts;
} }
@ -300,7 +300,7 @@ public class TSArea extends Composite {
* *
* @param sts . * @param sts .
*/ */
public void setSts(SerializableTimeSeries sts) { public void setSts(RepTimeSeries sts) {
this.sts = sts; this.sts = sts;
} }
@ -308,7 +308,7 @@ public class TSArea extends Composite {
* *
* @param tsf the new ts filter * @param tsf the new ts filter
*/ */
public void setNewFilter(SerializableTSFilter tsf) { public void setNewFilter(TimeSeriesFilter tsf) {
this.sts.setFilter(tsf); this.sts.setFilter(tsf);
} }
} }

View File

@ -39,11 +39,11 @@ import org.gcube.portlets.admin.wfdocslibrary.server.db.MyDerbyStore;
import org.gcube.portlets.admin.wfdocslibrary.server.db.Store; import org.gcube.portlets.admin.wfdocslibrary.server.db.Store;
import org.gcube.portlets.d4sreporting.common.server.ServiceUtil; import org.gcube.portlets.d4sreporting.common.server.ServiceUtil;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType; import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent; import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel; import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.SerializableSection; import org.gcube.portlets.d4sreporting.common.shared.BasicSection;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable; import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.TableCell; import org.gcube.portlets.d4sreporting.common.shared.TableCell;
import org.gcube.portlets.docxgenerator.DocxGenerator; import org.gcube.portlets.docxgenerator.DocxGenerator;
import org.gcube.portlets.user.homelibrary.home.HomeLibrary; import org.gcube.portlets.user.homelibrary.home.HomeLibrary;
@ -212,8 +212,8 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
/** /**
* @return a SerializableModel instance of the imported fimes xml * @return a SerializableModel instance of the imported fimes xml
*/ */
public SerializableModel readImportedModel(String tempPath) { public Model readImportedModel(String tempPath) {
SerializableModel toConvert = null; Model toConvert = null;
FileInputStream fis = null; FileInputStream fis = null;
ObjectInputStream in = null; ObjectInputStream in = null;
@ -222,7 +222,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
fis = new FileInputStream(tempPath); fis = new FileInputStream(tempPath);
in = new ObjectInputStream(fis); in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject(); toConvert = (Model) in.readObject();
in.close(); in.close();
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -241,12 +241,12 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @param isImporting says if your importing or youre loading a template in the UI * @param isImporting says if your importing or youre loading a template in the UI
* *
*/ */
public SerializableModel readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting) { public Model readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting) {
ServiceUtil myUtil = new ServiceUtil(getASLSession()); ServiceUtil myUtil = new ServiceUtil(getASLSession());
logger.debug("Reading " + templateName); logger.debug("Reading " + templateName);
if (! ReportConstants.isDeployed) { if (! ReportConstants.isDeployed) {
SerializableModel toConvert = null; Model toConvert = null;
FileInputStream fis = null; FileInputStream fis = null;
ObjectInputStream in = null; ObjectInputStream in = null;
@ -254,7 +254,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
String path = myUtil.getTemplateFolder(getVreName(), getUsername()); String path = myUtil.getTemplateFolder(getVreName(), getUsername());
fis = new FileInputStream(path + "CURRENT_OPEN/CURRENT_OPEN.d4st"); fis = new FileInputStream(path + "CURRENT_OPEN/CURRENT_OPEN.d4st");
in = new ObjectInputStream(fis); in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject(); toConvert = (Model) in.readObject();
in.close(); in.close();
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -367,15 +367,15 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
logger.debug("Loading fileToRead from Disk"); logger.debug("Loading fileToRead from Disk");
SerializableModel toReturn = null; Model toReturn = null;
SerializableModel toConvert = null; Model toConvert = null;
FileInputStream fis = null; FileInputStream fis = null;
ObjectInputStream in = null; ObjectInputStream in = null;
try { try {
fis = new FileInputStream(fileToRead); fis = new FileInputStream(fileToRead);
in = new ObjectInputStream(fis); in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject(); toConvert = (Model) in.readObject();
in.close(); in.close();
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -413,10 +413,10 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
} }
} }
logger.error("FAILED TO READ RETURING EMPTY Serializable Template"); logger.error("FAILED TO READ RETURING EMPTY Serializable Template");
return new SerializableModel(); return new Model();
} }
logger.error("FAILED TO READ FROM BASKET RETURING EMPTY Serializable Template"); logger.error("FAILED TO READ FROM BASKET RETURING EMPTY Serializable Template");
return new SerializableModel(); return new Model();
} }
} }
@ -536,19 +536,19 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
/** /**
* *
*/ */
public String generateTempDocx(SerializableModel model) { public String generateTempDocx(Model model) {
logger.info("Generating docx file"); logger.info("Generating docx file");
DocxGenerator docxGenerator = new DocxGenerator(model); DocxGenerator docxGenerator = new DocxGenerator(model);
logger.debug("DocxGenerator instanciated:"); logger.debug("DocxGenerator instanciated:");
boolean result = docxGenerator.exportInDocx(model); //boolean result = new DocxGenerator(model, true, true);
logger.trace("RESULT:" + result); // logger.trace("RESULT:" + result);
if (! result) // if (! result)
return "ERROR"; // return "ERROR";
File docx = null; File docx = null;
try { try {
docx = docxGenerator.writeOutputTempFile(model.getTemplateName()); docx = docxGenerator.outputTmpFile();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return "ERROR"; return "ERROR";
@ -561,17 +561,17 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @param type the type * @param type the type
* @return true if the generatePDF is successful * @return true if the generatePDF is successful
*/ */
public boolean generateManifestation(SerializableModel model, ExportManifestationType type) { public boolean generateManifestation(Model model, ExportManifestationType type) {
//in case there are dynamic images need to get the from the HL //in case there are dynamic images need to get the from the HL
importDynamicImagesFromHL(model); importDynamicImagesFromHL(model);
//in case there are dynamic TS need to get the CSV from HL and add it to the component //in case there are dynamic TS need to get the CSV from HL and add it to the component
for (SerializableSection section : model.getSections()) { for (BasicSection section : model.getSections()) {
for (SerializableComponent tc : section.getComponents()) { for (BasicComponent tc : section.getComponents()) {
if (tc.getType() == ComponentType.TIME_SERIES) { if (tc.getType() == ComponentType.TIME_SERIES) {
SerializableTimeSeries sts = (SerializableTimeSeries) tc.getPossibleContent(); RepTimeSeries sts = (RepTimeSeries) tc.getPossibleContent();
File toPass = getTimeSeriesFromWorkspace(sts); File toPass = getTimeSeriesFromWorkspace(sts);
if (toPass == null) if (toPass == null)
tc.setPossibleContent(null); tc.setPossibleContent(null);
@ -589,7 +589,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
logger.debug("Model Converted"); logger.debug("Model Converted");
DocxGenerator docxGenerator = new DocxGenerator(model); DocxGenerator docxGenerator = new DocxGenerator(model);
logger.info("DocxGenerator instanciated:"); logger.info("DocxGenerator instanciated:");
result = docxGenerator.exportInDocx(model); // result = docxGenerator.exportInDocx(model, true, true);
logger.trace("RESULT:" + result); logger.trace("RESULT:" + result);
//remove the extension //remove the extension
String exportName = model.getTemplateName(); String exportName = model.getTemplateName();
@ -601,7 +601,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
switch (type) { switch (type) {
case DOCX: case DOCX:
try { try {
File docx = docxGenerator.writeOutputTempFile(exportName); File docx = docxGenerator.outputTmpFile();
logger.debug("Generated docx file: " + docx.getAbsolutePath()); logger.debug("Generated docx file: " + docx.getAbsolutePath());
@ -621,7 +621,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
break; break;
case HTML: case HTML:
try { try {
File html = docxGenerator.createHTML(); File html = docxGenerator.outputHTMLTmpFile();
logger.info("Generated HTML file: " + html.getAbsolutePath()); logger.info("Generated HTML file: " + html.getAbsolutePath());
File toMoveTo = new File(myUtil.getTemplateFolder(getVreName(), getUsername()) + EXPORTS_DIR + File.separator + exportName + ".html"); File toMoveTo = new File(myUtil.getTemplateFolder(getVreName(), getUsername()) + EXPORTS_DIR + File.separator + exportName + ".html");
@ -786,7 +786,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* *
* @return the model previously stored in the session * @return the model previously stored in the session
*/ */
public SerializableModel readTemplateFromSession() { public Model readTemplateFromSession() {
ASLSession d4Session = getASLSession(); ASLSession d4Session = getASLSession();
String templateid = (String) d4Session.getAttribute("idreport"); String templateid = (String) d4Session.getAttribute("idreport");
@ -818,17 +818,17 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
} catch (HomeNotFoundException e) { e.printStackTrace(); } catch (HomeNotFoundException e) { e.printStackTrace();
} catch (ItemNotFoundException e) { e.printStackTrace();} } catch (ItemNotFoundException e) { e.printStackTrace();}
SerializableModel toReturn = readModel(templateName, templateid, false, false); Model toReturn = readModel(templateName, templateid, false, false);
return toReturn; return toReturn;
} }
if (d4Session.getAttribute(CURRENT_REPORT_INSTANCE) != null) if (d4Session.getAttribute(CURRENT_REPORT_INSTANCE) != null)
return (SerializableModel) d4Session.getAttribute(CURRENT_REPORT_INSTANCE) ; return (Model) d4Session.getAttribute(CURRENT_REPORT_INSTANCE) ;
return null; return null;
} }
else { else {
if (d4Session.getAttribute(CURRENT_REPORT_INSTANCE) != null) { if (d4Session.getAttribute(CURRENT_REPORT_INSTANCE) != null) {
logger.debug("getAttribute(\"CURRENT_REPORT_INSTANCE\")..."); logger.debug("getAttribute(\"CURRENT_REPORT_INSTANCE\")...");
SerializableModel model = (SerializableModel) d4Session.getAttribute(CURRENT_REPORT_INSTANCE) ; Model model = (Model) d4Session.getAttribute(CURRENT_REPORT_INSTANCE) ;
logger.debug(model.getTemplateName()); logger.debug(model.getTemplateName());
return model; return model;
@ -864,7 +864,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
/** /**
* @param model to store in the session * @param model to store in the session
*/ */
public void storeTemplateInSession(SerializableModel model) { public void storeTemplateInSession(Model model) {
ASLSession d4Session = getASLSession(); ASLSession d4Session = getASLSession();
d4Session.setAttribute(CURRENT_REPORT_INSTANCE, model); d4Session.setAttribute(CURRENT_REPORT_INSTANCE, model);
// Vector<SerialazableSection> sections = model.getSections(); // Vector<SerialazableSection> sections = model.getSections();
@ -878,13 +878,13 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
} }
private void importDynamicImagesFromHL(SerializableModel model) { private void importDynamicImagesFromHL(Model model) {
ServiceUtil myUtil = new ServiceUtil(getASLSession()); ServiceUtil myUtil = new ServiceUtil(getASLSession());
logger.debug("model == NULL " + (model == null)); logger.debug("model == NULL " + (model == null));
Vector<SerializableSection> sections = model.getSections(); Vector<BasicSection> sections = model.getSections();
for (SerializableSection section : sections) { for (BasicSection section : sections) {
logger.debug("\n\n****section.getComponents() == NULL " + (section.getComponents() == null)); logger.debug("\n\n****section.getComponents() == NULL " + (section.getComponents() == null));
for (SerializableComponent component : section.getComponents()) { for (BasicComponent component : section.getComponents()) {
if (component.getType() == ComponentType.DYNA_IMAGE) { if (component.getType() == ComponentType.DYNA_IMAGE) {
logger.debug("Found DP: " + component.getPossibleContent()); logger.debug("Found DP: " + component.getPossibleContent());
@ -1140,7 +1140,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
*/ */
public void saveReport(String folderid, String newname) { public void saveReport(String folderid, String newname) {
SerializableModel model = readTemplateFromSession(); Model model = readTemplateFromSession();
//raplacing " " with _ //raplacing " " with _
logger.info("Serializing Model basketidToSaveIn: " + folderid ); logger.info("Serializing Model basketidToSaveIn: " + folderid );
@ -1303,10 +1303,10 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @param sTS . * @param sTS .
* @return . * @return .
*/ */
public SerializableTable getSampleTimeSeries(SerializableTimeSeries sTS) { public Table getSampleTimeSeries(RepTimeSeries sTS) {
File csvTS = getTimeSeriesFromWorkspace(sTS); File csvTS = getTimeSeriesFromWorkspace(sTS);
SerializableTable toReturn = null; Table toReturn = null;
try { try {
toReturn = parseCSV(csvTS, sTS); toReturn = parseCSV(csvTS, sTS);
} catch (ParseException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace();
@ -1322,7 +1322,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @param sTS serializable TS * @param sTS serializable TS
* @return a File csv * @return a File csv
*/ */
private File getTimeSeriesFromWorkspace(SerializableTimeSeries sTS) { private File getTimeSeriesFromWorkspace(RepTimeSeries sTS) {
try { try {
String timeSeriesBasketID = sTS.getTsMetadata().getId(); String timeSeriesBasketID = sTS.getTsMetadata().getId();
@ -1367,23 +1367,23 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @throws IOException . * @throws IOException .
* @throws ParseException . * @throws ParseException .
*/ */
private SerializableTable parseCSV(File toParse, final SerializableTimeSeries sTS) throws ParseException , IOException, ProcessingException { private Table parseCSV(File toParse, final RepTimeSeries sTS) throws ParseException , IOException, ProcessingException {
final SerializableTable toReturn; final Table toReturn;
final boolean isFiltered; final boolean isFiltered;
final int fromLine; final int fromLine;
final int toLine; final int toLine;
//if there is no filter //if there is no filter
if ( sTS.getFilter() == null) { if ( sTS.getFilter() == null) {
toReturn = new SerializableTable(sTS.getTsMetadata().getHeaderLabels().size()); toReturn = new Table(sTS.getTsMetadata().getHeaderLabels().size());
isFiltered = false; isFiltered = false;
fromLine = 1; fromLine = 1;
toLine = 10; toLine = 10;
} }
else { else {
int headers = sTS.getFilter().getColsNumberToShow().size(); int headers = sTS.getFilter().getColsNumberToShow().size();
toReturn = new SerializableTable(headers); toReturn = new Table(headers);
isFiltered = true; isFiltered = true;
fromLine = sTS.getFilter().getFrom(); fromLine = sTS.getFilter().getFrom();
toLine = fromLine + 10; toLine = fromLine + 10;
@ -1516,17 +1516,17 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
} }
public SerializableModel getWorkflowDocumentFromDocumentLibrary() { public Model getWorkflowDocumentFromDocumentLibrary() {
ServiceUtil myUtil = new ServiceUtil(getASLSession()); ServiceUtil myUtil = new ServiceUtil(getASLSession());
if (testWorkflow) { if (testWorkflow) {
FileInputStream fis = null; FileInputStream fis = null;
ObjectInputStream in = null; ObjectInputStream in = null;
SerializableModel toConvert = null; Model toConvert = null;
try { try {
fis = new FileInputStream("/Users/massi/portal/CURRENT_OPEN.d4st"); fis = new FileInputStream("/Users/massi/portal/CURRENT_OPEN.d4st");
in = new ObjectInputStream(fis); in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject(); toConvert = (Model) in.readObject();
in.close(); in.close();
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -1568,12 +1568,12 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
FileInputStream fis = null; FileInputStream fis = null;
ObjectInputStream in = null; ObjectInputStream in = null;
SerializableModel toConvert = null; Model toConvert = null;
try { try {
String path = myUtil.getTemplateFolder(getVreName(), getUsername()); String path = myUtil.getTemplateFolder(getVreName(), getUsername());
fis = new FileInputStream(path + "CURRENT_OPEN/CURRENT_OPEN.d4st"); fis = new FileInputStream(path + "CURRENT_OPEN/CURRENT_OPEN.d4st");
in = new ObjectInputStream(fis); in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject(); toConvert = (Model) in.readObject();
in.close(); in.close();
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -1582,7 +1582,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
} }
toConvert.setTemplateName(documentName); toConvert.setTemplateName(documentName);
logger.debug("Converting fileToRead to Serializable object, model name: \n" + toConvert.getTemplateName()); logger.debug("Converting fileToRead to Serializable object, model name: \n" + toConvert.getTemplateName());
SerializableModel toReturn = (toConvert); Model toReturn = (toConvert);
//saves this model as previous one in session //saves this model as previous one in session
getASLSession().setAttribute(PREVIOUS_REPORT_INSTANCE, toConvert); getASLSession().setAttribute(PREVIOUS_REPORT_INSTANCE, toConvert);
@ -1635,13 +1635,13 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ServiceUtil myUtil = new ServiceUtil(session); ServiceUtil myUtil = new ServiceUtil(session);
String workflowid = session.getAttribute(WfDocsLibrary.LAST_WORKFLOW_ID).toString(); String workflowid = session.getAttribute(WfDocsLibrary.LAST_WORKFLOW_ID).toString();
SerializableModel model = null; Model model = null;
String documentWorkflowOwnerId = store.getWorkflowById(workflowid).getAuthor(); String documentWorkflowOwnerId = store.getWorkflowById(workflowid).getAuthor();
String documentWorkflowName = store.getWorkflowById(workflowid).getName(); String documentWorkflowName = store.getWorkflowById(workflowid).getName();
if (update) { if (update) {
logger.debug("SAVING in WorkflowDocument Library "); logger.debug("SAVING in WorkflowDocument Library ");
model = (SerializableModel) session.getAttribute(CURRENT_REPORT_INSTANCE); model = (Model) session.getAttribute(CURRENT_REPORT_INSTANCE);
logger.debug("Trying to convert dynamic images ... "); logger.debug("Trying to convert dynamic images ... ");
importDynamicImagesFromHL(model); importDynamicImagesFromHL(model);

View File

@ -260,6 +260,12 @@ tableBorder td {
padding-left: 0px; padding-left: 0px;
} }
.title-font {
font-size: 16pt;
padding-left: 0px;
padding-bottom: 10px;
}
.heading1 { .heading1 {
background-image: url(images/heading_1.png); background-image: url(images/heading_1.png);
font-size: 12pt; font-size: 12pt;