Hi all! I’m using a CssLayout as container for my views. When i navigate view by view i would change the content of my template so i use the function setContent:
public void setContent(Component view){
contentArea.removeAllComponents();
contentArea.addComponent(view);
}
This doesn’t work infact i can’t see nothing in the page, but if i delete the removeAllComponents function i can see the first content and only the first even if i change view.
Can someone help me?
Thank u
//////////////////////////////////////////// the full class: /////////////////////////////////////////
@SpringUI
@UIScope
public class MotorClickTemplate extends HorizontalLayout {
private static final long serialVersionUID = 4514153457724275485L;
CssLayout contentArea = new CssLayout();
CssLayout menuArea = new CssLayout();
Component menu;
@PostConstruct
public void initMotorClickTemplate() {
setSizeFull();
setSpacing(true);
setMargin(new MarginInfo(true,true,true,true));
menuArea.setPrimaryStyleName("valo-menu");
contentArea.setPrimaryStyleName("valo-content");
contentArea.addStyleName("v-scrollable");
contentArea.setSizeFull();
addComponents(menuArea, contentArea);
setExpandRatio(contentArea, 1);
}
public ComponentContainer getContentContainer() {
return contentArea;
}
public void setMenu(final Component menu) {
if (this.menu != null) {
menuArea.removeComponent(this.menu);
}
menu.addStyleName("valo-menu-part");
this.menu = menu;
menuArea.addComponent(this.menu);
}
public void setContent(Component view){
contentArea.removeAllComponents();
contentArea.addComponent(view);
}
}