Example usage for com.vaadin.ui.themes ValoTheme TEXTFIELD_INLINE_ICON

List of usage examples for com.vaadin.ui.themes ValoTheme TEXTFIELD_INLINE_ICON

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme TEXTFIELD_INLINE_ICON.

Prototype

String TEXTFIELD_INLINE_ICON

To view the source code for com.vaadin.ui.themes ValoTheme TEXTFIELD_INLINE_ICON.

Click Source Link

Document

Move the default caption icon inside the text field.

Usage

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

License:Open Source License

/**
 * Generates content.//from w  ww  .java2  s. c o m
 * @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 a v a2 s .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(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.fatalix.bookery.AppHeader.java

License:Open Source License

private MHorizontalLayout createSearchBar() {
    Label header = new Label("Bookery");
    header.addStyleName(ValoTheme.LABEL_BOLD);
    header.setSizeUndefined();// w w w .  j  a  va 2s. c om
    header.addStyleName(ValoTheme.LABEL_H3);

    searchText = new TextField();
    searchText.setIcon(FontAwesome.SEARCH);
    searchText.addStyleName(ValoTheme.TEXTFIELD_LARGE);
    searchText.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    searchText.setWidth(100, Unit.PERCENTAGE);
    searchText.setInputPrompt("hier einfach suchen..");
    Button searchButton = new Button("such!", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Navigator navigator = ((App) UI.getCurrent()).getNavigator();
            if (navigator.getState().contains("search")) {
                navigator.navigateTo(navigator.getState());
            } else {
                navigator.navigateTo(SearchView.id);
            }

        }
    });
    searchButton.addStyleName(ValoTheme.BUTTON_LARGE);
    searchText.addShortcutListener(new Button.ClickShortcut(searchButton, ShortcutAction.KeyCode.ENTER));

    MHorizontalLayout layout = new MHorizontalLayout(header, searchText, searchButton);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setExpandRatio(searchText, 1.0f);
    return layout;
}

From source file:fr.ortec.dsi.pointage.presentation.ihm.view.TextFields.java

License:Apache License

public TextFields() {
    setMargin(true);//from   ww  w.  jav  a2 s .  c o m
    setSpacing(true);

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

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    addComponent(row);

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

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

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

    tf = new TextField("Themed");
    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(ValoTheme.TEXTFIELD_BORDERLESS);
    row.addComponent(tf);

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

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

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

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

    CssLayout group = new CssLayout();
    group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    row.addComponent(group);

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

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

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

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

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

    row = new HorizontalLayout();
    row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    addComponent(row);

    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: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);/*from w ww .  j ava2 s.c o m*/
    password.addStyleName(
            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.AbstractHawkbitLoginUI.java

License:Open Source License

private void buildUserField() {
    username = new TextField(i18n.getMessage("label.login.username"));
    username.setIcon(FontAwesome.USER);/*w  w  w  .  ja  v a  2s . co m*/
    username.addStyleName(
            ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
    username.setId("login-username");
    if (isDemo && !uiProperties.getDemo().getUser().isEmpty()) {
        username.setValue(uiProperties.getDemo().getUser());
    }
}

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

License:Open Source License

private void buildTenantField() {
    if (multiTenancyIndicator.isMultiTenancySupported()) {
        tenant = new TextField(i18n.getMessage("label.login.tenant"));
        tenant.setIcon(FontAwesome.DATABASE);
        tenant.addStyleName(/*from www . ja  v a  2s.c om*/
                ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
        tenant.addStyleName("uppercase");
        tenant.setId("login-tenant");
    }
}

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);//from  w ww . j  a  va 2s .  com
    password.addStyleName(
            ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
    password.setId("login-password");
}

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

License:Open Source License

private void buildUserField() {
    username = new TextField(i18n.getMessage("label.login.username"));
    username.setIcon(FontAwesome.USER);/*  www.  java  2 s  .  c  o m*/
    username.addStyleName(
            ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
    username.setId("login-username");
}

From source file:org.jumpmind.metl.ui.common.ButtonBar.java

License:Open Source License

public TextField addFilter() {
    TextField textField = new TextField();
    textField.setColumns(20);/*from  w w  w.  j a v a  2  s .c o  m*/
    textField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    textField.setInputPrompt("Filter");
    textField.setIcon(FontAwesome.SEARCH);
    textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    textField.setTextChangeTimeout(500);
    textField.setNullRepresentation("");
    addRight(textField);
    return textField;
}