Example usage for com.vaadin.server FontAwesome LOCK

List of usage examples for com.vaadin.server FontAwesome LOCK

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome LOCK.

Prototype

FontAwesome LOCK

To view the source code for com.vaadin.server FontAwesome LOCK.

Click Source Link

Usage

From source file:me.uni.emuseo.view.login.LoginLayout.java

License:Open Source License

public LoginLayout() {

    loginField.setWidth(306, Unit.PIXELS);
    loginField.setIcon(FontAwesome.USER);
    loginField.addStyleName("inline-icon");
    passField.setWidth(306, Unit.PIXELS);
    passField.setIcon(FontAwesome.LOCK);
    passField.addStyleName("inline-icon");

    addComponent(loginField);//from w  w w.j a v  a 2  s.  c  o m
    addComponent(passField);
    addComponent(logButton);

    setComponentAlignment(loginField, Alignment.MIDDLE_CENTER);
    setComponentAlignment(passField, Alignment.MIDDLE_CENTER);
    setComponentAlignment(logButton, Alignment.BOTTOM_RIGHT);

    buildStyles();
    final AuthManager authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class);
    logButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1324235262L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                authManager.login(loginField.getValue(), passField.getValue());
            } catch (AuthenticationException e) {
                Notification.show("Niepoprawny login lub haso");
            }
        }
    });
    logButton.setClickShortcut(KeyCode.ENTER);

}

From source file:me.uni.emuseo.view.settings.MyAccountView.java

License:Open Source License

public MyAccountView() {

    authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class);
    userService = EMuseoUtil.getAppContext().getBean(UserService.class);

    final Long userId = authManager.getLoggedUserId();
    UserDTO user = userService.getUser(userId);

    FormWithButtonsLayout<UserDTO> formLayout = new FormWithButtonsLayout<UserDTO>(user) {

        private static final long serialVersionUID = -1826989504302110056L;

        @Override/*from  w  w  w  .java 2s  .  com*/
        protected void onSave(UserDTO bean) {
            userService.editUser(bean);
        }

        @Override
        protected FormBuilder<UserDTO> buildForm(UserDTO bean) {
            return new MyAccountFormLayout(bean);
        }
    };

    ExpandingPanel myAccountPanel = new ExpandingPanel();
    myAccountPanel.setCaption("Moje dane");
    myAccountPanel.setContent(formLayout);
    myAccountPanel.setExpanded(true);

    Button addButton = new Button("Zmie haso");
    addButton.setIcon(FontAwesome.LOCK);
    addButton.addStyleName("emuseo-button-icon");
    addButton.addStyleName("emuseo-button-margin");
    addButton.setWidth(100, Unit.PERCENTAGE);

    addComponent(myAccountPanel);
    addComponent(addButton);

    //      setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER);

    addButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = -263205007196895260L;

        @Override
        public void buttonClick(ClickEvent event) {
            PasswordPopUpWindow exhibitPopUpWidow = new PasswordPopUpWindow("Zmie haso") {
                private static final long serialVersionUID = 3776311059670953583L;

                @Override
                protected boolean onSave(PasswordDTO bean) throws InvalidBeanException {
                    try {
                        userService.changePassword(userId, bean);
                        return true;
                    } catch (PasswordChangeException e) {
                        new Notification("Bd", e.getReason(), Type.ERROR_MESSAGE, true)
                                .show(Page.getCurrent());
                    }
                    return false;
                }
            };
            UI.getCurrent().addWindow(exhibitPopUpWidow);
        }
    });
}

From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java

License:Open Source License

private void buildPasswordField() {
    password = new PasswordField(i18n.getMessage("label.login.password"));
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(//from  w  w  w.ja  v a2 s  .  c o  m
            ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
    password.setId("login-password");
    if (isDemo && !uiProperties.getDemo().getPassword().isEmpty()) {
        password.setValue(uiProperties.getDemo().getPassword());
    }
}

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

private void buildPasswordField() {
    password = new PasswordField(i18n.getMessage("label.login.password"));
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(//from w  w w  .  ja  v  a 2s  . c om
            ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
    password.setId("login-password");
}

From source file:org.vaadin.spring.samples.security.ui.login.views.LoginView.java

License:Apache License

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);//from  w ww. ja va2 s.c  om
    fields.addStyleName("fields");

    username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {

            try {

                security.login(username.getValue(), password.getValue());

            } catch (AuthenticationException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
            // TODO Register Remember me Token

            /*
             * Redirect is handled by the VaadinRedirectStrategy
             * User is redirected to either always the default
             * or the URL the user request before authentication
             * 
             * Strategy is configured within SecurityConfiguration
             * Defaults to User request URL.
             */
        }
    });

    return fields;
}

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

/**
 * Crea los campos del formulario.//  w w w  .j  av  a  2 s. c o m
 *
 * @return Component Devuelve el layout que contiene todos los campos del
 * formulario.
 */
private Component buildFields() {
    //LAYOUT CON LOS CAMPOS DEL FORMULARIO
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    final TextField email = new TextField("Email");
    email.setRequired(true);
    email.setIcon(FontAwesome.USER);
    email.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    email.focus();

    final PasswordField password = new PasswordField("Password");
    password.setRequired(true);
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);

    final Button registrar = new Button("Sign Up");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);

    fields.addComponents(email, password, signin, registrar);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);
    fields.setComponentAlignment(registrar, Alignment.BOTTOM_LEFT);

    //LOGARSE
    signin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                email.validate();
                password.validate();
                Usuario u = UsuarioDAO.read(email.getValue(), password.getValue());
                if (u != null) {
                    if (u.getEmail().equals("admin") && u.getPassword().equals("admin")) {
                        Session.setAttribute("usuario", u);
                        UI.getCurrent().getNavigator().navigateTo("AdminIndex");
                    } else {
                        Session.setAttribute("usuario", u);
                        UI.getCurrent().getNavigator().navigateTo("index");
                    }
                } else {
                    Notification n = new Notification("Usuario incorrecto", Notification.Type.WARNING_MESSAGE);
                    n.setPosition(Position.TOP_CENTER);
                    n.show(Page.getCurrent());
                }
            } catch (Validator.InvalidValueException ex) {
                Notification n = new Notification("Rellena todos los campos",
                        Notification.Type.WARNING_MESSAGE);
                n.setPosition(Position.TOP_CENTER);
                n.show(Page.getCurrent());
            }
        }
    });
    //IR AL FORMULARIO DE REGISTRARSE
    registrar.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            UI.getCurrent().getNavigator().navigateTo("registrar");
        }
    });
    return fields;
}