Example usage for com.vaadin.server FontAwesome CREDIT_CARD

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

Introduction

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

Prototype

FontAwesome CREDIT_CARD

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

Click Source Link

Usage

From source file:com.mycollab.module.crm.view.contact.ContactReadFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    SimpleContact contact = attachForm.getBean();

    if (propertyId.equals("accountid")) {
        return new LinkViewField(contact.getAccountName(),
                CrmLinkBuilder.generateAccountPreviewLinkFull(contact.getAccountid()),
                CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
    } else if (propertyId.equals("email")) {
        return new EmailViewField(attachForm.getBean().getEmail());
    } else if (propertyId.equals("assignuser")) {
        return new UserLinkViewField(contact.getAssignuser(), contact.getAssignUserAvatarId(),
                contact.getAssignUserFullName());
    } else if (propertyId.equals("iscallable")) {
        if (Boolean.FALSE.equals(contact.getIscallable())) {
            return new DefaultViewField(UserUIContext.getMessage(GenericI18Enum.BUTTON_NO));
        } else {/*from   ww w  .  j  ava 2  s  .co m*/
            return new DefaultViewField(UserUIContext.getMessage(GenericI18Enum.BUTTON_YES));
        }
    } else if (propertyId.equals("birthday")) {
        return new DateViewField(contact.getBirthday());
    } else if (propertyId.equals("firstname")) {
        final ContainerHorizontalViewField containerField = new ContainerHorizontalViewField();
        String displayName = "";
        if (contact.getPrefix() != null) {
            displayName = contact.getPrefix();
        }
        if (contact.getFirstname() != null) {
            displayName += contact.getFirstname();
        }

        Label nameLbl = new Label(displayName);
        containerField.addComponentField(nameLbl);
        containerField.getLayout().setExpandRatio(nameLbl, 1.0f);
        Button vcardDownloadBtn = new Button("");
        VCardStreamSource streamSource = new VCardStreamSource();
        OnDemandFileDownloader downloaderExt = new OnDemandFileDownloader(streamSource);
        downloaderExt.extend(vcardDownloadBtn);

        vcardDownloadBtn.setIcon(FontAwesome.CREDIT_CARD);
        vcardDownloadBtn.setStyleName(WebThemes.BUTTON_ICON_ONLY);
        containerField.addComponentField(vcardDownloadBtn);
        containerField.getLayout().setComponentAlignment(vcardDownloadBtn, Alignment.TOP_RIGHT);
        return containerField;
    } else if (propertyId.equals("description")) {
        return new RichTextViewField(contact.getDescription());
    } else if (Contact.Field.leadsource.equalTo(propertyId)) {
        return new I18nFormViewField(contact.getLeadsource(), OpportunityLeadSource.class)
                .withStyleName(UIConstants.FIELD_NOTE);
    } else if (Contact.Field.primcountry.equalTo(propertyId)) {
        return new CountryViewField(contact.getPrimcountry());
    } else if (Contact.Field.othercountry.equalTo(propertyId)) {
        return new CountryViewField(contact.getOthercountry());
    }

    return null;
}