Example usage for com.vaadin.ui VerticalLayout setSizeUndefined

List of usage examples for com.vaadin.ui VerticalLayout setSizeUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setSizeUndefined.

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:ru.codeinside.gses.webui.CertificateSelection.java

License:Mozilla Public License

public CertificateSelection(String userLogin, CertificateListener certificateListener) {
    this.certificateListener = certificateListener;

    String userName = StringUtils
            .trimToNull(Flash.flash().getAdminService().findEmployeeByLogin(userLogin).getFio());
    if (userName == null) {
        userName = userLogin;//from   w w  w  .ja  v  a 2s . c o m
    }

    Label header = new Label(" ?");
    header.setStyleName(Reindeer.LABEL_H1);

    Label hint = new Label("<b>" + userName
            + "</b>, ? ?   ? ?? ? "
            + "   ?,     ??? ? "
            + "<a target='_blank' href='http://ru.wikipedia.org/wiki/"
            + "%D0%AD%D0%BB%D0%B5%D0%BA%D1%82%D1%80%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D1%8C'"
            + ">? ?</a></i> ??  .",
            Label.CONTENT_XHTML);

    SignApplet applet = new SignApplet(new Protocol());
    applet.setName(" ?");
    applet.setCaption(null);
    applet.setBindingMode();

    appletHint = new Label("??  <b>Java</b>  "
            + Flash.getActor().getBrowser() + "   <b> JCP</b>.<br/> "
            + "   ?  ?  ?? "
            + "   <a target='_blank' href='http://ca.oep-penza.ru/'"
            + ">??  ?   ?</a>.",
            Label.CONTENT_XHTML);

    Button logout = new Button(" ( ?   )",
            new Logout());
    logout.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    buttons.addComponent(logout);

    VerticalLayout flow = new VerticalLayout();
    flow.setSizeUndefined();
    flow.setMargin(true);
    flow.setSpacing(true);
    flow.addComponent(header);
    flow.addComponent(hint);
    flow.addComponent(applet);
    flow.addComponent(appletHint);
    flow.addComponent(buttons);

    Panel panel = new Panel();
    panel.setSizeUndefined();
    panel.setContent(flow);

    VerticalLayout center = new VerticalLayout();
    center.addComponent(panel);
    center.setExpandRatio(panel, 1f);
    center.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    center.setSizeFull();

    setCompositionRoot(center);

    setSizeFull();
}

From source file:tad.grupo7.ccamistadeslargas.LoginView.java

/**
 * Crea el formulario./* ww  w  . j a v a2  s . c o m*/
 */
private void buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildFields());
    addComponent(loginPanel);
    setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
}

From source file:trader.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    setLocale(Locale.ENGLISH);//from   w  w w  . j a  v  a2s.c  o  m

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();

    loginForm.addComponent(userName = new TextField("Username"));
    loginForm.addComponent(passwordField = new PasswordField("Password"));
    loginForm.addComponent(rememberMe = new CheckBox("Remember me"));
    loginForm.addComponent(login = new Button("Login"));
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        /**
        * 
        */
        private static final long serialVersionUID = 7813011112417170727L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            login();
        }
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();
}

From source file:uk.q3c.krail.core.view.DefaultLoginView.java

License:Apache License

@Override
public void doBuild(ViewChangeBusMessage event) {
    super.doBuild(event);
    centrePanel = new Panel();
    centrePanel.addStyleName(ChameleonTheme.PANEL_BUBBLE);
    centrePanel.setSizeUndefined();//from  w  w  w .java2 s . c  om
    VerticalLayout vl = new VerticalLayout();
    centrePanel.setContent(vl);
    vl.setSpacing(true);
    vl.setSizeUndefined();
    label = new Label();
    usernameBox = new TextField();
    passwordBox = new PasswordField();

    demoInfoLabel = new Label("for this demo, enter any user name, and a password of 'password'");
    demoInfoLabel2 = new Label(
            "In a real application your Shiro Realm implementation defines how to authenticate");

    submitButton = new Button();
    submitButton.addClickListener(this);

    statusMsgLabel = new Label("Please enter your username and password");

    vl.addComponent(label);
    vl.addComponent(demoInfoLabel);
    vl.addComponent(demoInfoLabel2);
    vl.addComponent(usernameBox);
    vl.addComponent(passwordBox);
    vl.addComponent(submitButton);
    vl.addComponent(statusMsgLabel);

    setMiddleCentre(centrePanel);

}

From source file:xyz.iipster.ui.ChangePasswordComponent.java

License:Apache License

