Example usage for com.vaadin.ui Button setStyleName

List of usage examples for com.vaadin.ui Button setStyleName

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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

License:Open Source License

@Override
protected void initUI() {
    tableItem = new ContactTableDisplay(ContactTableFieldDef.selected(),
            Arrays.asList(ContactTableFieldDef.name(), ContactTableFieldDef.email(),
                    ContactTableFieldDef.phoneOffice(), ContactTableFieldDef.account()));

    Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
            clickEvent -> close());/*from  w  ww .ja v  a  2s .c  om*/
    selectBtn.setStyleName(WebUIConstants.BUTTON_ACTION);

    ContactSearchPanel searchPanel = new ContactSearchPanel();
    searchPanel.addSearchHandler(criteria -> tableItem.setSearchCriteria(criteria));

    bodyContent.with(searchPanel, selectBtn, tableItem);
}

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

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 3);
    layoutSearchPane.setSpacing(true);/*from   w  w  w  .j  a  v a2s . c o  m*/

    group = new ValueComboBox(false, "Subject", "Account Name", "Status",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Subject")) {
                addTextFieldSearch();
            } else if (searchType.equals("Account Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Status")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}

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

License:Open Source License

@Override
protected void initUI() {
    tableItem = new OpportunityTableDisplay(OpportunityTableFieldDef.selected(),
            Arrays.asList(OpportunityTableFieldDef.opportunityName(), OpportunityTableFieldDef.saleStage(),
                    OpportunityTableFieldDef.expectedCloseDate()));

    Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
            clickEvent -> close());/*  w  w w.  java2  s . com*/
    selectBtn.setStyleName(WebUIConstants.BUTTON_ACTION);

    OpportunitySearchPanel searchPanel = new OpportunitySearchPanel();
    searchPanel.addSearchHandler(criteria -> tableItem.setSearchCriteria(criteria));

    this.bodyContent.with(searchPanel, selectBtn, tableItem);
}

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 {//w w w  .  j ava 2 s.  c  o  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;
}

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

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 3);
    layoutSearchPane.setSpacing(true);//from   ww  w.  j a  v  a 2 s  . c o  m

    group = new ValueComboBox(false, "Name", "Email", "Phone",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Email")) {
                addTextFieldSearch();
            } else if (searchType.equals("Phone")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}

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

License:Open Source License

@Override
protected void initUI() {
    tableItem = new CampaignTableDisplay(CampaignTableFieldDef.selected(),
            Arrays.asList(CampaignTableFieldDef.campaignname(), CampaignTableFieldDef.status(),
                    CampaignTableFieldDef.type(), CampaignTableFieldDef.endDate()));

    Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
            clickEvent -> close());/*from w  ww .  j  av  a  2s .  c  o  m*/
    selectBtn.setStyleName(WebUIConstants.BUTTON_ACTION);

    CampaignSearchPanel searchPanel = new CampaignSearchPanel();
    searchPanel.addSearchHandler(criteria -> tableItem.setSearchCriteria(criteria));

    bodyContent.with(searchPanel, selectBtn, tableItem);
}

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

License:Open Source License

private void createBasicSearchLayout() {
    searchPanel = new GridLayout(3, 3);
    searchPanel.setSpacing(true);/* w  w w  .j  a  v a 2s . c  om*/

    group = new ValueComboBox(false, "Name", "Email", "Phone",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Email")) {
                addTextFieldSearch();
            } else if (searchType.equals("Phone")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    searchPanel.addComponent(group, 1, 0);
    searchPanel.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    searchPanel.addComponent(searchBtn, 2, 0);
    searchPanel.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(searchPanel);
}

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

License:Open Source License

@Override
protected void initUI() {
    tableItem = new ContactTableDisplay(ContactTableFieldDef.selected(),
            Arrays.asList(ContactTableFieldDef.name(), ContactTableFieldDef.email(),
                    ContactTableFieldDef.phoneOffice(), ContactTableFieldDef.account()));

    Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
            clickEvent -> close());// ww  w  . j a va 2 s .  com
    selectBtn.setStyleName(WebThemes.BUTTON_ACTION);

    ContactSearchPanel searchPanel = new ContactSearchPanel();
    searchPanel.addSearchHandler(criteria -> tableItem.setSearchCriteria(criteria));

    bodyContent.with(searchPanel, selectBtn, tableItem);
}

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

License:Open Source License

private void createBasicSearchLayout() {
    searchPanel = new GridLayout(3, 3);
    searchPanel.setSpacing(true);//  w w  w.  ja v  a  2  s .  co  m

    group = new ValueComboBox(false, "Name", "Account Name", "Sales Stage",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Account Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Sales Stage")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    searchPanel.addComponent(group, 1, 0);
    searchPanel.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    searchPanel.addComponent(searchBtn, 2, 0);
    searchPanel.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(searchPanel);
}

From source file:com.mycollab.module.project.view.settings.component.InviteUserTokenField.java

License:Open Source License

private Component generateToken(final SimpleUser user) {
    final Button btn = new Button("", FontAwesome.TIMES);
    btn.setCaptionAsHtml(true);/*from   w  w w .j av  a2 s  . c om*/
    btn.setCaption((new Img("", StorageFactory.getAvatarPath(user.getAvatarid(), 16))).write() + " "
            + user.getDisplayName());
    btn.addClickListener(clickEvent -> {
        InviteUserTokenField.this.removeComponent(btn);
        inviteEmails.remove(user.getEmail());
    });
    btn.setStyleName("token-field");
    return btn;
}