Hi !
I work on a modal window and I try to make a splitpanel height auto-resizeable regarding its content, that changes “on the fly”.
The modal window is containing a TabSheet, with many tabs. On other tabs I am able to adjust the height regarding each tab content, using an undefined height. But this doesn’t work with the tab containing the splitPanel.
This is the modal window constructor :
public ModalWindow() {
setWidth(500, UNITS_PIXELS);
VerticalLayout layout = (VerticalLayout) getContent();
layout.setWidth(100, UNITS_PERCENTAGE);
contentTab = new TabSheet();
contentTab.setSizeFull();
layout.addComponent(contentTab);
layout.setExpandRatio(contentTab, 1.0f);
close = new Button("Close",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
getParent().removeWindow(ModalWindow.this);
}
});
layout.addComponent(close);
layout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);
[...]
}
This is the Tab which causes issues (extends VerticalLayout) :
public SplitPanelTab() {
setWidth(100, UNITS_PERCENTAGE);
setSpacing(true);
setMargin(true);
basePanel = new HorizontalSplitPanel();
// tried this because constructor set size to 100%
basePanel.setHeight(-1, UNITS_PIXELS);
//
basePanel.setSplitPosition(25);
//this generates a tree which is displayed left on the panel
tree = generateTree();
basePanel.addComponent(tree);
addComponent(basePanel);
setExpandRatio(basePanel, 1.0f);
The idea of the SplitPanel is to select one item in the tree on the left side, and display a form on the right. What I want is the panel to resize its height regarding the content displayed on the right. This is what I call after selecting a tree node :
if (basePanel.getSecondComponent() != null) {
basePanel.removeComponent(basePanel.getSecondComponent());
}
XForm myForm= new XForm();
basePanel.addComponent(resourceMetadataForm);
Is there any hope to do that ? I am not so familiar with Vaadin layouts but maybe I took a wrong path here ?
thanks.