Vaadin Composite in subwindow

Hello,

For my project, I need to put some fields (TextFields, TextAreas, etc…) in a subwindow. The first method I tried was to add them into a Panel, and then add the Panel in the subwindow. It didn’t work as attended, only the Panel was put in the subwindow, without the TextFields.

So I created a new Vaadin Composite, and placed my components. But when I insert my composite in the subwindow, nothing happens…

Here is the code I use to put my composite in the subwindow.

ElementsFamille ef = new ElementsFamille();
subwindow.addComponent(ef);
mainWindow.addWindow(subwindow);

Thanks !

Hi,

Panel in a subwindow works, although it might be a bit redundant (at least if you only intend to put a single Panel inside the subwindow), since you can also set a subwindow’s caption and contents easily.

Also, adding a CustomComponent (Vaadin Composite) in a subwindow works, although there’s a small gotcha: you must set the AbsoluteLayout’s size, or use a different layout for the composite’s composition root. Example:

@AutoGenerated
private void buildMainLayout() {
	// the main layout and components will be created here
	mainLayout = new AbsoluteLayout();
	mainLayout.setWidth("200px");
	mainLayout.setHeight("200px");
	mainLayout.addComponent(new Button("Hello world!"));
}

Hope this helps.

Hello,

Thanks for your reply, setting the size of the AbsoluteLayout solved the problem. The value that was already set in % doesn’t work, I had to change it to something in pixels.

mainLayout.setWidth("500px");
mainLayout.setHeight("500px");