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:by.bigvova.ui.LoginUI.java

License:Apache License

private Component buildFields() {
    final VerticalLayout layout = new VerticalLayout();
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);//w w  w .  jav  a  2s.  c  o  m
    fields.addStyleName("fields");

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

    final PasswordField 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(ShortcutAction.KeyCode.ENTER);
    signin.focus();

    final CheckBox checkBox = new CheckBox("Remember me", true);

    signin.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            login(username.getValue(), password.getValue(), checkBox.getValue());
        }
    });

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

    layout.setSpacing(true);
    layout.addComponent(fields);
    layout.addComponent(checkBox);
    return layout;
}

From source file:com.cavisson.gui.dashboard.components.controls.TextFields.java

License:Apache License

public TextFields() {
    setMargin(true);//from ww w. j a va 2 s .  co  m

    Label h1 = new Label("Text Fields");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    TextField tf = new TextField("Normal");
    tf.setInputPrompt("First name");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Custom color");
    tf.setInputPrompt("Email");
    tf.addStyleName("color1");
    row.addComponent(tf);

    tf = new TextField("User Color");
    tf.setInputPrompt("Gender");
    tf.addStyleName("color2");
    row.addComponent(tf);

    tf = new TextField("Themed");
    tf.setInputPrompt("Age");
    tf.addStyleName("color3");
    row.addComponent(tf);

    tf = new TextField("Error");
    tf.setValue("Somethings wrong");
    tf.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(tf);

    tf = new TextField("Error, borderless");
    tf.setValue("Somethings wrong");
    tf.setComponentError(new UserError("Fix it, now!"));
    tf.addStyleName("borderless");
    row.addComponent(tf);

    tf = new TextField("Read-only");
    tf.setInputPrompt("Nationality");
    tf.setValue("Finnish");
    tf.setReadOnly(true);
    row.addComponent(tf);

    tf = new TextField("Small");
    tf.setValue("Field value");
    tf.addStyleName("small");
    row.addComponent(tf);

    tf = new TextField("Large");
    tf.setValue("Field value");
    tf.addStyleName("large");
    tf.setIcon(testIcon.get(true));
    row.addComponent(tf);

    tf = new TextField("Icon inside");
    tf.setInputPrompt("Ooh, an icon");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Large, Icon inside");
    tf.setInputPrompt("Ooh, an icon");
    tf.addStyleName("large");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Small, Icon inside");
    tf.setInputPrompt("Ooh, an icon");
    tf.addStyleName("small");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("16px supported by default");
    tf.setInputPrompt("Image icon");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get(true, 16));
    row.addComponent(tf);

    tf = new TextField();
    tf.setValue("Font, no caption");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField();
    tf.setValue("Image, no caption");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get(true, 16));
    row.addComponent(tf);

    CssLayout group = new CssLayout();
    group.addStyleName("v-component-group");
    row.addComponent(group);

    tf = new TextField();
    tf.setInputPrompt("Grouped with a button");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    tf.setWidth("260px");
    group.addComponent(tf);

    Button button = new Button("Do It");
    // button.addStyleName("primary");
    group.addComponent(button);

    tf = new TextField("Borderless");
    tf.setInputPrompt("Write here");
    tf.addStyleName("inline-icon");
    tf.addStyleName("borderless");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Right-aligned");
    tf.setValue("1,234");
    tf.addStyleName("align-right");
    row.addComponent(tf);

    tf = new TextField("Centered");
    tf.setInputPrompt("Guess what?");
    tf.addStyleName("align-center");
    row.addComponent(tf);

    PasswordField pwf = new PasswordField("Password");
    pwf.setInputPrompt("Secret words");
    pwf.addStyleName("inline-icon");
    pwf.setIcon(FontAwesome.LOCK);
    row.addComponent(pwf);

    pwf = new PasswordField("Password, right-aligned");
    pwf.setInputPrompt("Secret words");
    pwf.addStyleName("inline-icon");
    pwf.addStyleName("align-right");
    pwf.setIcon(FontAwesome.LOCK);
    row.addComponent(pwf);

    pwf = new PasswordField("Password, centered");
    pwf.setInputPrompt("Secret words");
    pwf.addStyleName("inline-icon");
    pwf.addStyleName("align-center");
    pwf.setIcon(FontAwesome.LOCK);
    row.addComponent(pwf);

    tf = new TextField("Tiny");
    tf.setValue("Field value");
    tf.addStyleName("tiny");
    row.addComponent(tf);

    tf = new TextField("Huge");
    tf.setValue("Field value");
    tf.addStyleName("huge");
    row.addComponent(tf);

    h1 = new Label("Text Areas");
    h1.addStyleName("h1");
    addComponent(h1);

    row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    TextArea ta = new TextArea("Normal");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Inline icon");
    ta.setInputPrompt("Inline icon not really working");
    ta.addStyleName("inline-icon");
    ta.setIcon(testIcon.get());
    row.addComponent(ta);

    ta = new TextArea("Custom color");
    ta.addStyleName("color1");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Custom color, read-only");
    ta.addStyleName("color2");
    ta.setValue("Field value, spanning multiple lines of text");
    ta.setReadOnly(true);
    row.addComponent(ta);

    ta = new TextArea("Custom color");
    ta.addStyleName("color3");
    ta.setValue("Field value, spanning multiple lines of text");
    row.addComponent(ta);

    ta = new TextArea("Small");
    ta.addStyleName("small");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Large");
    ta.addStyleName("large");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Borderless");
    ta.addStyleName("borderless");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Right-aligned");
    ta.addStyleName("align-right");
    ta.setValue("Field value, spanning multiple lines of text");
    row.addComponent(ta);

    ta = new TextArea("Centered");
    ta.addStyleName("align-center");
    ta.setValue("Field value, spanning multiple lines of text");
    row.addComponent(ta);

    ta = new TextArea("Tiny");
    ta.addStyleName("tiny");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Huge");
    ta.addStyleName("huge");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    RichTextArea rta = new RichTextArea();
    rta.setValue("<b>Some</b> <i>rich</i> content");
    row.addComponent(rta);

    rta = new RichTextArea("Read-only");
    rta.setValue("<b>Some</b> <i>rich</i> content");
    rta.setReadOnly(true);
    row.addComponent(rta);
}

