Example usage for com.vaadin.ui Label addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

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();/* w  ww  . j  av  a2s.c  o m*/
    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);//  w w  w. jav  a  2 s  . c o 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.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);//from w ww. java2 s . c  o  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 ww.  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);
}

From source file:com.esofthead.mycollab.module.project.ui.components.ProjectListNoItemView.java

License:Open Source License

public ProjectListNoItemView() {
    MVerticalLayout layout = new MVerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Label image = new Label(viewIcon().getHtml(), ContentMode.HTML);
    image.setSizeUndefined();/* w  w  w  .j a  va2s.  co m*/
    layout.with(image).withAlign(image, Alignment.TOP_CENTER);

    Label title = new Label(viewTitle());
    title.addStyleName("h2");
    title.setSizeUndefined();
    layout.with(title).withAlign(title, Alignment.TOP_CENTER);

    Label body = new Label(viewHint());
    body.setWidthUndefined();
    layout.addComponent(body);

    Button createBugBtn = new Button(actionMessage(), actionListener());
    createBugBtn.setEnabled(hasPermission());

    MHorizontalLayout links = new MHorizontalLayout();

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

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

From source file:com.esofthead.mycollab.module.project.ui.components.TimeTrackingDateOrderComponent.java

License:Open Source License

@Override
protected void displayGroupItems(List<SimpleItemTimeLogging> timeLoggingEntries) {
    if (timeLoggingEntries.size() > 0) {
        Label label = new Label(DATE_FORMAT.format(timeLoggingEntries.get(0).getLogforday()));
        label.addStyleName(UIConstants.TEXT_LOG_DATE);
        addComponent(label);/*w  w  w  .  j  a v a  2  s.c o  m*/

        addComponent(new TimeLoggingBockLayout(visibleFields, tableClickListener, timeLoggingEntries));
    }
}

From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.PredecessorWindow.java

License:Open Source License

PredecessorWindow(final GanttTreeTable taskTreeTable, final GanttItemWrapper ganttItemWrapper) {
    super("Edit predecessors");
    this.setModal(true);
    this.setResizable(false);
    this.setWidth("650px");
    this.center();
    this.taskTreeTable = taskTreeTable;
    this.ganttItemWrapper = ganttItemWrapper;

    MVerticalLayout content = new MVerticalLayout();
    this.setContent(content);
    Label headerLbl = new Label(
            String.format("Row %d: %s", ganttItemWrapper.getGanttIndex(), ganttItemWrapper.getName()));
    headerLbl.addStyleName(ValoTheme.LABEL_H2);
    content.add(headerLbl);//from   w w  w  .  ja  va 2  s  .  c  om

    CssLayout preWrapper = new CssLayout();
    content.with(preWrapper);

    MHorizontalLayout headerLayout = new MHorizontalLayout();
    headerLayout.addComponent(new ELabel("Row").withWidth(ROW_WDITH));
    headerLayout.addComponent(new ELabel("Task").withWidth(TASK_WIDTH));
    headerLayout.addComponent(new ELabel("Dependency").withWidth(PRE_TYPE_WIDTH));
    headerLayout.addComponent(new ELabel("Lag").withWidth(LAG_WIDTH));
    predecessorsLayout = new PredecessorsLayout();
    new Restrain(predecessorsLayout).setMaxHeight("600px");

    preWrapper.addComponent(headerLayout);
    preWrapper.addComponent(predecessorsLayout);

    MHorizontalLayout buttonControls = new MHorizontalLayout();
    content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    PredecessorWindow.this.close();
                }
            });
    cancelBtn.addStyleName(UIConstants.BUTTON_OPTION);

    Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            List<TaskPredecessor> predecessors = predecessorsLayout.buildPredecessors();
            EventBusFactory.getInstance()
                    .post(new GanttEvent.ModifyPredecessors(ganttItemWrapper, predecessors));
            PredecessorWindow.this.close();
        }
    });
    saveBtn.addStyleName(UIConstants.BUTTON_ACTION);
    buttonControls.with(cancelBtn, saveBtn);
}

From source file:com.esofthead.mycollab.module.project.view.assignments.GanttChartViewImpl.java

License:Open Source License

