I’m using Vaadin 6.5.8 and I’m having some trouble getting a subwindow to autosize properly when the window includes a form and a button.
When I add a button to the subwindow content layout (the default VerticalLayout), the width of the window seems to be calculated using only the button, ignoring the width of the form (so the form gets truncated). This happens in IE 8, FF 3.6 but does NOT happen on Chrome 7.
Here’s my test app:
package com.example.helloworld;
import com.vaadin.Application;
import com.vaadin.data.Item;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.data.util.PropertysetItem;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;
public class HelloWorldApplication extends Application {
@Override
public void init() {
final Window mainWindow = new Window("HelloWorld Application");
setMainWindow(mainWindow);
Label label = new Label("Hello Vaadin user");
mainWindow.addComponent(label);
Button button = new Button("Open Window");
button.addListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Window w = new MyFormWindow();
mainWindow.addWindow(w);
}
});
mainWindow.addComponent(button);
}
class MyFormWindow extends Window {
public MyFormWindow() {
super("Test Window");
getContent().setSizeUndefined();
Item item = new PropertysetItem();
item.addItemProperty("firstName", new ObjectProperty("Bob"));
item.addItemProperty("lastName", new ObjectProperty("Johnson"));
item.addItemProperty("age", new ObjectProperty(new Integer(45)));
Form form = new Form();
form.setItemDataSource(item);
getContent().addComponent(form);
getContent().addComponent(new Label("This is a Label"));
// without the following line autosizing works fine
getContent().addComponent(new Button("This is a Button"));
}
}
}
Am I doing something wrong or is this just a bug?