Hi Guys,
i wanted to write my first Vaadin Project and started with this little CustomWindow
public class LoginWindow extends Window{
private static final long serialVersionUID = -2051389658877931684L;
protected TextField tbUsername = new TextField();
protected PasswordField tbPassword = new PasswordField();
public LoginWindow(){
init();
generateForm();
}
protected void init(){
this.setCaption("Login");
this.setModal(true);
this.setResizable(false);
this.setDraggable(false);
this.setClosable(false);
}
protected void generateForm(){
VerticalLayout content = new VerticalLayout();
content.setMargin(true);
content.addComponent(tbUsername);
tbUsername.setCaption("Benutzername:");
content.setSpacing(true);
content.addComponent(tbPassword);
tbPassword.setCaption("Passwort:");
Button submit = new Button();
submit.setCaption("Login");
submit.addClickListener(new ClickListener(){
private static final long serialVersionUID = -8216851970311191613L;
@Override
public void buttonClick(ClickEvent event) {
//Notification info = new Notification("Login inkorrekt", Type.ERROR_MESSAGE);
tbPassword.setValue("");
tbUsername.setValue("");
}
});
content.addComponent(submit);
this.setContent(content);
}
}
The Window is called by my awesome main class:
public class FirstvaadinprojectUI extends UI {
/**
*
*/
private static final long serialVersionUID = 2923196033131607010L;
@Override
protected void init(VaadinRequest request) {
LoginWindow loginWindow = new LoginWindow();
this.addWindow(loginWindow);
}
}
When i start the programm the Window is displayed, but when i press the Button for Login. The Window disapears.
Even in Debugmode i could figure it out, where my Window is going.
I think i do some general failure here, but i have no idea, why thi isnt working.