Saludos muchachones, tengo esto por aca, la clase Navigator en la UI con algo de
MVP,sin el navigator el tree funciona, pero con “el no” , o sea, no agrega componentes al ContentLayout(){}
no si debo de usar otro medio para la creacion de vistas, no si mockito tengo el presentimiento
tree.addItemClickListener(), si me crea el objeto de [b]
Principal p = new Principal();
Solucionado
@Override
protected void init(VaadinRequest vaadinRequest) {
pageLayout = new PageLayout();
Navigator navigator = new Navigator(this, this);
navigator.addView(Login.LOGIN_VIEW, new Login());
navigator.addView(PageLayout.PAGELAYOUT_VIEW, pageLayout);
navigator.navigateTo(PageLayout.PAGELAYOUT_VIEW);[color=#FF0000]
//Correcto colocarlo asi,
[/color]
//agrega el layout MAIN
setContent(pageLayout);
}
[/b]
public MenuLayout() {
final VerticalLayout layoutMENU = new VerticalLayout();
label.setSizeUndefined();
layoutMENU.setWidth("100%");
layoutMENU.setMargin(true);
layoutMENU.addComponent(label);
tree.setSizeFull();
tree.addItem(PRINCIPAL);
tree.addItem(PRINCIPAL2);
tree.addItemClickListener(e -> {
Object valor = e.getItemId();
Demo ui = Demo.getCurrent();
ContentLayout contentLayout = ui.getPageLayout().getBodyLayout().getContentLayout();
contentLayout.removeAllComponents();
if (PRINCIPAL.equals(valor)) {
Principal p = new Principal();
contentLayout.addComponent(p);//esta linea aqui no agrega el componente
}
});
addComponents(layoutMENU, tree);
setExpandRatio(tree, 1);
}
25203.zip (94.6 KB)