Example usage for com.vaadin.ui FormLayout setSizeUndefined

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

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:at.peppol.webgui.app.LoginWindow.java

License:Mozilla Public License

private void init() {

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();/*w  w w  .  j  a va2 s.com*/

    FormLayout fl = new FormLayout();
    fl.setSizeUndefined();
    usernameField = new TextField("Username:");
    usernameField.setImmediate(true);
    fl.addComponent(usernameField);
    passwordField = new PasswordField("Password:");
    passwordField.setImmediate(true);
    fl.addComponent(passwordField);

    Button loginButton = new Button("Login");
    loginButton.addStyleName("default");
    loginButton.addListener(this);
    fl.addComponent(loginButton);
    loginButton.setClickShortcut(KeyCode.ENTER);

    h1.addComponent(fl);
    h1.setComponentAlignment(fl, Alignment.MIDDLE_CENTER);
    addComponent(h1);

}

From source file:be.rvponp.build.CommitViewerUI.java

License:Apache License

private HorizontalLayout createFiltersLayout(Table table, VerticalLayout files, VerticalLayout filesLayout) {
    HorizontalLayout filtersLayout = new HorizontalLayout();

    FormLayout formReleaseLayout = new FormLayout();
    fromVersion = new ComboBox("From release");
    toVersion = new ComboBox("To release");
    filtersLayout.addComponent(formReleaseLayout);
    formReleaseLayout.setDescription("formReleaseLayout");

    formReleaseLayout.addComponent(fromVersion);
    formReleaseLayout.addComponent(toVersion);
    formReleaseLayout.setSizeUndefined();

    //        FormLayout jiraTreeLayout = new FormLayout();
    final Tree tree = createTreeComponent();
    //        jiraTreeLayout.addComponent(tree);
    filtersLayout.addComponent(tree);/*w  w  w .j  ava 2  s  . c  om*/

    CheckBox jiraParsing = new CheckBox("Jira Parsing");
    jiraParsing.setValue(true);
    //        filtersLayout.addComponent(jiraParsing);

    FormLayout buttonsLayout = new FormLayout();
    CompareButton compareButton = new CompareButton(fromVersion, toVersion, table, files, jiraParsing, tree,
            filesLayout);
    RefreshButton refreshButton = new RefreshButton(this, fromVersion, toVersion);
    //        refreshButton.buttonClick(null);
    //        compareButton.buttonClick(null);
    buttonsLayout.addComponent(refreshButton);
    buttonsLayout.addComponent(compareButton);
    buttonsLayout.setSizeUndefined();
    filtersLayout.addComponent(buttonsLayout);
    filtersLayout.setSizeUndefined();
    return filtersLayout;
}

From source file:by.bigvova.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("Vaadin Shared Security Demo Login");

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

    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    rememberMe = new CheckBox("Remember me");
    login = new Button("Login");
    Label label = new Label("Name: User / Password: password");
    loginForm.addComponent(userName);//from  w  w w .  ja  v a  2s  .  co m
    loginForm.addComponent(passwordField);
    loginForm.addComponent(rememberMe);
    loginForm.addComponent(login);
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        @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(label);
    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:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationMakeView.java

License:Open Source License

