Hi,
I add a splitpanel into the second component of a splitpanel. But I can resize the main split after remove the second.
I join you my code, maybe you can find where I make an error :
public class TestApplication extends Application {
SplitPanel splitPanel ;
private HorizontalLayout contentLayout;
private Component saveComponent;
private AbstractOrderedLayout mainLayout;
private Button button;
private boolean click = true;
VerticalLayout layout1;
VerticalLayout layout2;
@Override
public void init() {
Window mainWindow = new Window("Test Application");
mainWindow.setSizeFull();
setTheme("OVH");
button = new Button("Click", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
setHelpLayout("test", click);
click = !click;
}
});
layout1 = new VerticalLayout();
layout1.setSizeFull();
Panel p1 = new Panel("p1");
p1.setSizeFull();
layout1.addComponent(p1);
layout2 = new VerticalLayout();
layout2.setSizeFull();
Panel p2 = new Panel("p2");
p2.setSizeFull();
layout2.addComponent(p2);
mainLayout = new VerticalLayout();
mainLayout.setSizeFull();
splitPanel = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
splitPanel.setSizeFull();
splitPanel.setMargin(false, true, false, true);
mainLayout.addComponent(splitPanel);
splitPanel.setSplitPosition(200, SplitPanel.UNITS_PIXELS);
splitPanel.setFirstComponent(layout1);
splitPanel.setLocked(true);
splitPanel.setSecondComponent(layout2);
mainWindow.addComponent(button);
mainWindow.addComponent(mainLayout);
setMainWindow(mainWindow);
}
public void setHelpLayout(String fromClass, boolean showHelp) {
if(showHelp) {
saveComponent = splitPanel.getSecondComponent();
contentLayout = new HorizontalLayout();
contentLayout.setSizeFull();
Panel helpPanel = new Panel("--Help-- " + fromClass );
helpPanel.setSizeFull();
SplitPanel contentSplitPanel = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
contentSplitPanel.setMargin(false, true, false, true);
contentLayout.addComponent(contentSplitPanel);
contentLayout.setExpandRatio(contentSplitPanel, 1);
contentSplitPanel.setSplitPosition(75, SplitPanel.UNITS_PERCENTAGE);
contentSplitPanel.setFirstComponent(splitPanel.getSecondComponent());
contentSplitPanel.setLocked(true);
contentSplitPanel.setSecondComponent(helpPanel);
splitPanel.setSecondComponent(contentLayout);
} else {
splitPanel.setSecondComponent(layout2);
}
}
}