Margins for CustomLayout

Dear Vaadin community,

I’ve noticed that margin support for
CustomLayout
is disabled (
setMargin()
family functions throw
UnsupportedOperationException
). Is it because margin support can’t be added to
CustomLayout
in principle, or this can be treated as “further extension”?

Anyway, I thought I can add
CustomLayout
to
VerticalLayout
or
HorizontalLayout
that support it. But as the result the width of the
VerticalLayout
is fixed to some value (which is approx 20% of the screen width and I can’t understand where it comes from).

Another alternative was to add
CustomLayout
to
CSSLayout
, which supports margins as well. In this case the left-top margin was rendered OK, but as
CustomLayout
has defined it’s width, the right margins are not correct (
CustomLayout
box is “shifted” overlapping the
CSSLayout
box). As
CustomLayout
does not fix height by default, the top/bottom margins are OK.

The problem was solved by setting
customLayout.setSizeUndefined()
.

Finally: it was not obvious how to make the margins. Does it make sense that
CustomLayout
support them out of the box?

EDIT: Fired
bug#7320