Table attributes support implemented
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@70977 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
00486c87fa
commit
ff80982188
|
@ -5,18 +5,18 @@ import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.Attribute;
|
|
||||||
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.Metadata;
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Table;
|
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.Presenter.Presenter;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSelection;
|
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSelection;
|
||||||
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.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.DropImageListener;
|
import org.gcube.portlets.user.reportgenerator.client.targets.DropImageListener;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
|
import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
|
||||||
|
@ -25,16 +25,13 @@ 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.GroupingDelimiterArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.GroupingInnerArea;
|
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.ImageArea;
|
||||||
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.ReportTextArea;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
|
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.user.client.ui.CheckBox;
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.RadioButton;
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
@ -411,21 +408,11 @@ public class TemplateComponent {
|
||||||
break;
|
break;
|
||||||
case ATTRIBUTE_MULTI:
|
case ATTRIBUTE_MULTI:
|
||||||
AttributeMultiSelection att = (AttributeMultiSelection) this.content;
|
AttributeMultiSelection att = (AttributeMultiSelection) this.content;
|
||||||
ArrayList<Attribute> values = new ArrayList<Attribute>();
|
content = att.getSerializable();
|
||||||
for (CheckBox box : att.getBoxes()) {
|
|
||||||
values.add(new Attribute(box.getText().trim(), box.getValue()));
|
|
||||||
}
|
|
||||||
AttributeArea sat= new AttributeArea(att.getAttrName().trim(), values);
|
|
||||||
content = sat;
|
|
||||||
break;
|
break;
|
||||||
case ATTRIBUTE_UNIQUE:
|
case ATTRIBUTE_UNIQUE:
|
||||||
AttributeSingleSelection atu = (AttributeSingleSelection) this.content;
|
AttributeSingleSelection atu = (AttributeSingleSelection) this.content;
|
||||||
ArrayList<Attribute> singlevalues = new ArrayList<Attribute>();
|
content = atu.getSerializable();
|
||||||
for (RadioButton box : atu.getBoxes()) {
|
|
||||||
singlevalues.add(new Attribute(box.getText().trim(), box.getValue()));
|
|
||||||
}
|
|
||||||
AttributeArea satu = new AttributeArea(atu.getAttrName().trim(), singlevalues);
|
|
||||||
content = satu;
|
|
||||||
break;
|
break;
|
||||||
case COMMENT:
|
case COMMENT:
|
||||||
content = ((HTML) this.content).getHTML();
|
content = ((HTML) this.content).getHTML();
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.client.targets;
|
package org.gcube.portlets.user.reportgenerator.client.targets;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Attribute;
|
import org.gcube.portlets.d4sreporting.common.shared.Attribute;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
|
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.user.client.ui.CheckBox;
|
import com.google.gwt.user.client.ui.CheckBox;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
@ -137,6 +138,13 @@ public class AttributeMultiSelection extends Composite {
|
||||||
return attrName;
|
return attrName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AttributeArea getSerializable() {
|
||||||
|
ArrayList<Attribute> values = new ArrayList<Attribute>();
|
||||||
|
for (CheckBox box : getBoxes()) {
|
||||||
|
values.add(new Attribute(box.getText().trim(), box.getValue()));
|
||||||
|
}
|
||||||
|
return new AttributeArea(getAttrName().trim(), values);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.client.targets;
|
package org.gcube.portlets.user.reportgenerator.client.targets;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Attribute;
|
import org.gcube.portlets.d4sreporting.common.shared.Attribute;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
|
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
@ -22,7 +23,7 @@ import com.google.gwt.user.client.ui.RadioButton;
|
||||||
*/
|
*/
|
||||||
public class AttributeSingleSelection extends Composite {
|
public class AttributeSingleSelection extends Composite {
|
||||||
|
|
||||||
private final String RADIO_NAME = "radio_unique";
|
private final String RADIO_NAME = "radio_unique"+(int)(Math.random()*10000);
|
||||||
private HorizontalPanel myPanel;
|
private HorizontalPanel myPanel;
|
||||||
private String attrName;
|
private String attrName;
|
||||||
private RadioButton[] boxes;
|
private RadioButton[] boxes;
|
||||||
|
@ -122,7 +123,7 @@ public class AttributeSingleSelection extends Composite {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ComponentType getType() {
|
public ComponentType getType() {
|
||||||
return ComponentType.ATTRIBUTE_MULTI;
|
return ComponentType.ATTRIBUTE_UNIQUE;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -139,6 +140,13 @@ public class AttributeSingleSelection extends Composite {
|
||||||
return attrName;
|
return attrName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AttributeArea getSerializable() {
|
||||||
|
ArrayList<Attribute> singlevalues = new ArrayList<Attribute>();
|
||||||
|
for (RadioButton box : getBoxes()) {
|
||||||
|
singlevalues.add(new Attribute(box.getText().trim(), box.getValue()));
|
||||||
|
}
|
||||||
|
return new AttributeArea(getAttrName().trim(), singlevalues);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class GenericTable extends Composite {
|
||||||
private FocusPanel focusPanel = new FocusPanel();
|
private FocusPanel focusPanel = new FocusPanel();
|
||||||
|
|
||||||
private VerticalPanel myPanel = new VerticalPanel();
|
private VerticalPanel myPanel = new VerticalPanel();
|
||||||
|
|
||||||
private FlexTable myTable;
|
private FlexTable myTable;
|
||||||
|
|
||||||
Presenter presenter;
|
Presenter presenter;
|
||||||
|
@ -52,6 +53,8 @@ public class GenericTable extends Composite {
|
||||||
|
|
||||||
private boolean isEditTableMode = false;
|
private boolean isEditTableMode = false;
|
||||||
|
|
||||||
|
private AttributeSingleSelection attrSS;
|
||||||
|
|
||||||
private Button cellMerger = new Button("Merge Cells");
|
private Button cellMerger = new Button("Merge Cells");
|
||||||
private Button colMerger = new Button("Merge Selected");
|
private Button colMerger = new Button("Merge Selected");
|
||||||
private Button cancel = new Button("Cancel");
|
private Button cancel = new Button("Cancel");
|
||||||
|
@ -105,7 +108,7 @@ public class GenericTable extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalPanel controlPanel = getControlPanel();
|
HorizontalPanel controlPanel = getControlPanel();
|
||||||
VerticalPanel attributesPanel = getAttributesPanel();
|
VerticalPanel attributesPanel = getAttributesPanel(sTable);
|
||||||
attributesPanel.setStyleName("tableAttributesPanel");
|
attributesPanel.setStyleName("tableAttributesPanel");
|
||||||
|
|
||||||
controlPanel.setStyleName("tableControlPanel");
|
controlPanel.setStyleName("tableControlPanel");
|
||||||
|
@ -162,7 +165,7 @@ public class GenericTable extends Composite {
|
||||||
return cellWidth;
|
return cellWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalPanel getAttributesPanel() {
|
private VerticalPanel getAttributesPanel(Table sTable) {
|
||||||
VerticalPanel toReturn = new VerticalPanel();
|
VerticalPanel toReturn = new VerticalPanel();
|
||||||
|
|
||||||
HorizontalPanel hp1 = new HorizontalPanel();
|
HorizontalPanel hp1 = new HorizontalPanel();
|
||||||
|
@ -170,6 +173,7 @@ public class GenericTable extends Composite {
|
||||||
hp1.add(title);
|
hp1.add(title);
|
||||||
hp1.add(titleTB);
|
hp1.add(titleTB);
|
||||||
titleTB.setWidth("135px");
|
titleTB.setWidth("135px");
|
||||||
|
titleTB.setText(sTable.getTitle());
|
||||||
|
|
||||||
HTML desc = new HTML(" Description: <span style=\"color: red;\">* </span>", true);
|
HTML desc = new HTML(" Description: <span style=\"color: red;\">* </span>", true);
|
||||||
//desc.setStyleName("attributeArea");
|
//desc.setStyleName("attributeArea");
|
||||||
|
@ -177,9 +181,14 @@ public class GenericTable extends Composite {
|
||||||
hp1.add(desc);
|
hp1.add(desc);
|
||||||
hp1.add(descTB);
|
hp1.add(descTB);
|
||||||
descTB.setWidth("435px");
|
descTB.setWidth("435px");
|
||||||
|
descTB.setText(sTable.getDescription());
|
||||||
toReturn.add(hp1);
|
toReturn.add(hp1);
|
||||||
|
|
||||||
AttributeSingleSelection attrSS = new AttributeSingleSelection(presenter, 0, 0, 700, 0, "DisplayType:Token|Inline|Link|Popup");
|
if (sTable.getAttrArea() != null) {
|
||||||
|
attrSS = new AttributeSingleSelection(presenter, 0, 0, 700, 0, sTable.getAttrArea());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
attrSS = new AttributeSingleSelection(presenter, 0, 0, 700, 0, "DisplayType:Token|Inline|Link|Popup");
|
||||||
toReturn.add(attrSS);
|
toReturn.add(attrSS);
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -417,7 +426,10 @@ public class GenericTable extends Composite {
|
||||||
for (int i = 0; i < myTable.getRowCount(); i++) {
|
for (int i = 0; i < myTable.getRowCount(); i++) {
|
||||||
toReturn.addRow(getRow(i));
|
toReturn.addRow(getRow(i));
|
||||||
}
|
}
|
||||||
|
toReturn.setTitle(titleTB.getText());
|
||||||
|
toReturn.setDescription(descTB.getText());
|
||||||
|
|
||||||
|
toReturn.setAttrArea(attrSS.getSerializable());
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,14 +604,13 @@ public class GenericTable extends Composite {
|
||||||
|
|
||||||
|
|
||||||
protected void resetMe() {
|
protected void resetMe() {
|
||||||
myTable.clear();
|
myTable.removeAllRows();
|
||||||
/**
|
/**
|
||||||
* construct the table
|
* construct the table
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < originalTable.getRowCount(); i++) {
|
for (int i = 0; i < originalTable.getRowCount(); i++) {
|
||||||
for (int j = 0; j < originalTable.getColsNo(); j++) {
|
for (int j = 0; j < originalTable.getColsNo(); j++) {
|
||||||
TableCell toPut = new TableCell("");
|
int cellWidth = getCellWidth(originalTable.getColsNo());
|
||||||
int cellWidth = toPut.getCellWidth();
|
|
||||||
GenTableCell toAdd = new GenTableCell(i, j, cellWidth, 1);
|
GenTableCell toAdd = new GenTableCell(i, j, cellWidth, 1);
|
||||||
toAdd.setText("");
|
toAdd.setText("");
|
||||||
toAdd.setStyleName("tableBorder");
|
toAdd.setStyleName("tableBorder");
|
||||||
|
|
Reference in New Issue