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="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="gcube-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="context-root" value="reports"/>
</wb-module>

View File

@ -117,7 +117,7 @@
<artifactId>csv4j</artifactId>
<version>1.2.0-SNAPSHOT</version>
<scope>${setScope}</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-light-tree</artifactId>
@ -134,7 +134,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-docx-generator</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>${setScope}</scope>
<scope>runtime</scope>
</dependency>
<dependency>
<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.shared.ComponentType;
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.reportgenerator.client.Headerbar;
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.TemplateModel;
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.Coords;
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.GroupingDelimiterArea;
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.TSArea;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
@ -201,11 +201,11 @@ public class Presenter {
currentUser = sessionInfo.getUsername();
currentScope = sessionInfo.getScope();
if (sessionInfo.isWorkflowDocument()) {
model.getModelService().getWorkflowDocumentFromDocumentLibrary(new AsyncCallback<SerializableModel>() {
model.getModelService().getWorkflowDocumentFromDocumentLibrary(new AsyncCallback<Model>() {
public void onFailure(Throwable caught) { }
public void onSuccess(SerializableModel wfReport) {
public void onSuccess(Model wfReport) {
loadModel(wfReport);
header.setMenuForWorkflowDocument(sessionInfo.isEditable());
pollServiceForLockRenewal();
@ -213,9 +213,9 @@ public class Presenter {
});
}
else {
model.getModelService().readTemplateFromSession(new AsyncCallback<SerializableModel>() {
model.getModelService().readTemplateFromSession(new AsyncCallback<Model>() {
public void onFailure(Throwable caught) { }
public void onSuccess(SerializableModel result) {
public void onSuccess(Model result) {
if (result != null) {
loadModel(result);
header.enableExports();
@ -552,7 +552,7 @@ public class Presenter {
* @param beforeSection say where to import this section (before)
* @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);
if (asLastSection)
seekLastPage();
@ -729,7 +729,7 @@ public class Presenter {
};
SerializableModel toSend = model.getSerializableModel();
Model toSend = model.getSerializableModel();
model.getModelService().generateManifestation(toSend, type, callback);
//TODO:
// 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
*/
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) {
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 (isTemplate)
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
*/
public void openImportedFimesXML(String serializedpath) {
model.getModelService().readImportedModel(serializedpath, new AsyncCallback<SerializableModel>() {
model.getModelService().readImportedModel(serializedpath, new AsyncCallback<Model>() {
public void onFailure(Throwable caught) {
Window.alert("Could not Load report, please try again later: " + caught.getMessage());
}
public void onSuccess(SerializableModel toLoad) {
public void onSuccess(Model toLoad) {
loadModel(toLoad);
}
});
@ -864,7 +864,7 @@ public class Presenter {
*
* @param toLoad
*/
private void loadModel(SerializableModel toLoad) {
private void loadModel(Model toLoad) {
//reset the UI
cleanAllNotSession();
@ -1001,7 +1001,7 @@ public class Presenter {
wp.addComponentToLayout(gt, component.isDoubleColLayout());
break;
case ATTRIBUTE_MULTI:
AttributeArea at = (AttributeArea) component.getContent();
ClientAttributeArea at = (ClientAttributeArea) component.getContent();
wp.addComponentToLayout(at, component.isDoubleColLayout());
setCurrCursorPos(uiY);
break;
@ -1018,7 +1018,7 @@ public class Presenter {
wp.addComponentToLayout(gpa, component.isDoubleColLayout());
break;
case REPEAT_SEQUENCE:
RepeatableSequence rps = (RepeatableSequence) component.getContent();
ClientRepeatableSequence rps = (ClientRepeatableSequence) component.getContent();
wp.addComponentToLayout(rps, component.isDoubleColLayout());
break;
}

View File

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

View File

@ -1,8 +1,8 @@
package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
@ -20,7 +20,7 @@ public interface ReportServiceAsync {
* @param sTS .
* @param callback .
*/
void getSampleTimeSeries(SerializableTimeSeries sTS, AsyncCallback<SerializableTable> callback);
void getSampleTimeSeries(RepTimeSeries sTS, AsyncCallback<Table> 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 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 callback .
*/
void generateManifestation(SerializableModel model, ExportManifestationType type, AsyncCallback<Boolean> callback);
void generateManifestation(Model model, ExportManifestationType type, AsyncCallback<Boolean> callback);
/**
*
* @param model .
* @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
* @param callback .
*/
void readTemplateFromSession( AsyncCallback<SerializableModel> callback);
void readTemplateFromSession( AsyncCallback<Model> callback);
/**
* @param callback .
@ -77,11 +77,11 @@ public interface ReportServiceAsync {
*/
void getSessionInfo(String currentHost, AsyncCallback<SessionInfo> callback);
void getWorkflowDocumentFromDocumentLibrary(
AsyncCallback<SerializableModel> callback);
AsyncCallback<Model> callback);
void updateWorkflowDocument(boolean update, AsyncCallback<Void> callback);
void renewLock(AsyncCallback<Void> callback);
void generateTempDocx(SerializableModel model,
void generateTempDocx(Model model,
AsyncCallback<String> callback);
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 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.model.TemplateComponent;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateSection;
@ -62,7 +62,7 @@ public class DeleteCitationsDialog extends Window {
ArrayList<String> citations = new ArrayList<String>();
for (TemplateComponent tc : bibliosection.getAllComponents()) {
if (tc.getType() == ComponentType.BODY) {
SerializableComponent sc = tc.getSerializable();
BasicComponent sc = tc.getSerializable();
citations.add(sc.getPossibleContent().toString());
}
}

View File

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

View File

@ -1,6 +1,6 @@
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.Presenter.Presenter;
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);
VerticalPanel toReplace = new VerticalPanel();
SerializableModel toimportFrom = null;
Model toimportFrom = null;
ListBox listbox = new ListBox();
ListBox listboxCurr = new ListBox();
@ -98,12 +98,12 @@ public class ImporterDialog extends DialogBox {
setWidget(dialogPanel);
AsyncCallback<SerializableModel> callback = new AsyncCallback<SerializableModel>() {
AsyncCallback<Model> callback = new AsyncCallback<Model>() {
public void onFailure(Throwable caught) {
Window.alert("Could not Import template, please try again later: " + caught.getMessage());
}
public void onSuccess(SerializableModel toLoad) {
public void onSuccess(Model 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...");
Grid grid = new Grid(4, 2);

View File

@ -19,7 +19,7 @@ public class TSHeader extends HorizontalPanel {
private HTML myHeader;
private int myColNo;
private FlexTable myTable;
TimeSeriesFilter caller;
TimeSeriesFilterDialog caller;
TSHeader myinstance;
/**
@ -29,7 +29,7 @@ public class TSHeader extends HorizontalPanel {
* @param myColNo .
* @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();
myinstance = this;
caller = tsf;

View File

@ -1,6 +1,6 @@
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.ClickListener;
@ -22,7 +22,7 @@ public class TimeSeriesDialog extends DialogBox {
*
* @param droppedTS .
*/
public TimeSeriesDialog(SerializableTSinfo droppedTS) {
public TimeSeriesDialog(TimeSeriesinfo droppedTS) {
setText(droppedTS.getTitle() + " Details");
String name = droppedTS.getTitle();
String description = droppedTS.getTimeSeriesDescription();

View File

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

View File

@ -1,6 +1,6 @@
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.ClickHandler;
@ -23,7 +23,7 @@ public class TimeSeriesSampleDialog extends DialogBox {
*
* @param table .
*/
public TimeSeriesSampleDialog(SerializableTable table) {
public TimeSeriesSampleDialog(Table table) {
super(true);
setText("TS Sample");
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.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttribute;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableRepeatableSequence;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.Attribute;
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
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.D4sRichTextarea;
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.GroupingInnerArea;
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.TSArea;
@ -149,7 +149,7 @@ public class TemplateComponent {
* @param sc the serialiazble to convert
* @param presenter .
*/
public TemplateComponent(TemplateModel myModel, SerializableComponent sc, Presenter presenter) {
public TemplateComponent(TemplateModel myModel, BasicComponent sc, Presenter presenter) {
this.myModel = myModel;
//
//Coords start = new Coords(x, y);
@ -254,18 +254,18 @@ public class TemplateComponent {
this.content = dp4;
break;
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);
this.content = table;
break;
case ATTRIBUTE_MULTI:
AttributeArea ta = null;
if (sc.getPossibleContent() instanceof SerializableAttributeArea) {
SerializableAttributeArea sata = (SerializableAttributeArea) sc.getPossibleContent();
ta = new AttributeArea(presenter, sc.getX(), sc.getY(), width, height, sata);
ClientAttributeArea ta = null;
if (sc.getPossibleContent() instanceof AttributeArea) {
AttributeArea sata = (AttributeArea) sc.getPossibleContent();
ta = new ClientAttributeArea(presenter, sc.getX(), sc.getY(), width, height, sata);
}
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;
break;
@ -283,9 +283,9 @@ public class TemplateComponent {
break;
case TIME_SERIES:
TSArea tsa;
SerializableTimeSeries sts = null;
RepTimeSeries sts = null;
try {
sts = ((SerializableTimeSeries) sc.getPossibleContent());
sts = ((RepTimeSeries) sc.getPossibleContent());
} catch (ClassCastException e) {
}
@ -311,11 +311,11 @@ public class TemplateComponent {
break;
case REPEAT_SEQUENCE:
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;
break;
}
@ -347,7 +347,7 @@ public class TemplateComponent {
* return a template Component which is serializable
* @return .
*/
public SerializableComponent getSerializable() {
public BasicComponent getSerializable() {
Serializable content = "";
String id = "";
switch (this.getType()) {
@ -392,17 +392,17 @@ public class TemplateComponent {
break;
case FLEX_TABLE:
GenericTable gt = (GenericTable) this.content;
SerializableTable st = gt.getSerializable();
Table st = gt.getSerializable();
content = st;
break;
case ATTRIBUTE_MULTI:
AttributeArea att = (AttributeArea) this.content;
ArrayList<SerializableAttribute> values = new ArrayList<SerializableAttribute>();
ClientAttributeArea att = (ClientAttributeArea) this.content;
ArrayList<Attribute> values = new ArrayList<Attribute>();
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());
SerializableAttributeArea sat= new SerializableAttributeArea(att.getAttrName().trim(), values);
AttributeArea sat= new AttributeArea(att.getAttrName().trim(), values);
content = sat;
break;
case COMMENT:
@ -412,12 +412,12 @@ public class TemplateComponent {
content = ((HTML) this.content).getHTML();
break;
case REPEAT_SEQUENCE:
RepeatableSequence repSeq = (RepeatableSequence) this.content;
SerializableRepeatableSequence toStore = new SerializableRepeatableSequence(getSerializableSequence(repSeq), height);
ClientRepeatableSequence repSeq = (ClientRepeatableSequence) this.content;
RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), height);
content = toStore;
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
* @return
*/
private ArrayList<SerializableComponent> getSerializableSequence(RepeatableSequence repSeq) {
ArrayList<SerializableComponent> sComps = new ArrayList<SerializableComponent>();
private ArrayList<BasicComponent> getSerializableSequence(ClientRepeatableSequence repSeq) {
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
for (TemplateComponent tc : repSeq.getGroupedComponents()) {
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.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.d4sreporting.common.shared.SerializableSection;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.BasicSection;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.ReportService;
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
@ -199,7 +199,7 @@ public class TemplateModel {
TemplateSection singleSection = new TemplateSection();
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());
TemplateComponent referencesTC = new TemplateComponent(this, references, presenter);
@ -215,11 +215,11 @@ public class TemplateModel {
public void addCitation(String citeKey, String citeText) {
String citation ="<b>" + citeKey + ".</b>&nbsp;" + citeText;
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());
TemplateComponent entryTC = new TemplateComponent(this, entry, presenter);
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());
TemplateComponent entryTextTC = new TemplateComponent(this, entryText, presenter);
singleSection.addComponent(entryTextTC);
@ -235,7 +235,7 @@ public class TemplateModel {
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
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
String citation = citationHTML.getText();
if (citation.startsWith(citeKey)) {
@ -263,7 +263,7 @@ public class TemplateModel {
* @param toLoad the SerializableModel instance to load in the model
* @param presenter .
*/
public void loadModel(SerializableModel toLoad, Presenter presenter) {
public void loadModel(Model toLoad, Presenter presenter) {
//loading template from disk
this.author = toLoad.getAuthor();
@ -285,17 +285,17 @@ public class TemplateModel {
//the sections to be transferred
Vector<SerializableSection> sectionsSerialized = toLoad.getSections();
Vector<BasicSection> sectionsSerialized = toLoad.getSections();
//reset current sections container
this.sections = new HashMap<String, TemplateSection>();
//page Number, this model uses a HashMap for each page, the key is the page number
int pageNo = 1;
for (SerializableSection serialazableSection : sectionsSerialized) { //for each section
for (BasicSection serialazableSection : sectionsSerialized) { //for each section
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));
}
//TODO: load also metadata
@ -314,14 +314,14 @@ public class TemplateModel {
* @param beforeSection say where to import this section (before)
* @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;
//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>();
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));
}
//TODO: load also metadata
@ -369,8 +369,8 @@ public class TemplateModel {
*
* @return a serialized version od the model
*/
public SerializableModel getSerializableModel() {
Vector<SerializableSection> serializedsections = new Vector<SerializableSection>();
public Model getSerializableModel() {
Vector<BasicSection> serializedsections = new Vector<BasicSection>();
for (int i = 1; i <= sections.size(); i++) {
//the pages
@ -379,9 +379,9 @@ public class TemplateModel {
TemplateSection singleSection = sections.get(pageNo);
List<TemplateComponent> templateElements = singleSection.getAllComponents();
List<SerializableComponent> serialazableComponents = new LinkedList<SerializableComponent>();
List<BasicComponent> serialazableComponents = new LinkedList<BasicComponent>();
//construct the serialized section
SerializableSection aSection = new SerializableSection();
BasicSection aSection = new BasicSection();
//copy the components
for (TemplateComponent tc : templateElements)
serialazableComponents.add(tc.getSerializable());
@ -395,8 +395,8 @@ public class TemplateModel {
}
SerializableModel toReturn =
new SerializableModel("UniqueID", author, dateCreated, lastEdit, lastEditBy, templateName, columnWidth, currentPage, marginBottom, marginLeft, marginRight, marginTop,
Model toReturn =
new Model("UniqueID", author, dateCreated, lastEdit, lastEditBy, templateName, columnWidth, currentPage, marginBottom, marginLeft, marginRight, marginTop,
pageHeight, pageWidth, serializedsections, totalPages, metadata);
return toReturn;
@ -500,7 +500,7 @@ public class TemplateModel {
public void onSuccess(Object result) { }
};
SerializableModel modelToSend = getSerializableModel();
Model modelToSend = getSerializableModel();
GWT.log("Storing in session: currpage = " + modelToSend.getCurrPage(), null);
@ -647,8 +647,8 @@ public class TemplateModel {
TemplateSection section = (TemplateSection) entry.getValue();
for (TemplateComponent tc : section.getAllComponents()) {
if (tc.getType() == ComponentType.TIME_SERIES) {
SerializableComponent sc = tc.getSerializable();
SerializableTimeSeries sts = (SerializableTimeSeries) sc.getPossibleContent();
BasicComponent sc = tc.getSerializable();
RepTimeSeries sts = (RepTimeSeries) sc.getPossibleContent();
if (sts.getFilter() != null) {
int from = sts.getFilter().getFrom();
int to = sts.getFilter().getTo();

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttribute;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.Attribute;
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
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
* @version April 2011 (1.0)
*/
public class AttributeArea extends Composite {
public class ClientAttributeArea extends Composite {
private HorizontalPanel myPanel;
private String attrName;
@ -28,7 +28,7 @@ public class AttributeArea extends Composite {
/**
* 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.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
@ -51,7 +51,7 @@ public class AttributeArea extends Composite {
/**
* 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.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
@ -68,7 +68,7 @@ public class AttributeArea extends Composite {
int values = sata.getValues().size();
boxes = new CheckBox[values];
int j = 0;
for (SerializableAttribute attr: sata.getValues()) {
for (Attribute attr: sata.getValues()) {
CheckBox toAdd = new CheckBox(attr.getName());
toAdd.setStyleName("checkAttribute");
toAdd.setValue(attr.getValue());

View File

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

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.user.reportgenerator.client.targets;
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.user.reportgenerator.client.Presenter.Presenter;
@ -36,7 +36,7 @@ public class GenericTable extends Composite {
* constructor called when reading the model
* @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);
this.rows = sTable.getRowCount();
@ -107,8 +107,8 @@ public class GenericTable extends Composite {
*
* @return
*/
public SerializableTable getSerializable() {
SerializableTable toReturn = new SerializableTable(this.cols);
public Table getSerializable() {
Table toReturn = new Table(this.cols);
for (int i = 0; i < myTable.getRowCount(); 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.List;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSFilter;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSinfo;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.TimeSeriesFilter;
import org.gcube.portlets.d4sreporting.common.shared.TimeSeriesinfo;
import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
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.TimeSeriesFilter;
import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesFilterDialog;
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.folder.item.GWTTimeSeries;
@ -40,7 +40,7 @@ import com.google.gwt.user.client.ui.Label;
public class TSArea extends Composite {
private VerticalPanel mainPanel;
private SerializableTimeSeries sts = new SerializableTimeSeries();
private RepTimeSeries sts = new RepTimeSeries();
private String idInBasket;
private Presenter presenter;
private FlexTable flexTable;
@ -56,7 +56,7 @@ public class TSArea extends Composite {
* @param height .
* @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;
this.presenter = presenter;
mainPanel = new VerticalPanel();
@ -83,7 +83,7 @@ public class TSArea extends Composite {
* called when dropped a TS on the area
* @param toShow the TS to show
*/
public void showTS(SerializableTSinfo toShow) {
public void showTS(TimeSeriesinfo toShow) {
mainPanel.removeAll();
mainPanel.removeStyleName("timeseriesArea_bg");
tableContainer.removeAll();
@ -152,7 +152,7 @@ public class TSArea extends Composite {
ClickHandler applyFilterTs = new ClickHandler() {
public void onClick(ClickEvent event) {
TimeSeriesFilter dlg = new TimeSeriesFilter(singleton, sts);
TimeSeriesFilterDialog dlg = new TimeSeriesFilterDialog(singleton, sts);
//dlg.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop());
dlg.setAnimationEnabled(true);
dlg.show();
@ -162,11 +162,11 @@ public class TSArea extends Composite {
ClickHandler showTSSample = new ClickHandler() {
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 onSuccess(SerializableTable result) {
SerializableTable toPass = result;
public void onSuccess(Table result) {
Table toPass = result;
TimeSeriesSampleDialog dlg = new TimeSeriesSampleDialog(toPass);
dlg.setAnimationEnabled(true);
dlg.show();
@ -180,8 +180,8 @@ public class TSArea extends Composite {
*/
public void dropTS(GWTTimeSeries droppedTS) {
idInBasket = droppedTS.getId();
SerializableTSinfo tsMetadata = convertWSTS2SerialazableTS(droppedTS);
sts = new SerializableTimeSeries(null, tsMetadata);
TimeSeriesinfo tsMetadata = convertWSTS2SerialazableTS(droppedTS);
sts = new RepTimeSeries(null, tsMetadata);
GWT.log("showTS TS");
showTS(tsMetadata);
}
@ -208,8 +208,8 @@ public class TSArea extends Composite {
* @param md the TS metadata to convert
* @return
*/
private SerializableTSinfo convertWSTS2SerialazableTS(GWTTimeSeries md) {
SerializableTSinfo tsMetadata = new SerializableTSinfo(md.getId(), md.getName(), md.getDescription(), md.getOwner(),
private TimeSeriesinfo convertWSTS2SerialazableTS(GWTTimeSeries md) {
TimeSeriesinfo tsMetadata = new TimeSeriesinfo(md.getId(), md.getName(), md.getDescription(), md.getOwner(),
md.getCreationTime(), md.getLastModificationTime(), md.getTimeSeriesId(), md.getTitle(), md.getCreator(),
md.getTimeSeriesDescription(), md.getTimeSeriesCreationDate(),
md.getPublisher(), md.getSourceId(), md.getSourceName(), md.getRights(), md.getDimension(), md.getHeaderLabels());
@ -225,7 +225,7 @@ public class TSArea extends Composite {
flexTable = new FlexTable();
List<String> filteredHeaders = new LinkedList<String>();
SerializableTSFilter tf = sts.getFilter();
TimeSeriesFilter tf = sts.getFilter();
for (Integer colNo : tf.getColsNumberToShow()) {
String toAdd = sts.getTsMetadata().getHeaderLabels().get(colNo);
@ -292,7 +292,7 @@ public class TSArea extends Composite {
*
* @return .
*/
public SerializableTimeSeries getSts() {
public RepTimeSeries getSts() {
return sts;
}
@ -300,7 +300,7 @@ public class TSArea extends Composite {
*
* @param sts .
*/
public void setSts(SerializableTimeSeries sts) {
public void setSts(RepTimeSeries sts) {
this.sts = sts;
}
@ -308,7 +308,7 @@ public class TSArea extends Composite {
*
* @param tsf the new ts filter
*/
public void setNewFilter(SerializableTSFilter tsf) {
public void setNewFilter(TimeSeriesFilter 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.d4sreporting.common.server.ServiceUtil;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.d4sreporting.common.shared.SerializableSection;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.BasicSection;
import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.TableCell;
import org.gcube.portlets.docxgenerator.DocxGenerator;
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
*/
public SerializableModel readImportedModel(String tempPath) {
SerializableModel toConvert = null;
public Model readImportedModel(String tempPath) {
Model toConvert = null;
FileInputStream fis = null;
ObjectInputStream in = null;
@ -222,7 +222,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
fis = new FileInputStream(tempPath);
in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject();
toConvert = (Model) in.readObject();
in.close();
} catch (IOException ex) {
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
*
*/
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());
logger.debug("Reading " + templateName);
if (! ReportConstants.isDeployed) {
SerializableModel toConvert = null;
Model toConvert = null;
FileInputStream fis = null;
ObjectInputStream in = null;
@ -254,7 +254,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
String path = myUtil.getTemplateFolder(getVreName(), getUsername());
fis = new FileInputStream(path + "CURRENT_OPEN/CURRENT_OPEN.d4st");
in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject();
toConvert = (Model) in.readObject();
in.close();
} catch (IOException ex) {
ex.printStackTrace();
@ -367,15 +367,15 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
logger.debug("Loading fileToRead from Disk");
SerializableModel toReturn = null;
SerializableModel toConvert = null;
Model toReturn = null;
Model toConvert = null;
FileInputStream fis = null;
ObjectInputStream in = null;
try {
fis = new FileInputStream(fileToRead);
in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject();
toConvert = (Model) in.readObject();
in.close();
} catch (IOException ex) {
ex.printStackTrace();
@ -413,10 +413,10 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
}
}
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");
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");
DocxGenerator docxGenerator = new DocxGenerator(model);
logger.debug("DocxGenerator instanciated:");
boolean result = docxGenerator.exportInDocx(model);
logger.trace("RESULT:" + result);
if (! result)
return "ERROR";
//boolean result = new DocxGenerator(model, true, true);
// logger.trace("RESULT:" + result);
// if (! result)
// return "ERROR";
File docx = null;
try {
docx = docxGenerator.writeOutputTempFile(model.getTemplateName());
docx = docxGenerator.outputTmpFile();
} catch (Exception e) {
e.printStackTrace();
return "ERROR";
@ -561,17 +561,17 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @param type the type
* @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
importDynamicImagesFromHL(model);
//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 (SerializableComponent tc : section.getComponents()) {
for (BasicSection section : model.getSections()) {
for (BasicComponent tc : section.getComponents()) {
if (tc.getType() == ComponentType.TIME_SERIES) {
SerializableTimeSeries sts = (SerializableTimeSeries) tc.getPossibleContent();
RepTimeSeries sts = (RepTimeSeries) tc.getPossibleContent();
File toPass = getTimeSeriesFromWorkspace(sts);
if (toPass == null)
tc.setPossibleContent(null);
@ -589,7 +589,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
logger.debug("Model Converted");
DocxGenerator docxGenerator = new DocxGenerator(model);
logger.info("DocxGenerator instanciated:");
result = docxGenerator.exportInDocx(model);
// result = docxGenerator.exportInDocx(model, true, true);
logger.trace("RESULT:" + result);
//remove the extension
String exportName = model.getTemplateName();
@ -601,7 +601,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
switch (type) {
case DOCX:
try {
File docx = docxGenerator.writeOutputTempFile(exportName);
File docx = docxGenerator.outputTmpFile();
logger.debug("Generated docx file: " + docx.getAbsolutePath());
@ -621,7 +621,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
break;
case HTML:
try {
File html = docxGenerator.createHTML();
File html = docxGenerator.outputHTMLTmpFile();
logger.info("Generated HTML file: " + html.getAbsolutePath());
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
*/
public SerializableModel readTemplateFromSession() {
public Model readTemplateFromSession() {
ASLSession d4Session = getASLSession();
String templateid = (String) d4Session.getAttribute("idreport");
@ -818,17 +818,17 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
} catch (HomeNotFoundException e) { e.printStackTrace();
} catch (ItemNotFoundException e) { e.printStackTrace();}
SerializableModel toReturn = readModel(templateName, templateid, false, false);
Model toReturn = readModel(templateName, templateid, false, false);
return toReturn;
}
if (d4Session.getAttribute(CURRENT_REPORT_INSTANCE) != null)
return (SerializableModel) d4Session.getAttribute(CURRENT_REPORT_INSTANCE) ;
return (Model) d4Session.getAttribute(CURRENT_REPORT_INSTANCE) ;
return null;
}
else {
if (d4Session.getAttribute(CURRENT_REPORT_INSTANCE) != null) {
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());
return model;
@ -864,7 +864,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
/**
* @param model to store in the session
*/
public void storeTemplateInSession(SerializableModel model) {
public void storeTemplateInSession(Model model) {
ASLSession d4Session = getASLSession();
d4Session.setAttribute(CURRENT_REPORT_INSTANCE, model);
// 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());
logger.debug("model == NULL " + (model == null));
Vector<SerializableSection> sections = model.getSections();
for (SerializableSection section : sections) {
Vector<BasicSection> sections = model.getSections();
for (BasicSection section : sections) {
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) {
logger.debug("Found DP: " + component.getPossibleContent());
@ -1140,7 +1140,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
*/
public void saveReport(String folderid, String newname) {
SerializableModel model = readTemplateFromSession();
Model model = readTemplateFromSession();
//raplacing " " with _
logger.info("Serializing Model basketidToSaveIn: " + folderid );
@ -1303,10 +1303,10 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @param sTS .
* @return .
*/
public SerializableTable getSampleTimeSeries(SerializableTimeSeries sTS) {
public Table getSampleTimeSeries(RepTimeSeries sTS) {
File csvTS = getTimeSeriesFromWorkspace(sTS);
SerializableTable toReturn = null;
Table toReturn = null;
try {
toReturn = parseCSV(csvTS, sTS);
} catch (ParseException e) { e.printStackTrace();
@ -1322,7 +1322,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @param sTS serializable TS
* @return a File csv
*/
private File getTimeSeriesFromWorkspace(SerializableTimeSeries sTS) {
private File getTimeSeriesFromWorkspace(RepTimeSeries sTS) {
try {
String timeSeriesBasketID = sTS.getTsMetadata().getId();
@ -1367,23 +1367,23 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* @throws IOException .
* @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 int fromLine;
final int toLine;
//if there is no filter
if ( sTS.getFilter() == null) {
toReturn = new SerializableTable(sTS.getTsMetadata().getHeaderLabels().size());
toReturn = new Table(sTS.getTsMetadata().getHeaderLabels().size());
isFiltered = false;
fromLine = 1;
toLine = 10;
}
else {
int headers = sTS.getFilter().getColsNumberToShow().size();
toReturn = new SerializableTable(headers);
toReturn = new Table(headers);
isFiltered = true;
fromLine = sTS.getFilter().getFrom();
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());
if (testWorkflow) {
FileInputStream fis = null;
ObjectInputStream in = null;
SerializableModel toConvert = null;
Model toConvert = null;
try {
fis = new FileInputStream("/Users/massi/portal/CURRENT_OPEN.d4st");
in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject();
toConvert = (Model) in.readObject();
in.close();
} catch (IOException ex) {
ex.printStackTrace();
@ -1568,12 +1568,12 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
FileInputStream fis = null;
ObjectInputStream in = null;
SerializableModel toConvert = null;
Model toConvert = null;
try {
String path = myUtil.getTemplateFolder(getVreName(), getUsername());
fis = new FileInputStream(path + "CURRENT_OPEN/CURRENT_OPEN.d4st");
in = new ObjectInputStream(fis);
toConvert = (SerializableModel) in.readObject();
toConvert = (Model) in.readObject();
in.close();
} catch (IOException ex) {
ex.printStackTrace();
@ -1582,7 +1582,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
}
toConvert.setTemplateName(documentName);
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
getASLSession().setAttribute(PREVIOUS_REPORT_INSTANCE, toConvert);
@ -1635,13 +1635,13 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ServiceUtil myUtil = new ServiceUtil(session);
String workflowid = session.getAttribute(WfDocsLibrary.LAST_WORKFLOW_ID).toString();
SerializableModel model = null;
Model model = null;
String documentWorkflowOwnerId = store.getWorkflowById(workflowid).getAuthor();
String documentWorkflowName = store.getWorkflowById(workflowid).getName();
if (update) {
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 ... ");
importDynamicImagesFromHL(model);

View File

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