mardi 24 octobre 2017

Vaadin started to collapse elements

When I started working on my vaadin project I made a login form and it worked just fine. But yesterday I opened it and the form just collapsed (Title, 2 TextFields and 2 buttons used to have some space between them, but now they don't have it at all)

That is the code of the starting class MainScreenUI:

getPage().setTitle("Vaadin Web");
mainLayout = new VerticalLayout();
mainLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
mainLayout.setSizeFull();
setContent(mainLayout);
mainLayout.addComponent(loginForm);

And that is the init method of loginForm:

@PostConstruct
    public void init(){
        setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
        setWidth("60%");
        setHeight("30%");

        Label title = new Label("Vaadin Web");
        addComponent(title);
        title.addStyleName(ValoTheme.LABEL_H2);

        login = new TextField("Login");
        pass = new PasswordField("Password");

        addComponents(login, pass);
        loginButton = new Button("Login");
        registerButton = new Button("Register");
        loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        addComponent(new HorizontalLayout(loginButton, registerButton));
        login.focus();
    }

LoginForm extend Vertical Layout. Can somebody tell what causes this problem?




Aucun commentaire:

Enregistrer un commentaire