From source file:com.dungnv.streetfood.ui.CategoryItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }/*from w  w w  .  j  a v a2 s.  c  om*/
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    if ("1".equals(item.getCategoryStatus())) {
        lbTitle.addStyleName("lb-status-active");
    } else {
        lbTitle.addStyleName("lb-status-inActive");
    }
    vlInfo.addComponent(lbTitle);

    lbDesc = new Label(item.getDescription());
    lbDesc.setStyleName("lb-description");
    vlInfo.addComponent(lbDesc);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnLock = new Button();
    if ("1".equals(item.getCategoryStatus())) {
        btnLock.setIcon(FontAwesome.LOCK);
    } else {
        btnLock.setIcon(FontAwesome.UNLOCK);
    }

    btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLock.setWidth("25px");
    btnLock.setHeight("25px");
    htToolBar.addComponent(btnLock);
    htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT);

    btnLink = new Button();
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLink.setWidth("25px");
    btnLink.setHeight("25px");
    htToolBar.addComponent(btnLink);
    htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.dungnv.streetfood.ui.DishItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }/*from w  w w.  j a va 2 s . c o m*/
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    vlInfo.addComponent(lbTitle);

    lbDesc = new Label(item.getShortDescription());
    lbDesc.setStyleName("lb-description");
    vlInfo.addComponent(lbDesc);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnLock = new Button();
    if ("1".equals(item.getDishStatus())) {
        btnLock.setIcon(FontAwesome.LOCK);
    } else {
        btnLock.setIcon(FontAwesome.UNLOCK);
    }

    btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLock.setWidth("25px");
    btnLock.setHeight("25px");
    htToolBar.addComponent(btnLock);
    htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT);

    btnLink = new Button();
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLink.setWidth("25px");
    btnLink.setHeight("25px");
    htToolBar.addComponent(btnLink);
    htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.dungnv.streetfood.ui.RestaurantItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }//from   w  ww  .  j  a  v a  2  s  .  co m
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    vlInfo.addComponent(lbTitle);

    lbIntroduce = new Label(item.getAddress());
    lbIntroduce.setStyleName("lb-description");
    vlInfo.addComponent(lbIntroduce);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnLock = new Button();
    if ("1".equals(item.getRestaurantStatus())) {
        btnLock.setIcon(FontAwesome.LOCK);
    } else {
        btnLock.setIcon(FontAwesome.UNLOCK);
    }

    btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLock.setWidth("25px");
    btnLock.setHeight("25px");
    htToolBar.addComponent(btnLock);
    htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT);

    btnLink = new Button();
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLink.setWidth("25px");
    btnLink.setHeight("25px");
    htToolBar.addComponent(btnLink);
    htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.github.djabry.platform.vaadin.view.LoginView.java

License:Open Source License

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);//from  w w  w.  j  a v  a2 s .  co  m

    userField = new TextField("Username");

    userField.setIcon(FontAwesome.USER);
    userField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    //username.addStyleName(ValoTheme.TEXTFIELD_TINY);

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

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

    fields.addComponents(userField, passwordField, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            loginAction.login(userField.getValue(), passwordField.getValue());
        }
    });
    return fields;
}

From source file:com.hybridbpm.ui.view.LoginView.java

License:Apache License

