Example usage for com.vaadin.server FontAwesome USER

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

Introduction

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

Prototype

FontAwesome USER

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

Click Source Link

Usage

From source file:org.balisunrise.vaadin.components.header.UserBar.java

private void init() {
    setHeight("100%");
    setWidthUndefined();/*from   w w  w .  ja v  a 2 s  . c o  m*/
    setStyleName("b-user-bar");
    setSpacing(true);
    addLayoutClickListener(this::click);

    userName = new Link("Entrar", null);
    userName.setStyleName("b-user-name");
    userName.setIcon(FontAwesome.USER);
    addComponent(userName);

    configuration = new Configuration();
    addComponent(configuration);
}

From source file:org.eclipse.hawkbit.simulator.ui.GenerateDialog.java

License:Open Source License

/**
 * Creates a new pop window for setting the configuration of simulating
 * devices.//from w  w  w.  ja  va 2 s  . c  om
 * 
 * @param callback
 *            the callback which is called when the dialog has been
 *            successfully confirmed.
 * @param dmfEnabled
 *            indicates if the AMQP/DMF interface is enabled by
 *            configuration and if the option DMF should be enabled or not
 */
public GenerateDialog(final GenerateDialogCallback callback, final boolean dmfEnabled) {
    this.dmfEnabled = dmfEnabled;
    formLayout.setSpacing(true);
    formLayout.setMargin(true);

    namePrefixTextField = createRequiredTextfield("name prefix", "dmfSimulated", FontAwesome.INFO,
            new NullValidator("Must be given", false));

    amountTextField = createRequiredTextfield("amount", new ObjectProperty<Integer>(10), FontAwesome.GEAR,
            new RangeValidator<Integer>("Must be between 1 and 30000", Integer.class, 1, 30000));

    tenantTextField = createRequiredTextfield("tenant", "default", FontAwesome.USER,
            new NullValidator("Must be given", false));

    pollDelayTextField = createRequiredTextfield("poll delay (sec)", new ObjectProperty<Integer>(10),
            FontAwesome.CLOCK_O, new RangeValidator<Integer>("Must be between 1 and 60", Integer.class, 1, 60));

    pollUrlTextField = createRequiredTextfield("base poll URL endpoint", "http://localhost:8080",
            FontAwesome.FLAG_O,
            new RegexpValidator("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]",
                    "is not an URL"));
    pollUrlTextField.setColumns(50);
    pollUrlTextField.setVisible(false);

    gatewayTokenTextField = createRequiredTextfield("gateway token", "", FontAwesome.FLAG_O, null);
    gatewayTokenTextField.setColumns(50);
    gatewayTokenTextField.setVisible(false);

    createProtocolGroup();
    createOkButton(callback);

    namePrefixTextField.addValueChangeListener(event -> checkValid());
    amountTextField.addValueChangeListener(event -> checkValid());
    tenantTextField.addValueChangeListener(event -> checkValid());

    formLayout.addComponent(namePrefixTextField);
    formLayout.addComponent(amountTextField);
    formLayout.addComponent(tenantTextField);
    formLayout.addComponent(protocolGroup);
    formLayout.addComponent(pollDelayTextField);
    formLayout.addComponent(pollUrlTextField);
    formLayout.addComponent(gatewayTokenTextField);
    formLayout.addComponent(buttonOk);

    setCaption("Simulate Devices");
    setContent(formLayout);
    setResizable(false);
    center();
}

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);
    username.addStyleName(/*from  ww w  . j  a va2 s  .c  o  m*/
            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.LoginView.java

License:Open Source License

private void buildUserField() {
    username = new TextField(i18n.getMessage("label.login.username"));
    username.setIcon(FontAwesome.USER);
    username.addStyleName(//  w ww  .ja  v a2  s . com
            ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
    username.setId("login-username");
}

From source file:org.opencms.ui.dialogs.permissions.CmsPermissionView.java

License:Open Source License

/**
 * Constructor.<p>// w w  w .  j  ava 2s .c  om
 *
 * @param entry the access control entry
 * @param editable the editable flag
 * @param isFolder the is folder flag
 * @param inheritedFrom the inherited from path
 * @param changeHandler the change handler
 */
public CmsPermissionView(CmsAccessControlEntry entry, boolean editable, boolean isFolder, String inheritedFrom,
        PermissionChangeHandler changeHandler) {
    m_changeHandler = changeHandler;
    m_editable = editable;
    m_entry = entry;
    CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null);
    CmsObject cms = A_CmsUI.getCmsObject();
    // get name and type of the current entry
    I_CmsPrincipal principal;
    try {
        principal = CmsPrincipal.readPrincipalIncludingHistory(cms, entry.getPrincipal());
    } catch (CmsException e) {
        principal = null;
        LOG.debug(e.getLocalizedMessage(), e);
    }

    m_principalName = (principal != null) ? principal.getName() : entry.getPrincipal().toString();
    String ou = null;
    String displayName;

    int flags = 0;
    if ((principal != null) && (principal instanceof CmsHistoryPrincipal)) {
        // there is a history principal entry, handle it
        if (principal.isGroup()) {
            String niceName = OpenCms.getWorkplaceManager().translateGroupName(principal.getName(), false);
            displayName = CmsVaadinUtils.getMessageText(
                    org.opencms.security.Messages.GUI_ORGUNIT_DISPLAY_NAME_2,
                    ((CmsHistoryPrincipal) principal).getDescription(), niceName);
            ou = CmsOrganizationalUnit.getParentFqn(m_principalName);
            flags = CmsAccessControlEntry.ACCESS_FLAGS_GROUP;
        } else {
            displayName = ((CmsHistoryPrincipal) principal).getName();
            ou = CmsOrganizationalUnit.getParentFqn(m_principalName);
            flags = CmsAccessControlEntry.ACCESS_FLAGS_USER;
        }
    } else if ((principal != null) && principal.isGroup()) {
        String niceName = OpenCms.getWorkplaceManager().translateGroupName(principal.getName(), false);
        displayName = CmsVaadinUtils.getMessageText(org.opencms.security.Messages.GUI_ORGUNIT_DISPLAY_NAME_2,
                ((CmsGroup) principal).getDescription(A_CmsUI.get().getLocale()), niceName);
        ou = CmsOrganizationalUnit.getParentFqn(m_principalName);
        flags = CmsAccessControlEntry.ACCESS_FLAGS_GROUP;
    } else if ((principal != null) && principal.isUser()) {
        displayName = ((CmsUser) principal).getFullName();
        ou = CmsOrganizationalUnit.getParentFqn(m_principalName);
        flags = CmsAccessControlEntry.ACCESS_FLAGS_USER;
    } else if ((m_principalName != null)
            && m_principalName.equals(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID.toString())) {
        m_principalName = CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME;
        displayName = CmsVaadinUtils.getMessageText(Messages.GUI_LABEL_ALLOTHERS_0);
        m_responsibleCheckbox.setVisible(false);
        flags = CmsAccessControlEntry.ACCESS_FLAGS_ALLOTHERS;
    } else if ((m_principalName != null)
            && m_principalName.equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID.toString())) {
        m_principalName = CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME;
        displayName = CmsVaadinUtils.getMessageText(Messages.GUI_LABEL_OVERWRITEALL_0);
        flags = CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE_ALL;
    } else {
        // check if it is the case of a role
        CmsRole role = CmsRole.valueOfId(entry.getPrincipal());
        if (role != null) {
            displayName = role.getName(A_CmsUI.get().getLocale());
            m_principalName = role.getRoleName();
            flags = CmsAccessControlEntry.ACCESS_FLAGS_ROLE;
        } else {
            displayName = entry.getPrincipal().toString();
        }
    }

    if ((flags > 0) && ((entry.getFlags() & flags) == 0)) {
        // the flag is set to the wrong principal type
        if (LOG.isErrorEnabled()) {
            LOG.error(Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.ERR_INVALID_ACE_1,
                    entry.toString()));
        }
        entry = new CmsAccessControlEntry(entry.getResource(), entry.getPrincipal(),
                entry.getAllowedPermissions(), entry.getDeniedPermissions(), (entry.getFlags() | flags));
    } else if (entry.getFlags() < CmsAccessControlEntry.ACCESS_FLAGS_USER) {
        // the flag is set to NO principal type
        if (LOG.isErrorEnabled()) {
            LOG.error(Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.ERR_INVALID_ACE_1,
                    entry.toString()));
        }
        entry = new CmsAccessControlEntry(entry.getResource(), entry.getPrincipal(),
                entry.getAllowedPermissions(), entry.getDeniedPermissions(),
                (entry.getFlags() | CmsAccessControlEntry.ACCESS_FLAGS_GROUP));
    }

    m_principalType = getEntryType(entry.getFlags(), false);

    if (m_principalName == null) {
        m_principalName = "";
    }

    FontIcon icon = null;
    boolean isOverwriteAll = false;
    switch (flags) {
    case CmsAccessControlEntry.ACCESS_FLAGS_USER:
        icon = FontAwesome.USER;
        break;
    case CmsAccessControlEntry.ACCESS_FLAGS_GROUP:
        icon = FontAwesome.GROUP;
        break;
    case CmsAccessControlEntry.ACCESS_FLAGS_ALLOTHERS:
        icon = FontAwesome.GLOBE;
        break;
    case CmsAccessControlEntry.ACCESS_FLAGS_ROLE:
        icon = FontAwesome.GRADUATION_CAP;
        break;
    case CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE_ALL:
        icon = FontAwesome.EXCLAMATION_CIRCLE;
        isOverwriteAll = true;
        break;
    default:
        icon = FontAwesome.QUESTION_CIRCLE;
    }

    m_label.setContentMode(ContentMode.HTML);
    String ouName = null;
    if (ou != null) {
        try {
            ouName = OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, ou)
                    .getDisplayName(UI.getCurrent().getLocale());
        } catch (CmsException e) {
            LOG.debug("Error reading OU name.", e);
        }
    }
    m_label.setValue(icon.getHtml() + " <b>" + displayName + "</b> "
            + entry.getPermissions().getPermissionString() + (ouName != null ? ("<br />" + ouName) : ""));
    m_label.setWidthUndefined();
    m_details.setIcon(FontAwesome.PLUS_SQUARE_O);
    m_details.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            toggleDetails();
        }
    });

    m_setButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            setPermissions();
        }
    });

    m_deleteButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            deletePermissionSet();
        }
    });

    if (inheritedFrom != null) {
        m_inheritedFrom.setValue(inheritedFrom);
    } else {
        m_inheritedFrom.setVisible(false);
    }

    if (isOverwriteAll) {
        setDetailButtonVisible(false);
        if (m_editable) {
            addComponent(m_deleteButton, 2);
            m_deleteButton.addStyleName("o-permissions_delete");
        }
    } else {
        // get all permissions of the current entry
        CmsPermissionSet permissions = entry.getPermissions();
        IndexedContainer container = getPermissionContainer(permissions);
        m_permissions.setContainerDataSource(container);
        m_permissions.setColumnReorderingAllowed(false);
        m_permissions.setColumnHeader(PROPERTY_LABEL, CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_0));
        m_permissions.setColumnHeader(PROPERTY_ALLOWED,
                CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_ALLOWED_0));
        m_permissions.setColumnHeader(PROPERTY_DISPLAY_ALLOWED,
                CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_ALLOWED_0));
        m_permissions.setColumnHeader(PROPERTY_DENIED,
                CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_DENIED_0));
        m_permissions.setColumnHeader(PROPERTY_DISPLAY_DENIED,
                CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_DENIED_0));

        m_permissions.setPageLength(5);
        m_permissions.setSortEnabled(false);
        if (m_editable) {
            toggleDetails();
            setDetailButtonVisible(false);
            m_permissions.setVisibleColumns(PROPERTY_LABEL, PROPERTY_ALLOWED, PROPERTY_DENIED);
            m_permissions.setTableFieldFactory(FIELD_FACTORY);
            m_permissions.setEditable(m_editable);
            m_responsibleCheckbox.setValue(isResponsible(entry.getFlags()));
            m_overwriteCheckbox.setValue(isOverWritingInherited(entry.getFlags()));
            m_inheritCheckbox.setVisible(isFolder);
            m_inheritCheckbox.setValue(Boolean.valueOf(m_entry.isInheriting()));

            m_buttonBar.setVisible(true);
        } else {
            m_permissions.setVisibleColumns(PROPERTY_LABEL, PROPERTY_DISPLAY_ALLOWED, PROPERTY_DISPLAY_DENIED);
        }
    }
}

