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.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.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.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.targets.AttributeMultiSelection;
|
||||
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.ClientRepeatableSequence;
|
||||
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.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.GroupingInnerArea;
|
||||
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.TSArea;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
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.Image;
|
||||
import com.google.gwt.user.client.ui.RadioButton;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
|
@ -411,21 +408,11 @@ public class TemplateComponent {
|
|||
break;
|
||||
case ATTRIBUTE_MULTI:
|
||||
AttributeMultiSelection att = (AttributeMultiSelection) this.content;
|
||||
ArrayList<Attribute> values = new ArrayList<Attribute>();
|
||||
for (CheckBox box : att.getBoxes()) {
|
||||
values.add(new Attribute(box.getText().trim(), box.getValue()));
|
||||
}
|
||||
AttributeArea sat= new AttributeArea(att.getAttrName().trim(), values);
|
||||
content = sat;
|
||||
content = att.getSerializable();
|
||||
break;
|
||||
case ATTRIBUTE_UNIQUE:
|
||||
AttributeSingleSelection atu = (AttributeSingleSelection) this.content;
|
||||
ArrayList<Attribute> singlevalues = new ArrayList<Attribute>();
|
||||
for (RadioButton box : atu.getBoxes()) {
|
||||
singlevalues.add(new Attribute(box.getText().trim(), box.getValue()));
|
||||
}
|
||||
AttributeArea satu = new AttributeArea(atu.getAttrName().trim(), singlevalues);
|
||||
content = satu;
|
||||
content = atu.getSerializable();
|
||||
break;
|
||||
case COMMENT:
|
||||
content = ((HTML) this.content).getHTML();
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
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.AttributeArea;
|
||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||
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.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
@ -137,6 +138,13 @@ public class AttributeMultiSelection extends Composite {
|
|||
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;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.d4sreporting.common.shared.Attribute;
|
||||
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 com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
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 {
|
||||
|
||||
private final String RADIO_NAME = "radio_unique";
|
||||
private final String RADIO_NAME = "radio_unique"+(int)(Math.random()*10000);
|
||||
private HorizontalPanel myPanel;
|
||||
private String attrName;
|
||||
private RadioButton[] boxes;
|
||||
|
@ -122,7 +123,7 @@ public class AttributeSingleSelection extends Composite {
|
|||
* @return
|
||||
*/
|
||||
public ComponentType getType() {
|
||||
return ComponentType.ATTRIBUTE_MULTI;
|
||||
return ComponentType.ATTRIBUTE_UNIQUE;
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -139,6 +140,13 @@ public class AttributeSingleSelection extends Composite {
|
|||
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 VerticalPanel myPanel = new VerticalPanel();
|
||||
|
||||
private FlexTable myTable;
|
||||
|
||||
Presenter presenter;
|
||||
|
@ -52,6 +53,8 @@ public class GenericTable extends Composite {
|
|||
|
||||
private boolean isEditTableMode = false;
|
||||
|
||||
private AttributeSingleSelection attrSS;
|
||||
|
||||
private Button cellMerger = new Button("Merge Cells");
|
||||
private Button colMerger = new Button("Merge Selected");
|
||||
private Button cancel = new Button("Cancel");
|
||||
|
@ -105,7 +108,7 @@ public class GenericTable extends Composite {
|
|||
}
|
||||
|
||||
HorizontalPanel controlPanel = getControlPanel();
|
||||
VerticalPanel attributesPanel = getAttributesPanel();
|
||||
VerticalPanel attributesPanel = getAttributesPanel(sTable);
|
||||
attributesPanel.setStyleName("tableAttributesPanel");
|
||||
|
||||
controlPanel.setStyleName("tableControlPanel");
|
||||
|
@ -162,7 +165,7 @@ public class GenericTable extends Composite {
|
|||
return cellWidth;
|
||||
}
|
||||
|
||||
private VerticalPanel getAttributesPanel() {
|
||||
private VerticalPanel getAttributesPanel(Table sTable) {
|
||||
VerticalPanel toReturn = new VerticalPanel();
|
||||
|
||||
HorizontalPanel hp1 = new HorizontalPanel();
|
||||
|
@ -170,6 +173,7 @@ public class GenericTable extends Composite {
|
|||
hp1.add(title);
|
||||
hp1.add(titleTB);
|
||||
titleTB.setWidth("135px");
|
||||
titleTB.setText(sTable.getTitle());
|
||||
|
||||
HTML desc = new HTML(" Description: <span style=\"color: red;\">* </span>", true);
|
||||
//desc.setStyleName("attributeArea");
|
||||
|
@ -177,9 +181,14 @@ public class GenericTable extends Composite {
|
|||
hp1.add(desc);
|
||||
hp1.add(descTB);
|
||||
descTB.setWidth("435px");
|
||||
descTB.setText(sTable.getDescription());
|
||||
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);
|
||||
|
||||
return toReturn;
|
||||
|
@ -417,7 +426,10 @@ public class GenericTable extends Composite {
|
|||
for (int i = 0; i < myTable.getRowCount(); i++) {
|
||||
toReturn.addRow(getRow(i));
|
||||
}
|
||||
toReturn.setTitle(titleTB.getText());
|
||||
toReturn.setDescription(descTB.getText());
|
||||
|
||||
toReturn.setAttrArea(attrSS.getSerializable());
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
@ -592,14 +604,13 @@ public class GenericTable extends Composite {
|
|||
|
||||
|
||||
protected void resetMe() {
|
||||
myTable.clear();
|
||||
myTable.removeAllRows();
|
||||
/**
|
||||
* construct the table
|
||||
*/
|
||||
for (int i = 0; i < originalTable.getRowCount(); i++) {
|
||||
for (int j = 0; j < originalTable.getColsNo(); j++) {
|
||||
TableCell toPut = new TableCell("");
|
||||
int cellWidth = toPut.getCellWidth();
|
||||
int cellWidth = getCellWidth(originalTable.getColsNo());
|
||||
GenTableCell toAdd = new GenTableCell(i, j, cellWidth, 1);
|
||||
toAdd.setText("");
|
||||
toAdd.setStyleName("tableBorder");
|
||||
|
|
Reference in New Issue