Example usage for com.vaadin.ui Label Label

List of usage examples for com.vaadin.ui Label Label

Introduction

In this page you can find the example usage for com.vaadin.ui Label Label.

Prototype

public Label(String text) 

Source Link

Document

Creates a new instance with text content mode and the given text.

Usage

From source file:com.esofthead.mycollab.module.crm.view.campaign.CampaignTableDisplay.java

License:Open Source License

public CampaignTableDisplay(String viewId, TableViewField requiredColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(CampaignService.class), SimpleCampaign.class, viewId,
            requiredColumn, displayColumns);
    this.addGeneratedColumn("selected", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override//from   w  w  w .  ja v  a  2 s  . com
        public Object generateCell(final Table source, final Object itemId, Object columnId) {
            final SimpleCampaign campaign = CampaignTableDisplay.this.getBeanByIndex(itemId);
            final CheckBoxDecor cb = new CheckBoxDecor("", campaign.isSelected());
            cb.addValueChangeListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    CampaignTableDisplay.this.fireSelectItemEvent(campaign);
                    fireTableEvent(new TableClickEvent(CampaignTableDisplay.this, campaign, "selected"));

                }
            });

            campaign.setExtraData(cb);
            return cb;
        }
    });

    this.addGeneratedColumn("campaignname", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCampaign campaign = CampaignTableDisplay.this.getBeanByIndex(itemId);

            LabelLink b = new LabelLink(campaign.getCampaignname(),
                    CrmLinkBuilder.generateCampaignPreviewLinkFull(campaign.getId()));
            b.setDescription(CrmTooltipGenerator.generateTooltipCampaign(AppContext.getUserLocale(), campaign,
                    AppContext.getSiteUrl(), AppContext.getTimezone()));
            b.setStyleName("link");

            if ("Complete".equals(campaign.getStatus())) {
                b.addStyleName(UIConstants.LINK_COMPLETED);
            } else {
                if (campaign.getEnddate() != null
                        && (campaign.getEnddate().before(new GregorianCalendar().getTime()))) {
                    b.addStyleName(UIConstants.LINK_OVERDUE);
                }
            }
            return b;

        }
    });

    this.addGeneratedColumn("assignUserFullName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCampaign campaign = CampaignTableDisplay.this.getBeanByIndex(itemId);
            UserLink b = new UserLink(campaign.getAssignuser(), campaign.getAssignUserAvatarId(),
                    campaign.getAssignUserFullName());
            return b;

        }
    });

    this.addGeneratedColumn("expectedrevenue", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCampaign campaign = CampaignTableDisplay.this.getBeanByIndex(itemId);
            if (campaign.getExpectedrevenue() != null) {
                String expectedRevenueText = campaign.getExpectedrevenue() + "";
                Currency currency = campaign.getCurrency();
                if (currency != null) {
                    expectedRevenueText += " " + currency.getSymbol();
                }

                return new Label(expectedRevenueText);
            } else {
                return new Label("");
            }

        }
    });

    this.addGeneratedColumn("expectedcost", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCampaign campaign = CampaignTableDisplay.this.getBeanByIndex(itemId);
            if (campaign.getExpectedrevenue() != null) {
                String expectedCostText = campaign.getExpectedcost() + "";
                Currency currency = campaign.getCurrency();
                if (currency != null) {
                    expectedCostText += " " + currency.getSymbol();
                }

                return new Label(expectedCostText);
            } else {
                return new Label("");
            }

        }
    });

    this.addGeneratedColumn("startdate", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, Object itemId, Object columnId) {
            final SimpleCampaign campaign = CampaignTableDisplay.this.getBeanByIndex(itemId);
            Label l = new Label();

            l.setValue(AppContext.formatDate(campaign.getStartdate()));
            return l;
        }
    });

    this.addGeneratedColumn("enddate", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, Object itemId, Object columnId) {
            final SimpleCampaign campaign = CampaignTableDisplay.this.getBeanByIndex(itemId);
            Label l = new Label();

            l.setValue(AppContext.formatDate(campaign.getEnddate()));
            return l;
        }
    });

    this.setWidth("100%");
}

