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 @Override
public void onSuccess(Model toLoad) { public void onSuccess(Model toLoad) {
if (toLoad != null) if (toLoad != null) {
loadModel(toLoad, type == VMETypeIdentifier.Vme); loadModel(toLoad, type == VMETypeIdentifier.Vme);
}
else else
Window.alert("Could not Load Report Model, error on server."); 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"); GWT.log("FOUND Master SEQUENCE trying getGroup");
ReportReferences refs = (ReportReferences) sc.getPossibleContent(); ReportReferences refs = (ReportReferences) sc.getPossibleContent();
ArrayList<Tuple> tuple = refs.getTuples(); if (refs != null) {
ArrayList<Tuple> tuple = refs.getTuples();
ClientReportReference cmSeq = new ClientReportReference(presenter, refs.getRefType(), tuple, refs.isSingleRelation()); ClientReportReference cmSeq = new ClientReportReference(presenter, refs.getRefType(), tuple, refs.isSingleRelation());
this.content = cmSeq; this.content = cmSeq;
} else
this.content = new HTML("");
break; break;
} }
} }
@ -521,8 +523,10 @@ public class TemplateComponent {
* @return * @return
*/ */
private ArrayList<BasicComponent> getSerializableSequence(ClientSequence repSeq) { private ArrayList<BasicComponent> getSerializableSequence(ClientSequence repSeq) {
GWT.log("Serializing sequence ... ");
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>(); ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
for (TemplateComponent tc : repSeq.getGroupedComponents()) { for (TemplateComponent tc : repSeq.getGroupedComponents()) {
GWT.log(" Got " + tc.getType());
sComps.add(tc.getSerializable()); sComps.add(tc.getSerializable());
} }
return sComps; 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.d4sreporting.common.shared.Tuple;
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;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier; import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import com.google.gwt.core.shared.GWT; import com.google.gwt.core.shared.GWT;
@ -65,7 +66,8 @@ public class ClientReportReference extends Composite implements ClientSequence {
private void shrinkComponents(ArrayList<Tuple> tupleList) { private void shrinkComponents(ArrayList<Tuple> tupleList) {
for (Tuple seq : tupleList) { for (Tuple seq : tupleList) {
for (BasicComponent bc : seq.getGroupedComponents()) { 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() { public void clearAssociation() {
GWT.log("Clearing Association"); 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()) { for (BasicComponent bc : repSequence.getGroupedComponents()) {
if (bc.getType() == ComponentType.BODY_NOT_FORMATTED) { if (bc.getType() == ComponentType.REPEAT_SEQUENCE_DELIMITER) {
bc.setPossibleContent(""); cleanedRef.add(bc);
bc.setMetadata(new ArrayList<Metadata>());
} }
} }
repSequence.setGroupedComponents(cleanedRef);
//in the VIEW //in the VIEW
for (TemplateComponent tc : seqGroupedComponents) { 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 if (component.getType() == ComponentType.REPEAT_SEQUENCE || component.getType() == ComponentType.BODY_TABLE_IMAGE) { //there could be images inside
RepeatableSequence res = (RepeatableSequence) component.getPossibleContent(); RepeatableSequence res = (RepeatableSequence) component.getPossibleContent();
for (BasicComponent co : res.getGroupedComponents()) { for (BasicComponent co : res.getGroupedComponents()) {
_log.debug("Found Image IN SEQUENCE, type is: " + component.getType()); if (component.getType() == ComponentType.DYNA_IMAGE) {
if (co.getId() != null) { // you need to convert only new images that stay in the HL Workspace, this is the check _log.debug("Found Image IN SEQUENCE, type is: " + component.getType());
String imageID = co.getId(); if (co.getId() != null) { // you need to convert only new images that stay in the HL Workspace, this is the check
co.setPossibleContent(getdDataImagebase64(imageID)); String imageID = co.getId();
_log.trace("Image converted base 64 OK, in SEQUENCE: " + co.getPossibleContent()); co.setPossibleContent(getdDataImagebase64(imageID));
_log.trace("Image converted base 64 OK, in SEQUENCE: " + co.getPossibleContent());
}
} }
} }
} }
@ -1499,7 +1501,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ReportType type = new ReportType(); ReportType type = new ReportType();
type.setTypeIdentifier(refType.toString()); type.setTypeIdentifier(refType.toString());
RsgService rsgClient = new RsgClient(); RsgService rsgClient = new RsgClient();
for (ReportEntry re :rsgClient.listReports(new ReportType(refType.getId()))) { for (ReportEntry re :rsgClient.listReports(new ReportType(refType.getId()))) {
String rfmo = re.getOwner(); String rfmo = re.getOwner();
String name = re.getIdentifier(); String name = re.getIdentifier();
@ -1512,7 +1514,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
@Override @Override
public Model importVMEReport(String id, String name, VMETypeIdentifier refType) { public Model importVMEReport(String id, String name, VMETypeIdentifier refType) {
RsgService rsgClient = new RsgClient(); RsgService rsgClient = new RsgClient();
CompiledReport cr = null; CompiledReport cr = null;
if (refType == VMETypeIdentifier.Vme) { if (refType == VMETypeIdentifier.Vme) {
_log.info("Importing VME id=" + id + " name=" + name); _log.info("Importing VME id=" + id + " name=" + name);
@ -1521,7 +1523,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
else { else {
_log.info("Importing Ref type= " + refType.getId() + " id=" + id + " name=" + name); _log.info("Importing Ref type= " + refType.getId() + " id=" + id + " name=" + name);
cr = rsgClient.getReferenceReportById(new ReportType(refType.getId()), id); cr = rsgClient.getReferenceReportById(new ReportType(refType.getId()), id);
} }
Model model = null; Model model = null;
try { try {
@ -1533,7 +1535,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
} }
return model; return model;
} }
@Override @Override
public Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType) { public Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType) {
RsgService rsgClient = new RsgClient(); RsgService rsgClient = new RsgClient();