Buenas,
Estoy aprendiendo Java y Vaadin y estoy tratando de cargar una pagina de menu despues de hacer click en el boton de ingresar del formulario de login y no me carga la pagina completa, solo el Obejeto menu, quisiera ver si me pudiesen ayudar
este es mi codigo
pagina de Login:
package com.RSMWebApp.View;
import java.util.List;
import com.RSMWebApp.Controlador.ManejadorLogin;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.View;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import model.Empleado;
public class FrmLogin extends VerticalLayout implements View{
private static final long serialVersionUID = 1L;
private TextField txtUsu;
private PasswordField txtClave;
private Button btnIngresar;
Panel loginPanel;
List<Empleado> empl;
ManejadorLogin ML = new ManejadorLogin();
//Navigator navigator;
public FrmLogin() {
//protected void init (VaadinRequest vaadinRequest) {
txtUsu = new TextField();
txtUsu.setCaption("Usuario");
txtUsu.setIcon(VaadinIcons.USER);
txtUsu.setSizeFull();
txtClave = new PasswordField();
txtClave.setCaption("Clave");
txtClave.setIcon(VaadinIcons.KEY);
txtClave.setSizeFull();
btnIngresar = new Button("Ingresar", VaadinIcons.CHECK);
btnIngresar.addStyleName("primary");
btnIngresar.setSizeFull();
btnIngresar.setClickShortcut(KeyCode.ENTER);
btnIngresar.addClickListener(e ->{
empl=ML.listaEmp(txtUsu.getValue(), txtClave.getValue());
if (empl.isEmpty()) {
Notification.show("Usuario o Clave son Incorrectos", Notification.TYPE_ERROR_MESSAGE);
}else {
// Prueba aux = new Prueba();
//getNavigator().navigateTo("MENU");
// navigator.navigateTo("MENU");
Prueba aux = new Prueba();
aux.setVisible(true);
addComponent(aux);
}
});
FormLayout frmLogin = new FormLayout(txtUsu,txtClave,btnIngresar);
frmLogin.setMargin(true);
loginPanel = new Panel("Ingreso a la Aplicacion", frmLogin);
loginPanel.setSizeFull();
//loginPanel.setStyleName("transparentPanel", true);
loginPanel.setWidth("450");
loginPanel.setHeight("250");
addComponent(loginPanel);
setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
setStyleName("fondologin", true);
setHeight("100%");
}
protected void init(VaadinRequest request) {
// TODO Auto-generated method stub
}
}
pagina de Menu
package com.RSMWebApp.View;
import com.vaadin.data.TreeData;
import com.vaadin.data.provider.TreeDataProvider;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.navigator.View;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import com.vaadin.ui.themes.ValoTheme;
public class Prueba extends VerticalLayout implements View{
/**
*
*/
private static final long serialVersionUID = 1L;
Panel loginPanel;
TreeDataProvider<String> inMemoryDataProvider;
//protected void init(VaadinRequest vaadinRequest) {
public Prueba() {
Label menuTitle = new Label("Menu");
menuTitle.setSizeFull();
menuTitle.addStyleName(ValoTheme.MENU_TITLE);
Label lblMV = new Label("este es el view principal");
// An initial planet tree
Tree<String> tree = new Tree<>();
TreeData<String> treeData = new TreeData<>();
// Couple of childless root items
treeData.addItem(null,"Facturacion");
treeData.addItem("Facturacion","Clientes");
treeData.addItem("Facturacion","Ventas");
treeData.addItem(null,"Venus");
// Items with hierarchy
treeData.addItem(null,"Inventario");
treeData.addItem("Inventario","Articulos");
inMemoryDataProvider = new TreeDataProvider<>(treeData);
tree.setDataProvider(inMemoryDataProvider);
//tree.expand("Inventario"); // Expand programmatically
//tree.expand("Facturacion");
// Show all leaf nodes as disabled
/* tree.setStyleGenerator(item -> {
if (!tree.getDataProvider().hasChildren(item))
return "leaf";
return null;
}
);
*/
tree.addItemClickListener(event ->
Notification.show("Click",
Notification.Type.HUMANIZED_MESSAGE)
);
FormLayout frmLogin = new FormLayout(menuTitle,tree);
//frmLogin.setMargin(true);
frmLogin.addStyleName(ValoTheme.MENU_ROOT);
CssLayout loginPanel = new CssLayout(frmLogin);
loginPanel.addStyleName(ValoTheme.LAYOUT_CARD);
// loginPanel = new Panel("Ingreso a la Aplicacion", frmLogin);
loginPanel.setWidth("200");
loginPanel.setHeight("700");
addComponent(loginPanel);
}
}
cualaquier ayuda me vendria bien, recuerden soy nuevo en el mundo de java… muchas gracias de antemano