From source file:com.esofthead.mycollab.module.crm.view.cases.CaseListNoItemView.java

License:Open Source License

public CaseListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//from   w  ww  .j  av  a  2 s  . c om
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/case.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(CaseI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(CaseI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CaseEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Cases", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

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

License:Open Source License

public ContactListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);// www.ja v a 2 s  . c om
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/contact.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new ContactEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Contacts", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.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 (contact.getIscallable() == null || Boolean.FALSE == contact.getIscallable()) {
            return new DefaultViewField(AppContext.getMessage(GenericI18Enum.BUTTON_NO));
        } else {/*www  . ja va 2  s .  c o  m*/
            return new DefaultViewField(AppContext.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();
        }

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

        vcardDownloadBtn.setIcon(MyCollabResource.newResource("icons/12/vcard.png"));
        vcardDownloadBtn.setStyleName(UIConstants.THEME_TRANSPARENT_LINK);
        containerField.addComponentField(vcardDownloadBtn);
        containerField.getLayout().setComponentAlignment(vcardDownloadBtn, Alignment.TOP_RIGHT);
        return containerField;
    } else if (propertyId.equals("description")) {
        return new RichTextViewField(contact.getDescription());
    }

    return null;
}

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

License:Open Source License

public ContactTableDisplay(String viewId, TableViewField requiredColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(ContactService.class), SimpleContact.class, viewId,
            requiredColumn, displayColumns);

    addGeneratedColumn("selected", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override/*from  w  w w .j  a  va 2s.co  m*/
        public Object generateCell(final Table source, final Object itemId, final Object columnId) {
            final SimpleContact contact = ContactTableDisplay.this.getBeanByIndex(itemId);
            final CheckBoxDecor cb = new CheckBoxDecor("", contact.isSelected());
            cb.addValueChangeListener(new ValueChangeListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void valueChange(ValueChangeEvent event) {
                    ContactTableDisplay.this.fireSelectItemEvent(contact);
                    fireTableEvent(new TableClickEvent(ContactTableDisplay.this, contact, "selected"));

                }
            });

            contact.setExtraData(cb);
            return cb;
        }
    });

    addGeneratedColumn("contactName", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public Object generateCell(final Table source, final Object itemId, final Object columnId) {
            final SimpleContact contact = ContactTableDisplay.this.getBeanByIndex(itemId);

            LabelLink b = new LabelLink(contact.getContactName(),
                    CrmLinkBuilder.generateContactPreviewLinkFull(contact.getId()));
            b.setDescription(CrmTooltipGenerator.generateToolTipContact(AppContext.getUserLocale(), contact,
                    AppContext.getSiteUrl(), AppContext.getTimezone()));
            return b;
        }
    });

    addGeneratedColumn("createdtime", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleContact contact = ContactTableDisplay.this.getBeanByIndex(itemId);
            return new Label(AppContext.formatDateTime(contact.getCreatedtime()));

        }
    });

    addGeneratedColumn("email", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleContact contact = ContactTableDisplay.this.getBeanByIndex(itemId);
            return new EmailLink(contact.getEmail());
        }
    });

    addGeneratedColumn("accountName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleContact contact = ContactTableDisplay.this.getBeanByIndex(itemId);
            if (contact.getAccountName() != null) {

                LabelLink b = new LabelLink(contact.getAccountName(),
                        CrmLinkBuilder.generateAccountPreviewLinkFull(contact.getAccountid()));
                return b;
            } else {
                return new Label();
            }
        }
    });

    addGeneratedColumn("birthday", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleContact contact = ContactTableDisplay.this.getBeanByIndex(itemId);
            return new Label(AppContext.formatDate(contact.getBirthday()));
        }
    });

    addGeneratedColumn("assignUserFullName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleContact contact = ContactTableDisplay.this.getBeanByIndex(itemId);
            return new UserLink(contact.getAssignuser(), contact.getAssignUserAvatarId(),
                    contact.getAssignUserFullName());
        }
    });

    this.setWidth("100%");
}

