Good afternoon !
I seem to have a problem with CustomLayout.removeComponent(location).
I have a quite generic CustomLayout , having locations like “MainContent”, “Header”, “Footer”, etc.
When I add component to any of those location, everything is ok.
But I have some cases where I want to remove one of those component, and add another one to another location; for example, something like:
CustomLayout layout = new CustomLayout(layoutName);
layout.addComponent(mainComponent, "main");
layout.addComponent(header, "header");
Button button = new Button("Click me");
button.addListener(new Button.ClickListener() {
public void buttonClick(Button.ClickEvent event) {
layout.addComponent(anotherComponent, "main");
layout.removeComponent("header");
}
});
In that case, the “main” component is replaced by the new one; but the header is not removed. Well, it is. If I refresh the page manually (say, by hitting F5) the header is removed.
I’ve tried to ask for a layout.requestRepaint(), and for anything with “paint” or “repaint” on it - but to no effect.
I don’t know if it is a bug, or something that I’m doing wrong…
I currently use a workaround - instead of removing a component in a given location, I set a new component to that location (an empty label).
Any hindsight ?
I’m using the version 5.2.1 of the toolkit. I have the same behavior with version 5.1.2, and I have not tested with any other versions
Thank you very much !
Quentin Astegiano.