diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java index 2a8db7b..8140941 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java @@ -250,27 +250,44 @@ public class TemplateComponent { break; case ATTRIBUTE_MULTI: AttributeMultiSelection ta = null; + //check the metatadata attr display + boolean displayBlock = false; + if (sc.getMetadata() != null && sc.getMetadata().size() > 0) { + for (Metadata md : sc.getMetadata()) { + if (md.getAttribute().equalsIgnoreCase("display") && md.getValue().equalsIgnoreCase("block")) { + displayBlock = true; + break; + } + } + } + //is it is saved as a Report is an instance of this class else is a simple text in a template if (sc.getPossibleContent() instanceof AttributeArea) { AttributeArea sata = (AttributeArea) sc.getPossibleContent(); //in the metadata in this case there an attribute for diplayType - if (sc.getMetadata() != null && sc.getMetadata().size() > 0) { - GWT.log("attr:"+ sc.getMetadata().get(0).getAttribute()); - } - ta = new AttributeMultiSelection(presenter, sc.getX(), sc.getY(), width, height, sata, false); + ta = new AttributeMultiSelection(presenter, sc.getX(), sc.getY(), width, height, sata, displayBlock); } else { - ta = new AttributeMultiSelection(presenter, sc.getX(), sc.getY(), width, height, sc.getPossibleContent().toString()); + ta = new AttributeMultiSelection(presenter, sc.getX(), sc.getY(), width, height, sc.getPossibleContent().toString(), displayBlock); } this.content = ta; break; case ATTRIBUTE_UNIQUE: AttributeSingleSelection atu = null; + boolean displayBlock2 = false; + if (sc.getMetadata() != null && sc.getMetadata().size() > 0) { + for (Metadata md : sc.getMetadata()) { + if (md.getAttribute().equalsIgnoreCase("display") && md.getValue().equalsIgnoreCase("block")) { + displayBlock2 = true; + break; + } + } + } if (sc.getPossibleContent() instanceof AttributeArea) { AttributeArea sata = (AttributeArea) sc.getPossibleContent(); - atu = new AttributeSingleSelection(presenter, sc.getX(), sc.getY(), width, height, sata); + atu = new AttributeSingleSelection(presenter, sc.getX(), sc.getY(), width, height, sata, displayBlock2); } else { - atu = new AttributeSingleSelection(presenter, sc.getX(), sc.getY(), width, height, sc.getPossibleContent().toString()); + atu = new AttributeSingleSelection(presenter, sc.getX(), sc.getY(), width, height, sc.getPossibleContent().toString(), displayBlock2); } this.content = atu; break; diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeMultiSelection.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeMultiSelection.java index 3b07cba..9a13c1b 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeMultiSelection.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeMultiSelection.java @@ -8,12 +8,14 @@ import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.ui.CheckBox; +import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.VerticalPanel; /** * AttributeArea class * @@ -28,7 +30,7 @@ public class AttributeMultiSelection extends Composite { /** * Coming form a template constructor */ - public AttributeMultiSelection(final Presenter presenter, int left, int top, int width, final int height, String textToDisplay) { + public AttributeMultiSelection(final Presenter presenter, int left, int top, int width, final int height, String textToDisplay, boolean displayBlock) { myPanel = new HorizontalPanel(); myPanel.setTitle("Attribute Area"); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); @@ -36,9 +38,18 @@ public class AttributeMultiSelection extends Composite { myPanel.addStyleName("attributeArea"); attrName = getAttributeName(textToDisplay); - HTML attrNameLabel = new HTML(attrName+":"); + HTML attrNameLabel = new HTML(attrName); + attrNameLabel.setStyleName("attribute-name"); attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); - FlowPanel boxesPanel = new FlowPanel(); + + ComplexPanel boxesPanel = null; + if (displayBlock) { + boxesPanel = new VerticalPanel(); //use a vertical panel when display block is requested + attrNameLabel.getElement().getStyle().setPaddingBottom(5, Unit.PX); + } + else { + boxesPanel = new FlowPanel(); + } boxesPanel.add(attrNameLabel); myPanel.add(boxesPanel); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); @@ -59,9 +70,17 @@ public class AttributeMultiSelection extends Composite { myPanel.addStyleName("attributeArea"); attrName = sata.getAttrName(); - HTML attrNameLabel = new HTML(attrName+":"); + HTML attrNameLabel = new HTML(attrName); + attrNameLabel.setStyleName("attribute-name"); attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); - FlowPanel boxesPanel = new FlowPanel(); + ComplexPanel boxesPanel = null; + if (displayBlock) { + boxesPanel = new VerticalPanel(); //use a vertical panel when display block is requested + attrNameLabel.getElement().getStyle().setPaddingBottom(5, Unit.PX); + } + else { + boxesPanel = new FlowPanel(); + } boxesPanel.add(attrNameLabel); myPanel.add(boxesPanel); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeSingleSelection.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeSingleSelection.java index 563492b..ab41250 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeSingleSelection.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/AttributeSingleSelection.java @@ -9,6 +9,7 @@ import org.gcube.portlets.d4sreporting.common.shared.ComponentType; import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter; import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; @@ -16,6 +17,7 @@ import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.RadioButton; +import com.google.gwt.user.client.ui.VerticalPanel; /** * AttributeArea class * @@ -31,7 +33,7 @@ public class AttributeSingleSelection extends Composite { /** * Coming form a template constructor */ - public AttributeSingleSelection(final Presenter presenter, int left, int top, int width, final int height, String textToDisplay) { + public AttributeSingleSelection(final Presenter presenter, int left, int top, int width, final int height, String textToDisplay, boolean displayBlock) { myPanel = new HorizontalPanel(); myPanel.setTitle("Attribute Area"); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); @@ -39,9 +41,17 @@ public class AttributeSingleSelection extends Composite { myPanel.addStyleName("attributeArea"); attrName = getAttributeName(textToDisplay); - HTML attrNameLabel = new HTML(attrName+":"); + HTML attrNameLabel = new HTML(attrName); + attrNameLabel.setStyleName("attribute-name"); attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); - FlowPanel boxesPanel = new FlowPanel(); + ComplexPanel boxesPanel = null; + if (displayBlock) { + boxesPanel = new VerticalPanel(); //use a vertical panel when display block is requested + attrNameLabel.getElement().getStyle().setPaddingBottom(5, Unit.PX); + } + else { + boxesPanel = new FlowPanel(); + } boxesPanel.add(attrNameLabel); myPanel.add(boxesPanel); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); @@ -54,7 +64,7 @@ public class AttributeSingleSelection extends Composite { /** * Coming form a report constructor */ - public AttributeSingleSelection(final Presenter presenter, int left, int top, int width, final int height, AttributeArea sata) { + public AttributeSingleSelection(final Presenter presenter, int left, int top, int width, final int height, AttributeArea sata, boolean displayBlock) { myPanel = new HorizontalPanel(); myPanel.setTitle("Attribute Area"); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); @@ -62,9 +72,18 @@ public class AttributeSingleSelection extends Composite { myPanel.addStyleName("attributeArea"); attrName = sata.getAttrName(); - HTML attrNameLabel = new HTML(attrName+":"); + + HTML attrNameLabel = new HTML(attrName); + attrNameLabel.setStyleName("attribute-name"); attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); - FlowPanel boxesPanel = new FlowPanel(); + ComplexPanel boxesPanel = null; + if (displayBlock) { + boxesPanel = new VerticalPanel(); //use a vertical panel when display block is requested + attrNameLabel.getElement().getStyle().setPaddingBottom(5, Unit.PX); + } + else { + boxesPanel = new FlowPanel(); + } boxesPanel.add(attrNameLabel); myPanel.add(boxesPanel); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/GenericTable.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/GenericTable.java index f1def2e..fe36853 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/GenericTable.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/GenericTable.java @@ -197,10 +197,10 @@ public class GenericTable extends Composite { toReturn.add(hp1); if (sTable.getAttrArea() != null) { - attrSS = new AttributeSingleSelection(presenter, 0, 0, 700, 0, sTable.getAttrArea()); + attrSS = new AttributeSingleSelection(presenter, 0, 0, 700, 0, sTable.getAttrArea(), false); } else - attrSS = new AttributeSingleSelection(presenter, 0, 0, 700, 0, "DisplayType:Inline|Link|Popup"); + attrSS = new AttributeSingleSelection(presenter, 0, 0, 700, 0, "DisplayType:Inline|Link|Popup", false); toReturn.add(attrSS); return toReturn; diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/TextTableImage.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/TextTableImage.java index 4263664..a4e1324 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/TextTableImage.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/TextTableImage.java @@ -202,6 +202,13 @@ public class TextTableImage extends Composite { break; } } + if (tc.getType() == ComponentType.DYNA_IMAGE) { + ClientImage toCheck = (ClientImage) tc.getContent(); + if (toCheck.equals(w)) { + addedComponents.remove(tc); + break; + } + } } } diff --git a/src/main/webapp/ReportGenerator.css b/src/main/webapp/ReportGenerator.css index f3ff41f..d2c2536 100644 --- a/src/main/webapp/ReportGenerator.css +++ b/src/main/webapp/ReportGenerator.css @@ -159,6 +159,13 @@ tableBorder td { padding: 3px; } +.attribute-name { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: bold; + padding-top: 8px; +} + .checkAttribute label { margin-left: 5px; margin-right: 5px;