public ReservationMakeView() {
    fromField = new DateField("Start Date");
    fromField.setLocale(new Locale("de", "DE"));
    fromField.setResolution(Resolution.MINUTE);
    fromField.setDateFormat("dd.MM.yyyy HH:mm");
    fromField.setIcon(FontAwesome.CALENDAR);
    fromField.setWidth(12, Unit.EM);//from   w  w  w .  j ava  2s. com
    toField = new DateField("End Date");
    toField.setLocale(new Locale("de", "DE"));
    toField.setResolution(Resolution.MINUTE);
    toField.setDateFormat("dd.MM.yyyy HH:mm");
    toField.setIcon(FontAwesome.CALENDAR);
    toField.setWidth(12, Unit.EM);
    roomSelect = new NativeSelect("Room Number");
    roomSelect.setIcon(FontAwesome.BED);
    roomSelect.setNullSelectionAllowed(true);
    roomSelect.setImmediate(true);
    makeReservationButton = new Button("Make Reservation", FontAwesome.CHECK);
    makeReservationButton.setWidth(12, Unit.EM);
    logoutButton = new Button("Logout");

    Panel panel = new Panel("Create New Reservation");
    FormLayout content = new FormLayout();
    content.addComponents(fromField, toField, roomSelect, makeReservationButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndLogout = new VerticalLayout(content, logoutButton);
    formAndLogout.setMargin(true);
    panel.setContent(formAndLogout);
    makeViewLayout = new VerticalLayout(panel);
    makeViewLayout.setSizeUndefined();
    makeViewLayout.setMargin(true);
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.signUpView.SignUpView.java

License:Open Source License

public SignUpView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    passwordFieldRepeat = new PasswordField("Repeat Password");
    passwordFieldRepeat.setIcon(FontAwesome.KEY);
    passwordFieldRepeat.setWidth(12, Unit.EM);
    addUserButton = new Button("Add New User");
    addUserButton.setWidth(12, Unit.EM);
    goBackButton = new Button("Back");

    VerticalLayout layout = new VerticalLayout();
    Panel panel = new Panel("Sign Up - Smart ReservationEntity System");
    panel.setSizeUndefined();//from   w  ww.  j  ava  2 s  .  c  o m
    layout.addComponent(panel);

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, passwordFieldRepeat, addUserButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndBack = new VerticalLayout(content, goBackButton);
    formAndBack.setMargin(true);
    panel.setContent(formAndBack);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java

License:Open Source License

/**
 * Method which actually creates the whole UI.
 *///from  w ww  .  j a va  2 s . c om
@Override
protected void init(VaadinRequest vaadinRequest) {

    VerticalLayout layout = new VerticalLayout();

    Panel panel = new Panel("Login");
    panel.setSizeUndefined();

    FormLayout content = new FormLayout();
    userName = new TextField("Username");
    content.addComponent(userName);

    PasswordField password = new PasswordField("Password");
    content.addComponent(password);

    Button login = new Button("Login");
    register = new Button("Register");
    CheckBox askBox = new CheckBox("Are you a Roommanager?");

    login.setStyleName(Reindeer.BUTTON_SMALL);
    login.setWidth("86px");

    register.setStyleName(Reindeer.BUTTON_SMALL);
    register.setWidth("86px");
    askBox.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.addComponent(login);
    hl.addComponent(register);
    hl.addComponent(askBox);

    content.addComponent(hl);
    content.setSizeUndefined();
    content.setMargin(true);

    panel.setContent(content);

    login.addClickListener(e -> {
        System.out.println(userName.getValue());
        System.out.println(password.getValue());
        try {
            if (controller.login(userName.getValue(), password.getValue())
                    || userName.equals(userName.getValue()) && password.equals(password.getValue())) {
                setContent(new ReservationUI());
            }
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    register.addClickListener(e -> {
        try {
            Role x = askBox.getValue() ? Role.ROOMMANAGER : Role.CUSTOMER;
            controller.register(userName.getValue(), password.getValue(), x);
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(panel);
    setContent(layout);
}

From source file:com.gmail.volodymyrdotsenko.cms.fe.vaadin.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    langRepo.findAll().forEach(e -> {
        langSet.add(e.getCode());//from   w  w  w .  ja v  a  2s.co  m
    });

    lang = new ComboBox("Language", langSet);

    getPage().setTitle("CMS");

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

    loginForm.addComponent(userName = new TextField("Username"));
    userName.setRequired(true);
    loginForm.addComponent(passwordField = new PasswordField("Password"));
    passwordField.setRequired(true);
    loginForm.addComponent(rememberMe = new CheckBox("Remember me"));
    loginForm.addComponent(lang);
    lang.setRequired(true);
    lang.setNullSelectionAllowed(false);
    loginForm.addComponent(login = new Button("Login"));
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(e -> {
        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();

    String currentLang = getLocale().getLanguage();
    if (langSet.contains(currentLang))
        lang.select(currentLang);
    else
        lang.select("en");
}

From source file:com.haulmont.cuba.web.LoginWindow.java

License:Apache License

protected FormLayout createLoginFormLayout(int fieldWidth, boolean localesSelectVisible) {
    FormLayout loginFormLayout = new FormLayout();
    loginFormLayout.setStyleName("cuba-login-form");
    loginFormLayout.setSpacing(true);//from  w  ww  .  jav a2 s  .  c  om
    loginFormLayout.setSizeUndefined();

    loginField.setCaption(messages.getMainMessage("loginWindow.loginField", resolvedLocale));
    loginFormLayout.addComponent(loginField);
    loginField.setWidth(fieldWidth + "px");
    loginField.setStyleName("username-field");
    loginFormLayout.setComponentAlignment(loginField, Alignment.MIDDLE_CENTER);

    passwordField.setCaption(messages.getMainMessage("loginWindow.passwordField", resolvedLocale));
    passwordField.setWidth(fieldWidth + "px");
    passwordField.setAutocomplete(true);
    passwordField.setStyleName("password-field");
    loginFormLayout.addComponent(passwordField);
    loginFormLayout.setComponentAlignment(passwordField, Alignment.MIDDLE_CENTER);

    if (localesSelectVisible) {
        localesSelect.setCaption(messages.getMainMessage("loginWindow.localesSelect", resolvedLocale));
        localesSelect.setWidth(fieldWidth + "px");
        localesSelect.setNullSelectionAllowed(false);
        loginFormLayout.addComponent(localesSelect);
        loginFormLayout.setComponentAlignment(localesSelect, Alignment.MIDDLE_CENTER);
    }

    if (rememberMeAllowed) {
        rememberMeCheckBox.setCaption(messages.getMainMessage("loginWindow.rememberMe", resolvedLocale));
        rememberMeCheckBox.setStyleName("remember-me");
        loginFormLayout.addComponent(rememberMeCheckBox);
        loginFormLayout.setComponentAlignment(rememberMeCheckBox, Alignment.MIDDLE_CENTER);
    }

    okButton.setCaption(messages.getMainMessage("loginWindow.okButton", resolvedLocale));
    okButton.addClickListener(submitListener);
    okButton.setStyleName("cuba-login-submit");
    okButton.setIcon(WebComponentsHelper.getIcon("app/images/login-button.png"));

    loginFormLayout.addComponent(okButton);
    loginFormLayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER);
    return loginFormLayout;
}

From source file:com.mcparland.john.vaadin_mvn_arch.samples.authentication.LoginScreen.java

License:Apache License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();
    loginForm.setMargin(false);// w  ww .  j a  v  a2 s. c o m

    loginForm.addComponent(username = new TextField("Username", "admin"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField("Password"));
    password.setWidth(15, Unit.EM);
    password.setDescription("Write anything");
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    buttons.addComponent(login = new Button("Login"));
    login.setDisableOnClick(true);
    login.addClickListener(new Button.ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                login();
            } finally {
                login.setEnabled(true);
            }
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    buttons.addComponent(forgotPassword = new Button("Forgot password?"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            showNotification(new Notification("Hint: Try anything"));
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:com.snowy.NewUserSubWindow.java

public void build() {
    //setClosable(false);
    setModal(true);/*from  w  w w . ja v a  2s  .c o m*/
    setResizable(false);
    setResponsive(true);
    setDraggable(false);
    FormLayout fl = new FormLayout();
    fl.setMargin(true);
    //fl.setSizeFull();
    fl.setSizeUndefined();
    fl.setSpacing(true);
    TextField uname = new TextField("Username");
    uname.setRequired(true);

    //uname.addValidator(null);
    fl.addComponent(uname);
    TextField email = new TextField("Email");

    email.setRequired(true);
    email.addValidator(new EmailValidator("A Valid Email is Required"));
    fl.addComponent(email);
    PasswordField pf1 = new PasswordField("Password");
    pf1.setRequired(true);
    pf1.addValidator(new StringLengthValidator("Password must be between 8 and 60 characters", 8, 60, false));
    fl.addComponent(pf1);

    PasswordField pf2 = new PasswordField("Confirm Password");
    pf2.setRequired(true);
    pf2.addValidator((Object value) -> {
        if (!pf2.getValue().equals(pf1.getValue())) {
            throw new InvalidValueException("Passwords Must Match");
        }
    });
    //pf2.setImmediate(true);
    fl.addComponent(pf2);
    Button b = new Button("Submit");

    b.addClickListener((Button.ClickEvent e) -> {

        if (uname.isValid() && email.isValid() && pf1.isValid() && pf2.isValid()) {

            String result = d.createUser(uname.getValue(), pf2.getValue(), email.getValue());
            if (result.equals("Creation Sucess")) {
                fl.removeAllComponents();
                fl.addComponent(new Label("User Created Sucessfully"));
                fl.addComponent(new Button("Close", (ee) -> {
                    this.close();
                }));

            } else {
                Notification.show(result);
            }
        } else {
            b.setComponentError(new UserError("Issues with required fields"));
        }
        //d.close();
    });
    fl.addComponent(b);
    setContent(fl);

}