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.BasicTextArea;
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.Coords;
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
@ -1020,8 +1020,8 @@ public class Presenter {
ClientRepeatableSequence rps = (ClientRepeatableSequence) component.getContent();
wp.addComponentToLayout(rps, component.isDoubleColLayout());
break;
case MASTER_SEQUENCE_LIST:
ClientMasterSequence cmSeq = (ClientMasterSequence) component.getContent();
case TUPLE:
ClientTuple cmSeq = (ClientTuple) component.getContent();
wp.addComponentToLayout(cmSeq, component.isDoubleColLayout());
break;
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.BasicComponent;
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.RepTimeSeries;
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.BasicTextArea;
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.D4sRichTextarea;
import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
@ -347,8 +348,6 @@ public class TemplateComponent {
//GWT.log("FOUND SEQUENCE trying getGroup");
RepeatableSequence repeatableSequence = (RepeatableSequence) sc.getPossibleContent();
//GWT.log("getGroup: " + repeatableSequence.toString());
ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
this.content = rps;
break;
@ -362,17 +361,13 @@ public class TemplateComponent {
}
this.content = tti;
break;
case MASTER_SEQUENCE_LIST:
case TUPLE:
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;
//GWT.log("getGroup: " + repeatableSequence.toString());
//ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
//this.content = rps;
break;
}
}
@ -434,7 +429,6 @@ public class TemplateComponent {
case TITLE:
if (this.isLocked()) {
content = ((HTML) this.content).getText();
}
else
content = ((HeadingTextArea) this.content).getText();
@ -442,7 +436,6 @@ public class TemplateComponent {
case BODY_NOT_FORMATTED:
if (this.isLocked()) {
content = ((HTML) this.content).getText();
}
else
content = ((BasicTextArea) this.content).getText();
@ -481,7 +474,13 @@ public class TemplateComponent {
RepeatableSequence toSave = new RepeatableSequence(getSerializableSequence(tti), height);
content = toSave;
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);
}
@ -490,7 +489,7 @@ public class TemplateComponent {
* @param repSeq
* @return
*/
private ArrayList<BasicComponent> getSerializableSequence(ClientRepeatableSequence repSeq) {
private ArrayList<BasicComponent> getSerializableSequence(ClientSequence repSeq) {
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
for (TemplateComponent tc : repSeq.getGroupedComponents()) {
sComps.add(tc.getSerializable());
@ -511,6 +510,8 @@ public class TemplateComponent {
return sComps;
}
/**
* @return .
*/

View File

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

View File

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