Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
click en tree, no agrega componente
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 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);
}
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);
}
Last updated on
You cannot reply to this thread.