From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertReadViewImpl.java

License:Open Source License

@Override
public void displayConvertLeadInfo(final SimpleLead lead) {
    previewForm.removeAllComponents();//from   w  w w.  ja  va  2s.  c  om
    this.lead = lead;

    Label header = new Label("Conversion Details");
    header.addStyleName("h2");
    previewForm.addComponent(header);

    GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 3);
    layoutHelper.getLayout().setWidth("100%");
    layoutHelper.getLayout().setMargin(false);
    layoutHelper.getLayout().addStyleName("colored-gridlayout");

    LOG.debug("Display associate account");
    AccountService accountService = ApplicationContextUtil.getSpringBean(AccountService.class);
    final SimpleAccount account = accountService.findAccountAssoWithConvertedLead(lead.getId(),
            AppContext.getAccountId());
    if (account != null) {
        Button accountLink = new Button(account.getAccountname(), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                EventBusFactory.getInstance().post(new AccountEvent.GotoRead(this, account.getId()));

            }
        });
        accountLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
        accountLink.setStyleName("link");
        layoutHelper.addComponent(accountLink, "Account", 0, 0);
    } else {
        layoutHelper.addComponent(new Label(""), "Account", 0, 0);
    }

    LOG.debug("Display associate contact");
    ContactService contactService = ApplicationContextUtil.getSpringBean(ContactService.class);
    final SimpleContact contact = contactService.findContactAssoWithConvertedLead(lead.getId(),
            AppContext.getAccountId());
    if (contact != null) {
        Button contactLink = new Button(contact.getContactName(), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                EventBusFactory.getInstance().post(new ContactEvent.GotoRead(this, contact.getId()));

            }
        });
        contactLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
        contactLink.setStyleName("link");
        layoutHelper.addComponent(contactLink, "Contact", 0, 1);
    } else {
        layoutHelper.addComponent(new Label(""), "Contact", 0, 1);
    }

    LOG.debug("Display associate opportunity");
    OpportunityService opportunityService = ApplicationContextUtil.getSpringBean(OpportunityService.class);
    final SimpleOpportunity opportunity = opportunityService.findOpportunityAssoWithConvertedLead(lead.getId(),
            AppContext.getAccountId());
    if (opportunity != null) {
        Button opportunityLink = new Button(opportunity.getOpportunityname(), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                EventBusFactory.getInstance().post(new OpportunityEvent.GotoRead(this, opportunity.getId()));

            }
        });
        opportunityLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));
        opportunityLink.setStyleName("link");
        layoutHelper.addComponent(opportunityLink, "Opportunity", 0, 2);
    } else {
        layoutHelper.addComponent(new Label(""), "Opportunity", 0, 2);
    }

    previewForm.addComponent(layoutHelper.getLayout());
    previewLayout.addBody(previewContent);

    this.addComponent(previewItemContainer);
}

From source file:com.esofthead.mycollab.module.crm.view.lead.LeadListNoItemView.java

License:Open Source License

public LeadListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*from  www  .  j a  v  a 2  s.  co  m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/lead.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button btCreateContact = new Button("New Lead", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null));
        }
    });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Leads", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.crm.view.lead.LeadTableDisplay.java

License:Open Source License