private void constructUI() {
    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, false, true, false))
            .withStyleName("hdr-view").withWidth("100%");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label headerText = new Label(FontAwesome.BAR_CHART_O.getHtml() + " Gantt chart", ContentMode.HTML);
    headerText.setStyleName(ValoTheme.LABEL_H2);
    headerText.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    CssLayout headerWrapper = new CssLayout();
    headerWrapper.addComponent(headerText);

    MHorizontalLayout resWrapper = new MHorizontalLayout();
    Label resLbl = new Label("Resolution: ");
    final ComboBox resValue = new ValueComboBox(false, "Day", "Week");
    resValue.addValueChangeListener(new Property.ValueChangeListener() {
        @Override//from  w  ww .j  a  v a  2  s . c o  m
        public void valueChange(Property.ValueChangeEvent event) {
            String val = (String) resValue.getValue();
            if ("Day".equals(val)) {
                gantt.setResolution(Resolution.Day);
            } else if ("Week".equals(val)) {
                gantt.setResolution(Resolution.Week);
            }
        }
    });
    resWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    resWrapper.with(resLbl, resValue);

    header.with(headerWrapper, resWrapper).withAlign(headerWrapper, Alignment.MIDDLE_LEFT)
            .expand(headerWrapper);

    mainLayout = new MHorizontalLayout().withSpacing(false);
    mainLayout.addStyleName("gantt_container");
    mainLayout.setSizeFull();
    this.with(header, mainLayout);
}

From source file:com.esofthead.mycollab.module.project.view.FollowingTicketViewImpl.java

License:Open Source License

public FollowingTicketViewImpl() {
    this.setWidth("100%");

    final MVerticalLayout headerWrapper = new MVerticalLayout().withSpacing(false).withMargin(false)
            .withWidth("100%").withStyleName("projectfeed-hdr-wrapper");

    final MHorizontalLayout header = new MHorizontalLayout().withMargin(false).withWidth("100%");

    final Label layoutHeader = new Label(FontAwesome.EYE.getHtml() + " My Following Tickets", ContentMode.HTML);
    layoutHeader.addStyleName("h2");
    header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader);

    headerWrapper.addComponent(header);//from   ww  w.j  a  v  a 2s. com
    this.addComponent(headerWrapper);

    MHorizontalLayout controlBtns = new MHorizontalLayout().withSpacing(false)
            .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%");

    final MVerticalLayout contentWrapper = new MVerticalLayout().withSpacing(false).withMargin(false)
            .withWidth("100%");
    contentWrapper.addStyleName("content-wrapper");

    contentWrapper.addComponent(controlBtns);
    this.addComponent(contentWrapper);

    final Button backBtn = new Button(AppContext.getMessage(FollowerI18nEnum.BUTTON_BACK_TO_WORKBOARD));
    backBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

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

    backBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    backBtn.setIcon(FontAwesome.ARROW_LEFT);

    controlBtns.addComponent(backBtn);
    controlBtns.setExpandRatio(backBtn, 1.0f);

    Button exportBtn = new Button("Export", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            exportButtonControl.setPopupVisible(true);
        }
    });
    exportButtonControl = new SplitButton(exportBtn);
    exportButtonControl.setWidthUndefined();
    exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK);
    exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);

    VerticalLayout popupButtonsControl = new VerticalLayout();
    exportButtonControl.setContent(popupButtonsControl);

    Button exportPdfBtn = new Button("Pdf");
    FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF));
    pdfDownloader.extend(exportPdfBtn);
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    exportPdfBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportPdfBtn);

    Button exportExcelBtn = new Button("Excel");
    FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL));
    excelDownloader.extend(exportExcelBtn);
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    exportExcelBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportExcelBtn);

    controlBtns.addComponent(exportButtonControl);

    searchPanel = new FollowingTicketSearchPanel();
    contentWrapper.addComponent(searchPanel);

    this.ticketTable = new FollowingTicketTableDisplay();
    this.ticketTable.addStyleName("full-border-table");
    this.ticketTable.setMargin(new MarginInfo(true, false, false, false));
    contentWrapper.addComponent(this.ticketTable);
}

From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneBugListComp.java

License:Open Source License

private void constructHeader() {
    final HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);//  w  w w .  j a v  a2s.  c o  m
    header.setWidth("100%");
    final Label taskGroupSelection = new Label(AppContext.getMessage(MilestoneI18nEnum.TAB_RELATED_BUGS));
    taskGroupSelection.addStyleName("h2");
    taskGroupSelection.addStyleName(UIConstants.THEME_NO_BORDER);
    header.addComponent(taskGroupSelection);
    header.setExpandRatio(taskGroupSelection, 1.0f);
    header.setComponentAlignment(taskGroupSelection, Alignment.MIDDLE_LEFT);

    this.viewGroup = new ToggleButtonGroup();

    final Button simpleDisplay = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            MilestoneBugListComp.this.displaySimpleView();
        }
    });
    simpleDisplay.setIcon(MyCollabResource.newResource("icons/16/project/list_display.png"));

    this.viewGroup.addButton(simpleDisplay);

    final Button advanceDisplay = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            MilestoneBugListComp.this.displayAdvancedView();
        }
    });
    advanceDisplay.setIcon(MyCollabResource.newResource("icons/16/project/bug_advanced_display.png"));
    this.viewGroup.addButton(advanceDisplay);
    header.addComponent(this.viewGroup);
    header.setComponentAlignment(this.viewGroup, Alignment.MIDDLE_RIGHT);
    this.addComponent(header);
}