@Override
public void attach() {
    super.attach();

    setModal(true);//from   w  w  w . ja v a 2 s  .co m
    setClosable(false);
    setResizable(false);

    setCaption(i18N.get("iipster.changePassword.title"));

    oldPasswordField.setCaption(i18N.get("iipster.changePassword.oldPassword.label"));
    newPasswordField1.setCaption(i18N.get("iipster.changePassword.newPassword1.label"));
    newPasswordField2.setCaption(i18N.get("iipster.changePassword.newPassword2.label"));

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeUndefined();
    vl.setMargin(true);

    if (currentPassword != null) {
        // currentPassowrd is not null, that means we are on login screen and the password is expired
        Label expiredLabel = new Label(i18N.get("iipster.changePassword.expired.text"));
        vl.addComponent(expiredLabel);
    }

    FormLayout fl = new FormLayout();
    fl.setSizeUndefined();
    fl.addComponents(oldPasswordField, newPasswordField1, newPasswordField2);
    vl.addComponent(fl);
    vl.setExpandRatio(fl, 1F);

    okButton.setCaption(i18N.get("iipster.ok"));
    okButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    okButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    okButton.addClickListener(e -> {
        try {
            ibmiService.changePassword(
                    securityUtils.getAuthentication() == null ? userName
                            : securityUtils.getAuthentication().getPrincipal().toString(),
                    oldPasswordField.getValue(), newPasswordField1.getValue());
            close();
            eventBus.post(new PasswordChangedEvent(newPasswordField1.getValue()));
        } catch (BadCredentialsException e1) {
            Notification.show(i18N.get("iipster.changePassword.oldPassword.error"),
                    Notification.Type.WARNING_MESSAGE);
            oldPasswordField.focus();
        } catch (IOException e1) {
            Notification.show("Error while changing password", Notification.Type.ERROR_MESSAGE);
        } catch (NewPasswordInvalidException e1) {
            Notification.show(i18N.get(e1.getMessageId()), Notification.Type.WARNING_MESSAGE);
            newPasswordField1.focus();
        }
    });

    cancelButton.setCaption(i18N.get("iipster.cancel"));
    cancelButton.setClickShortcut(ShortcutAction.KeyCode.F12);
    cancelButton.addClickListener(e -> {
        close();
    });

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeUndefined();
    hl.setSpacing(true);
    hl.addComponents(okButton, cancelButton);

    vl.addComponent(hl);
    vl.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);

    setContent(vl);

    if (currentPassword == null) {
        // currentPassword is null so we are not forced to change password during login
        oldPasswordField.setValue("");
        oldPasswordField.setEnabled(true);

        oldPasswordField.focus();
    } else {
        oldPasswordField.setValue(currentPassword);
        oldPasswordField.setEnabled(false);

        newPasswordField1.focus();
    }

    newPasswordField1.setValue("");
    newPasswordField2.setValue("");
}

From source file:xyz.iipster.ui.DefaultIbmiLoginComponent.java

License:Apache License

@Override
public void attach() {
    super.attach();
    final FormLayout fl = new FormLayout();
    fl.setSizeUndefined();/* w w w.j a va2  s . co m*/

    userNameTF.setCaption(i18N.get("iipster.login.username.label"));
    //        userNameTF.setRequired(true);
    userNameTF.addStyleName("upper-case");
    userNameTF.setMaxLength(10);
    passwordPF.setCaption(i18N.get("iipster.login.password.label"));
    //        passwordPF.setRequired(true);

    fl.addComponent(userNameTF);
    fl.addComponent(passwordPF);

    final VerticalLayout vl = new VerticalLayout();
    vl.setSizeUndefined();
    vl.addComponent(fl);
    vl.setExpandRatio(fl, 1F);
    vl.setComponentAlignment(fl, Alignment.MIDDLE_CENTER);

    final HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeUndefined();

    loginButton.setCaption(i18N.get("iipster.login.loginButton.label"));
    loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    loginButton.addClickListener(event -> {
        if (userNameTF.isEmpty()) {
            Notification.show(i18N.get("iipster.login.username.missing"), Notification.Type.WARNING_MESSAGE);
            userNameTF.focus();
            return;
        }
        if (passwordPF.isEmpty()) {
            Notification.show(i18N.get("iipster.login.password.missing"), Notification.Type.WARNING_MESSAGE);
            passwordPF.focus();
            return;
        }

        try {
            Authentication auth = securityUtils.login(userNameTF.getValue(), passwordPF.getValue());
            eventBus.post(new LoginEvent(auth.getPrincipal().toString()));
        } catch (BadCredentialsException e) {
            Notification.show(i18N.get("iipster.login.bad.credential"), Notification.Type.WARNING_MESSAGE);
        } catch (DisabledException e) {
            Notification.show(i18N.get("iipster.login.disabled"), Notification.Type.WARNING_MESSAGE);
        } catch (CredentialsExpiredException e) {
            changePasswordComponent.setUserName(userNameTF.getValue());
            changePasswordComponent.setCurrentPassword(passwordPF.getValue());
            UI.getCurrent().addWindow(changePasswordComponent);
        } catch (Exception e) {
            Notification.show(i18N.get("iipster.login.error"), Notification.Type.WARNING_MESSAGE);
        }
    });
    hl.addComponent(loginButton);
    vl.addComponent(hl);
    vl.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);
    vl.setSizeUndefined();

    vl.setMargin(true);
    final Panel panel = new Panel(i18N.get("iipster.login.panel.title"), vl);
    panel.setSizeUndefined();

    rootLayout.addComponent(panel);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    setCompositionRoot(rootLayout);
    setSizeFull();
}