VAADIN - set full height of tab content
Solution 1
By default, when you create new table component, table "page length", it mean rows count, value is 15, this is a reason why table do not set full size of your tab. Only way to set full size is increase table "page length" by table.setPageLength(30).
PS. You can remove this lines, because you already use "table.setSizeFull();"
table.setWidth("100%");
table.setHeight("100%");
EDIT 1
Case with you show on your screens in comment will be only when you resize parent or table component. Try fist of all add ResizeListener to your window and inside listener write something like
// This will return current rendered rows count
int shownRowsCount = table.getVisibleItemIds().size();
table.setPageLength(shownRowsCount);
Solution 2
If a component should occupy all the available space in a layout, you have to invoke setExpandRatio
on the layout in addition to invoking setSizeFull
on the component. In your case:
tabsheet.setSizeFull();
VerticalLayout rootLayout = new VerticalLayout();
rootLayout.setSizeFull();
rootLayout.addComponent(tabsheet);
rootLayout.setExpandRatio(tabsheet, 1f);
mainWindow.setContent(rootLayout);
Comments
-
A.W. over 1 year
I have a
TabSheet
and a tab item. There is a table inside the tab. I have set all height tosetFullSize
but the height of the table does not occupy the whole tab.Code is here:
public class GvApplication extends Application { private static Logger log = Logger.getLogger(GvApplication.class.getName()); Window mainWindow; TabSheet tabsheet; @Override public void init() { setTheme("gv"); mainWindow = new Window("Test"); mainWindow.getContent().setHeight("100%"); tabsheet = new TabSheet(); tabsheet.setSizeFull(); mainWindow.addComponent(tabsheet); initSMSTab(); setMainWindow(mainWindow); } private void initSMSTab() { VerticalLayout tab = new VerticalLayout(); tab.setMargin(true); Table table = new Table("Naam"); table.setWidth("100%"); table.setHeight("100%"); table.setSizeFull(); tab.addComponent(table); tabsheet.addTab(tab); Tab smsTab = tabsheet.getTab(tab); smsTab.setCaption("SMS"); } }
There is a lot of space left under the table. How can I make table use the whole content of the tab?