2.13 added the attribute block

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@71356 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-03-14 12:02:04 +00:00
parent 73ef91249c
commit 60cc9e1860
6 changed files with 89 additions and 20 deletions

View File

@ -250,27 +250,44 @@ public class TemplateComponent {
break; break;
case ATTRIBUTE_MULTI: case ATTRIBUTE_MULTI:
AttributeMultiSelection ta = null; 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) { if (sc.getPossibleContent() instanceof AttributeArea) {
AttributeArea sata = (AttributeArea) sc.getPossibleContent(); AttributeArea sata = (AttributeArea) sc.getPossibleContent();
//in the metadata in this case there an attribute for diplayType //in the metadata in this case there an attribute for diplayType
if (sc.getMetadata() != null && sc.getMetadata().size() > 0) { ta = new AttributeMultiSelection(presenter, sc.getX(), sc.getY(), width, height, sata, displayBlock);
GWT.log("attr:"+ sc.getMetadata().get(0).getAttribute());
}
ta = new AttributeMultiSelection(presenter, sc.getX(), sc.getY(), width, height, sata, false);
} }
else { 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; this.content = ta;
break; break;
case ATTRIBUTE_UNIQUE: case ATTRIBUTE_UNIQUE:
AttributeSingleSelection atu = null; 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) { if (sc.getPossibleContent() instanceof AttributeArea) {
AttributeArea sata = (AttributeArea) sc.getPossibleContent(); 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 { 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; this.content = atu;
break; break;

View File

@ -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.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.ComplexPanel;
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;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/** /**
* <code> AttributeArea </code> class * <code> AttributeArea </code> class
* *
@ -28,7 +30,7 @@ public class AttributeMultiSelection extends Composite {
/** /**
* Coming form a template constructor * 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 = new HorizontalPanel();
myPanel.setTitle("Attribute Area"); myPanel.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
@ -36,9 +38,18 @@ public class AttributeMultiSelection extends Composite {
myPanel.addStyleName("attributeArea"); myPanel.addStyleName("attributeArea");
attrName = getAttributeName(textToDisplay); attrName = getAttributeName(textToDisplay);
HTML attrNameLabel = new HTML(attrName+":"); HTML attrNameLabel = new HTML(attrName);
attrNameLabel.setStyleName("attribute-name");
attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); 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); boxesPanel.add(attrNameLabel);
myPanel.add(boxesPanel); myPanel.add(boxesPanel);
myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
@ -59,9 +70,17 @@ public class AttributeMultiSelection extends Composite {
myPanel.addStyleName("attributeArea"); myPanel.addStyleName("attributeArea");
attrName = sata.getAttrName(); attrName = sata.getAttrName();
HTML attrNameLabel = new HTML(attrName+":"); HTML attrNameLabel = new HTML(attrName);
attrNameLabel.setStyleName("attribute-name");
attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); 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); boxesPanel.add(attrNameLabel);
myPanel.add(boxesPanel); myPanel.add(boxesPanel);
myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

View File

@ -9,6 +9,7 @@ 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.dom.client.Style.Unit; 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.Composite;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML; 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.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.VerticalPanel;
/** /**
* <code> AttributeArea </code> class * <code> AttributeArea </code> class
* *
@ -31,7 +33,7 @@ public class AttributeSingleSelection extends Composite {
/** /**
* Coming form a template constructor * 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 = new HorizontalPanel();
myPanel.setTitle("Attribute Area"); myPanel.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
@ -39,9 +41,17 @@ public class AttributeSingleSelection extends Composite {
myPanel.addStyleName("attributeArea"); myPanel.addStyleName("attributeArea");
attrName = getAttributeName(textToDisplay); attrName = getAttributeName(textToDisplay);
HTML attrNameLabel = new HTML(attrName+":"); HTML attrNameLabel = new HTML(attrName);
attrNameLabel.setStyleName("attribute-name");
attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); 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); boxesPanel.add(attrNameLabel);
myPanel.add(boxesPanel); myPanel.add(boxesPanel);
myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
@ -54,7 +64,7 @@ public class AttributeSingleSelection extends Composite {
/** /**
* Coming form a report constructor * 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 = new HorizontalPanel();
myPanel.setTitle("Attribute Area"); myPanel.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
@ -62,9 +72,18 @@ public class AttributeSingleSelection extends Composite {
myPanel.addStyleName("attributeArea"); myPanel.addStyleName("attributeArea");
attrName = sata.getAttrName(); attrName = sata.getAttrName();
HTML attrNameLabel = new HTML(attrName+":");
HTML attrNameLabel = new HTML(attrName);
attrNameLabel.setStyleName("attribute-name");
attrNameLabel.getElement().getStyle().setMarginRight(5, Unit.PX); 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); boxesPanel.add(attrNameLabel);
myPanel.add(boxesPanel); myPanel.add(boxesPanel);
myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

View File

@ -197,10 +197,10 @@ public class GenericTable extends Composite {
toReturn.add(hp1); toReturn.add(hp1);
if (sTable.getAttrArea() != null) { 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 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); toReturn.add(attrSS);
return toReturn; return toReturn;

View File

@ -202,6 +202,13 @@ public class TextTableImage extends Composite {
break; break;
} }
} }
if (tc.getType() == ComponentType.DYNA_IMAGE) {
ClientImage toCheck = (ClientImage) tc.getContent();
if (toCheck.equals(w)) {
addedComponents.remove(tc);
break;
}
}
} }
} }

View File

@ -159,6 +159,13 @@ tableBorder td {
padding: 3px; padding: 3px;
} }
.attribute-name {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
padding-top: 8px;
}
.checkAttribute label { .checkAttribute label {
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;