private void buildLoginForm() {
    Responsive.makeResponsive(loginPanel);
    loginPanel.setSizeUndefined();//  w ww.j a va 2s. c  om
    loginPanel.setSpacing(true);
    loginPanel.addStyleName("login-panel");

    labels.addStyleName("labels");
    welcome.setSizeUndefined();
    welcome.addStyleName(ValoTheme.LABEL_H4);
    welcome.addStyleName(ValoTheme.LABEL_LIGHT);
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_COLORED);

    fields.setSpacing(true);
    fields.addStyleName("fields");

    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    username.setNullRepresentation("");

    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    signin.focus();

    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener((Button.ClickEvent event) -> {
        HybridbpmUI.getCurrent().login(username.getValue(), password.getValue(), rememberMe.getValue());
    });
}

From source file:com.toptal.ui.view.LoginView.java

License:Open Source License

/**
 * Generates content.//from  w  w w  .  jav  a2 s .  c om
 * @return Content.
 */
private Component content() {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSpacing(true);
    this.username = new TextField("Username");
    this.username.setIcon(FontAwesome.USER);
    this.username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    this.password = new PasswordField("Password");
    this.password.setIcon(FontAwesome.LOCK);
    this.password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    final Button login = new Button("Log In");
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    login.setClickShortcut(KeyCode.ENTER);
    login.focus();
    login.addClickListener(e -> this.login(this.username.getValue(), this.password.getValue()));
    final Button signup = new Button("Sign Up");
    signup.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signup.addClickListener(e -> this.signup(this.username.getValue(), this.password.getValue()));
    content.addComponents(this.username, this.password, login, signup);
    content.setComponentAlignment(login, Alignment.BOTTOM_LEFT);
    content.setComponentAlignment(signup, Alignment.BOTTOM_LEFT);
    return content;
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);// w ww.  j ava  2 s .  c om
    fields.addStyleName("fields");

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

    final PasswordField 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() {
        @Override
        public void buttonClick(final ClickEvent event) {

            System.out.println("TRIGGER LOGIN");
            DashboardEventBus.post(new UserLoginRequestedEvent(username.getValue(), password.getValue()));
        }
    });
    return fields;
}

From source file:de.metas.procurement.webui.ui.view.LoginView.java

License:Open Source License

public LoginView() {
    super();/*from   w w w  .j  a  va 2s.  c  o m*/
    Application.autowire(this);

    addStyleName(STYLE);

    //
    // Content
    {
        final VerticalComponentGroup content = new VerticalComponentGroup();

        final Resource logoResource = getLogoResource();
        final Image logo = new Image(null, logoResource);
        logo.addStyleName(STYLE_Logo);
        content.addComponent(logo);

        this.email = new EmailField(i18n.get("LoginView.fields.email"));
        email.addStyleName(STYLE_LoginEmail);
        email.setIcon(FontAwesome.USER);
        content.addComponent(email);

        this.password = new PasswordField(i18n.get("LoginView.fields.password"));
        password.addStyleName(STYLE_LoginPassword);
        password.setIcon(FontAwesome.LOCK);
        content.addComponent(password);

        final Button loginButton = new Button(i18n.get("LoginView.fields.loginButton"));
        loginButton.addStyleName(STYLE_LoginButton);
        loginButton.setClickShortcut(KeyCode.ENTER);
        loginButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                onUserLogin(email.getValue(), password.getValue());
            }
        });

        final Button forgotPasswordButton = new Button(i18n.get("LoginView.fields.forgotPasswordButton"));
        forgotPasswordButton.setStyleName(STYLE_ForgotPasswordButton);
        forgotPasswordButton.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                onForgotPassword(email.getValue());
            }
        });

        final CssLayout contentWrapper = new CssLayout(content, loginButton, forgotPasswordButton);
        contentWrapper.addStyleName(STYLE_LoginFormWrapper);
        setContent(contentWrapper);
    }

    //
    // Bottom:
    {
        //
        // Powered-by logo resource
        // Use the configured one if any; fallback to default embedded powered-by logo
        final Resource poweredByLogoResource;
        if (poweredByLogoUrl != null && !poweredByLogoUrl.trim().isEmpty()) {
            poweredByLogoResource = new ExternalResource(poweredByLogoUrl.trim());
        } else {
            poweredByLogoResource = Constants.RESOURCE_PoweredBy;
        }

        //
        // Powered-by component:
        final Component poweredByComponent;
        if (poweredByLinkUrl != null && !poweredByLinkUrl.trim().isEmpty()) {
            final Link link = new Link();
            link.setIcon(poweredByLogoResource);
            link.setResource(new ExternalResource(poweredByLinkUrl.trim()));
            link.setTargetName("_blank");
            poweredByComponent = link;
        } else {
            final Image image = new Image(null, poweredByLogoResource);
            poweredByComponent = image;
        }
        //
        poweredByComponent.addStyleName(STYLE_PoweredBy);
        setToolbar(poweredByComponent);
    }
}