initially all of my three Portlet object is within the same vertical position (where all of them is visually under the same row), but after I have added the setAttribute() method, all three of my Portlet object is now at different vertical position, where it now looks like a stair.
May I know how can I fix this? Below is my codes:
May I know how can I fix this? Below is my codes:
Code:
private Portlet populatePortlet(final int i, final VLayout layout)
{ final Portlet portlet = new Portlet();
portlet.setHeight((countPortletHeight+20)+"px");
portlet.setBodyColor("transparent");
portlet.setBodyStyle("");
portlet.setLayoutMargin(0);
portlet.setShowHeader(false);
portlet.setMinWidth(countPortletMinWidth);
Element portletElement = portlet.getElement();
if(UserDetailService.isDeviceModeHandsetOrTablet()){ dashletPortlet.setWidth100(); }
if(i % 4 == 1)
{ portlet.setBackgroundColor("#EC5B42");
portlet.setCanSelectText(true);
portletElement.setAttribute("PortletId", String.valueOf(portletId));
}else if(i % 4 == 2)
{ portlet.setBackgroundColor("#F2B134");
portlet.setCanSelectText(true);
portletElement.setAttribute("PortletId", String.valueOf(portletId));
}else if(i % 4 == 3)
{ portlet.setBackgroundColor("#2EB997");
portlet.setCanSelectText(true);
portletElement.setAttribute("PortletId", String.valueOf(portletId)); } return portlet; }
private Layout populatePortlet(Integer count, String headerContent, int i)
{ final VLayout vLayout = new VLayout();
vLayout.setWidth100();
vLayout.setHeight100();
vLayout.setBackgroundColor("transparent");
final Label lbl1 = new Label();
lbl1.setContents(Integer.toString(count));
lbl1.setValign(VerticalAlignment.BOTTOM);
lbl1.setWidth100(); lbl1.setHeight("80%");
final Label lbl2 = new Label();
lbl2.setContents(headerContent);
lbl2.setValign(VerticalAlignment.TOP);
lbl2.setWidth100(); lbl2.setHeight("20%");
vLayout.addMember(lbl1); vLayout.addMember(lbl2); return vLayout; }
Comment