fixed bug when saving sequnces in workspace

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@86687 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-12-06 17:23:49 +00:00
parent ebe705fd16
commit 5b66b78810
5 changed files with 29 additions and 19 deletions

View File

@ -1208,8 +1208,9 @@ public class Presenter {
@Override
public void onSuccess(Model toLoad) {
if (toLoad != null)
if (toLoad != null) {
loadModel(toLoad, type == VMETypeIdentifier.Vme);
}
else
Window.alert("Could not Load Report Model, error on server.");
}

View File

@ -374,10 +374,12 @@ public class TemplateComponent {
GWT.log("FOUND Master SEQUENCE trying getGroup");
ReportReferences refs = (ReportReferences) sc.getPossibleContent();
ArrayList<Tuple> tuple = refs.getTuples();
ClientReportReference cmSeq = new ClientReportReference(presenter, refs.getRefType(), tuple, refs.isSingleRelation());
this.content = cmSeq;
if (refs != null) {
ArrayList<Tuple> tuple = refs.getTuples();
ClientReportReference cmSeq = new ClientReportReference(presenter, refs.getRefType(), tuple, refs.isSingleRelation());
this.content = cmSeq;
} else
this.content = new HTML("");
break;
}
}
@ -521,8 +523,10 @@ public class TemplateComponent {
* @return
*/
private ArrayList<BasicComponent> getSerializableSequence(ClientSequence repSeq) {
GWT.log("Serializing sequence ... ");
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
for (TemplateComponent tc : repSeq.getGroupedComponents()) {
GWT.log(" Got " + tc.getType());
sComps.add(tc.getSerializable());
}
return sComps;

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
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.TemplateModel;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import com.google.gwt.core.shared.GWT;
@ -65,7 +66,8 @@ public class ClientReportReference extends Composite implements ClientSequence {
private void shrinkComponents(ArrayList<Tuple> tupleList) {
for (Tuple seq : tupleList) {
for (BasicComponent bc : seq.getGroupedComponents()) {
bc.setWidth(bc.getWidth()-(indentationValue+5));
if (bc.getWidth() >= (TemplateModel.TEMPLATE_WIDTH - 50))
bc.setWidth(bc.getWidth()-(indentationValue+5));
}
}
}

View File

@ -142,13 +142,14 @@ public class SequenceWidget extends Composite {
public void clearAssociation() {
GWT.log("Clearing Association");
//in the MODEL
//in the MODEL leave only the delimiters
ArrayList<BasicComponent> cleanedRef = new ArrayList<BasicComponent>();
for (BasicComponent bc : repSequence.getGroupedComponents()) {
if (bc.getType() == ComponentType.BODY_NOT_FORMATTED) {
bc.setPossibleContent("");
bc.setMetadata(new ArrayList<Metadata>());
if (bc.getType() == ComponentType.REPEAT_SEQUENCE_DELIMITER) {
cleanedRef.add(bc);
}
}
repSequence.setGroupedComponents(cleanedRef);
//in the VIEW
for (TemplateComponent tc : seqGroupedComponents) {

View File

@ -680,11 +680,13 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
if (component.getType() == ComponentType.REPEAT_SEQUENCE || component.getType() == ComponentType.BODY_TABLE_IMAGE) { //there could be images inside
RepeatableSequence res = (RepeatableSequence) component.getPossibleContent();
for (BasicComponent co : res.getGroupedComponents()) {
_log.debug("Found Image IN SEQUENCE, type is: " + component.getType());
if (co.getId() != null) { // you need to convert only new images that stay in the HL Workspace, this is the check
String imageID = co.getId();
co.setPossibleContent(getdDataImagebase64(imageID));
_log.trace("Image converted base 64 OK, in SEQUENCE: " + co.getPossibleContent());
if (component.getType() == ComponentType.DYNA_IMAGE) {
_log.debug("Found Image IN SEQUENCE, type is: " + component.getType());
if (co.getId() != null) { // you need to convert only new images that stay in the HL Workspace, this is the check
String imageID = co.getId();
co.setPossibleContent(getdDataImagebase64(imageID));
_log.trace("Image converted base 64 OK, in SEQUENCE: " + co.getPossibleContent());
}
}
}
}