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.ui.components.DynaFormLayout.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    int sectionCount = dynaForm.getSectionCount();
    sectionMappings = new HashMap<>();

    for (int i = 0; i < sectionCount; i++) {
        DynaSection section = dynaForm.getSection(i);
        if (section.isDeletedSection()) {
            continue;
        }//w ww. ja v  a2s  . c om
        Label header = new Label(section.getHeader());
        header.setStyleName("h2");
        layout.addComponent(header);

        GridFormLayoutHelper gridLayout;

        if (section.isDeletedSection() || section.getFieldCount() == 0) {
            continue;
        }

        if (section.getLayoutType() == LayoutType.ONE_COLUMN) {
            gridLayout = new GridFormLayoutHelper(2, section.getFieldCount(), "100%", "167px",
                    Alignment.TOP_LEFT);
        } else if (section.getLayoutType() == LayoutType.TWO_COLUMN) {
            gridLayout = new GridFormLayoutHelper(2, (section.getFieldCount() + 3) / 2, "100%", "167px",
                    Alignment.TOP_LEFT);
        } else {
            throw new MyCollabException("Does not support attachForm layout except 1 or 2 columns");
        }

        gridLayout.getLayout().setWidth("100%");
        gridLayout.getLayout().setMargin(false);
        gridLayout.getLayout().setSpacing(false);
        gridLayout.getLayout().addStyleName("colored-gridlayout");
        layout.addComponent(gridLayout.getLayout());

        sectionMappings.put(section, gridLayout);
    }
    return layout;
}

From source file:com.esofthead.mycollab.module.crm.ui.components.NoteListItems.java

License:Open Source License

public NoteListItems(final String title, final String type, final Integer typeId) {
    super();/*ww w  .  j  ava  2s .  c  o m*/

    Label header = new Label(title);
    header.addStyleName("h2");
    this.addComponent(header);
    noteService = ApplicationContextUtil.getSpringBean(NoteService.class);
    this.type = type;
    this.typeId = typeId;

    initUI();
}

From source file:com.esofthead.mycollab.module.crm.ui.components.RelatedReadItemField.java

License:Open Source License

@Override
protected Component initContent() {
    try {/*from  w  w  w . j a va 2 s  . co  m*/
        final Integer typeid = (Integer) PropertyUtils.getProperty(RelatedReadItemField.this.bean, "typeid");
        if (typeid == null) {
            return new Label("");
        }

        final String type = (String) PropertyUtils.getProperty(bean, "type");
        if (type == null || type.equals("")) {
            return new Label("");
        }

        FontAwesome relatedLink = null;
        String relateItemName = null;

        if ("Account".equals(type)) {
            AccountService accountService = ApplicationContextUtil.getSpringBean(AccountService.class);
            final SimpleAccount account = accountService.findById(typeid, AppContext.getAccountId());
            if (account != null) {
                relateItemName = account.getAccountname();
                relatedLink = CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT);
            }
        } else if ("Campaign".equals(type)) {
            CampaignService campaignService = ApplicationContextUtil.getSpringBean(CampaignService.class);
            final SimpleCampaign campaign = campaignService.findById(typeid, AppContext.getAccountId());
            if (campaign != null) {
                relateItemName = campaign.getCampaignname();
                relatedLink = CrmAssetsManager.getAsset(CrmTypeConstants.CAMPAIGN);

            }
        } else if ("Contact".equals(type)) {
            ContactService contactService = ApplicationContextUtil.getSpringBean(ContactService.class);
            final SimpleContact contact = contactService.findById(typeid, AppContext.getAccountId());
            if (contact != null) {
                relateItemName = contact.getContactName();
                relatedLink = CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT);

            }
        } else if ("Lead".equals(type)) {
            LeadService leadService = ApplicationContextUtil.getSpringBean(LeadService.class);
            final SimpleLead lead = leadService.findById(typeid, AppContext.getAccountId());
            if (lead != null) {
                relateItemName = lead.getLeadName();
                relatedLink = CrmAssetsManager.getAsset(CrmTypeConstants.LEAD);

            }
        } else if ("Opportunity".equals(type)) {
            OpportunityService opportunityService = ApplicationContextUtil
                    .getSpringBean(OpportunityService.class);
            final SimpleOpportunity opportunity = opportunityService.findById(typeid,
                    AppContext.getAccountId());
            if (opportunity != null) {
                relateItemName = opportunity.getOpportunityname();
                relatedLink = CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY);

            }
        } else if ("Case".equals(type)) {
            CaseService caseService = ApplicationContextUtil.getSpringBean(CaseService.class);
            final SimpleCase cases = caseService.findById(typeid, AppContext.getAccountId());
            if (cases != null) {
                relateItemName = cases.getSubject();
                relatedLink = CrmAssetsManager.getAsset(CrmTypeConstants.CASE);
            }
        }

        LabelLink related = new LabelLink(relateItemName,
                CrmLinkBuilder.generateActivityPreviewLinkFull(type, typeid));
        if (relatedLink != null)
            related.setIconLink(relatedLink);

        if (relatedLink != null) {
            return related;
        } else {
            return new Label("");
        }

    } catch (Exception e) {
        return new Label("");
    }
}

