Sorry devs but I’m really pulling my hair out with this one and it’s a bit of a show stopper. I just cannot get scrolling to work properly with the following code:
public class Test2View extends Dialog {
public Test2View() {
setHeaderTitle("Test");
setResizable(true);
setWidth("800px");
setHeight("600px");
VerticalLayout content = new VerticalLayout();
content.setPadding(false);
content.setHeightFull();
add(content);
content.add(new TextField("Name"));
TabSheet tabSheet = new TabSheet();
tabSheet.addClassName(LumoUtility.Overflow.HIDDEN);
tabSheet.setSizeFull();
content.add(tabSheet);
tabSheet.add("Instructions", createViewLayout());
}
private VerticalLayout createViewLayout() {
VerticalLayout previewLayout = new VerticalLayout();
previewLayout.addClassNames(LumoUtility.Border.ALL, LumoUtility.BorderColor.CONTRAST_20);
previewLayout.setHeightFull();
VerticalLayout phaseLayout = new VerticalLayout();
phaseLayout.addClassNames(LumoUtility.Border.ALL, LumoUtility.BorderColor.CONTRAST_20);
phaseLayout.add(new Span("Phase"));
VerticalLayout instructionLayout = new VerticalLayout();
instructionLayout.addClassNames(LumoUtility.Border.ALL, LumoUtility.BorderColor.CONTRAST_20);
instructionLayout.setHeightFull();
VerticalLayout scrollLayout = new VerticalLayout();
scrollLayout.setHeightFull();
Scroller scroller = new Scroller(scrollLayout, Scroller.ScrollDirection.BOTH);
scroller.setSizeFull();
instructionLayout.add(new Span("Inputs"), scroller);
previewLayout.add(phaseLayout, instructionLayout);
IntStream.range(0, 20).forEach(i -> {
TextField textField = new TextField("Text " + i);
scrollLayout.add(textField);
});
return previewLayout;
}
}
Called using:
new Test2View().open();
Produces the following:
I’ve been on this for 3 days now and still can’t find a solution and I’m questioning my sanity. Surely it can’t be this hard to produce what I require - just a simple vertical scroll within the inputs layout with no overflow and therefore no superfluous scroll bars appearing for the overflown content. Note if the “phaseLayout” is removed then all is good. Please help as this is holding me up big time with Vaadin.