From source file:org.opencms.ui.dialogs.permissions.CmsPrincipalSelect.java

License:Open Source License

/**
 * Constructor.<p>/*w ww  .  ja  va  2  s.c o  m*/
 */
public CmsPrincipalSelect() {

    m_main = new HorizontalLayout();
    m_main.setSpacing(true);
    m_main.setWidth("100%");
    setCompositionRoot(m_main);

    m_widgetType = WidgetType.principalwidget;

    m_principalTypeSelect = new ComboBox();
    m_principalTypeSelect.setWidth("150px");
    Map<String, String> principalTypes = new LinkedHashMap<String, String>();
    principalTypes.put(I_CmsPrincipal.PRINCIPAL_USER,
            CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_USER_0));
    principalTypes.put(I_CmsPrincipal.PRINCIPAL_GROUP,
            CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_GROUP_0));
    CmsVaadinUtils.prepareComboBox(m_principalTypeSelect, principalTypes);

    m_principalTypeSelect.setNewItemsAllowed(false);
    m_principalTypeSelect.setNullSelectionAllowed(false);
    m_principalTypeSelect.select(I_CmsPrincipal.PRINCIPAL_USER);
    m_main.addComponent(m_principalTypeSelect);

    m_principalName = new TextField();
    m_principalName.setWidth("100%");
    m_main.addComponent(m_principalName);
    m_main.setExpandRatio(m_principalName, 2);

    m_selectPrincipalButton = new Button(FontAwesome.USER);
    m_selectPrincipalButton.addStyleName(OpenCmsTheme.BUTTON_ICON);
    m_selectPrincipalButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            openPrincipalSelect();
        }
    });
    m_main.addComponent(m_selectPrincipalButton);
}

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  www.jav  a2  s.  c o  m
    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:pl.exsio.frameset.vaadin.account.menu.presenter.AccountMenuPresenterImpl.java

