Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
UriFragmentUtility component lead to additional space on the screen
I have a question concerning the URIFragmentUtility component.
My application displays a component (VerticalLayout) and aligns it in order to have it center in the window.
mainView = new MainView(viewHeight, viewWidth); eSolifeWindow mainWindow = (eSolifeWindow) getMainWindow(); mainWindow.loadLocale(); mainWindow.addComponent(mainView); //((VerticalLayout) getMainWindow().getContent()).setExpandRatio(getMainView(), 1.0f); ((VerticalLayout) mainWindow.getContent()).setComponentAlignment(getMainView(), Alignment.MIDDLE_CENTER);
It works perfectly. The application is centered.
Now, I added the URIFragmentUtility component in order to manage the URI.
In the "attach" method of my component "MainView", I add the URIFragmentUtility.
At that moment, an additional "DIV" is added and this DIV has a height and a width and my MainVIew is not centered anymore.
How could I do to avoid the URIFragmentUtility to have a height ?
Thanks in advance
You need to set an explicit expand ratio for the main view, otherwise both the main view and the uri fragment utility will have implicit expand ratios of 1, and hence will get equal amount of space for them.
So calling ((VerticalLayout) mainWindow.getContent()).setExpandRatio(getMainView(), 1.0f); should fix it.
Thanks a lot.