I’m trying to do a sidebar to navigate between different pages, I using this code:
@SuppressWarnings("serial")
@Theme("mytheme")
@PushStateNavigation
public class FormacionEjemplo5 extends UI {
public static final String SELECTORES = "selectores";
@Override
protected void init(VaadinRequest vaadinRequest) {
// Titulo del menu
Label label = new Label("Menú de Contenidos");
label.addStyleName(ValoTheme.MENU_TITLE);
// Secciones
Button button1 = new Button("Botones", e -> getNavigator().navigateTo("botones"));
button1.setIcon(VaadinIcons.VAADIN_H);
button1.addStyleName("v-iconCustom");
button1.addStyleNames(ValoTheme.BUTTON_LINK, ValoTheme.MENU_ITEM);
// Menu
CssLayout menu = new CssLayout(label, button1);
menu.addStyleName(ValoTheme.MENU_ROOT);
CssLayout contenido1 = new CssLayout();
HorizontalLayout mainLayout = new HorizontalLayout(menu, contenido1);
mainLayout.setSizeFull();
setContent(mainLayout);
// Contenido de la navegacion
Navigator navigator = new Navigator(this, contenido1);
navigator.addView("", Default.class);
navigator.addView("botones", Botones.class);
}
}
And when I enter in the web and push the button always throw this error: https://ibb.co/hqyG0T
The exception most likely occurs when calling getNavigator().navigateTo(“botones”) tries to instantiate the view Botones.class. Why this is happening is not revealed by the information provided by you. Sharing Botones.class code and full stacktrace could help Forum readers to spot potential issue there.