Layout size to fit contents + stretchable

Hi,

I want to implement this simple use case which I’m sure lots of people would want, but it doesn’t seem easy to do in Vaadin.

  1. create a layout (in my case in a subwindow but that may be irrelevant) that contains some components
  2. make sure that all components are visible
  3. allow the layout to be stretched (in my case by dragging the subwindow’s sizing handle) which causes the components to stretch or be placed further apart

I can use SIZE_UNDEFINED so that the layout will expand to fit all components, but in that case it doesn’t stretch.
I can use a fixed or relative size for the layout, and relative sizes for the components so they will stretch, but then it’s possible that the size is initially not big enough to contain all the components (or it may be far too big if there are only few components).

What would be the recommended way to do this?