When changing layout of a LayoutContainer from BorderLayout to some other layout the following exception occurs:

java.lang.AssertionError: BorderLayout needs a LayoutContainer
at com.extjs.gxt.ui.client.widget.layout.BorderLayout.setContainer(BorderLayout.java:162)
at com.extjs.gxt.ui.client.widget.Container.setLayout(Container.java:597)
at com.extjs.gxt.ui.client.widget.LayoutContainer.setLayout(LayoutContainer.java:281)
....

The code that does this:

public void onModuleLoad(){
final Viewport viewport = new Viewport();
viewport.setLayout(new BorderLayout());

Label label = new Label("Some Text");
viewport.add(label);
RootPanel.get().add(viewport);

Timer t = new Timer() {

@Override
public void run() {
MessageBox.alert("Alert", "Change layout", new Listener<MessageBoxEvent>() {

@Override
public void handleEvent(MessageBoxEvent be) {
viewport.setLayout(new CenterLayout());
}
});

}
};
t.schedule(1000);
viewport.layout();
}


GXT Version: 2.1.1
GWT version: 2.0.4
Mode: Hosted

Regards
Rupesh