public LeadTableDisplay(String viewId, TableViewField requiredColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(LeadService.class), SimpleLead.class, viewId, requiredColumn,
            displayColumns);//from  w  w  w. j ava 2  s. c o  m

    this.addGeneratedColumn("selected", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public Object generateCell(final Table source, final Object itemId, Object columnId) {
            final SimpleLead lead = LeadTableDisplay.this.getBeanByIndex(itemId);
            final CheckBoxDecor cb = new CheckBoxDecor("", lead.isSelected());
            cb.setImmediate(true);
            cb.addValueChangeListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    LeadTableDisplay.this.fireSelectItemEvent(lead);

                    fireTableEvent(new TableClickEvent(LeadTableDisplay.this, lead, "selected"));

                }
            });

            lead.setExtraData(cb);
            return cb;
        }
    });

    this.addGeneratedColumn("leadName", new Table.ColumnGenerator() {
        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            final SimpleLead lead = LeadTableDisplay.this.getBeanByIndex(itemId);

            LabelLink b = new LabelLink(lead.getLeadName(),
                    CrmLinkBuilder.generateLeadPreviewLinkFull(lead.getId()));
            if ("Dead".equals(lead.getStatus()) || "Converted".equals(lead.getStatus())) {
                b.addStyleName(UIConstants.LINK_COMPLETED);
            }
            b.setDescription(CrmTooltipGenerator.generateTooltipLead(AppContext.getUserLocale(), lead,
                    AppContext.getSiteUrl(), AppContext.getTimezone()));
            return b;
        }
    });

    this.addGeneratedColumn("assignUserFullName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleLead lead = LeadTableDisplay.this.getBeanByIndex(itemId);
            UserLink b = new UserLink(lead.getAssignuser(), lead.getAssignUserAvatarId(),
                    lead.getAssignUserFullName());
            return b;

        }
    });

    this.addGeneratedColumn("email", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, Object itemId, Object columnId) {
            final SimpleLead lead = LeadTableDisplay.this.getBeanByIndex(itemId);
            Link l = new Link();
            l.setResource(new ExternalResource("mailto:" + lead.getEmail()));
            l.setCaption(lead.getEmail());
            return l;

        }
    });

    this.addGeneratedColumn("website", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, Object itemId, Object columnId) {
            final SimpleLead lead = LeadTableDisplay.this.getBeanByIndex(itemId);
            if (lead.getWebsite() != null) {
                return new UrlLink(lead.getWebsite());
            } else {
                return new Label("");
            }

        }
    });

    this.setWidth("100%");
}

From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityContactListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    HorizontalLayout controlsBtnWrap = new HorizontalLayout();
    controlsBtnWrap.setWidth("100%");

    HorizontalLayout notesWrap = new HorizontalLayout();
    notesWrap.setWidth("100%");
    notesWrap.setSpacing(true);/* w ww.j  a  va 2  s . co m*/
    Label noteLbl = new Label("Note: ");
    noteLbl.setSizeUndefined();
    noteLbl.setStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);

    CssLayout noteBlock = new CssLayout();
    noteBlock.setWidth("100%");
    noteBlock.setStyleName("list-note-block");
    for (int i = 0; i < CrmDataTypeFactory.getOpportunityContactRoleList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getOpportunityContactRoleList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunityContactRoleList()[i]));
        note.setSizeUndefined();

        noteBlock.addComponent(note);
    }
    notesWrap.addComponent(noteBlock);
    notesWrap.setExpandRatio(noteBlock, 1.0f);

    controlsBtnWrap.addComponent(notesWrap);

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption("Add/Edit Contacts' Role");
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            EventBusFactory.getInstance().post(new OpportunityEvent.GotoContactRoleEdit(this, opportunity));
        }
    });
    final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final OpportunityContactSelectionWindow contactsWindow = new OpportunityContactSelectionWindow(
                    OpportunityContactListComp.this);
            final ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(contactsWindow);
            contactsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

    controlsBtnWrap.addComponent(controlsBtn);
    controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
}

From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityListNoItemView.java

License:Open Source License

public OpportunityListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*from  w  w  w  . ja v  a2 s.  c  o  m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/opportunity.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button btCreateContact = new Button(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new OpportunityEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Leads", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}