From source file:com.esofthead.mycollab.module.crm.view.account.AccountCaseListComp.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);//from   ww  w  .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.getCasesStatusList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getCasesStatusList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colorsMap.get(CrmDataTypeFactory.getCasesStatusList()[i]));
        note.setSizeUndefined();

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

    controlsBtnWrap.addComponent(notesWrap);

    controlsBtnWrap.setWidth("100%");
    final Button createBtn = new Button();
    createBtn.setSizeUndefined();
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CASE));
    createBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setCaption(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE));
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -8725970955325733072L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            fireNewRelatedItem("");
        }
    });

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

From source file:com.esofthead.mycollab.module.crm.view.account.AccountListNoItemView.java

License:Open Source License

public AccountListNoItemView() {

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

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

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

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

    Button createAccountBtn = new Button(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

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

    HorizontalLayout links = new HorizontalLayout();

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

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Accounts", 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.account.AccountOpportunityListComp.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);//from w  w w .j  av  a2s . 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.getOpportunitySalesStageList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getOpportunitySalesStageList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunitySalesStageList()[i]));
        note.setSizeUndefined();

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

    controlsBtnWrap.addComponent(notesWrap);

    controlsBtnWrap.setWidth("100%");
    final Button createBtn = new Button(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY),
            new Button.ClickListener() {
                private static final long serialVersionUID = -8101659779838108951L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    fireNewRelatedItem("");
                }
            });
    createBtn.setSizeUndefined();
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY));
    createBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);

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

From source file:com.esofthead.mycollab.module.crm.view.account.AccountTableDisplay.java

License:Open Source License

public AccountTableDisplay(String viewId, TableViewField requiredColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(AccountService.class), SimpleAccount.class, viewId,
            requiredColumn, displayColumns);

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

        @Override/* w  w  w  . j  av a2  s  .c om*/
        public Object generateCell(final Table source, final Object itemId, final Object columnId) {
            final SimpleAccount account = AccountTableDisplay.this.getBeanByIndex(itemId);
            final CheckBoxDecor cb = new CheckBoxDecor("", account.isSelected());
            cb.addValueChangeListener(new ValueChangeListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void valueChange(ValueChangeEvent event) {

                    AccountTableDisplay.this.fireSelectItemEvent(account);
                    fireTableEvent(new TableClickEvent(AccountTableDisplay.this, account, "selected"));

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

    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 SimpleAccount account = AccountTableDisplay.this.getBeanByIndex(itemId);
            return new EmailLink(account.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 SimpleAccount account = AccountTableDisplay.this.getBeanByIndex(itemId);

            LabelLink b = new LabelLink(account.getAccountname(),
                    CrmLinkBuilder.generateAccountPreviewLinkFull(account.getId()));
            b.setDescription(CrmTooltipGenerator.generateToolTipAccount(AppContext.getUserLocale(), account,
                    AppContext.getSiteUrl()));
            return b;
        }
    });

    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 SimpleAccount account = AccountTableDisplay.this.getBeanByIndex(itemId);
            return new UserLink(account.getAssignuser(), account.getAssignUserAvatarId(),
                    account.getAssignUserFullName());

        }
    });

    addGeneratedColumn("website", 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 SimpleAccount account = AccountTableDisplay.this.getBeanByIndex(itemId);
            if (account.getWebsite() != null) {
                return new UrlLink(account.getWebsite());
            } else {
                return new Label("");
            }

        }
    });

    this.setWidth("100%");
}

From source file:com.esofthead.mycollab.module.crm.view.activity.CallTableDisplay.java

License:Open Source License

public CallTableDisplay(TableViewField requireColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(CallService.class), SimpleCall.class, requireColumn,
            displayColumns);// w  ww  .  j a  va2  s .c  o  m

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

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCall call = CallTableDisplay.this.getBeanByIndex(itemId);

            LabelLink b = new LabelLink(call.getSubject(),
                    CrmLinkBuilder.generateCallPreviewLinkFul(call.getId()));

            if ("Held".equals(call.getStatus())) {
                b.addStyleName(UIConstants.LINK_COMPLETED);
            }
            return b;

        }
    });

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

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCall call = CallTableDisplay.this.getBeanByIndex(itemId);
            Button b = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    fireTableEvent(new TableClickEvent(CallTableDisplay.this, call, "isClosed"));
                }
            });
            b.setIcon(FontAwesome.TRASH_O);
            b.setStyleName("link");
            b.setDescription("Close this call");
            return b;

        }
    });

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

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCall call = CallTableDisplay.this.getBeanByIndex(itemId);
            return new Label(AppContext.formatDateTime(call.getStartdate()));

        }
    });
}

From source file:com.esofthead.mycollab.module.crm.view.activity.MeetingTableDisplay.java

License:Open Source License

public MeetingTableDisplay(List<TableViewField> displaycolumns) {
    super(ApplicationContextUtil.getSpringBean(MeetingService.class), SimpleMeeting.class, displaycolumns);

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

        @Override/*from  w  w w . j av  a  2  s. c o  m*/
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleMeeting meeting = MeetingTableDisplay.this.getBeanByIndex(itemId);

            LabelLink b = new LabelLink(meeting.getSubject(),
                    CrmLinkBuilder.generateMeetingPreviewLinkFull(meeting.getId()));
            b.addStyleName(UIConstants.LINK_COMPLETED);

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

        }
    });

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

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleMeeting meeting = MeetingTableDisplay.this.getBeanByIndex(itemId);
            return new Label(AppContext.formatDateTime(meeting.getStartdate()));

        }
    });
}

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

License:Open Source License

public CampaignListNoItemView() {

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

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

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

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

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CampaignEvent.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 Campaigns", 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);
}