backporting stuff from vdemeester/vaadin-container-utils