Add/Remove splitPanel in splitPanel

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);
		}
	}
}

Hi!

Can you please describe a little more what the problem exactly is. What is excepted and what is the actual result?

Hi,

I have a SplitPanel like this :


--------------------
|     |             |
|     |             |
|     |             |
|     |             |
--------------------

And I had a second Split when I click on a button to have this :


--------------------
|     |        |   |
|     |        |   |
|     |        |   |
|     |        |   |
--------------------

In theory, if I click again on the button, I return to the first view.

Actually, I can add the second SplitPanel but, after a second click, I have something like this :


--------------------
|     |         |X |
|     |         |X |
|     |         |X |
|     |         |X |
--------------------

Where ‘X’ is the background.

I want to my first Splitpanel expands but, although I have a Refresher, I can’t do this.

Maybe there are a more simplier solution for thi

Sounds like a bug. Create a ticket at
http://dev.vaadin.com
and include the test case