vendredi 9 mai 2014

VerticalLayoutContainer does not calculates own height properly.

VerticalLayoutContainer does not calculates own height properly if any margin specified. It seems that margins are not getting included into overall height.

Code:



public void onModuleLoad() {
VerticalLayoutContainer parentContainer = new VerticalLayoutContainer();
RootPanel.get().add(parentContainer);

VerticalLayoutContainer childContainer = new VerticalLayoutContainer();
parentContainer.add(childContainer);
// To make the containers boundries visible
childContainer.getElement().getStyle().setBackgroundColor("red");

TextField firstName = new TextField();
childContainer.add(new FieldLabel(firstName, "First Name"), new VerticalLayoutData(-1, -1, new Margins(6)));

TextField lastName = new TextField();
childContainer.add(new FieldLabel(lastName, "Last Name"), new VerticalLayoutData(-1, -1, new Margins(6)));
}

As you see contents are getting out of the container boundaries. This will make very hard to place something next/after to the container.

Output:

theproblem.jpg





Aucun commentaire:

Enregistrer un commentaire