added support for references

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@84712 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-10-30 23:51:45 +00:00
parent 4e230df547
commit 583dc432d9
4 changed files with 62 additions and 37 deletions

View File

@ -42,7 +42,7 @@ import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSele
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection; import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection;
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.ClientImage; import org.gcube.portlets.user.reportgenerator.client.targets.ClientImage;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientMasterSequence; import org.gcube.portlets.user.reportgenerator.client.targets.ClientTuple;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence; import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
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;
@ -1020,8 +1020,8 @@ public class Presenter {
ClientRepeatableSequence rps = (ClientRepeatableSequence) component.getContent(); ClientRepeatableSequence rps = (ClientRepeatableSequence) component.getContent();
wp.addComponentToLayout(rps, component.isDoubleColLayout()); wp.addComponentToLayout(rps, component.isDoubleColLayout());
break; break;
case MASTER_SEQUENCE_LIST: case TUPLE:
ClientMasterSequence cmSeq = (ClientMasterSequence) component.getContent(); ClientTuple cmSeq = (ClientTuple) component.getContent();
wp.addComponentToLayout(cmSeq, component.isDoubleColLayout()); wp.addComponentToLayout(cmSeq, component.isDoubleColLayout());
break; break;
case BODY_TABLE_IMAGE: case BODY_TABLE_IMAGE:

View File

@ -8,7 +8,7 @@ import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea; import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent; import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType; import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.MasterSequenceList; import org.gcube.portlets.d4sreporting.common.shared.Tuple;
import org.gcube.portlets.d4sreporting.common.shared.Metadata; import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries; import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence; import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
@ -18,7 +18,8 @@ import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSele
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection; import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection;
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.ClientImage; import org.gcube.portlets.user.reportgenerator.client.targets.ClientImage;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientMasterSequence; import org.gcube.portlets.user.reportgenerator.client.targets.ClientSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientTuple;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence; import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
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.DropTSListener; import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
@ -347,8 +348,6 @@ public class TemplateComponent {
//GWT.log("FOUND SEQUENCE trying getGroup"); //GWT.log("FOUND SEQUENCE trying getGroup");
RepeatableSequence repeatableSequence = (RepeatableSequence) sc.getPossibleContent(); RepeatableSequence repeatableSequence = (RepeatableSequence) sc.getPossibleContent();
//GWT.log("getGroup: " + repeatableSequence.toString());
ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence); ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
this.content = rps; this.content = rps;
break; break;
@ -362,17 +361,13 @@ public class TemplateComponent {
} }
this.content = tti; this.content = tti;
break; break;
case MASTER_SEQUENCE_LIST: case TUPLE:
GWT.log("FOUND Master SEQUENCE trying getGroup"); GWT.log("FOUND Master SEQUENCE trying getGroup");
MasterSequenceList masterSequence = (MasterSequenceList) sc.getPossibleContent(); @SuppressWarnings("unchecked")
ArrayList<Tuple> tuple = (ArrayList<Tuple>) sc.getPossibleContent();
ClientMasterSequence cmSeq = new ClientMasterSequence(presenter, masterSequence); ClientTuple cmSeq = new ClientTuple(presenter, tuple);
this.content = cmSeq; this.content = cmSeq;
//GWT.log("getGroup: " + repeatableSequence.toString());
//ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
//this.content = rps;
break; break;
} }
} }
@ -434,7 +429,6 @@ public class TemplateComponent {
case TITLE: case TITLE:
if (this.isLocked()) { if (this.isLocked()) {
content = ((HTML) this.content).getText(); content = ((HTML) this.content).getText();
} }
else else
content = ((HeadingTextArea) this.content).getText(); content = ((HeadingTextArea) this.content).getText();
@ -442,7 +436,6 @@ public class TemplateComponent {
case BODY_NOT_FORMATTED: case BODY_NOT_FORMATTED:
if (this.isLocked()) { if (this.isLocked()) {
content = ((HTML) this.content).getText(); content = ((HTML) this.content).getText();
} }
else else
content = ((BasicTextArea) this.content).getText(); content = ((BasicTextArea) this.content).getText();
@ -481,7 +474,13 @@ public class TemplateComponent {
RepeatableSequence toSave = new RepeatableSequence(getSerializableSequence(tti), height); RepeatableSequence toSave = new RepeatableSequence(getSerializableSequence(tti), height);
content = toSave; content = toSave;
break; break;
case TUPLE:
ClientTuple cTuples = (ClientTuple) this.content;
ArrayList<Tuple> tuples = cTuples.getTupleList();
content = tuples;
break;
} }
return new BasicComponent(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);
} }
@ -490,7 +489,7 @@ public class TemplateComponent {
* @param repSeq * @param repSeq
* @return * @return
*/ */
private ArrayList<BasicComponent> getSerializableSequence(ClientRepeatableSequence repSeq) { private ArrayList<BasicComponent> getSerializableSequence(ClientSequence repSeq) {
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>(); ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
for (TemplateComponent tc : repSeq.getGroupedComponents()) { for (TemplateComponent tc : repSeq.getGroupedComponents()) {
sComps.add(tc.getSerializable()); sComps.add(tc.getSerializable());
@ -511,6 +510,8 @@ public class TemplateComponent {
return sComps; return sComps;
} }
/** /**
* @return . * @return .
*/ */

View File

@ -2,8 +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.MasterSequence; import org.gcube.portlets.d4sreporting.common.shared.Tuple;
import org.gcube.portlets.d4sreporting.common.shared.MasterSequenceList;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence; 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;
@ -15,34 +14,52 @@ import com.google.gwt.user.client.ui.VerticalPanel;
* @author massi * @author massi
* *
*/ */
public class ClientMasterSequence extends Composite implements ClientSequence { public class ClientTuple extends Composite implements ClientSequence {
protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>(); protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
private VerticalPanel myPanel = new VerticalPanel(); private VerticalPanel myPanel = new VerticalPanel();
protected RepeatableSequence repSequence;
protected RepeatableSequence originalSequence = new RepeatableSequence(); private ArrayList<Tuple> tupleList;
private SequenceWidget first;
/** /**
* s * s
* @param p * @param p
* @param ms * @param ms
*/ */
public ClientMasterSequence(Presenter p, MasterSequenceList msl) { public ClientTuple(Presenter p, ArrayList<Tuple> tupleList) {
for (MasterSequence seq : msl.getSequences()) { this.tupleList = tupleList;
if (seq.isSelected()) { for (Tuple seq : tupleList) {
repSequence = seq; if (myPanel.getWidgetCount()==0) { // if is the first one
first = new SequenceWidget(p, this, seq, true, false);
if (tupleList.size() == 1) {
first.enableClear();
} }
myPanel.add(first);
} else {
SequenceWidget seqW = new SequenceWidget(p, this, seq, false, false);
myPanel.add(seqW);
} }
SequenceWidget seqW = new SequenceWidget(p, this, repSequence, true, false);
seqW.enableClear();
myPanel.add(seqW); }
initWidget(myPanel); initWidget(myPanel);
} }
public ArrayList<Tuple> getTupleList() {
return tupleList;
}
public void setTupleList(ArrayList<Tuple> tupleList) {
this.tupleList = tupleList;
}
@Override @Override
public ArrayList<TemplateComponent> getGroupedComponents() { public ArrayList<TemplateComponent> getGroupedComponents() {
return groupedComponents; return groupedComponents;
@ -60,6 +77,9 @@ public class ClientMasterSequence extends Composite implements ClientSequence {
for (TemplateComponent tc : toRemove.getSeqGroupedComponents()) { for (TemplateComponent tc : toRemove.getSeqGroupedComponents()) {
groupedComponents.remove(tc); groupedComponents.remove(tc);
} }
tupleList.remove(toRemove.getSequence());
if (tupleList.size() == 1)
first.enableClear();
return toRemove; return toRemove;
} }

View File

@ -164,4 +164,8 @@ public class SequenceWidget extends Composite {
private void removeMe() { private void removeMe() {
owner.remove(this); owner.remove(this);
} }
public RepeatableSequence getSequence() {
return repSequence;
}
} }