Hi.
Im not quite sure if I should create a ticket for this.
After upgrading to Vaadin 6.7.1 from 6.6.0 I had an issue with a table that caused a Javascript exception and the result was rows was not shown in the table.
It only happened when my CustomComponent with the table was detached and then attached again. I could work around it by forcing events from the container,
which made the table redraw. After many hours of bugtracking I found out that I simply forgot to call ‘super.attach()’ in the ‘attach()’-method in my CustomComponent.
As soon as I add that, it works flawlessly - but an exception from the Java code would have been really nice.
This code reproduces it when clicking button 2 and then button 1:
public class TableErrorApplication extends Application {
private Window window;
private VerticalLayout content = new VerticalLayout();
private Button btn1 = new Button("1");
private Button btn2 = new Button("2");
private TableComponent tc = new TableComponent();
public class MyBean {
private final String id;
private final String name;
public MyBean(String id, String name) {
this.id = id;
this.name=name;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
}
public class TableComponent extends CustomComponent {
private Table table = new Table();
public TableComponent() {
BeanContainer c = new BeanContainer(MyBean.class);
c.setBeanIdProperty("id");
c.addBean(new MyBean("foobar", "johndoe"));
table.setContainerDataSource(c);
setCompositionRoot(table);
}
@Override
public void attach() {
//Missing call to attach
}
}
@Override
public void init() {
window = new Window();
setMainWindow(window);
window.addComponent(btn1);
window.addComponent(btn2);
window.addComponent(content);
content.addComponent(tc);
btn1.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
content.removeAllComponents();
content.addComponent(tc);
}
});
btn2.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
content.removeAllComponents();
content.addComponent(new Label("test"));
}
});
}
}
Best Regards
Michael Krog