License:Open Source License

protected Label getProfileIconLabel() {
    Label profilePic = new Label(FontAwesome.USER.getHtml(), ContentMode.HTML);
    profilePic.setStyleName("user-icon");
    return profilePic;
}

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

public IndexView() {
    setMenuCaption("CCAmistadesLargas");
    String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath()
            + "/WEB-INF/wallpaper2.jpg";
    FileResource resource = new FileResource(new File(basepath));
    Image image = new Image(null, resource);
    image.setSizeFull();//from ww  w  .  j  av a  2s  .  com
    addComponent(image);
    addMenuItem("Perfil", FontAwesome.USER, () -> {
        removeAllComponents();
        addComponent(new PerfilLayout());
    });
    addMenuItem("Eventos", FontAwesome.COMPASS, () -> {
        removeAllComponents();
        addComponent(new EventosLayout());
    });
    addMenuItem("Amigos", FontAwesome.USERS, () -> {
        removeAllComponents();
        addComponent(new AmigosLayout());
    });
    addMenuItem("Cerrar sesin", FontAwesome.POWER_OFF, () -> {
        Session.destroy();
        UI.getCurrent().getNavigator().navigateTo("");
    });
}

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

/**
 * Crea los campos del formulario./*from  w  w w.  jav a 2  s .co  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;
}