By creating a panel with the value set in FormLayout to layout seen in the
following code:
FormLayout formLayout;
formLayout = new FormLayout();
formLayout.setHideLabels(true);
Panel fieldP = ExtUtil.newCleanPanel();
fieldP.setLayout(formLayout);
We noticed a strange behavior. For the hidelabels FormLayout and other
attributes are not considered strange in the container. When searching for the
reason, we find the following. The method of the Container class:
public void setLayout(ContainerLayout layout) throws IllegalStateException {
this.layout = layout;
if (layout.getSpacing() != null && this instanceof Panel) {
((Panel) this).setBorder(false);
}
setAttribute("layout", layout.getJsObj(), true);
if (layout.getContainerAttributes() != null) {
JavaScriptObjectHelper.apply(layout.getContainerAttributes(), isCreated() ? getJsObj() : config);
}
}
We note that the layout was trying to get their attributes by the method
highlighted above (getContainerAttributes), but there was no class FormLayout
getContainerAttributes the method and the same was inherited from the parent
class AnchorLayout. Consequently, in addition to not respect the style set, put
in another container style that ruined the layout.
Conclusion, many times when trying to mount a fomLayout encapsulating a Field
as seen in the example, there is this strange behavior and labors to give the
knack.
Add FormLayout class the following method.
@Override
public native JavaScriptObject getContainerAttributes()
/*-{
var cl = this.@com.gwtext.client.widgets.layout.ContainerLayout::getJsObj()();
return {labelAlign:cl.labelAlign,hideLabels:cl.hideLabels,labelPad:cl.labelPad,labelWidth:cl.labelWidth,itemCls:cl.itemCls};
}-*/;
And in class FieldSet comment the method setLayout
Original issue reported on code.google.com by marlon...@gmail.com on 12 Jan 2012 at 6:58
Original issue reported on code.google.com by
marlon...@gmail.com
on 12 Jan 2012 at 6:58